Auxiliary Statements

Set / Reset

The SET command sets a property, returns the value of an existing property or returns all SQLConf properties with value and meaning. The RESET command resets runtime configurations specific to the current session which were set via the SET command to their default values. To set paimon configs specifically, you need add the spark.paimon. prefix.

  1. -- set spark conf
  2. SET spark.sql.sources.partitionOverwriteMode=dynamic;
  3. -- set paimon conf
  4. SET spark.paimon.file.block-size=512M;
  5. -- reset conf
  6. RESET spark.paimon.file.block-size;

Describe table

DESCRIBE TABLE statement returns the basic metadata information of a table. The metadata information includes column name, column type and column comment.

  1. -- describe table
  2. DESCRIBE TABLE my_table;
  3. -- describe table with additional metadata
  4. DESCRIBE TABLE EXTENDED my_table;

Show create table

SHOW CREATE TABLE returns the CREATE TABLE statement that was used to create a given table.

  1. SHOW CREATE TABLE my_table;

Show columns

Returns the list of columns in a table. If the table does not exist, an exception is thrown.

  1. SHOW COLUMNS FROM my_table;

Show partitions

The SHOW PARTITIONS statement is used to list partitions of a table. An optional partition spec may be specified to return the partitions matching the supplied partition spec.

  1. -- Lists all partitions for my_table
  2. SHOW PARTITIONS my_table;
  3. -- Lists partitions matching the supplied partition spec for my_table
  4. SHOW PARTITIONS my_table PARTITION (dt=20230817);

Analyze table

The ANALYZE TABLE statement collects statistics about the table, that are to be used by the query optimizer to find a better query execution plan. Paimon supports collecting table-level statistics and column statistics through analyze.

  1. -- collect table-level statistics
  2. ANALYZE TABLE my_table COMPUTE STATISTICS;
  3. -- collect table-level statistics and column statistics for col1
  4. ANALYZE TABLE my_table COMPUTE STATISTICS FOR COLUMNS col1;
  5. -- collect table-level statistics and column statistics for all columns
  6. ANALYZE TABLE my_table COMPUTE STATISTICS FOR ALL COLUMNS;