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

   ### 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.
   
   
   ### Version
   
   trunk-a49bde8
   
   ### What's Wrong?
   
   Test table like this
   ```
   CREATE TABLE `test`
   (
       `k1`    date          NOT NULL,
       `k2`    varchar(180)  NOT NULL,
        v1     decimal(27,9)
   ) ENGINE = OLAP UNIQUE KEY(`k1`) COMMENT 'ctas aggregate key column is 
varchar test'
   DISTRIBUTED BY HASH(`k1`) BUCKETS 3
   PROPERTIES (
   "replication_num" = "1"
   );
   ```
   ctas table sql like this
   ```
   create table ctas as
   SELECT `k2`, sum(v1) AS sumv1
   FROM test
   GROUP BY k2;
   ```
   error:
   ```
   [HY000][1105] Unexpected exception: errCode = 2, detailMessage = Failed to 
execute CTAS Reason: errCode = 2, detailMessage = Key columns should be a 
ordered prefix of the schema. KeyColumns[0] (starts from zero) is sumv1, but 
corresponding column is k2 in the previous columns declaration.
   ```
   
   ### What You Expected?
   
   CTAS succeed
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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