You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mingmwang (via GitHub)" <gi...@apache.org> on 2023/03/21 15:11:17 UTC

[GitHub] [arrow-datafusion] mingmwang opened a new issue, #5672: Group by duplicate GROUPING SETS returns wrong result

mingmwang opened a new issue, #5672:
URL: https://github.com/apache/arrow-datafusion/issues/5672

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   ```rust
   let sql = "SELECT  c1, avg(c12) FROM aggregate_test_100 GROUP BY GROUPING SETS((c1),(c1),())";
   let actual = execute_to_batches(&ctx, sql).await;
       let expected = vec![
           "+----+-----------------------------+",
           "| c1 | AVG(aggregate_test_100.c12) |",
           "+----+-----------------------------+",
           "|    | 0.5089725099127211          |",
           "| a  | 0.48754517466109415         |",
           "| b  | 0.41040709263815384         |",
           "| c  | 0.6600456536439784          |",
           "| d  | 0.48855379387549824         |",
           "| e  | 0.48600669271341534         |",
           "| a  | 0.48754517466109415         |",
           "| b  | 0.41040709263815384         |",
           "| c  | 0.6600456536439784          |",
           "| d  | 0.48855379387549824         |",
           "| e  | 0.48600669271341534         |",
           "+----+-----------------------------+",
       ];
   
   ```
   
   the actual returned is:
   
   ```rust
   
           "+----+-----------------------------+",
           "| c1 | AVG(aggregate_test_100.c12) |",
           "+----+-----------------------------+",
           "|    | 0.5089725099127211          |",
           "| a  | 0.48754517466109415         |",
           "| b  | 0.41040709263815384         |",
           "| c  | 0.6600456536439784          |",
           "| d  | 0.48855379387549824         |",
           "| e  | 0.48600669271341534         |",
           "+----+-----------------------------+",
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] Group by duplicate GROUPING SETS returns wrong result [datafusion]

Posted by "Phoenix500526 (via GitHub) via github" <gi...@datafusion.apache.org>.
Phoenix500526 commented on issue #5672:
URL: https://github.com/apache/datafusion/issues/5672#issuecomment-6675769634

   This appears to be fixed on `main` by #21058, merged as 4aed81afcb8b34012f720daffe85aad680520e23. That PR preserves duplicate grouping sets and adds regression coverage, but it linked #21316 rather than this issue.
   
   I checked this reduced version of the reported query with a local `v57.0.0-dev` CLI:
   
   ```sql
   SELECT category, AVG(value) AS avg_value
   FROM (VALUES ('a', 10), ('b', 20)) AS t(category, value)
   GROUP BY GROUPING SETS ((category), (category), ())
   ORDER BY category NULLS LAST;
   ```
   
   It correctly returns five rows, preserving both occurrences of each category:
   
   ```text
   category | avg_value
   a        | 10.0
   a        | 10.0
   b        | 20.0
   b        | 20.0
   NULL     | 15.0
   ```
   
   Could we close this issue as resolved?
   


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


[GitHub] [arrow-datafusion] mingmwang commented on issue #5672: Group by duplicate GROUPING SETS returns wrong result

Posted by "mingmwang (via GitHub)" <gi...@apache.org>.
mingmwang commented on issue #5672:
URL: https://github.com/apache/arrow-datafusion/issues/5672#issuecomment-1478015088

   I'm working on it now.


-- 
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: github-unsubscribe@arrow.apache.org

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