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

   ## Proposed changes
   
   Issue Number: close #xxx
   
   add table properties for auto range partition: 
`use_simple_auto_partition_name`
   ```sql
   mysql> CREATE TABLE test_interval (
       ->     `TIME_STAMP` datetimev2 NOT NULL
       -> )
       -> auto partition by range (date_trunc(`TIME_STAMP`, 'month'))()
       -> DISTRIBUTED BY HASH(`TIME_STAMP`) BUCKETS 10
       -> PROPERTIES (
       ->     "replication_allocation" = "tag.location.default: 1"
       -> );
   Query OK, 0 rows affected (0.09 sec)
   
   mysql> insert into test_interval values ('2022-12-14'), ('2022-01-15'), 
('2022-07-26'), ('2000-02-29'), ('2015-09-18');
   Query OK, 5 rows affected (0.18 sec)
   {'label':'label_ff749db2fbb4911_9cfadca598edd3e7', 'status':'VISIBLE', 
'txnId':'149471'}
   
   mysql> show partitions from test_interval;
   
+-------------+-----------------+----------------+---------------------+--------+--------------+----------------------------------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+--------------------+--------------+------------------+
   | PartitionId | PartitionName   | VisibleVersion | VisibleVersionTime  | 
State  | PartitionKey | Range                                                   
                                                 | DistributionKey | Buckets | 
ReplicationNum | StorageMedium | CooldownTime        | RemoteStoragePolicy | 
LastConsistencyCheckTime | DataSize | IsInMemory | ReplicaAllocation       | 
IsMutable | SyncWithBaseTables | UnsyncTables | CommittedVersion |
   
+-------------+-----------------+----------------+---------------------+--------+--------------+----------------------------------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+--------------------+--------------+------------------+
   | 9085582     | p20000201000000 | 2              | 2024-08-30 00:01:19 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2000-02-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2000-03-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085624     | p20150901000000 | 2              | 2024-08-30 00:01:19 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2015-09-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2015-10-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085666     | p20220101000000 | 2              | 2024-08-30 00:01:19 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2022-01-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2022-02-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085603     | p20220701000000 | 2              | 2024-08-30 00:01:19 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2022-07-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2022-08-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085645     | p20221201000000 | 2              | 2024-08-30 00:01:19 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2022-12-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2023-01-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   
+-------------+-----------------+----------------+---------------------+--------+--------------+----------------------------------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+--------------------+--------------+------------------+
   5 rows in set (0.09 sec)
   
   mysql> CREATE TABLE test_interval (
       ->     `TIME_STAMP` datetimev2 NOT NULL
       -> )
       -> auto partition by range (date_trunc(`TIME_STAMP`, 'month'))()
       -> DISTRIBUTED BY HASH(`TIME_STAMP`) BUCKETS 10
       -> PROPERTIES (
       ->     "replication_allocation" = "tag.location.default: 1",
       ->     "use_simple_auto_partition_name" = "true"
       -> );
   Query OK, 0 rows affected (0.09 sec)
   
   mysql> insert into test_interval values ('2022-12-14'), ('2022-01-15'), 
('2022-07-26'), ('2000-02-29'), ('2015-09-18');
   Query OK, 5 rows affected (0.19 sec)
   {'label':'label_2a513c94b8e5415e_80bd8338e7c5823d', 'status':'VISIBLE', 
'txnId':'149474'}
   
   mysql> show partitions from test_interval;
   
+-------------+---------------+----------------+---------------------+--------+--------------+----------------------------------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+--------------------+--------------+------------------+
   | PartitionId | PartitionName | VisibleVersion | VisibleVersionTime  | State 
 | PartitionKey | Range                                                         
                                           | DistributionKey | Buckets | 
ReplicationNum | StorageMedium | CooldownTime        | RemoteStoragePolicy | 
LastConsistencyCheckTime | DataSize | IsInMemory | ReplicaAllocation       | 
IsMutable | SyncWithBaseTables | UnsyncTables | CommittedVersion |
   
+-------------+---------------+----------------+---------------------+--------+--------------+----------------------------------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+--------------------+--------------+------------------+
   | 9085741     | p200002       | 2              | 2024-08-30 00:02:33 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2000-02-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2000-03-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085762     | p201509       | 2              | 2024-08-30 00:02:33 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2015-09-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2015-10-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085720     | p202201       | 2              | 2024-08-30 00:02:33 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2022-01-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2022-02-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085783     | p202207       | 2              | 2024-08-30 00:02:33 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2022-07-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2022-08-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   | 9085699     | p202212       | 2              | 2024-08-30 00:02:33 | 
NORMAL | TIME_STAMP   | [types: [DATETIMEV2]; keys: [2022-12-01 00:00:00]; 
..types: [DATETIMEV2]; keys: [2023-01-01 00:00:00]; ) | TIME_STAMP      | 10    
  | 1              | HDD           | 9999-12-31 23:59:59 |                     
| NULL                     | 0.000    | false      | tag.location.default: 1 | 
true      | true               | NULL         | 2                |
   
+-------------+---------------+----------------+---------------------+--------+--------------+----------------------------------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+--------------------+--------------+------------------+
   5 rows in set (0.09 sec)
   ```
   
   


-- 
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