Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest/pulsar): handle missing/invalid schema objects #11945

Merged
12 changes: 11 additions & 1 deletion metadata-ingestion/src/datahub/ingestion/source/pulsar.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,17 @@ class PulsarSchema:
def __init__(self, schema):
self.schema_version = schema.get("version")

avro_schema = json.loads(schema.get("data"))
schema_data = schema.get("data")
if not schema_data:
logger.warning("Schema data is empty or None. Using default empty schema.")
schema_data = "{}"

try:
avro_schema = json.loads(schema_data)
except json.JSONDecodeError as e:
logger.error(f"Invalid JSON schema: {schema_data}. Error: {str(e)}")
avro_schema = {}

self.schema_name = avro_schema.get("namespace") + "." + avro_schema.get("name")
self.schema_description = avro_schema.get("doc")
self.schema_type = schema.get("type")
Expand Down
Loading