2010YOUY01 opened a new pull request, #16003:
URL: https://github.com/apache/datafusion/pull/16003

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   - Closes #.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.  
   -->
   DataFusion doesn't have an integration benchmark focus on window functions 
yet. DuckDB has extended `h2o.ai` benchmark for additional window functions in 
their 
[blog](https://duckdb.org/2024/06/26/benchmarks-over-time.html#window-functions-benchmark)
   We already implemented h2o benchmark, and those extended queries are easy to 
add.
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   Added additional window queries to the existing h2o benchmark.
   The benchmark queries are adapted from this DuckDB blog: 
https://duckdb.org/2024/06/26/benchmarks-over-time.html#window-functions-benchmark
   The changes are:
   1. Removed queries with unsupported window function `quantile_cont()`
   2. use  window function `first_value()` instead of `first()`
   3. Remove window expressions with unsupported feature: non-constant 
expression in window frame like
   ```sql
   avg(v2) OVER
       (PARTITION BY id2 ORDER BY id3 ROWS BETWEEN 100 PRECEDING AND CURRENT 
ROW)
       AS my_moving_average_by_id2,
   -- 'BETWEEN id1' is not supported yet
   avg(v2) OVER
       (PARTITION BY id2 ORDER BY id3 ROWS BETWEEN id1 PRECEDING AND CURRENT 
ROW)
       AS my_dynamic_moving_average_by_id2
   ```
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   5. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   I tested manually.
   
   ```sh
   # In datafusion/benchmarks
   ./bench.sh data h2o_small_window
   ./bench.sh run h2o_small_window
   ```
   
   Results:
   ```
   ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┓
   ┃ Query        ┃ h2o-window ┃ h2o-window ┃    Change ┃
   ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━┩
   │ QQuery 1     │   574.56ms │   574.56ms │ no change │
   │ QQuery 2     │  1513.47ms │  1513.47ms │ no change │
   │ QQuery 3     │  3342.39ms │  3342.39ms │ no change │
   │ QQuery 4     │   405.59ms │   405.59ms │ no change │
   │ QQuery 5     │   949.65ms │   949.65ms │ no change │
   │ QQuery 6     │  1103.01ms │  1103.01ms │ no change │
   │ QQuery 7     │  1114.28ms │  1114.28ms │ no change │
   │ QQuery 8     │  4735.29ms │  4735.29ms │ no change │
   │ QQuery 9     │   335.31ms │   335.31ms │ no change │
   │ QQuery 10    │   375.07ms │   375.07ms │ no change │
   │ QQuery 11    │   349.66ms │   349.66ms │ no change │
   │ QQuery 12    │   685.23ms │   685.23ms │ no change │
   └──────────────┴────────────┴────────────┴───────────┘
   ```
   
   Additional note: DuckDB's performance numbers can be found in 
https://duckdb.org/2024/06/26/benchmarks-over-time.html#window-functions, and 
it's their `medium` scale result (10X than this run's data size, also in CSV I 
assume)
   Looks like they're around 10 times faster
   cc @Dandandan @suibianwanwank 
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->
   


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

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


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

Reply via email to