Skip to content

[CALCITE-7485] FIRST_VALUE/LAST_VALUE should only be defined for window aggregates#4919

Open
xuzifu666 wants to merge 3 commits intoapache:mainfrom
xuzifu666:calcite-7485
Open

[CALCITE-7485] FIRST_VALUE/LAST_VALUE should only be defined for window aggregates#4919
xuzifu666 wants to merge 3 commits intoapache:mainfrom
xuzifu666:calcite-7485

Conversation

@xuzifu666
Copy link
Copy Markdown
Member

ReturnTypes.ARG0,
OperandTypes.NUMERIC_UNIT_INTERVAL_NUMERIC_LITERAL)
.withFunctionType(SqlFunctionCategory.SYSTEM)
.withOver(true)
Copy link
Copy Markdown
Member Author

@xuzifu666 xuzifu666 May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code incorrectly marked BigQuery's PERCENTILE_DISC2 as requiresOver=true, but the test actually used its aggregate function, which naturally does not require OVER, so here changed it.

ReturnTypes.DOUBLE,
OperandTypes.NUMERIC_UNIT_INTERVAL_NUMERIC_LITERAL)
.withFunctionType(SqlFunctionCategory.SYSTEM)
.withOver(true)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also changed for BigQuery PERCENTILE_CONT2 function.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. The previous test was incorrect, which I've corrected. Thanks for pointing it out.

@xuzifu666 xuzifu666 requested a review from mihaibudiu May 7, 2026 01:44
@xuzifu666
Copy link
Copy Markdown
Member Author

I've already modified the test; please help to review it again when you have time. Thank you! @mihaibudiu

SqlStdOperatorTable.ARG_MIN.withName("MIN_BY");

/** The {@code PERCENTILE_CONT} function, BigQuery's
* equivalent to {@link SqlStdOperatorTable#PERCENTILE_CONT},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same problem you fixed in commit 2?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I forgot to fix the comment; it has been corrected.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants