okumin commented on code in PR #5312:
URL: https://github.com/apache/hive/pull/5312#discussion_r1681332963
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveCalciteUtil.java:
##########
@@ -109,6 +110,25 @@ public static boolean
validateASTForUnsupportedTokens(ASTNode ast) {
}
}
+ public static boolean requiresCBO(Tree node) {
+ switch (node.getType()) {
+ // Hive can't support the following features without CBO
+ case HiveParser.TOK_EXCEPTALL:
+ case HiveParser.TOK_EXCEPTDISTINCT:
+ case HiveParser.TOK_INTERSECTALL:
+ case HiveParser.TOK_INTERSECTDISTINCT:
+ case HiveParser.TOK_QUALIFY:
+ return true;
+ default:
+ for (int i = 0; i < node.getChildCount(); i++) {
+ if (requiresCBO(node.getChild(i))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
Review Comment:
Thanks for the advice. I checked the potential where we can skip the extra
traversal, and `QueryProperties` could be an option. I attached a debugger and
confirmed it sounds like an up-and-coming option if we can accept a new
attribute like `QueryProperties#requiresCBO.`
I will check the feasibility more in exceptional cases with sub-queries or
CTEs. If the approach turns out to have another problem, I will try it using
ParseUtils.
Thanks again.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]