rubenada commented on code in PR #6895:
URL: https://github.com/apache/hive/pull/6895#discussion_r4334867864


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java:
##########
@@ -218,10 +218,14 @@ public ExprNodeDesc visitCall(RexCall call) {
       return args.get(0);
     } else if (call.isA(SqlKind.AND)) {
       // Make sure AND is flattened (we may have nested ANDs due to 
SearchTransformer conversion above)
-      return ExprNodeDescUtils.and(args);
+      // Flattening/deduplication may collapse the operand list;
+      // AND require at least two operands (GenericUDFOPAnd#initialize 
enforces this), so unwrapping trivial cases.
+      return unwrapSingleOperand(ExprNodeDescUtils.and(args));
     }  else if (call.isA(SqlKind.OR)) {
       // Make sure OR is flattened (we may have nested ORs due to 
SearchTransformer conversion above)
-      return ExprNodeDescUtils.or(args);
+      // Flattening/deduplication may collapse the operand list;
+      // OR require at least two operands (GenericUDFOPOr#initialize enforces 
this), so unwrapping trivial cases.
+      return unwrapSingleOperand(ExprNodeDescUtils.or(args));

Review Comment:
   @mdayakar I have attached in the Jira a patch that introduces the fix inside 
`ExprNodeDescUtils.or` and `ExprNodeDescUtils.and`, changing the return type 
and propagating the necessary adjustments in cascade to all relevant files 
(just code change, no test included); in case we want to consider this solution.



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