deniskuzZ commented on code in PR #6179:
URL: https://github.com/apache/hive/pull/6179#discussion_r2809468167


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartFilterExprUtil.java:
##########
@@ -116,4 +125,59 @@ private static ExpressionTree makeExpressionTree(String 
filter) throws MetaExcep
   public static ExpressionTree parseFilterTree(String filter) throws 
MetaException {
     return PartFilterParser.parseFilter(filter);
   }
+
+  public static TreeNode buildTreeFromNodes(List<? extends TreeNode> nodes, 
LogicalOperator operator) {
+    // The 'nodes' list is expected to have at least one element.
+    // If the list if empty, the lexer parse would have failed.
+    assert !nodes.isEmpty() ;
+    if (nodes.size() == 1) {
+      return nodes.get(0);
+    }
+    TreeNode root = new TreeNode(nodes.get(0), operator, nodes.get(1));
+    for (int i = 2; i < nodes.size(); ++i) {
+      TreeNode tmp = new TreeNode(root, operator, nodes.get(i));
+      root = tmp;
+    }
+    return root;
+  }
+
+  /**
+   * Flatten all AND-connected leaf nodes in the given expression tree
+   * into MultiAndLeafNodes for more efficient evaluation.
+   */
+  public static TreeNode flattenAndExpressions(TreeNode node) {

Review Comment:
   should it be under parser module?



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

Reply via email to