Skip to content

Conversation

@xiangfu0
Copy link
Contributor

@xiangfu0 xiangfu0 commented Jun 7, 2024

Fix the LEAD/LAG window function implementation to match the SQL syntax.
Syntax:

LEAD(column_name, offset, default_value) OVER (PARTITION BY partition_column ORDER BY order_column)
LAG(column_name, offset, default_value) OVER (PARTITION BY partition_column ORDER BY order_column)
  • column_name: The column from which to retrieve the value.
  • offset: The number of rows forward from the current row to access. Default is 1 if not specified.
  • default_value: The value to return if the offset goes beyond the number of rows.

Example:

SELECT 
    employee_id, 
    salary, 
    LAG(salary, 1) OVER (ORDER BY employee_id) AS previous_salary
FROM employees;

@xiangfu0 xiangfu0 force-pushed the improve_lead_lag_window branch from 4c9c020 to f839097 Compare June 7, 2024 20:45
@xiangfu0 xiangfu0 requested a review from Jackie-Jiang June 7, 2024 20:49
@xiangfu0 xiangfu0 added feature multi-stage Related to the multi-stage query engine labels Jun 7, 2024
@xiangfu0 xiangfu0 changed the title Fix LEAD/LAG window function implementation Support more arguments for LEAD/LAG window functions Jun 7, 2024
@xiangfu0 xiangfu0 force-pushed the improve_lead_lag_window branch from f839097 to 42f1e43 Compare June 7, 2024 20:52
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 79.31034% with 12 lines in your changes missing coverage. Please review.

Project coverage is 62.05%. Comparing base (59551e4) to head (ec4e714).
Report is 580 commits behind head on master.

Files Patch % Lines
.../operator/window/value/LagValueWindowFunction.java 80.00% 2 Missing and 4 partials ⚠️
...operator/window/value/LeadValueWindowFunction.java 77.77% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13340      +/-   ##
============================================
+ Coverage     61.75%   62.05%   +0.29%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2545     +109     
  Lines        133233   139733    +6500     
  Branches      20636    21671    +1035     
============================================
+ Hits          82274    86707    +4433     
- Misses        44911    46462    +1551     
- Partials       6048     6564     +516     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 62.03% <79.31%> (+0.32%) ⬆️
java-21 61.93% <79.31%> (+0.31%) ⬆️
skip-bytebuffers-false 62.05% <79.31%> (+0.30%) ⬆️
skip-bytebuffers-true 27.73% <0.00%> (+0.01%) ⬆️
temurin 62.05% <79.31%> (+0.29%) ⬆️
unittests 62.04% <79.31%> (+0.30%) ⬆️
unittests1 46.59% <79.31%> (-0.30%) ⬇️
unittests2 27.74% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xiangfu0 xiangfu0 force-pushed the improve_lead_lag_window branch 3 times, most recently from b466adf to bd2a4bc Compare June 7, 2024 22:10
@xiangfu0 xiangfu0 force-pushed the improve_lead_lag_window branch from bd2a4bc to ec4e714 Compare June 8, 2024 07:24
@xiangfu0 xiangfu0 merged commit 0dcad92 into apache:master Jun 8, 2024
@xiangfu0 xiangfu0 deleted the improve_lead_lag_window branch June 8, 2024 08:26
gortiz pushed a commit to gortiz/pinot that referenced this pull request Jun 14, 2024
@yashmayya yashmayya added the window-functions Related to SQL window functions on the multi-stage query engine label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature multi-stage Related to the multi-stage query engine window-functions Related to SQL window functions on the multi-stage query engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants