-
Notifications
You must be signed in to change notification settings - Fork 4
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
[SNOW-172] Add filter to file_latest and add comments #128
[SNOW-172] Add filter to file_latest and add comments #128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one other filter which is missing. The original upsert_to_file_latest_task
had this filter before QUALIFYing the results.
... WHERE NOT IS_PREVIEW
See these lines: https://github.com/Sage-Bionetworks/snowflake/blob/main/synapse_data_warehouse/synapse_raw/tasks/V1.14.0__merge_into_latest_tables.sql#L149-L150
Add NOT IS_PREVIEW filter
Thanks for catching. I forgot to add this one back when removing the status filter. |
@danlu1 There's an optimization we can do here, since a file handle which is a preview file handle will never NOT be a preview, we don't need to consider whether this is the latest snapshot of that file. That means we can move the WHERE filter up into the The WHERE filtering will be done before QUALIFY as documented here. |
@danlu1 Do you want to move the |
@philerooski Done. |
move not is_preview filter
|
* add filter to file_latest and add comments * Update V2.38.0__reintroduce_file_latest_dynamic_table.sql Add NOT IS_PREVIEW filter * Update V2.38.0__reintroduce_file_latest_dynamic_table.sql move not is_preview filter
* add filter to file_latest and add comments * Update V2.38.0__reintroduce_file_latest_dynamic_table.sql Add NOT IS_PREVIEW filter * Update V2.38.0__reintroduce_file_latest_dynamic_table.sql move not is_preview filter
Problem:
The original file_latest dynamic table does not have filter since the interpretation of
CHANGE_TYPE='DELETE'
vsSTATUS != "AVAILABLE"
. Platform team confirmed thatCHANGE_TYPE!='DELETE'
can be used to filter out file handles which have been deleted.Solution:
CHANGE_TYPE!='DELETE'
andNOT IS_PREVIEW