Description
Supported engines: Presto and SparkSQL
Applicable table: External tables
Purpose: Create one or more partitioning columns for a data table.
Statement
ALTER TABLE table_name ADD [IF NOT EXISTS]
PARTITION (partition_spec)
[PARTITION (partition_spec) ...]
partition_spec:
: partition_column = partition_col_value, partition_column = partition_col_value, ...
Parameter
table_name
: Name of the target table
partition_column
: Partitioning column name
partition_col_value
: Partitioning column value
Example
ALTER TABLE tbl ADD PARTITION (p1=1, p2='a');
ALTER TABLE tbl ADD IF NOT EXISTS PARTITION (P1 = 1) PARTITION (P2 = 2);
Was this page helpful?