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

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### Description
   
   Now, table is order by the `Keys` like `Aggregate Key`....
   
   When we use the sql include `orderby` which match `keys` of table. We can 
push it.
   
   like:
   
   ```sql
   create
   
   CREATE TABLE IF NOT EXISTS example_db.expamle_tbl
   (
       `user_id` LARGEINT NOT NULL COMMENT "用户id",
       `date` DATE NOT NULL COMMENT "数据灌入日期时间",
       `city` VARCHAR(20) COMMENT "用户所在城市",
       `age` SMALLINT COMMENT "用户年龄",
       `sex` TINYINT COMMENT "用户性别",
       `last_visit_date` DATETIME REPLACE DEFAULT "1970-01-01 00:00:00" COMMENT 
"用户最后一次访问时间",
       `cost` BIGINT SUM DEFAULT "0" COMMENT "用户总消费",
       `max_dwell_time` INT MAX DEFAULT "0" COMMENT "用户最大停留时间",
       `min_dwell_time` INT MIN DEFAULT "99999" COMMENT "用户最小停留时间"
   )
   AGGREGATE KEY(`user_id`, `date`, `city`, `age`, `sex`)
   DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1"
   );
   
   query:
   select * from tbl order by user_id, city limit 10;
   ```
   
   We can push `sort` to `olapscan`.
   
   Limit->Sort->OlapScan  ------> Limit->Merge->OlapScan.
   
   
   ### Use case
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### 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