trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.38k stars 2.98k forks source link

Support Hive VIEW with CAST to decimal #6450

Open findepi opened 3 years ago

findepi commented 3 years ago

it looks like casting a column to any decimal precision is translated to decimal(10,0).

Hive:

hive> create view decimal_view as select cast(a as decimal (6,2)) b from dect;
OK
hive> show create table decimal_view;
OK
CREATE VIEW `decimal_view` AS select cast(`dect`.`a` as decimal (6,2)) `b` from `newschema`.`dect`

Presto:

presto> show create view decimal_view;
                Create View                 
--------------------------------------------
 CREATE VIEW hive.newschema.decimal_view AS 
 SELECT CAST("a" AS DECIMAL(10, 0)) "b"     
 FROM                                       
   "newschema"."dect"    
findepi commented 3 years ago

Since it worked in Presto 344, i am marking this as a bug.