File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/snowflake/snowpark/_internal/compiler Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1818 update_resolvable_node ,
1919)
2020from snowflake .snowpark ._internal .utils import (
21+ TEMP_OBJECT_NAME_PREFIX ,
2122 TempObjectType ,
22- random_name_for_temp_object ,
2323)
2424
2525
@@ -164,10 +164,11 @@ def _update_parents(
164164 node .encoded_node_id_with_query
165165 ]
166166 else :
167- # create a WithQueryBlock node
168- with_block = WithQueryBlock (
169- name = random_name_for_temp_object (TempObjectType .CTE ), child = node
170- )
167+ # create a WithQueryBlock node with deterministic name
168+ # Use first 16 chars of encoded_node_id_with_query (SHA256 hash)
169+ # This ensures the same node always gets the same CTE name
170+ cte_name = f"{ TEMP_OBJECT_NAME_PREFIX } { TempObjectType .CTE .value } _{ node .encoded_node_id_with_query [:16 ].upper ()} "
171+ with_block = WithQueryBlock (name = cte_name , child = node )
171172 with_block ._is_valid_for_replacement = True
172173
173174 resolved_with_block = self ._query_generator .resolve (with_block )
You can’t perform that action at this time.
0 commit comments