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

   ### 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
   
   2.1.3
   
   ### What's Wrong?
   
   执行这条sql返回正常
   SELECT
        sg1.student_id,
        sg1.student_name,
        sg1.SUBJECT,
        sg1.grade,
        ( SELECT COUNT(*) FROM student_grades sg2 WHERE sg2.SUBJECT = 
sg1.SUBJECT AND (sg2.grade = sg1.grade) ) + 1 AS rank 
   FROM
        student_grades sg1 
   ORDER BY
        sg1.SUBJECT,
        rank;  
   但是把sg2.grade = sg1.grade 换成 sg2.grade > sg1.grade就提示Subquery is not 
supported in the select list.
    SELECT
        sg1.student_id,
        sg1.student_name,
        sg1.SUBJECT,
        sg1.grade,
        ( SELECT COUNT(*) FROM student_grades sg2 WHERE sg2.SUBJECT = 
sg1.SUBJECT AND (sg2.grade > sg1.grade) ) + 1 AS rank 
   FROM
        student_grades sg1 
   ORDER BY
        sg1.SUBJECT,
        rank;  
   
   ### What You Expected?
   
   希望这条语句能正常执行
   SELECT
        sg1.student_id,
        sg1.student_name,
        sg1.SUBJECT,
        sg1.grade,
        ( SELECT COUNT(*) FROM student_grades sg2 WHERE sg2.SUBJECT = 
sg1.SUBJECT AND (sg2.grade > sg1.grade) ) + 1 AS rank 
   FROM
        student_grades sg1 
   ORDER BY
        sg1.SUBJECT,
        rank;
   
   ### How to Reproduce?
   
   CREATE TABLE `student_grades` (
     `student_id` INT NULL,
     `student_name` VARCHAR(50) NULL,
     `subject` VARCHAR(50) NULL,
     `grade` DECIMAL(5, 2) NULL
   ) ENGINE=OLAP
   AGGREGATE KEY(`student_id`, `student_name`, `subject`, `grade`)
   COMMENT 'OLAP'
   DISTRIBUTED BY HASH(`student_id`) BUCKETS 10
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "min_load_replica_num" = "-1",
   "is_being_synced" = "false",
   "storage_medium" = "hdd",
   "storage_format" = "V2",
   "inverted_index_storage_format" = "V1",
   "light_schema_change" = "true",
   "disable_auto_compaction" = "false",
   "enable_single_replica_compaction" = "false",
   "group_commit_interval_ms" = "10000",
   "group_commit_data_bytes" = "134217728"
   );
   INSERT INTO student_grades (student_id, student_name, subject, grade) VALUES
   (1, 'Alice', 'Math', 85.00),
   (2, 'Bob', 'Math', 90.00),
   (3, 'Charlie', 'Math', 78.50),
   (4, 'David', 'Math', 88.00),
   (5, 'Eve', 'Math', 92.00),
   (6, 'Frank', 'Math', 74.00),
   (7, 'Grace', 'Math', 80.00),
   (8, 'Heidi', 'Math', 89.50),
   (9, 'Ivan', 'Math', 81.00),
   (10, 'Judy', 'Math', 85.50),
   
   (11, 'Alice', 'English', 91.00),
   (12, 'Bob', 'English', 88.00),
   (13, 'Charlie', 'English', 83.50),
   (14, 'David', 'English', 86.00),
   (15, 'Eve', 'English', 95.00),
   (16, 'Frank', 'English', 78.00),
   (17, 'Grace', 'English', 84.00),
   (18, 'Heidi', 'English', 89.00),
   (19, 'Ivan', 'English', 90.00),
   (20, 'Judy', 'English', 92.00),
   
   (21, 'Alice', 'Science', 88.00),
   (22, 'Bob', 'Science', 91.00),
   (23, 'Charlie', 'Science', 85.00),
   (24, 'David', 'Science', 87.50),
   (25, 'Eve', 'Science', 90.00),
   (26, 'Frank', 'Science', 82.00),
   (27, 'Grace', 'Science', 86.00),
   (28, 'Heidi', 'Science', 89.50),
   (29, 'Ivan', 'Science', 84.00),
   (30, 'Judy', 'Science', 87.00);
   
   
   ### 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