MCPcopy Create free account
hub / github.com/apache/impala / get_avro_schema

Method get_avro_schema

tests/comparison/common.py:586–602  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

584 self._storage_format = storage_format and storage_format.upper()
585
586 def get_avro_schema(self):
587 avro_schema = {'name': 'my_record', 'type': 'record', 'fields': []}
588 for col in self.cols:
589 if issubclass(col.type, get_import('Int')):
590 avro_type = 'int'
591 elif issubclass(col.type, get_import('Char')):
592 avro_type = 'string'
593 elif issubclass(col.type, get_import('Decimal')):
594 avro_type = {
595 "type": "bytes",
596 "logicalType": "decimal",
597 "precision": col.exact_type.MAX_DIGITS,
598 "scale": col.exact_type.MAX_FRACTIONAL_DIGITS}
599 else:
600 avro_type = col.type.__name__.lower()
601 avro_schema['fields'].append({'name': col.name, 'type': ['null', avro_type]})
602 return json.dumps(avro_schema)
603
604 def __repr__(self):
605 return 'Table<name: %s, cols: %s>' \

Callers 3

create_tableMethod · 0.80
upload_avro_schemaMethod · 0.80
make_create_table_sqlMethod · 0.80

Implementers 1

CalciteTablejava/calcite-planner/src/main/java/org

Calls 2

get_importFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected