You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "avantgardnerio (via GitHub)" <gi...@apache.org> on 2023/09/20 14:44:58 UTC

[GitHub] [arrow-datafusion] avantgardnerio opened a new pull request, #7609: Fix panic in TopK

avantgardnerio opened a new pull request, #7609:
URL: https://github.com/apache/arrow-datafusion/pull/7609

   ## Which issue does this PR close?
   
   Closes #7608.
   
   ## Rationale for this change
   
   Resolve a panic for specific types of TopK queries.
   
   ## What changes are included in this PR?
   
   - a fix
   - a test
   
   ## Are these changes tested?
   
   2/4... still trying to figure out how to test the last case. Maybe 3/4 is the best I can do.
   
   ## Are there any user-facing changes?
   
   More queries should work


-- 
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


[GitHub] [arrow-datafusion] avantgardnerio merged pull request #7609: Fix panic in TopK

Posted by "avantgardnerio (via GitHub)" <gi...@apache.org>.
avantgardnerio merged PR #7609:
URL: https://github.com/apache/arrow-datafusion/pull/7609


-- 
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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #7609: Fix panic in TopK

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #7609:
URL: https://github.com/apache/arrow-datafusion/pull/7609#discussion_r1332141464


##########
datafusion/core/src/physical_optimizer/topk_aggregation.rs:
##########
@@ -51,7 +52,7 @@ impl TopKAggregation {
         if desc != order.options.descending {
             return None;
         }
-        let group_key = aggr.group_expr().expr().first()?;
+        let group_key = aggr.group_expr().expr().iter().exactly_one().ok()?;

Review Comment:
   TIL `exactly_one`  👍  makes sense to me. 
   
   Another way to write this that is more verbose but perhaps clearer might be:
   
   ```rust
   if agg.group_expr().len() != 1 {
     return None;
   }
   ```



##########
datafusion/core/src/physical_optimizer/topk_aggregation.rs:
##########
@@ -51,7 +52,7 @@ impl TopKAggregation {
         if desc != order.options.descending {
             return None;
         }
-        let group_key = aggr.group_expr().expr().first()?;
+        let group_key = aggr.group_expr().expr().iter().exactly_one().ok()?;

Review Comment:
   TIL `exactly_one`  👍  makes sense to me. 
   
   Another way to write this that is more verbose but perhaps clearer might be:
   
   ```rust
   if agg.group_expr().len() != 1 {
     return None;
   }
   ```



-- 
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


[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #7609: Fix panic in TopK

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on code in PR #7609:
URL: https://github.com/apache/arrow-datafusion/pull/7609#discussion_r1332139622


##########
datafusion/core/src/physical_optimizer/topk_aggregation.rs:
##########
@@ -51,7 +52,7 @@ impl TopKAggregation {
         if desc != order.options.descending {
             return None;
         }
-        let group_key = aggr.group_expr().expr().first()?;
+        let group_key = aggr.group_expr().expr().iter().exactly_one().ok()?;

Review Comment:
   😎😎😎



##########
datafusion/core/src/physical_optimizer/topk_aggregation.rs:
##########
@@ -51,7 +52,7 @@ impl TopKAggregation {
         if desc != order.options.descending {
             return None;
         }
-        let group_key = aggr.group_expr().expr().first()?;
+        let group_key = aggr.group_expr().expr().iter().exactly_one().ok()?;

Review Comment:
   😎😎😎



-- 
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