danny0405 commented on a change in pull request #1811: [CALCITE-3789] Support
validation of UNNEST multiple array columns like Presto
URL: https://github.com/apache/calcite/pull/1811#discussion_r390741619
##########
File path: core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
##########
@@ -7540,6 +7540,42 @@ public void _testGroupExpressionEquivalenceParams() {
.fails("Column 'C1' not found in any table");
}
+ /**
+ * Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-3789">[CALCITE-3789]
+ * Support validation of UNNEST multiple array columns like Presto</a>.
+ */
+ @Test public void testAliasUnnestMultipleArrays() {
+ sql("select A, varType "
+ + "from COMPLEXTYPES.CTC_T1 "
+ + "CROSS JOIN UNNEST(varchar5ArrayType) as t(varType)")
+ .withExtendedCatalog()
+ .withCaseSensitive(false)
+ .withConformance(SqlConformanceEnum.PRESTO).ok();
+ sql("select A, varType, intType "
+ + "from COMPLEXTYPES.CTC_T1 "
+ + "CROSS JOIN UNNEST(varchar5ArrayType, intArrayType) as t(varType,
intType)")
+ .withExtendedCatalog()
+ .withCaseSensitive(false)
+ .withConformance(SqlConformanceEnum.PRESTO).ok();
+ sql("select e.ENAME\n"
+ + "from dept_nested as d CROSS JOIN\n"
+ + " UNNEST(d.employees) as t(e)")
+ .withConformance(SqlConformanceEnum.PRESTO).columnType("VARCHAR(10) NOT
NULL");
+ sql("select d.deptno, e.detail, k.empno\n"
+ + "from dept_nested as d CROSS JOIN\n"
+ + " UNNEST(d.employees, d.employees) as t(e, k)")
Review comment:
You should add a new nested `StructKind.PEEK_FIELDS` type and write test
with that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services