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

Function _sanitize_schema

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

Source from the content-addressed store, hash-verified

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