You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "xiangfu0 (via GitHub)" <gi...@apache.org> on 2024/04/24 02:33:52 UTC

[PR] Refactor WindowFunction process rows in batched partition [pinot]

xiangfu0 opened a new pull request, #12993:
URL: https://github.com/apache/pinot/pull/12993

   1. Partition the data to containers first
   2. For each partition, generate the window agg results. using merger functions for 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: commits-unsubscribe@pinot.apache.org

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


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


Re: [PR] Refactor WindowFunction process rows in batched partition [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on PR #12993:
URL: https://github.com/apache/pinot/pull/12993#issuecomment-2090071828

   > Can you add some more comments in the PR describing about the different types of window functions extracted? What is their difference?
   
   Following how presto models the WindowFunction with one `WindowFunction` interface, then 3 types:
   1. AggregateWindowFunction: this is one function try to handle all the existing aggregation functions 
   2. Abstract `RankingWindowFunction`, this is for all the ranking functions. Here are all the implements: `CumulativeDistributionFunction`, `CustomRank`, `DenseRankFunction`, `NTileFunction`, `PercentRankFunction`, `RankFunction`, `RowNumberFunction`
   3. Abstract `ValueWindowFunction`, this is for all the row position based functions.  Here are all the implements: `FirstValueFunction`, `LagFunction`, `LastValueFunction`, `LeadFunction`, `NthValueFunction`
   


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

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


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


Re: [PR] Refactor WindowFunction process rows in batched partition [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #12993:
URL: https://github.com/apache/pinot/pull/12993#discussion_r1580255906


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/window/WindowFunction.java:
##########
@@ -18,14 +18,75 @@
  */
 package org.apache.pinot.query.runtime.operator.window;
 
+import com.google.common.collect.ImmutableMap;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.query.planner.logical.RexExpression;
+import org.apache.pinot.query.runtime.operator.WindowAggregateOperator;
+import org.apache.pinot.query.runtime.operator.utils.AggregationUtils;
+import org.apache.pinot.query.runtime.operator.window.aggregate.AggregateWindowFunction;
+import org.apache.pinot.query.runtime.operator.window.range.RangeWindowFunction;
+import org.apache.pinot.query.runtime.operator.window.value.ValueWindowFunction;
 
 
-public interface WindowFunction {
+/**
+ * This class provides the basic structure for window functions. It provides the batch row processing API:
+ * processRows(List<Object[]> rows) which processes a batch of rows at a time.
+ *
+ */
+public abstract class WindowFunction extends AggregationUtils.Accumulator {

Review Comment:
   Suggest adding a `WindowFunctionFactory` if you want to make it pluggable, maybe following the same way of how `TransformFunction` is handle



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/window/WindowFunction.java:
##########
@@ -18,14 +18,75 @@
  */
 package org.apache.pinot.query.runtime.operator.window;
 
+import com.google.common.collect.ImmutableMap;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.query.planner.logical.RexExpression;
+import org.apache.pinot.query.runtime.operator.WindowAggregateOperator;
+import org.apache.pinot.query.runtime.operator.utils.AggregationUtils;
+import org.apache.pinot.query.runtime.operator.window.aggregate.AggregateWindowFunction;
+import org.apache.pinot.query.runtime.operator.window.range.RangeWindowFunction;
+import org.apache.pinot.query.runtime.operator.window.value.ValueWindowFunction;
 
 
-public interface WindowFunction {
+/**
+ * This class provides the basic structure for window functions. It provides the batch row processing API:
+ * processRows(List<Object[]> rows) which processes a batch of rows at a time.
+ *
+ */
+public abstract class WindowFunction extends AggregationUtils.Accumulator {

Review Comment:
   Also consider making this a separate PR?



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

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


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


Re: [PR] Refactor WindowFunction process rows in batched partition [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #12993:
URL: https://github.com/apache/pinot/pull/12993#issuecomment-2073982624

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/12993?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `84.40860%` with `29 lines` in your changes are missing coverage. Please review.
   > Project coverage is 35.03%. Comparing base [(`59551e4`)](https://app.codecov.io/gh/apache/pinot/commit/59551e45224f1535c4863fd577622b37366ccc97?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`e1a8fec`)](https://app.codecov.io/gh/apache/pinot/pull/12993?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 355 commits behind head on master.
   
   | [Files](https://app.codecov.io/gh/apache/pinot/pull/12993?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...ime/operator/window/range/RangeWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Frange%2FRangeWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvcmFuZ2UvUmFuZ2VXaW5kb3dGdW5jdGlvbi5qYXZh) | 68.18% | [4 Missing and 3 partials :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ator/window/aggregate/AggregateWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Faggregate%2FAggregateWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvYWdncmVnYXRlL0FnZ3JlZ2F0ZVdpbmRvd0Z1bmN0aW9uLmphdmE=) | 88.23% | [2 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...perator/window/value/FirstValueWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Fvalue%2FFirstValueWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvdmFsdWUvRmlyc3RWYWx1ZVdpbmRvd0Z1bmN0aW9uLmphdmE=) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../operator/window/value/LagValueWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Fvalue%2FLagValueWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvdmFsdWUvTGFnVmFsdWVXaW5kb3dGdW5jdGlvbi5qYXZh) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...operator/window/value/LastValueWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Fvalue%2FLastValueWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvdmFsdWUvTGFzdFZhbHVlV2luZG93RnVuY3Rpb24uamF2YQ==) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...operator/window/value/LeadValueWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Fvalue%2FLeadValueWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvdmFsdWUvTGVhZFZhbHVlV2luZG93RnVuY3Rpb24uamF2YQ==) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ime/operator/window/value/ValueWindowFunction.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2Fwindow%2Fvalue%2FValueWindowFunction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci93aW5kb3cvdmFsdWUvVmFsdWVXaW5kb3dGdW5jdGlvbi5qYXZh) | 70.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...uery/runtime/operator/WindowAggregateOperator.java](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&filepath=pinot-query-runtime%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fruntime%2Foperator%2FWindowAggregateOperator.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcnVudGltZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcnVudGltZS9vcGVyYXRvci9XaW5kb3dBZ2dyZWdhdGVPcGVyYXRvci5qYXZh) | 97.22% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12993?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@              Coverage Diff              @@
   ##             master   #12993       +/-   ##
   =============================================
   - Coverage     61.75%   35.03%   -26.73%     
   =============================================
     Files          2436     2433        -3     
     Lines        133233   132944      -289     
     Branches      20636    20587       -49     
   =============================================
   - Hits          82274    46572    -35702     
   - Misses        44911    82974    +38063     
   + Partials       6048     3398     -2650     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <0.00%> (-0.01%)` | :arrow_down: |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <0.00%> (ø)` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `35.03% <84.40%> (-26.60%)` | :arrow_down: |
   | [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `35.03% <84.40%> (-26.72%)` | :arrow_down: |
   | [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <0.00%> (-27.73%)` | :arrow_down: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `35.03% <84.40%> (-26.73%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `46.55% <84.40%> (-15.19%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `46.55% <84.40%> (-0.34%)` | :arrow_down: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/12993/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/12993?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


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

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


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


Re: [PR] Refactor WindowFunction process rows in batched partition [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 merged PR #12993:
URL: https://github.com/apache/pinot/pull/12993


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

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


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


Re: [PR] Refactor WindowFunction process rows in batched partition [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #12993:
URL: https://github.com/apache/pinot/pull/12993#discussion_r1587453729


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/window/WindowFunction.java:
##########
@@ -18,14 +18,75 @@
  */
 package org.apache.pinot.query.runtime.operator.window;
 
+import com.google.common.collect.ImmutableMap;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.query.planner.logical.RexExpression;
+import org.apache.pinot.query.runtime.operator.WindowAggregateOperator;
+import org.apache.pinot.query.runtime.operator.utils.AggregationUtils;
+import org.apache.pinot.query.runtime.operator.window.aggregate.AggregateWindowFunction;
+import org.apache.pinot.query.runtime.operator.window.range.RangeWindowFunction;
+import org.apache.pinot.query.runtime.operator.window.value.ValueWindowFunction;
 
 
-public interface WindowFunction {
+/**
+ * This class provides the basic structure for window functions. It provides the batch row processing API:
+ * processRows(List<Object[]> rows) which processes a batch of rows at a time.
+ *
+ */
+public abstract class WindowFunction extends AggregationUtils.Accumulator {

Review Comment:
   Added WindowFunctionFactory, will make a separated pr for pluggable stuffs



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

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


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