scarlin-cloudera commented on code in PR #4442:
URL: https://github.com/apache/hive/pull/4442#discussion_r1246991408


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveLVTableFunctionScan.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hadoop.hive.ql.optimizer.calcite.reloperators;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.TableFunctionScan;
+import org.apache.calcite.rel.metadata.RelColumnMapping;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rex.RexNode;
+import org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException;
+
+/**
+  *  HiveLVTableFunctionScan (LV stands for lateral views).
+  * This RelNode is created through a lateral view. This class differs from its
+  * parent's class in that the fields in the child RelNode are present in the 
output
+  * RelDataType. The output of the UDTF is joined to these base table types on 
each
+  * row.
+  */
+public class HiveLVTableFunctionScan extends HiveTableFunctionScan {

Review Comment:
   I relooked at this and I think the Calcite TableFunctionScan node actually 
turns out to be the correct primitive.  Its purpose is to take an input row 
structure and output a table with multiple rows.
   
   The reason I added an extra operator (which was actually done as part of the 
code review) was because I added additional functionality as to how the 
TableFunctionScan operator worked.  The lateral views put in the input RelNode 
fields as the first <n> fields and then add on the output of the UDTF fields.  
This is different from UDTF operators which only contain the output of the UDTF 
function.  The second operator was used to distinguish these different use 
cases.
   
   After looking at the Calcite API a bit deeper, it turns out they have the 
capability to support both of these use cases already.  By taking advantage of 
the Set<RelColumnMapping>, both use cases are now represented so we now are 
using a core Calcite operator for this feature.  
   
   Thanks for making me look into this a little deeper because I think the code 
is now better!



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to