You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/11/25 12:45:45 UTC

[GitHub] [hive] ayushtkn commented on a change in pull request #2815: [WIP] Master hive 25734 case when wrong type

ayushtkn commented on a change in pull request #2815:
URL: https://github.com/apache/hive/pull/2815#discussion_r756859217



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java
##########
@@ -655,6 +665,26 @@ private static RexNode handleAND(RexBuilder rexBuilder, RexCall call) {
       return RexUtil.composeConjunction(rexBuilder, newOperands, false);
     }
 
+    /**
+     * Check if the type of nodes in the two collections is homogeneous within the collections
+     * and identical between them.
+     * @param nodes1 the first collection of nodes
+     * @param nodes2 the second collection of nodes
+     * @return true if nodes in both collections is unique and identical, false otherwise
+     */
+    private static boolean shareSameType(Collection<RexNode> nodes1, Collection<RexNode> nodes2) {
+      Set<SqlTypeName> types1 = nodes1.stream()

Review comment:
       Can any one of this work-
   
   ```
        return Stream.of(nodes1, nodes2).flatMap(Collection::stream).map(n -> n.getType().getSqlTypeName()).distinct()
          .count() == 1;
   ```
   
   ```
      return CollectionUtils.union(nodes1, nodes2).stream().map(n -> n.getType().getSqlTypeName()).distinct().count()
             == 1;
   ```
   
   ```     
    return Stream.concat(nodes1.stream(),nodes2.stream()).map(n-> n.getType().getSqlTypeName()).distinct().count() == 1;
   ```




-- 
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-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org