SaintBacchus opened a new issue, #16881:
URL: https://github.com/apache/doris/issues/16881

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Description
   
   As an example of doris table
   ```sql
   CREATE TABLE IF NOT EXISTS example_db.example_tbl
   (
       `timestamp` DATETIME NOT NULL COMMENT "日志时间",
       `type` INT NOT NULL COMMENT "日志类型",
       `error_code` INT COMMENT "错误码",
       `error_msg` VARCHAR(1024) COMMENT "错误详细信息",
       `op_id` BIGINT COMMENT "负责人id",
       `op_time` DATETIME COMMENT "处理时间"
   )
   DUPLICATE KEY(`timestamp`, `type`, `error_code`)
   DISTRIBUTED BY HASH(`type`) BUCKETS 1
   PROPERTIES ("replication_allocation" = "tag.location.default: 1");
   ```
   
   The order of table schema must be same with `DUPLICATE KEY(timestamp, type, 
error_code)`
   ```
        `timestamp` DATETIME NOT NULL COMMENT "日志时间",
       `type` INT NOT NULL COMMENT "日志类型",
       `error_code` INT COMMENT "错误码",
   ``` 
   
   But the `DUPLICATE KEY` is also a prefix index for the table. So if we want 
to change the first order of it, you must also change the order the table 
create statement. 
   For example, if you want change DUPLICATE key into  `DUPLICATE KEY(op_id)`, 
you must place `op_id` field to be the first  column of this table.
   It's not convenience for user.
   
   ---------
   建表时字段的顺序需要跟排序键的对齐, 但调优的时候我们会调整排序键, 因此我们同时也要调整建表的字段顺序. 
   这就很不方便了, 尤其在对接其他SQL系统的时候, 例如hive等, hive没有字段顺序, 和Doris不对齐时, 在建表和导入过程中, 
都要非常小心的去处理顺序. 尤其是超过200列的大宽表.
   
   
   ### Use case
   
   - 对接其他系统的时候
   - 迁移其他系统数据的时候
   
   ### Related issues
   
   NO
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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