julianhyde commented on code in PR #4289:
URL: https://github.com/apache/calcite/pull/4289#discussion_r2039903313


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -7389,15 +7396,50 @@ private SqlNode nthSelectItem(int ordinal, final 
SqlParserPos pos) {
   /**
    * Converts an expression into canonical form by fully-qualifying any
    * identifiers. For common columns in USING, it will be converted to
-   * COALESCE(A.col, B.col) AS col.
+   * COALESCE(A.col, B.col) AS col.  When using a conformance that
+   * allows isSelectAlias, it expands identifiers that refer to
+   * local select expressions into the expressions themselves.
    */
   static class SelectExpander extends Expander {
     final SqlSelect select;
-
-    SelectExpander(SqlValidatorImpl validator, SelectScope scope,
-        SqlSelect select) {
+    // Maps simple identifiers to their expansions.
+    final Map<String, SqlNode> expansions;
+    // List of identifiers that are currently beeing looked-up.  Used to detect
+    // circular dependencies when SqlConformance#isSelectAlias is ANY.
+    final Set<String> lookingUp;
+    @Nullable SqlNode root = null;
+
+    private SelectExpander(SqlValidatorImpl validator, SelectScope scope,
+        SqlSelect select, Map<String, SqlNode> expansions, Set<String> 
lookingUp) {
       super(validator, scope);
       this.select = select;
+      this.expansions = expansions;
+      this.lookingUp = lookingUp;
+    }
+
+    /**
+     * Create an expander for the items in a SELECT list.

Review Comment:
   s/Create/Creates/



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