使用 Presto 插入静态配置单元分区

Insert into static hive partition using Presto

假设我想要 INSERT INTO 一个静态配置单元分区,我可以用 Presto 做到这一点吗?

PARTITION 关键字仅适用于 hive。

INSERT INTO TABLE Employee PARTITION (department='HR') 

Caused by: com.facebook.presto.sql.parser.ParsingException: line 1:44: mismatched input 'PARTITION'. Expecting: '(', at com.facebook.presto.sql.parser.ErrorHandler.syntaxError(ErrorHandler.java:109)

Presto 中您不需要 PARTITION(department='HR')。

INSERT INTO TABLE Employee (name, department)
VALUES  ('John', 'HR');

INSERT INTO TABLE Employee (name, department)
select 
      name, 
      'HR' --partition column is the last one
from 
...