diff --git a/metadata-ingestion/src/datahub/ingestion/source/pulsar.py b/metadata-ingestion/src/datahub/ingestion/source/pulsar.py index 790c1f918cdfd..15ee995b2d5fd 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/pulsar.py +++ b/metadata-ingestion/src/datahub/ingestion/source/pulsar.py @@ -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")