my7ym 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_r399838961
##########
File path:
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
##########
@@ -1304,7 +1304,31 @@ public final Sql sql(String sql) {
final String sql = "select d.deptno, e2.empno\n"
+ "from dept_nested as d,\n"
+ " UNNEST(d.employees) as e2(empno, y, z)";
- sql(sql).with(getExtendedTester()).ok();
+ sql(sql).ok();
+ }
+
+ /**
+ * 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 testAliasUnnestArrayPlanWithSingleColumn() {
+ final String sql = "select d.deptno, employee.empno\n"
+ + "from dept_nested_expanded as d,\n"
+ + " UNNEST(d.employees) as t(employee)";
+ sql(sql).conformance(SqlConformanceEnum.PRESTO).decorrelate(false).ok();
Review comment:
The reason of turning off `decorrelate` is because during flattening, the
row type of Uncollect is not fully flattened, but the index is calculated on a
fully flattened base (RelStructuredTypeFlattener.postFlattenSize). So the type
mismatches validated query. Not sure whether it will be a big issue tho.
----------------------------------------------------------------
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