[ 
https://issues.apache.org/jira/browse/HIVE-21742?focusedWorklogId=253400&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-253400
 ]

ASF GitHub Bot logged work on HIVE-21742:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Jun/19 21:50
            Start Date: 03/Jun/19 21:50
    Worklog Time Spent: 10m 
      Work Description: vineetgarg02 commented on pull request #656: HIVE-21742 
: Vectorization: CASE result type casting
URL: https://github.com/apache/hive/pull/656#discussion_r290017784
 
 

 ##########
 File path: ql/src/test/results/clientpositive/infer_join_preds.q.out
 ##########
 @@ -1187,7 +1187,7 @@ STAGE PLANS:
               predicate: prid is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 668 Basic stats: COMPLETE 
Column stats: NONE
               Select Operator
-                expressions: idp_warehouse_id (type: bigint), prid (type: 
bigint), concat(CAST( CASE WHEN (prid is null) THEN (1) ELSE (prid) END AS 
STRING), ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) 
END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) 
END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) 
END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (CAST( prtypecodeid 
AS STRING)) END, ',', CASE WHEN (practsum is null) THEN (1) ELSE (practsum) 
END, ',', CASE WHEN (prsequence is null) THEN (1) ELSE (prsequence) END, ',', 
CASE WHEN (length(prmodby) is null) THEN ('') ELSE (prmodby) END, ',', CASE 
WHEN (prmodtime is null) THEN (TIMESTAMP'2017-12-08 00:00:00') ELSE (prmodtime) 
END, ',', CASE WHEN (prrmexported is null) THEN (1) ELSE (prrmexported) END, 
',', CASE WHEN (prrmckdel is null) THEN (1) ELSE (prrmckdel) END, ',', CASE 
WHEN (slice_status is null) THEN (1) ELSE (slice_status) END, ',', CASE WHEN 
(role_id is null) THEN (1) ELSE (role_id) END, ',', CASE WHEN 
(length(user_lov1) is null) THEN ('') ELSE (user_lov1) END, ',', CASE WHEN 
(length(user_lov2) is null) THEN ('') ELSE (user_lov2) END, ',', CASE WHEN 
(incident_id is null) THEN (1) ELSE (incident_id) END, ',', CASE WHEN 
(incident_investment_id is null) THEN (1) ELSE (incident_investment_id) END, 
',', CASE WHEN (odf_ss_actuals is null) THEN (1) ELSE (odf_ss_actuals) END) 
(type: string)
+                expressions: idp_warehouse_id (type: bigint), prid (type: 
bigint), concat(CAST( CASE WHEN (prid is null) THEN (1L) ELSE (prid) END AS 
STRING), ',', CASE WHEN (prtimesheetid is null) THEN (1L) ELSE (prtimesheetid) 
END, ',', CASE WHEN (prassignmentid is null) THEN (1L) ELSE (prassignmentid) 
END, ',', CASE WHEN (prchargecodeid is null) THEN (1L) ELSE (prchargecodeid) 
END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (CAST( prtypecodeid 
AS STRING)) END, ',', CASE WHEN (practsum is null) THEN (CAST( 1 AS 
decimal(38,20))) ELSE (practsum) END, ',', CASE WHEN (prsequence is null) THEN 
(1L) ELSE (prsequence) END, ',', CASE WHEN (length(prmodby) is null) THEN ('') 
ELSE (CAST( prmodby AS STRING)) END, ',', CASE WHEN (prmodtime is null) THEN 
(TIMESTAMP'2017-12-08 00:00:00') ELSE (prmodtime) END, ',', CASE WHEN 
(prrmexported is null) THEN (1L) ELSE (prrmexported) END, ',', CASE WHEN 
(prrmckdel is null) THEN (1L) ELSE (prrmckdel) END, ',', CASE WHEN 
(slice_status is null) THEN (1) ELSE (slice_status) END, ',', CASE WHEN 
(role_id is null) THEN (1L) ELSE (role_id) END, ',', CASE WHEN 
(length(user_lov1) is null) THEN ('') ELSE (CAST( user_lov1 AS STRING)) END, 
',', CASE WHEN (length(user_lov2) is null) THEN ('') ELSE (CAST( user_lov2 AS 
STRING)) END, ',', CASE WHEN (incident_id is null) THEN (1L) ELSE (incident_id) 
END, ',', CASE WHEN (incident_investment_id is null) THEN (1L) ELSE 
(incident_investment_id) END, ',', CASE WHEN (odf_ss_actuals is null) THEN (1L) 
ELSE (odf_ss_actuals) END) (type: string)
 
 Review comment:
   Yes. The type of whole case expression is determined to be `bigint` as a 
result `1` is cast to long.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 253400)
    Time Spent: 2h 40m  (was: 2.5h)

> Vectorization: CASE result type casting
> ---------------------------------------
>
>                 Key: HIVE-21742
>                 URL: https://issues.apache.org/jira/browse/HIVE-21742
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer, Vectorization
>    Affects Versions: 3.1.1
>            Reporter: Gopal V
>            Assignee: Vineet Garg
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-21742.1.patch, HIVE-21742.2.patch, 
> HIVE-21742.3.patch, HIVE-21742.4.patch
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> {code}
> create temporary table foo(q548284 int);
> insert into foo values(1),(2),(3),(4),(5),(6);
> select q548284, CASE WHEN ((q548284 = 1)) THEN (0.2) WHEN ((q548284 = 2)) 
> THEN (0.4) WHEN ((q548284 = 3)) THEN (0.6) WHEN ((q548284 = 4)) THEN (0.8) 
> WHEN ((q548284 = 5)) THEN (1) ELSE (null) END from foo order by q548284 limit 
> 1;
> {code}
> Fails with 
> {code}
> Caused by: java.lang.ClassCastException: 
> org.apache.hadoop.hive.ql.exec.vector.LongColumnVector cannot be cast to 
> org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector
>         at 
> org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector.setElement(DecimalColumnVector.java:130)
>         at 
> org.apache.hadoop.hive.ql.exec.vector.expressions.IfExprColumnNull.evaluate(IfExprColumnNull.java:101)
> {code}
> This gets fixed if the case return of (1) is turned into a (1.0).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to