zabetak commented on code in PR #6895:
URL: https://github.com/apache/hive/pull/6895#discussion_r4346958503
##########
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:
The patch attached by @rubenada makes sense and given that we have a bit
more time for landing this I would say that it's worth going into this
direction.
--
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]