partitions

Name

partitions

Description

The table function generates a temporary partition TABLE, which allows you to view the PARTITION list of a certain TABLE.

This function is used in the from clause.

This function is supported since 2.1.5

Syntax

partitions("catalog"="","database"="","table"="")

partitions() Table structure:

  1. mysql> desc function partitions("catalog"="internal","database"="zd","table"="user");
  2. +--------------------------+---------+------+-------+---------+-------+
  3. | Field | Type | Null | Key | Default | Extra |
  4. +--------------------------+---------+------+-------+---------+-------+
  5. | PartitionId | BIGINT | No | false | NULL | NONE |
  6. | PartitionName | TEXT | No | false | NULL | NONE |
  7. | VisibleVersion | BIGINT | No | false | NULL | NONE |
  8. | VisibleVersionTime | TEXT | No | false | NULL | NONE |
  9. | State | TEXT | No | false | NULL | NONE |
  10. | PartitionKey | TEXT | No | false | NULL | NONE |
  11. | Range | TEXT | No | false | NULL | NONE |
  12. | DistributionKey | TEXT | No | false | NULL | NONE |
  13. | Buckets | INT | No | false | NULL | NONE |
  14. | ReplicationNum | INT | No | false | NULL | NONE |
  15. | StorageMedium | TEXT | No | false | NULL | NONE |
  16. | CooldownTime | TEXT | No | false | NULL | NONE |
  17. | RemoteStoragePolicy | TEXT | No | false | NULL | NONE |
  18. | LastConsistencyCheckTime | TEXT | No | false | NULL | NONE |
  19. | DataSize | TEXT | No | false | NULL | NONE |
  20. | IsInMemory | BOOLEAN | No | false | NULL | NONE |
  21. | ReplicaAllocation | TEXT | No | false | NULL | NONE |
  22. | IsMutable | BOOLEAN | No | false | NULL | NONE |
  23. | SyncWithBaseTables | BOOLEAN | No | false | NULL | NONE |
  24. | UnsyncTables | TEXT | No | false | NULL | NONE |
  25. +--------------------------+---------+------+-------+---------+-------+
  26. 20 rows in set (0.02 sec)
  • PartitionId:partition id
  • PartitionName:partition name
  • VisibleVersion:visible version
  • VisibleVersionTime:visible version time
  • State:state
  • PartitionKey:partition key
  • Range:range
  • DistributionKey:distribution key
  • Buckets:bucket num
  • ReplicationNum:replication num
  • StorageMedium:storage medium
  • CooldownTime:cooldown time
  • RemoteStoragePolicy:remote storage policy
  • LastConsistencyCheckTime:last consistency check time
  • DataSize:data size
  • IsInMemory:is in memory
  • ReplicaAllocation:replica allocation
  • IsMutable:is mutable
  • SyncWithBaseTables:Is it synchronized with the base table data (for partitioning asynchronous materialized views)
  • UnsyncTables:Which base table data is not synchronized with (for partitions of asynchronous materialized views)
  1. mysql> desc function partitions("catalog"="hive","database"="zdtest","table"="com2");
  2. +-----------+------+------+-------+---------+-------+
  3. | Field | Type | Null | Key | Default | Extra |
  4. +-----------+------+------+-------+---------+-------+
  5. | Partition | TEXT | No | false | NULL | NONE |
  6. +-----------+------+------+-------+---------+-------+
  7. 1 row in set (0.11 sec)
  • Partition:partition name

Example

  1. View the partition list of table1 under db1 in the internal catalog
  1. mysql> select * from partitions("catalog"="internal","database"="db1","table"="table1");
  1. View the partition information with partition name partition1 under table1
  1. mysql> select * from partitions("catalog"="internal","database"="db1","table"="table1") where PartitionName = "partition1";
  1. View the partition ID with the partition name ‘partition1’ under Table 1
  1. mysql> select PartitionId from partitions("catalog"="internal","database"="db1","table"="table1") where PartitionName = "partition1";

Keywords

  1. partitions