@@ -5953,7 +5953,7 @@ def _bounded_reentry_carry_columns(
59535953 * ,
59545954 query : CypherQuery ,
59555955 prefix_stage : ProjectionStage ,
5956- ) -> Tuple [str , ...]:
5956+ ) -> Tuple [str , Tuple [ str , ...] ]:
59575957 whole_row_columns = [column for column in prefix_projection .columns if column .kind == "whole_row" ]
59585958 if len (whole_row_columns ) != 1 :
59595959 raise _unsupported (
@@ -5964,7 +5964,7 @@ def _bounded_reentry_carry_columns(
59645964 column = prefix_stage .span .column ,
59655965 )
59665966 if len (prefix_projection .columns ) == 1 :
5967- return ()
5967+ return whole_row_columns [ 0 ]. output_name , ()
59685968 seed_alias = _single_node_seed_alias (query .matches [0 ]) if len (query .matches ) == 1 else None
59695969 if seed_alias is None or seed_alias != prefix_projection .alias :
59705970 raise _unsupported (
@@ -5998,7 +5998,7 @@ def _bounded_reentry_carry_columns(
59985998 )
59995999 hidden_names .add (hidden_column )
60006000 carried_columns .append (column .output_name )
6001- return tuple (carried_columns )
6001+ return whole_row_columns [ 0 ]. output_name , tuple (carried_columns )
60026002
60036003
60046004def _literal_limit_value (limit_clause : Optional [LimitClause ]) -> Optional [int ]:
@@ -6101,7 +6101,7 @@ def _compile_bounded_reentry_query(
61016101 line = prefix_stage .span .line ,
61026102 column = prefix_stage .span .column ,
61036103 )
6104- carry_columns = _bounded_reentry_carry_columns (
6104+ reentry_alias , carry_columns = _bounded_reentry_carry_columns (
61056105 prefix_projection ,
61066106 query = query ,
61076107 prefix_stage = prefix_stage ,
@@ -6137,7 +6137,7 @@ def _compile_bounded_reentry_query(
61376137
61386138 reentry_match = query .reentry_matches [0 ]
61396139 first_alias = _first_pattern_node_alias (reentry_match )
6140- if first_alias is None or first_alias != prefix_projection . alias :
6140+ if first_alias is None or first_alias != reentry_alias :
61416141 raise _unsupported (
61426142 "Cypher MATCH after WITH currently requires the trailing MATCH to start from the same carried node alias" ,
61436143 field = "match" ,
@@ -6152,7 +6152,7 @@ def _compile_bounded_reentry_query(
61526152 reentry_where ,
61536153 expr = _rewrite_reentry_expr_to_hidden_properties (
61546154 reentry_where .expr ,
6155- carried_alias = prefix_projection . alias ,
6155+ carried_alias = reentry_alias ,
61566156 carried_columns = carry_columns ,
61576157 field = "where" ,
61586158 ),
@@ -6171,7 +6171,7 @@ def _compile_bounded_reentry_query(
61716171 for rewritten_expr in (
61726172 _rewrite_reentry_expr_to_hidden_properties (
61736173 item .expression ,
6174- carried_alias = prefix_projection . alias ,
6174+ carried_alias = reentry_alias ,
61756175 carried_columns = carry_columns ,
61766176 field = query .return_ .kind ,
61776177 ),
@@ -6187,7 +6187,7 @@ def _compile_bounded_reentry_query(
61876187 item ,
61886188 expression = _rewrite_reentry_expr_to_hidden_properties (
61896189 item .expression ,
6190- carried_alias = prefix_projection . alias ,
6190+ carried_alias = reentry_alias ,
61916191 carried_columns = carry_columns ,
61926192 field = "order_by" ,
61936193 ),
@@ -6219,7 +6219,7 @@ def _compile_bounded_reentry_query(
62196219 column = reentry_match .span .column ,
62206220 )
62216221 result_projection = suffix_compiled .result_projection
6222- if result_projection is not None and result_projection .alias == prefix_projection . alias and carry_columns :
6222+ if result_projection is not None and result_projection .alias == reentry_alias and carry_columns :
62236223 result_projection = replace (
62246224 result_projection ,
62256225 exclude_columns = tuple (
0 commit comments