Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void checkLegalityBeforeTypeCoercion() {
if (children().size() >= 2) {
checkValidParams(getOffset(), true);
if (getOffset() instanceof Literal) {
if (((Literal) getOffset()).getDouble() <= 0) {
if (((Literal) getOffset()).getDouble() < 0) {
throw new AnalysisException(
"The offset parameter of LAG must be a constant positive integer: " + this.toSql());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void checkLegalityBeforeTypeCoercion() {
if (children().size() >= 2) {
checkValidParams(getOffset(), true);
if (getOffset() instanceof Literal) {
if (((Literal) getOffset()).getDouble() <= 0) {
if (((Literal) getOffset()).getDouble() < 0) {
throw new AnalysisException(
"The offset parameter of LEAD must be a constant positive integer: " + this.toSql());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,15 @@
24 02-24-10-21 1 \N \N \N \N \N \N \N \N
24 02-24-10-21 1 1 1 1 1.0 1 1 \N \N

-- !select_lead_lag --
1 1 1 04-21-11 21
1 1 1 04-21-11 21
0 0 0 04-22-10-21 22
0 0 0 04-22-10-21 22
1 1 1 04-22-10-21 22
1 1 1 04-22-10-21 22
1 1 1 04-23-10 23
1 1 1 04-23-10 23
1 1 1 02-24-10-21 24
1 1 1 02-24-10-21 24

Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,11 @@ suite("test_always_nullable_window_function") {
lead(state, 2, null) over (partition by myday order by time_col) lead_value
from ${nullableTableName} order by myday, time_col, state;
"""

sql "set enable_nereids_planner = true"
qt_select_lead_lag """
select lag(state, 0, 22) over (partition by myday order by time_col) lag_value,
lead(state, 0, 33) over (partition by myday order by time_col) lead_value,
state,time_col,myday
from ${nullableTableName} order by myday, time_col, state;
"""
}