MCPcopy Create free account
hub / github.com/apache/arrow / _sanitize_schema

Function _sanitize_schema

python/pyarrow/parquet/core.py:727–748  ·  view source on GitHub ↗
(schema, flavor)

Source from the content-addressed store, hash-verified

725
726
727def _sanitize_schema(schema, flavor):
728 if 'spark' in flavor:
729 sanitized_fields = []
730
731 schema_changed = False
732
733 for field in schema:
734 name = field.name
735 sanitized_name = _sanitized_spark_field_name(name)
736
737 if sanitized_name != name:
738 schema_changed = True
739 sanitized_field = pa.field(sanitized_name, field.type,
740 field.nullable, field.metadata)
741 sanitized_fields.append(sanitized_field)
742 else:
743 sanitized_fields.append(field)
744
745 new_schema = pa.schema(sanitized_fields, metadata=schema.metadata)
746 return new_schema, schema_changed
747 else:
748 return schema, False
749
750
751def _sanitize_table(table, new_schema, flavor):

Callers 1

__init__Method · 0.85

Calls 4

fieldMethod · 0.45
appendMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected