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


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/parser/PartFilterVisitor.java:
##########
@@ -262,4 +262,163 @@ public String 
visitQuotedIdentifier(PartitionFilterParser.QuotedIdentifierContex
     return StringUtils.replace(ctx.getText().substring(1, 
ctx.getText().length() -1 ), "``", "`");
   }
 
+  @Override
+  public TreeNode 
visitConditionIsBoolean(PartitionFilterParser.ConditionIsBooleanContext ctx) {
+    TreeNode exprNode = (TreeNode) visit(ctx.expression());
+    boolean isNegated = ctx.NOT() != null;  // Check for negation (NOT)
+
+    // Retrieve the boolean literal (TRUE/FALSE) and handle negation
+    String booleanLiteral = ctx.booleanLiteral().getText();
+    switch (booleanLiteral.toUpperCase()) {
+      case "TRUE":
+        // For TRUE: return expression directly if not negated, otherwise 
negate it
+        return isNegated ? negateTreeNode(exprNode) : exprNode;
+      case "FALSE":
+        // For FALSE: return negated expression if not negated, otherwise 
return as is
+        return isNegated ? exprNode : negateTreeNode(exprNode);
+      default:

Review Comment:
   you've defined `booleanLiteral` as TRUE/FALSE, how could it be something 
else?`
   
https://github.com/apache/hive/pull/5614/files#diff-4f2ef6e04f868805ddc84ef7500193d1004c01a821805d1593c073f0e6e65c20R93
   
   ````
   return (isNegated && Boolean.parseBoolean(booleanLiteral)) ? 
       negateTreeNode(exprNode) : exprNode;
   ````



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