Skip to content

Commit

Permalink
fix(ingestion/glue): fix to ingest the comment for partition key as d…
Browse files Browse the repository at this point in the history
…escription (datahub-project#10189)
  • Loading branch information
dushayntAW authored and sleeperdeep committed Jun 25, 2024
1 parent 649b7ae commit b437793
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ def get_schema_metadata() -> Optional[SchemaMetadata]:
schema_fields = get_schema_fields_for_hive_column(
hive_column_name=partition_key["Name"],
hive_column_type=partition_key.get("Type", "unknown"),
description=partition_key.get("Comment"),
default_nullable=False,
)
assert schema_fields
Expand Down
2 changes: 2 additions & 0 deletions metadata-ingestion/tests/unit/glue/glue_mces_golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
{
"fieldPath": "[version=2.0].[type=int].yr",
"nullable": true,
"description": "test comment",
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.NumberType": {}
Expand Down Expand Up @@ -204,6 +205,7 @@
{
"fieldPath": "[version=2.0].[type=string].year",
"nullable": true,
"description": "partition test comment",
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.StringType": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
{
"fieldPath": "[version=2.0].[type=int].yr",
"nullable": true,
"description": "test comment",
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.NumberType": {}
Expand Down Expand Up @@ -206,6 +207,7 @@
{
"fieldPath": "[version=2.0].[type=string].year",
"nullable": true,
"description": "partition test comment",
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.StringType": {}
Expand Down
6 changes: 4 additions & 2 deletions metadata-ingestion/tests/unit/test_glue_source_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"Retention": 0,
"StorageDescriptor": {
"Columns": [
{"Name": "yr", "Type": "int"},
{"Name": "yr", "Type": "int", "Comment": "test comment"},
{"Name": "flightdate", "Type": "string"},
{"Name": "uniquecarrier", "Type": "string"},
{"Name": "airlineid", "Type": "int"},
Expand Down Expand Up @@ -129,7 +129,9 @@
},
"StoredAsSubDirectories": False,
},
"PartitionKeys": [{"Name": "year", "Type": "string"}],
"PartitionKeys": [
{"Name": "year", "Type": "string", "Comment": "partition test comment"}
],
"TableType": "EXTERNAL_TABLE",
"Parameters": {
"CrawlerSchemaDeserializerVersion": "1.0",
Expand Down

0 comments on commit b437793

Please sign in to comment.