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

Function _sanitize_schema

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

Source from the content-addressed store, hash-verified

719
720
721def _sanitize_schema(schema, flavor):
722 if 'spark' in flavor:
723 sanitized_fields = []
724
725 schema_changed = False
726
727 for field in schema:
728 name = field.name
729 sanitized_name = _sanitized_spark_field_name(name)
730
731 if sanitized_name != name:
732 schema_changed = True
733 sanitized_field = pa.field(sanitized_name, field.type,
734 field.nullable, field.metadata)
735 sanitized_fields.append(sanitized_field)
736 else:
737 sanitized_fields.append(field)
738
739 new_schema = pa.schema(sanitized_fields, metadata=schema.metadata)
740 return new_schema, schema_changed
741 else:
742 return schema, False
743
744
745def _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