This is an automated email from the ASF dual-hosted git repository.
mihaibudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 30d86a075f [CALCITE-7784] Parse fails for ROW(CASE ...)
30d86a075f is described below
commit 30d86a075f24fa165bc46e19280ce62824e4eea1
Author: Mihai Budiu <[email protected]>
AuthorDate: Mon Sep 14 16:52:00 2026 -0700
[CALCITE-7784] Parse fails for ROW(CASE ...)
Signed-off-by: Mihai Budiu <[email protected]>
---
core/src/main/codegen/templates/Parser.jj | 2 +-
.../main/java/org/apache/calcite/sql/parser/SqlParserTest.java | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/core/src/main/codegen/templates/Parser.jj
b/core/src/main/codegen/templates/Parser.jj
index 968c386f6c..42e4fc791a 100644
--- a/core/src/main/codegen/templates/Parser.jj
+++ b/core/src/main/codegen/templates/Parser.jj
@@ -4814,7 +4814,7 @@ SqlNode AtomicRowExpression() :
)
|
// Parses "*" or "* EXCLUDE (col, ...)" inside a ROW constructor
- LOOKAHEAD({ allowRowValueStar() })
+ LOOKAHEAD(<STAR>, { allowRowValueStar() })
<STAR> {
final SqlIdentifier starId = SqlIdentifier.star(getPos());
}
diff --git
a/testkit/src/main/java/org/apache/calcite/sql/parser/SqlParserTest.java
b/testkit/src/main/java/org/apache/calcite/sql/parser/SqlParserTest.java
index 68c14a73b7..be6087e752 100644
--- a/testkit/src/main/java/org/apache/calcite/sql/parser/SqlParserTest.java
+++ b/testkit/src/main/java/org/apache/calcite/sql/parser/SqlParserTest.java
@@ -2744,6 +2744,14 @@ void checkPeriodPredicate(Checker checker) {
sql(sql).ok(expected);
}
+ /** Test case for <a
href="https://issues.apache.org/jira/browse/CALCITE-7784">[CALCITE-7784]
+ * Parse fails for ROW(CASE ...)</a>. */
+ @Test void testRowCase() {
+ sql("select row(case when x > 0 then 1 end, x) from t")
+ .ok("SELECT (ROW((CASE WHEN (`X` > 0) THEN 1 ELSE NULL END), `X`))\n"
+ + "FROM `T`");
+ }
+
@Test void testMultipleWithRecursive() {
final String sql = "WITH RECURSIVE a(x) AS\n"
+ " (SELECT 1),\n"