[
https://issues.apache.org/jira/browse/HIVE-21742?focusedWorklogId=252150&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-252150
]
ASF GitHub Bot logged work on HIVE-21742:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Jun/19 00:18
Start Date: 01/Jun/19 00:18
Worklog Time Spent: 10m
Work Description: t3rmin4t0r commented on pull request #656: HIVE-21742 :
Vectorization: CASE result type casting
URL: https://github.com/apache/hive/pull/656#discussion_r289582883
##########
File path: ql/src/test/results/clientpositive/vectorized_case.q.out
##########
@@ -705,13 +705,13 @@ STAGE PLANS:
native: true
vectorizationSchemaColumns:
[0:member:decimal(10,0)/DECIMAL_64, 1:attr:decimal(10,0)/DECIMAL_64,
2:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
Select Operator
- expressions: CASE WHEN ((member = 1)) THEN ((attr + 1)) ELSE (2)
END (type: decimal(11,0))
+ expressions: CASE WHEN ((member = 1)) THEN ((attr + 1)) ELSE
(CAST( 2 AS decimal(11,0))) END (type: decimal(11,0))
outputColumnNames: _col0
Select Vectorization:
className: VectorSelectOperator
native: true
- projectedOutputColumnNums: [9]
- selectExpressions: IfExprDecimalColumnColumn(col 6:boolean,
col 10:decimal(11,0)col 8:decimal(11,0))(children:
Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val
1, decimalVal 1) -> 6:boolean, ConvertDecimal64ToDecimal(col
7:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col
1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) ->
7:decimal(11,0)/DECIMAL_64) -> 10:decimal(11,0), ConstantVectorExpression(val
2) -> 8:decimal(11,0)) -> 9:decimal(11,0)
+ projectedOutputColumnNums: [8]
+ selectExpressions: IfExprDecimal64ColumnDecimal64Scalar(col
6:boolean, col 7:decimal(11,0)/DECIMAL_64, decimal64Val 2, decimalVal
2)(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64,
decimal64Val 1, decimalVal 1) -> 6:boolean, Decimal64ColAddDecimal64Scalar(col
1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) ->
7:decimal(11,0)/DECIMAL_64) -> 8:decimal(11,0)/DECIMAL_64
Review comment:
This is pretty neat, the expression optimized to a faster one.
----------------------------------------------------------------
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: 252150)
Time Spent: 1h 40m (was: 1.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
>
> Time Spent: 1h 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)