SHOW PARTITIONS
적용 대상: Databricks SQL Databricks Runtime
table파티션을 나열합니다.
구문
SHOW PARTITIONS table_name [ PARTITION clause ]
Parameters
-
table을(를) 식별합니다. 이름에는 임시 사양 또는 옵션 사양이 포함되어서는 안됩니다.
-
선택적 매개 변수로서 partition값을 지정합니다. 사양이 부분적이면 일치하는 모든 파티션이 반환됩니다. 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