-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ingest/redshift): tweak lineage v2 queries (#10045)
- Loading branch information
Showing
8 changed files
with
334 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
231 changes: 231 additions & 0 deletions
231
.../tests/unit/sql_parsing/aggregator_goldens/test_overlapping_inserts_from_temp_tables.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
[ | ||
{ | ||
"entityType": "dataset", | ||
"entityUrn": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD)", | ||
"changeType": "UPSERT", | ||
"aspectName": "upstreamLineage", | ||
"aspect": { | ||
"json": { | ||
"upstreams": [ | ||
{ | ||
"auditStamp": { | ||
"time": 1707182625000, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"created": { | ||
"time": 0, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"dataset": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.customer,PROD)", | ||
"type": "TRANSFORMED", | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
}, | ||
{ | ||
"auditStamp": { | ||
"time": 1707182625000, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"created": { | ||
"time": 0, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"dataset": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_returns,PROD)", | ||
"type": "TRANSFORMED", | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
}, | ||
{ | ||
"auditStamp": { | ||
"time": 1707182625000, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"created": { | ||
"time": 0, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"dataset": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_survey,PROD)", | ||
"type": "TRANSFORMED", | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
}, | ||
{ | ||
"auditStamp": { | ||
"time": 1707182625000, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"created": { | ||
"time": 0, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"dataset": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.in_person_returns,PROD)", | ||
"type": "TRANSFORMED", | ||
"query": "urn:li:query:composite_638945c382e30206a8f8a57894d375e5f6f2a3562fe68480badf37e38e836d75" | ||
} | ||
], | ||
"fineGrainedLineages": [ | ||
{ | ||
"upstreamType": "FIELD_SET", | ||
"upstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.in_person_returns,PROD),customer_id)" | ||
], | ||
"downstreamType": "FIELD", | ||
"downstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD),customer_id)" | ||
], | ||
"confidenceScore": 0.2, | ||
"query": "urn:li:query:composite_638945c382e30206a8f8a57894d375e5f6f2a3562fe68480badf37e38e836d75" | ||
}, | ||
{ | ||
"upstreamType": "FIELD_SET", | ||
"upstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_returns,PROD),customer_id)" | ||
], | ||
"downstreamType": "FIELD", | ||
"downstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD),customer_id)" | ||
], | ||
"confidenceScore": 0.2, | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
}, | ||
{ | ||
"upstreamType": "FIELD_SET", | ||
"upstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.customer,PROD),customer_email)" | ||
], | ||
"downstreamType": "FIELD", | ||
"downstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD),customer_email)" | ||
], | ||
"confidenceScore": 0.2, | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
}, | ||
{ | ||
"upstreamType": "FIELD_SET", | ||
"upstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.in_person_returns,PROD),return_date)" | ||
], | ||
"downstreamType": "FIELD", | ||
"downstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD),return_date)" | ||
], | ||
"confidenceScore": 0.2, | ||
"query": "urn:li:query:composite_638945c382e30206a8f8a57894d375e5f6f2a3562fe68480badf37e38e836d75" | ||
}, | ||
{ | ||
"upstreamType": "FIELD_SET", | ||
"upstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_returns,PROD),return_date)" | ||
], | ||
"downstreamType": "FIELD", | ||
"downstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD),return_date)" | ||
], | ||
"confidenceScore": 0.2, | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
}, | ||
{ | ||
"upstreamType": "FIELD_SET", | ||
"upstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_survey,PROD),return_reason)" | ||
], | ||
"downstreamType": "FIELD", | ||
"downstreams": [ | ||
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD),return_reason)" | ||
], | ||
"confidenceScore": 0.2, | ||
"query": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"entityType": "query", | ||
"entityUrn": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17", | ||
"changeType": "UPSERT", | ||
"aspectName": "queryProperties", | ||
"aspect": { | ||
"json": { | ||
"statement": { | ||
"value": "CREATE TABLE #stage_online_returns AS\nSELECT\n online_ret.customer_id,\n customer.customer_email,\n online_ret.return_date,\n online_survey.return_reason\nFROM online_returns AS online_ret\nLEFT JOIN customer\n ON online_ret.customer_id = customer.customer_id\nLEFT JOIN online_survey\n ON online_ret.customer_id = online_survey.customer_id\n AND online_ret.return_id = online_survey.event_id;\n\nINSERT INTO all_returns (\n customer_id,\n customer_email,\n return_date,\n return_reason\n)\nSELECT\n customer_id,\n customer_email,\n return_date,\n return_reason\nFROM #stage_online_returns", | ||
"language": "SQL" | ||
}, | ||
"source": "SYSTEM", | ||
"created": { | ||
"time": 0, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"lastModified": { | ||
"time": 1707182625000, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"entityType": "query", | ||
"entityUrn": "urn:li:query:composite_ad747ecae933492280d24dfa7f3a4ae3a3c67457e145803d05f7d8bd7efa7d17", | ||
"changeType": "UPSERT", | ||
"aspectName": "querySubjects", | ||
"aspect": { | ||
"json": { | ||
"subjects": [ | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD)" | ||
}, | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.customer,PROD)" | ||
}, | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_returns,PROD)" | ||
}, | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.online_survey,PROD)" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"entityType": "query", | ||
"entityUrn": "urn:li:query:composite_638945c382e30206a8f8a57894d375e5f6f2a3562fe68480badf37e38e836d75", | ||
"changeType": "UPSERT", | ||
"aspectName": "queryProperties", | ||
"aspect": { | ||
"json": { | ||
"statement": { | ||
"value": "CREATE TABLE #stage_in_person_returns AS\nSELECT\n ipr.customer_id,\n customer.customer_email,\n ipr.return_date\nFROM in_person_returns AS ipr\nLEFT JOIN customer\n ON in_person_returns.customer_id = customer.customer_id;\n\nINSERT INTO all_returns (\n customer_id,\n customer_email,\n return_date\n)\nSELECT\n customer_id,\n customer_email,\n return_date\nFROM #stage_in_person_returns", | ||
"language": "SQL" | ||
}, | ||
"source": "SYSTEM", | ||
"created": { | ||
"time": 0, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
}, | ||
"lastModified": { | ||
"time": 1707182625000, | ||
"actor": "urn:li:corpuser:_ingestion" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"entityType": "query", | ||
"entityUrn": "urn:li:query:composite_638945c382e30206a8f8a57894d375e5f6f2a3562fe68480badf37e38e836d75", | ||
"changeType": "UPSERT", | ||
"aspectName": "querySubjects", | ||
"aspect": { | ||
"json": { | ||
"subjects": [ | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.all_returns,PROD)" | ||
}, | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.customer,PROD)" | ||
}, | ||
{ | ||
"entity": "urn:li:dataset:(urn:li:dataPlatform:redshift,dev.public.in_person_returns,PROD)" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] |
Oops, something went wrong.