Apr 20, 2019

INSERT OVERWRITE in Presto

If you are hive user and ETL developer, you may see a lot of INSERT OVERWRITE. Though it's not yet documented, Presto also supports OVERWRITE mode for partitioned table.

Currently, there are 3 modes, OVERWRITE, APPEND and ERROR.

OVERWRITE overwrites existing partition.
APPEND appends rows in existing partition.
ERROR fails when the partition already exists.

You can change the mode by set session command.
set session hive.insert_existing_partitions_behavior = 'overwrite';
set session hive.insert_existing_partitions_behavior = 'append';
set session hive.insert_existing_partitions_behavior = 'error';

The enhanced feature for unpartitioned table is ongoing in this PR (https://github.com/prestosql/presto/pull/648) by James Xu.

No comments:

Post a Comment