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) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 07:35:26 +09:00
parent 5fc9c3bbea
commit 54bf6f5bb4

View File

@@ -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 )