-
Notifications
You must be signed in to change notification settings - Fork 118
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-1865904 fix query gen when nested cte node is partitioned #2816
Merged
sfc-gh-aalam
merged 5 commits into
main
from
aalam-SNOW-1865904-fix-query-gen-when-nested-cte-node-is-partitioned
Jan 3, 2025
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
655c0e3
fix query gen when cte is updated
sfc-gh-aalam 08a2b8d
add test; update comment
sfc-gh-aalam 8c8dbbd
Update src/snowflake/snowpark/_internal/compiler/query_generator.py
sfc-gh-aalam 614568c
Merge branch 'main' into aalam-SNOW-1865904-fix-query-gen-when-nested…
sfc-gh-aalam bef4e25
remove todo
sfc-gh-aalam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,6 @@ def compile(self) -> Dict[PlanQueryType, List[Query]]: | |
error_type=type(e).__name__, | ||
error_message=str(e), | ||
) | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we have a bug before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no. I just noticed an unnecessary |
||
|
||
return self.replace_temp_obj_placeholders(queries) | ||
|
||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can you give some more detailed description about what is the problem if we skip the node update here ? the cte optimizaiton is doing a level to level update, so it can skip the node update if it is already updated, but for large query breakdown, i recall you were doing a dfs, right?
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.
consider a tree below
suppose we start by re-resolving
node3 -> node2 -> node1
. In this process,node2
andnode1
are marked inupdated_nodes
. Now, when we go updating the ancestors ofnode4
, re-resolution ofnode2
andnode1
would be skipped. This is not ideal ifnode4
update can also trigger a re-update ofnode2
andnode1
.For example, this could be problematic is when
node3
andnode4
before the update hadreferenced_cte
map. After the first updatenode3 -> node2 -> node1
,node2
will be resolved with an older version ofnode4
. If after a re-resolvednode4
there are no referenced_ctes, thennode2
will not be updated with this information.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.
so it is because you are doing a dfs, if you are doing updated in the order of node3, node4 then node2, last node1 you shouldn't run into problems.