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

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

                Author: ASF GitHub Bot
            Created on: 23/Nov/20 22:53
            Start Date: 23/Nov/20 22:53
    Worklog Time Spent: 10m 
      Work Description: jcamachor commented on a change in pull request #1676:
URL: https://github.com/apache/hive/pull/1676#discussion_r529046059



##########
File path: 
ql/src/test/results/clientpositive/llap/materialized_view_rewrite_window.q.out
##########
@@ -293,24 +293,24 @@ STAGE PLANS:
                 Statistics: Num rows: 4 Data size: 480 Basic stats: COMPLETE 
Column stats: COMPLETE
                 Group By Operator
                   aggregations: max(_col1)
-                  keys: _col2 (type: decimal(12,1))
+                  keys: _col2 (type: decimal(19,4))

Review comment:
       Difference in precision and scale for column. Why has this changed (same 
below)?
   
   

##########
File path: ql/src/test/results/clientpositive/llap/metadata_only_queries.q.out
##########
@@ -377,7 +377,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8
                 Statistics: Num rows: 1 Data size: 520 Basic stats: COMPLETE 
Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: bigint), '1' (type: string), _col1 
(type: bigint), _col2 (type: decimal(11,1)), 2 (type: int), _col0 (type: 
bigint), _col3 (type: bigint), 7 (type: decimal(2,0)), _col4 (type: bigint), 
_col5 (type: bigint), _col6 (type: bigint), _col7 (type: int), _col8 (type: 
bigint)
+                  expressions: _col0 (type: bigint), '1' (type: string), _col1 
(type: bigint), _col2 (type: decimal(11,1)), 2 (type: int), _col0 (type: 
bigint), _col3 (type: bigint), 7 (type: decimal(11,0)), _col4 (type: bigint), 
_col5 (type: bigint), _col6 (type: bigint), _col7 (type: int), _col8 (type: 
bigint)

Review comment:
       Difference in precision and scale for column. Why has this changed?
   
   

##########
File path: 
ql/src/test/results/clientpositive/llap/materialized_view_rewrite_window.q.out
##########
@@ -166,7 +166,7 @@ POSTHOOK: Input: arc_view@wealth
 #### A masked pattern was here ####
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC])
-  HiveProject(quartile=[$0], total=[$1])
+  HiveProject(quartile=[CAST($0):DECIMAL(12, 1)], total=[$1])

Review comment:
       Difference in precision and scale for column. Why has this changed?
   
   

##########
File path: ql/src/test/results/clientpositive/llap/vector_cast_constant.q.out
##########
@@ -180,7 +180,7 @@ STAGE PLANS:
                               native: true
                               nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                           Statistics: Num rows: 257 Data size: 40092 Basic 
stats: COMPLETE Column stats: COMPLETE
-                          value expressions: _col1 (type: bigint), _col2 
(type: bigint), _col3 (type: double), _col4 (type: bigint), _col5 (type: 
decimal(12,0)), _col6 (type: bigint)
+                          value expressions: _col1 (type: bigint), _col2 
(type: bigint), _col3 (type: double), _col4 (type: bigint), _col5 (type: 
decimal(20,0)), _col6 (type: bigint)

Review comment:
       Difference in precision and scale for column. Why has this changed?
   
   

##########
File path: 
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantIntObjectInspector.java
##########
@@ -46,12 +46,4 @@ public IntWritable getWritableConstantValue() {
     return value;
   }
 
-  @Override
-  public int precision() {

Review comment:
       I think this could lead to a change of behavior, e.g., all integers will 
have same precision by default, but constant integer would have the precision 
of the constant value?




----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 515807)
    Time Spent: 1h  (was: 50m)

> Trailing zeros of constant decimal numbers are removed
> ------------------------------------------------------
>
>                 Key: HIVE-24389
>                 URL: https://issues.apache.org/jira/browse/HIVE-24389
>             Project: Hive
>          Issue Type: Bug
>          Components: Types
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> In some case Hive removes trailing zeros of constant decimal numbers
> {code}
> select cast(1.1 as decimal(22, 2)) 
> 1.1
> {code}
> In this case *WritableConstantHiveDecimalObjectInspector* is used and this 
> object inspector takes it's wrapped HiveDecimal scale instead of the scale 
> specified in the wrapped typeinfo: 
> {code}
> this = {WritableConstantHiveDecimalObjectInspector@14415} 
>  value = {HiveDecimalWritable@14426} "1.1"
>  typeInfo = {DecimalTypeInfo@14421} "decimal(22,2)"{code}
> However in case of an expression with an aggregate function 
> *WritableHiveDecimalObjectInspector* is used
> {code}
> select cast(sum(1.1) as decimal(22, 2))
> 1.10
> {code}
> {code}
> o = {HiveDecimalWritable@16633} "1.1"
> oi = {WritableHiveDecimalObjectInspector@16634} 
>  typeInfo = {DecimalTypeInfo@16640} "decimal(22,2)"
> {code}
> Casting the expressions to string
> {code:java}
> select cast(cast(1.1 as decimal(22, 2)) as string), cast(cast(sum(1.1) as 
> decimal(22, 2)) as string)
> 1.1   1.10
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to