HPL/SQL is included to Apache Hive since version 2.0
HPL/SQL is included to Apache Hive since version 2.0
PART_COUNT function returns the number partitions in the specified table.
Syntax:
PART_COUNT([db_name.]table_name, part_col=filter, ...);
Parameters:
[dbname.]table_name | Identifier, variable or expression |
part_col=filter | One or more partition filters |
Notes:
SHOW PARTITIONS db_name.tab_name [PARTITION (part_col=filter, ...)]
Return Value:
Return Type:
INT
Examples:
Table db.orders is partitioned by dt and region columns and has the following partitions:
dt=2015-09-01/region=1 |
dt=2015-09-01/region=2 |
dt=2015-09-02/region=1 |
dt=2015-09-03/region=3 |
dt=2015-09-03/region=2 |
Get the total number of partitions:
part_count(db.orders); -- 5
Get the number of partitions in region 1:
part_count(db.orders, region='1'); -- 2
Compatibility: HPL/SQL extension.
Version: HPL/SQL 0.3.13
See also: