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

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   1.2.3
   
   ### What's Wrong?
   
   window function occur error "Expressions in the PARTITION BY clause must not 
be constant" after upgraded from doris-1.2.0 to doris-1.2.3, The sql and table 
is as follows,the sql operation is normal in doris-1.2.0.
   
   --- sql
   SELECT
        base_time,
   IF
        ( null_or_empty ( feature_value_bin )= 1, '(null)', feature_value_bin ) 
AS feature_value_bin,
        cnt,
        concat( round( pct * 100, 2 ), '%' ) pct 
   FROM
        (
        SELECT
                *,
                dense_rank() over ( ORDER BY bin_cnt DESC, feature_value_bin ) 
rn 
        FROM
                (
                SELECT
                        *,
                        cnt / sum( cnt ) over ( PARTITION BY base_time ) pct,
                        sum( cnt ) over ( PARTITION BY feature_value_bin ) 
bin_cnt 
                FROM
                        (
                        SELECT
                                base_time,
                                feature_value_bin,
                                count( id ) cnt 
                        FROM
                                (
                                SELECT
                                        *,
                                        substring( hour_floor ( feature_value 
), 1, 16 ) AS feature_value_bin 
                                FROM
                                        ( SELECT curdate() AS base_time, 
COALESCE ( long_id, varchar_id ) id, feature_VALUE_TM feature_value FROM 
h000000.ads_feature_yituiAll WHERE feature_name = 'feature_20230328_232' ) ta 
                                ) ta_1 
                        GROUP BY
                                base_time,
                                feature_value_bin 
                        ) ta_2 
                ) ta_3 
        ) ta_4 
   ORDER BY
        base_time DESC,
        rn;
   
   -- table
   CREATE TABLE `ads_feature_yituiAll` (
     `feature_name` varchar(64) NULL COMMENT '标签名称',
     `long_id` bigint(20) NULL COMMENT '用户唯一ID',
     `varchar_id` varchar(256) NULL COMMENT '字符串分析对象ID',
     `feature_value_str` varchar(256) NULL COMMENT '标签值(字符串)',
     `feature_value_num` double NULL COMMENT '标签值(数值)',
     `feature_value_tm` datetime NULL COMMENT '标签值(时间)',
     `feature_value_bool` boolean NULL COMMENT '标签值(布尔)'
   ) ENGINE=OLAP
   UNIQUE KEY(`feature_name`, `long_id`, `varchar_id`)
   COMMENT '标签表,存储标签和分群的最新版本数据'
   DISTRIBUTED BY HASH(`feature_name`) BUCKETS 8
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   
   ### What You Expected?
   
   the sql operation of window function is normal in doris-1.2.3
   
   ### How to Reproduce?
   
   To run the following sql in version of doris-1.2.3
   
   --- sql
   SELECT
        base_time,
   IF
        ( null_or_empty ( feature_value_bin )= 1, '(null)', feature_value_bin ) 
AS feature_value_bin,
        cnt,
        concat( round( pct * 100, 2 ), '%' ) pct 
   FROM
        (
        SELECT
                *,
                dense_rank() over ( ORDER BY bin_cnt DESC, feature_value_bin ) 
rn 
        FROM
                (
                SELECT
                        *,
                        cnt / sum( cnt ) over ( PARTITION BY base_time ) pct,
                        sum( cnt ) over ( PARTITION BY feature_value_bin ) 
bin_cnt 
                FROM
                        (
                        SELECT
                                base_time,
                                feature_value_bin,
                                count( id ) cnt 
                        FROM
                                (
                                SELECT
                                        *,
                                        substring( hour_floor ( feature_value 
), 1, 16 ) AS feature_value_bin 
                                FROM
                                        ( SELECT curdate() AS base_time, 
COALESCE ( long_id, varchar_id ) id, feature_VALUE_TM feature_value FROM 
h000000.ads_feature_yituiAll WHERE feature_name = 'feature_20230328_232' ) ta 
                                ) ta_1 
                        GROUP BY
                                base_time,
                                feature_value_bin 
                        ) ta_2 
                ) ta_3 
        ) ta_4 
   ORDER BY
        base_time DESC,
        rn;
   
   -- table
   CREATE TABLE `ads_feature_yituiAll` (
     `feature_name` varchar(64) NULL COMMENT '标签名称',
     `long_id` bigint(20) NULL COMMENT '用户唯一ID',
     `varchar_id` varchar(256) NULL COMMENT '字符串分析对象ID',
     `feature_value_str` varchar(256) NULL COMMENT '标签值(字符串)',
     `feature_value_num` double NULL COMMENT '标签值(数值)',
     `feature_value_tm` datetime NULL COMMENT '标签值(时间)',
     `feature_value_bool` boolean NULL COMMENT '标签值(布尔)'
   ) ENGINE=OLAP
   UNIQUE KEY(`feature_name`, `long_id`, `varchar_id`)
   COMMENT '标签表,存储标签和分群的最新版本数据'
   DISTRIBUTED BY HASH(`feature_name`) BUCKETS 8
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   
   ### Anything Else?
   
   nothing
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to