Sunil Kumar created HIVE-20144:
----------------------------------
Summary: Casting of Decimal Data Selected from ORC table and
Insert to the Target table not working.
Key: HIVE-20144
URL: https://issues.apache.org/jira/browse/HIVE-20144
Project: Hive
Issue Type: Bug
Components: Query Processor, SQL, SQLStandardAuthorization
Affects Versions: 1.2.1
Environment: HDP 2.6.4, Centos7
Reporter: Sunil Kumar
Decimal Data Selected from ORC table and inserted to Hive Target table Cast
Operator not working for the Decimal data Type. When data selected from ORC
table and Specifically cast written to cast to value but data in the target
table not getting casted to precision and scale mentioned with the CAST
operator.
create table tbl_src_txt(col1 decimal(10,7)) stored as textfile;
create table tbl_src_orc(col1 decimal(10,7)) stored as orc;
create table tbl_TGT_TXT(col1 decimal(10,7)) stored as orc;
insert into tbl_src_txt select -145.299999 from (select 1)tbl;
insert into tbl_src_orc select -149.299999 from (select 1)tbl;
Data in Source Tables:
hive> select * from tbl_src_txt;
OK
-145.299999
Time taken: 0.056 seconds, Fetched: 1 row(s)
hive> select * from tbl_src_orc;
OK
-149.299999
Time taken: 0.11 seconds, Fetched: 1 row(s)
hive>
Insert into Target table from both Source table:
insert into tbl_TGT_TXT select cast(col1 as decimal(4,1)) from tbl_src_txt;
insert into tbl_TGT_TXT select cast(col1 as decimal(4,1)) from tbl_src_orc;
hive> select * from tbl_TGT_TXT;
OK
-145.3
{color:#d04437}-149.299999{color}
Time taken: 0.065 seconds, Fetched: 2 row(s)
hive>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)