@@ -361,32 +361,28 @@ def _try_native_row_op(g_cur, op):
361361 from .search import search_any_polars
362362
363363 fn = getattr (op , "function" , None )
364- if (
365- fn == "rows"
366- and op .params .get ("binding_ops" ) is not None
367- and op .params .get ("alias_endpoints" ) is None
368- ):
369- # Multi-alias bindings table (#1709): native for fixed-length connected
370- # patterns. A decline must fall through to the pre-existing correlated
371- # pattern handler below (EXISTS/searchAny); returning None here would turn
372- # those already-native shapes into an NIE.
373- bindings_result = binding_rows_polars (
374- g_cur , op .params ["binding_ops" ], op .params .get ("attach_prop_aliases" )
375- )
376- if bindings_result is not None :
377- return bindings_result
364+ if fn == "rows" and op .params .get ("binding_ops" ) is not None :
365+ # #1731: single-entity boundary rows (MATCH (n) / EXISTS seeds) are handled by
366+ # the pattern-apply helper; try that narrow shape first.
367+ if op .params .get ("source" ) is None :
368+ out = rows_binding_ops_polars (g_cur , op .params ["binding_ops" ])
369+ if out is not None :
370+ return out
371+ # #1730 gate: only take the multi-alias bindings table when alias_endpoints is
372+ # absent (the alias-endpoints shape is handled elsewhere and must fall through).
373+ if op .params .get ("alias_endpoints" ) is None :
374+ # Multi-alias bindings table (#1709): native for fixed-length connected
375+ # patterns. A decline must fall through to the pre-existing correlated
376+ # pattern handler below (EXISTS/searchAny); returning None here would turn
377+ # those already-native shapes into an NIE.
378+ bindings_result = binding_rows_polars (
379+ g_cur , op .params ["binding_ops" ], op .params .get ("attach_prop_aliases" )
380+ )
381+ if bindings_result is not None :
382+ return bindings_result
378383 if _call_native_on_polars (op ):
379384 # frame ops (rows/limit/skip/distinct/drop_cols) — engine-polymorphic
380385 return op .execute (g = g_cur , prev_node_wavefront = None , target_wave_front = None , engine = Engine .POLARS )
381- # correlated pattern-existence family (EXISTS { } / pattern predicates): native
382- # via chain_polars-computed key sets; unsupported shapes return None -> honest NIE.
383- if (
384- fn == "rows"
385- and op .params .get ("binding_ops" ) is not None
386- and op .params .get ("alias_endpoints" ) is None
387- and op .params .get ("source" ) is None
388- ):
389- return rows_binding_ops_polars (g_cur , op .params ["binding_ops" ])
390386 if fn == "semi_apply_mark" :
391387 # required params are safelist-validated — direct indexing (an or-default
392388 # here could only mask an unvalidated call); neq is the optional one.
0 commit comments