mirror of
https://github.com/apache/impala.git
synced 2026-01-05 21:00:54 -05:00
Fix decimal literal casting and cast expr reanalyze().
BigDecimal doesn't think about scale the way we need it to. Change-Id: I09612c31e30e80ce4806080f1d24c6615090785e Reviewed-on: http://gerrit.ent.cloudera.com:8080/2794 Reviewed-by: Nong Li <nong@cloudera.com> Tested-by: jenkins
This commit is contained in:
@@ -30,3 +30,43 @@ values((1+8, 2, 5.0, 'a'), (2, 3, 6.0, 'b'), (3, 4, 7.0, 'c')) order by 1 desc l
|
||||
---- TYPES
|
||||
SMALLINT, TINYINT, DECIMAL, STRING
|
||||
====
|
||||
# Test literal casts by inserting into a table that requires a float.
|
||||
---- QUERY
|
||||
drop table if exists values_test_float_tbl;
|
||||
create table values_test_float_tbl(f float);
|
||||
insert into values_test_float_tbl values
|
||||
(1), (16), (1024), (65536), (1000000), (1.1), (98.6), (0.07), (33.333);
|
||||
select * from values_test_float_tbl;
|
||||
---- RESULTS
|
||||
1
|
||||
16
|
||||
1024
|
||||
65536
|
||||
1000000
|
||||
1.100000023841858
|
||||
98.59999847412109
|
||||
0.07
|
||||
33.33300018310547
|
||||
---- TYPES
|
||||
float
|
||||
====
|
||||
# Test literal casts by inserting into a table that requires a decimal.
|
||||
---- QUERY
|
||||
drop table if exists values_test_decimal_tbl;
|
||||
create table values_test_decimal_tbl(f decimal(20, 4));
|
||||
insert into values_test_decimal_tbl values
|
||||
(1), (16), (1024), (65536), (1000000), (1.1), (98.6), (0.07), (33.333);
|
||||
select * from values_test_decimal_tbl;
|
||||
---- RESULTS
|
||||
1.0000
|
||||
16.0000
|
||||
1024.0000
|
||||
65536.0000
|
||||
1000000.0000
|
||||
1.1000
|
||||
98.6000
|
||||
0.0700
|
||||
33.3330
|
||||
---- TYPES
|
||||
decimal
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user