scarlin-cloudera commented on code in PR #4442: URL: https://github.com/apache/hive/pull/4442#discussion_r1286162327
########## ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java: ########## @@ -621,6 +703,45 @@ private ASTNode pkFkHint(int fkTableIndex, boolean nonFkSideIsFiltered) { } } + /** + * Check to see if we can optimize out the lateral view operators + * We do not need to use the lateral view syntax if all of the fields + * selected out of the table scan come from the UDTF call. No join + * is needed because all the fields come from the table level rather + * than the row level. + */ + private boolean canOptimizeOutLateralView(HiveTableFunctionScan htfs) { + Set<Integer> inputRefs = new HashSet<>(); + if (this.select instanceof HiveProject) { Review Comment: "this" is always the parent. As mentioned above, this only checks to see if the join is needed and if the parent makes reference to any field within the child that needs joining. No need to check grandparents because those inputs are on a different level. -- 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