modern-monitor-81461
12/20/2021, 3:09 PMMetadataChangeEvent with a SchemaMetadata aspect. It looks like something is rejected by the Avro validator, but it doesn't tell me what. Is there a trick to figure what exactly is incompatible with the schema?
File "/datahub/metadata-ingestion/src/datahub/cli/ingest_cli.py", line 82, in run
pipeline.run()
File "/datahub/metadata-ingestion/src/datahub/ingestion/run/pipeline.py", line 157, in run
for record_envelope in self.transform(record_envelopes):
File "/datahub/metadata-ingestion/src/datahub/ingestion/extractor/mce_extractor.py", line 46, in get_records
raise ValueError(
ValueError: source produced an invalid metadata work unit: MetadataChangeEventClass(...helpful-optician-78938
12/20/2021, 8:33 PMmodern-monitor-81461
12/21/2021, 2:49 AMfield = SchemaField(
fieldPath="test",
nativeDataType="bool",
type=BooleanTypeClass,
)
print("BEFORE FIELD VALIDATE")
field.validate()
print("AFTER FIELD VALIDATE")
I create a SchemaField and I set its type to be a boolean. When I validate, the type attribute is invalid and I don't understand why. I have modified the avrojson.py code like this:
elif schema_type in ['record', 'error', 'request']:
##### start of test
if (isinstance(datum, dict) or isinstance(datum, DictWrapper)):
result = []
for f in expected_schema.fields:
print(f"Validating {f.name} is {self.validate(f.type, datum.get(f.name), skip_logical_types)}")
testResult = self.validate(f.type, datum.get(f.name), skip_logical_types)
result.append(testResult)
return False not in result
##### end of test
# return ((isinstance(datum, dict) or isinstance(datum, DictWrapper)) and
# False not in
# [self.validate(f.type, datum.get(f.name), skip_logical_types) for f in expected_schema.fields])
and I get the following output:
BEFORE FIELD VALIDATE
Validating fieldPath is True
Validating jsonPath is True
Validating nullable is True
Validating description is True
Validating type is False
Validating nativeDataType is True
Validating recursive is True
Validating globalTags is True
Validating glossaryTerms is True
Validating isPartOfKey is True
Validating jsonProps is True
AFTER FIELD VALIDATE
All in all, what I'm trying to do is read an Apache Iceberg schema, get all the columns and create a SchemaField for each one. fieldPath would simply be the name of the column, nativeDataType would be the native Iceberg type and type would be what I map the column to in DataHub. Is my logic good? If so, why is my code not passing validation?helpful-optician-78938
12/21/2021, 6:15 PMSchemaFieldDataTypeClass. Can you try changing it to type=SchemaFieldDataTypeClass(type=BooleanTypeClass())? Here is an example.modern-monitor-81461
12/21/2021, 8:59 PM