You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "IsmailTosunTnyl (via GitHub)" <gi...@apache.org> on 2025/12/06 19:03:50 UTC

[PR] GROUPING_ID not supported with ORDER BY in Nereids planner [doris-website]

IsmailTosunTnyl opened a new pull request, #3162:
URL: https://github.com/apache/doris-website/pull/3162

   GROUPING_ID is not supported with ORDER BY in the Nereids planner. Since Nereids is used mostly in 3.x and fully in 4.x, the documentation should be updated. The error message is: LOGICAL_SORT cannot contain GroupingScalarFunction expression: Grouping_Id(department, level).
   
   <img width="1186" height="257" alt="Screenshot from 2025-12-06 21-13-33" src="https://github.com/user-attachments/assets/0c9ad70d-a4e1-43f1-bdd1-531430fea9bc" />
   
   
   ## Versions 
   
   - [ ] dev
   - [x] 4.x
   - [x] 3.x
   - [ ] 2.1
   
   ## Languages
   
   - [ ] Chinese
   - [x] English
   
   ## Docs Checklist
   
   - [ ] Checked by AI
   - [ ] Test Cases Built
   


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] GROUPING_ID not supported with ORDER BY in Nereids planner [doris-website]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3162:
URL: https://github.com/apache/doris-website/pull/3162#discussion_r2595307172


##########
versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/other-functions/grouping-id.md:
##########
@@ -41,7 +41,7 @@ SELECT
   COUNT(uid) AS `Employee Count`
 FROM employee 
 GROUP BY ROLLUP(department, level)
-ORDER BY GROUPING_ID(department, level) ASC;
+ORDER BY department desc;
 ```
 

Review Comment:
   While the ORDER BY clause has been correctly changed from using GROUPING_ID to using the department column, there's no explanatory note added to inform users about this limitation. Consider adding a note before or after this example explaining that GROUPING_ID cannot be used in ORDER BY clauses when using the Nereids planner (versions 3.x and 4.x), and that the error message would be "LOGICAL_SORT cannot contain GroupingScalarFunction expression."
   
   This would help users understand why the example doesn't demonstrate ORDER BY with GROUPING_ID and prevent them from encountering the same error.
   ```suggestion
   
   > **Note:**  
   > When using the Nereids planner (versions 3.x and 4.x), the `GROUPING_ID` function cannot be used in the `ORDER BY` clause. Attempting to do so will result in the error:  
   > `LOGICAL_SORT cannot contain GroupingScalarFunction expression.`  
   > This is why the example orders by the `department` column instead of `GROUPING_ID`.
   ```



##########
versioned_docs/version-3.x/sql-manual/sql-functions/aggregate-functions/grouping-id.md:
##########
@@ -41,7 +41,7 @@ SELECT
   COUNT(uid) AS `Employee Count`
 FROM employee 
 GROUP BY ROLLUP(department, level)
-ORDER BY GROUPING_ID(department, level) ASC;
+ORDER BY department desc;
 ```
 

Review Comment:
   While the ORDER BY clause has been correctly changed from using GROUPING_ID to using the department column, there's no explanatory note added to inform users about this limitation. Consider adding a note before or after this example explaining that GROUPING_ID cannot be used in ORDER BY clauses when using the Nereids planner (versions 3.x and 4.x), and that the error message would be "LOGICAL_SORT cannot contain GroupingScalarFunction expression."
   
   This would help users understand why the example doesn't demonstrate ORDER BY with GROUPING_ID and prevent them from encountering the same error.
   ```suggestion
   
   > **Note:**  
   > When using the Nereids planner (versions 3.x and 4.x), you cannot use `GROUPING_ID` in the `ORDER BY` clause. Attempting to do so will result in the error:  
   > `LOGICAL_SORT cannot contain GroupingScalarFunction expression.`  
   > This is why the example orders by the `department` column instead of `GROUPING_ID`.
   ```



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] GROUPING_ID not supported with ORDER BY in Nereids planner [doris-website]

Posted by "IsmailTosunTnyl (via GitHub)" <gi...@apache.org>.
IsmailTosunTnyl closed pull request #3162: GROUPING_ID not supported with ORDER BY in Nereids planner
URL: https://github.com/apache/doris-website/pull/3162


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org