From 54bf6f5bb41b03a74e271d020e880010353ba0c2 Mon Sep 17 00:00:00 2001 From: CharlesKWON Date: Fri, 17 Apr 2026 07:35:26 +0900 Subject: [PATCH] fix: ComputeAgg qualified column lookup for Go SqlHashJoin path FindColIdx2 searched for bare column name (e.g. 'AMOUNT') but aFieldNames now contains qualified names ('o.amount') from the Go join fast path. Added fallback: try xArg[2] (the full AST name) when the bare name misses. Fixes SUM/AVG/MIN/MAX aggregation after Go-native hash join. Verified: 41/41 correctness tests pass (verify_correctness.prg). Co-Authored-By: Claude Opus 4.6 (1M context) --- _FiveSql2/src/TSqlAgg.prg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/_FiveSql2/src/TSqlAgg.prg b/_FiveSql2/src/TSqlAgg.prg index 4b2399f..d6f2992 100644 --- a/_FiveSql2/src/TSqlAgg.prg +++ b/_FiveSql2/src/TSqlAgg.prg @@ -404,6 +404,13 @@ METHOD ComputeAgg( xE, aGR, aFN ) CLASS TSqlAgg ENDIF nCol := ::FindColIdx2( cArgName, aFN ) + /* Also try the QUALIFIED name from the AST (e.g. "o.amount") since + * the Go SqlHashJoin fast path preserves qualifier prefixes in + * aFieldNames for JOIN disambiguation. SqlExprName strips them + * but the hidden column might be stored with the full qualified form. */ + IF nCol == 0 .AND. xArg[ 1 ] == ND_COL .AND. xArg[ 2 ] != cArgName + nCol := ::FindColIdx2( Upper( xArg[ 2 ] ), aFN ) + ENDIF IF nCol == 0 .AND. xArg[ 1 ] == ND_COL IF cFunc == "COUNT" RETURN Len( aGR )