파티션 표시

적용 대상:검사 예 Databricks SQL 검사 예 Databricks Runtime으로 표시됨

테이블의 파티션을 나열합니다.

구문

SHOW PARTITIONS table_name [ PARTITION clause ]

매개 변수

  • Table_name

    테이블을 식별합니다. 이름에 임시 사양이 포함되어서는 안됩니다.

  • PARTITION 절

    파티션을 지정하는 선택적 매개 변수입니다. 사양이 부분만인 경우 일치하는 모든 파티션이 반환됩니다. 모든 Databricks SQL에 지정된 파티션이 없으면 모든 파티션이 반환됩니다.

-- create a partitioned table and insert a few rows.
> USE salesdb;
> CREATE TABLE customer(id INT, name STRING) PARTITIONED BY (state STRING, city STRING);
> INSERT INTO customer PARTITION (state = 'CA', city = 'Fremont') VALUES (100, 'John');
> INSERT INTO customer PARTITION (state = 'CA', city = 'San Jose') VALUES (200, 'Marry');
> INSERT INTO customer PARTITION (state = 'AZ', city = 'Peoria') VALUES (300, 'Daniel');

-- Lists all partitions for table `customer`
> SHOW PARTITIONS customer;
   state=AZ/city=Peoria
  state=CA/city=Fremont
 state=CA/city=San Jose

-- Lists all partitions for the qualified table `customer`
> SHOW PARTITIONS salesdb.customer;
   state=AZ/city=Peoria
  state=CA/city=Fremont
 state=CA/city=San Jose

-- Specify a full partition spec to list specific partition
> SHOW PARTITIONS customer PARTITION (state = 'CA', city = 'Fremont');
 |state=CA/city=Fremont|

-- Specify a partial partition spec to list the specific partitions
> SHOW PARTITIONS customer PARTITION (state = 'CA');
  state=CA/city=Fremont
 state=CA/city=San Jose

-- Specify a partial spec to list specific partition
> SHOW PARTITIONS customer PARTITION (city =  'San Jose');
 state=CA/city=San Jose