配置单元从另一个表创建表并将格式存储为实木复合地板

时间:2019-07-21 13:33:57

标签: sql presto

当我尝试运行此配置单元查询时:

create table my_db.test_table
as (select * from my_db.my_table
where partition_date >= '2019-06-01')
STORED as PARQUET;

我看到错误:

SQL Error [1]: Query failed (#1): line 5:1: mismatched 
    input 'STORED' expecting {<EOF>, 'EXCEPT', 'INTERSECT', 
'LIMIT', 'ORDER', 'UNION', 'WITH'}

这与my_db.my_tableRCBINARY格式的事实有关吗?还是不了解stored as是什么意思?

如果死于RCBINARY,我该如何从RCBINARY格式转换为PARQUET

2 个答案:

答案 0 :(得分:1)

我意识到这是一个presto数据库,而不是Hive问题。

这对我有用:

create table my_db.test_table
WITH (format = 'PARQUET')
as (select * from my_db.my_table
where partition_date >= '2019-06-01'); 

答案 1 :(得分:0)

您必须在选择语句之前将stored as指定为-

create table my_db.test_table
STORED as PARQUET
as (select * from my_db.my_table
where partition_date >= '2019-06-01')

请参阅CTAS格式here