zabetak commented on code in PR #4442:
URL: https://github.com/apache/hive/pull/4442#discussion_r1244982472


##########
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:
   ```
   The output of the UDTF is joined to these base table types on each row.
   ```
   According to the current description we are introducing a new operator that 
according to the description could be expressed by existing simpler operators:
   ```
   Join
     TableFunctionScan
     TableScan
   ```
   Why do we need this new compound operator and we didn't opt for the simpler 
primitives?
   
   Every new RelNode needs to be handled in various places (rules, factories, 
builders, transformers, etc.,) so its better if we can rely on existing ones.
   
   If we collapse/hide the join inside the table function scan then for sure 
join specific rules will not trigger. Aren't we losing potential optimizations 
by doing this?
   
   Ideally the representation that we pick for supporting lateral views in CBO 
should allow us to perform more powerful optimizations at the CBO level that 
are more powerful than those (if any) applied at the physical plan.



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