paul-rogers commented on a change in pull request #1974: DRILL-7574: Generalize 
the projection parser
URL: https://github.com/apache/drill/pull/1974#discussion_r379127271
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/resultSet/project/RequestedColumn.java
 ##########
 @@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.physical.resultSet.project;
+
+/**
+ * Plan-time properties of a requested column.Represents
+ * a consolidated view of the set of references to a column.
+ * For example, the project list might contain:<br>
+ * <tt>SELECT columns[4], columns[8]</tt><br>
+ * <tt>SELECT a.b, a.c</tt><br>
+ * <tt>SELECT columns, columns[1]</tt><br>
+ * <tt>SELECT a, a.b</tt><br>
+ * In each case, the same column is referenced in different
+ * forms which are consolidated into this abstraction.
+ * <p>
+ * The resulting information is a "pattern": a form of reference
+ * which which a concrete type can be compatible or not. The project
+ * list does not contain sufficient information to definitively pick
+ * a type; it only excludes certain types.
+ * <p>
+ * Depending on the syntax, we can infer if a column must
+ * be an array or map. This is definitive: though we know that
+ * columns of the form above must be an array or a map,
+ * we cannot know if a simple column reference might refer
+ * to an array or map.
+ *
+ * <h4>Compatibility Rules<h4>
+ *
+ * The pattern given by projection is consistent with certain concrete types
+ * as follows. + means any number of additional qualifiers.
+ * <p>
+ * <table>
+ * <tr><th>Type</th><th>Consistent with</th></tr>
+ * <tr><td>Non-repeated MAP</td>
+ *     <td>{@code a+} {@code a.b+}</td></tr>
+ * <tr><td>Repeated MAP</td>
+ *     <td>{@code a+} {@code a.b+} {@code a[n].b+}</td>></tr>
+ * <tr><td>Non-repeated Scalar</td>
+ *     <td>{@code a}</td></tr>
+ * <tr><td>Repeated Scalar</td>
+ *     <td>{@code a} {@code a[n]}</td></tr>
+ * <tr><td>Non-repeated DICT</td>
+ *     <td>{@code a} {@code a['key']}</td></tr>
+ * <tr><td>Repeated DICT</td>
+ *     <td>{@code a} {@code a[n]} {@code a['key']} {@code 
a[n]['key']}</td></tr>
 
 Review comment:
   Agreed. Changed the wording to suggest the mappings are conceptual. I 
*think* we allow `m.a` for `MAP` arrays, the Project operator(?) will pull out 
that one column as a top-level array. Conceptually, we could do the same for 
`DICT`. Implementation-wise, your suggestion might be more practical.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to