zabetak commented on code in PR #2683:
URL: https://github.com/apache/calcite/pull/2683#discussion_r977435956


##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -9210,6 +9210,23 @@ public void _testGroupExpressionEquivalenceParams() {
                 + " CATALOG.SALES.EMP.HIREDATE,"
                 + " null,"
                 + " null}"));
+
+    sql("select e.empno from dept_nested, unnest(employees) as e")
+        .assertFieldOrigin(
+            is("{CATALOG.SALES.DEPT_NESTED.EMPLOYEES.EMPNO}"));
+
+    sql("select * from UNNEST(ARRAY['a', 'b'])")
+        .assertFieldOrigin(
+            is("{null}"));

Review Comment:
   nit: rather short so keep in everything in the same line



##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -9210,6 +9210,23 @@ public void _testGroupExpressionEquivalenceParams() {
                 + " CATALOG.SALES.EMP.HIREDATE,"
                 + " null,"
                 + " null}"));
+
+    sql("select e.empno from dept_nested, unnest(employees) as e")
+        .assertFieldOrigin(
+            is("{CATALOG.SALES.DEPT_NESTED.EMPLOYEES.EMPNO}"));
+
+    sql("select * from UNNEST(ARRAY['a', 'b'])")
+        .assertFieldOrigin(
+            is("{null}"));
+
+    sql("select * from UNNEST(ARRAY['a', 'b'], ARRAY['d', 'e'])")
+        .assertFieldOrigin(
+            is("{null, "
+                + "null}"));

Review Comment:
   nit: idem put in the same line



##########
core/src/main/java/org/apache/calcite/sql/validate/UnnestNamespace.java:
##########
@@ -64,6 +64,33 @@ class UnnestNamespace extends AbstractNamespace {
     return null;
   }
 
+  /**
+   * Given a field name from SelectScope, find the column in this
+   * UnnestNamespace it originates from.
+   *
+   * @param queryFieldName Name of column
+   * @return A SqlQualified if subfield comes from this unnest, null if not 
found
+   */
+  public @Nullable SqlQualified getColumnUnnestedFrom(String queryFieldName) {

Review Comment:
   Do we need to expose this as public? How about package private?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to