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/24 18:21:33 UTC

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

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



##########
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:
       I'm wondering if its possible to logically union `nodes1` and `nodes2` together - that way this could become a one liner method :)

##########
File path: ql/src/test/queries/clientpositive/cbo_case_when_wrong_type.q
##########
@@ -0,0 +1,20 @@
+create external table test_case (row_seq smallint, row_desc string) stored as parquet;

Review comment:
       can we also add a simpler testcase like:
   ```
   explain select 1 from t where a in (1,2,3) and case a when 1S then true when 2S then true end;
   ```




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