Skip to content

Commit 20b7bc3

Browse files
committed
Restore Alias branch in expandProjectFields for IN/EXISTS subqueries
PR opensearch-project#5448 (parent commit b10d541) introduced SQL IN/EXISTS subquery support that produces a Project AST whose project list contains Alias expressions. The 'Lower structured search predicates' commit (c18b11e) on this PR accidentally dropped the case Alias branch from CalciteRelNodeVisitor.expandProjectFields, so the subquery's project list hit the default arm and threw 'Unexpected expression type in project list: Alias'. Restoring the one-line branch fixes UnifiedQueryPlannerSqlV2Test testInSubquery / testNotInSubquery / testExistsSubquery / testNotExistsSubquery (the four macOS unit-test failures on this PR). Signed-off-by: Kai Huang <ahkcs@amazon.com>
1 parent 9583614 commit 20b7bc3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ private List<RexNode> expandProjectFields(
730730
.filter(addedFields::add)
731731
.forEach(field -> expandedFields.add(context.relBuilder.field(field)));
732732
}
733+
case Alias alias -> expandedFields.add(rexVisitor.analyze(alias, context));
733734
default ->
734735
throw new IllegalStateException(
735736
"Unexpected expression type in project list: " + expr.getClass().getSimpleName());

0 commit comments

Comments
 (0)