JackDrogon opened a new pull request, #17622:
URL: https://github.com/apache/doris/pull/17622

   ## Problem summary
   可以把unix timestamp的值当做动态分区的分区键,时间计算是把它当做unix timestamp来算
   
   PR添加了一个property `dynamic_partition.time_source`, 
默认是空,是原先的行为。如果为`unix_timestamp`就把它当做unix时间戳使用. 分区range不再是date转化为字符串,还是unix 
timestamp
   
   建表语句
   ```sql
   CREATE TABLE tbl_day
   (
       k1 bigint
   )
   PARTITION BY RANGE(k1) ()
   DISTRIBUTED BY HASH(k1)
   PROPERTIES
   (
       "dynamic_partition.enable" = "true",
       "dynamic_partition.time_unit" = "DAY",
       "dynamic_partition.time_source" = "unix_timestamp",
       "dynamic_partition.start" = "-2",
       "dynamic_partition.end" = "2",
       "dynamic_partition.prefix" = "p",
       "dynamic_partition.buckets" = "8",
       "replication_allocation" = "tag.location.default: 1"
   );
   ```
   
   ```bash
   mysql> show partitions from tbl_day;
   
+-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
   | PartitionId | PartitionName | VisibleVersion | VisibleVersionTime  | State 
 | PartitionKey | Range                                                         
                 | DistributionKey | Buckets | ReplicationNum | StorageMedium | 
CooldownTime        | RemoteStoragePolicy | LastConsistencyCheckTime | DataSize 
| IsInMemory | ReplicaAllocation       | IsMutable |
   
+-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
   | 61055       | p20230308     | 1              | 2023-03-08 17:20:06 | 
NORMAL | k1           | [types: [BIGINT]; keys: [1678204800]; ..types: 
[BIGINT]; keys: [1678291200]; ) | k1              | 8       | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
   | 61072       | p20230309     | 1              | 2023-03-08 17:20:06 | 
NORMAL | k1           | [types: [BIGINT]; keys: [1678291200]; ..types: 
[BIGINT]; keys: [1678377600]; ) | k1              | 8       | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
   | 61089       | p20230310     | 1              | 2023-03-08 17:20:06 | 
NORMAL | k1           | [types: [BIGINT]; keys: [1678377600]; ..types: 
[BIGINT]; keys: [1678464000]; ) | k1              | 8       | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
   | 61106       | p20230311     | 1              | 2023-03-09 00:09:12 | 
NORMAL | k1           | [types: [BIGINT]; keys: [1678464000]; ..types: 
[BIGINT]; keys: [1678550400]; ) | k1              | 8       | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
   
+-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
   ```
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to