Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-8061][VL] Fall back nth_value if input is foldable #8062

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

zml1206
Copy link
Contributor

@zml1206 zml1206 commented Nov 27, 2024

What changes were proposed in this pull request?

Velox does not support nth_value when its input is foldable.

Although vanilla Spark supports foldable input of nth_value, there is almost no usage scenario in this case, and the values ​​obtained are all null, so simply fall back for it.

(Fixes: #8061)

How was this patch tested?

UT

@github-actions github-actions bot added the VELOX label Nov 27, 2024
Copy link

#8061

Copy link
Contributor

@PHILO-HE PHILO-HE left a comment

Choose a reason for hiding this comment

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

A minor comment. Thanks!

case _: RowNumber | _: Rank | _: CumeDist | _: DenseRank | _: PercentRank |
_: NthValue | _: NTile =>
case _: RowNumber | _: Rank | _: CumeDist | _: DenseRank | _: PercentRank | _: NTile =>
case nv: NthValue if !nv.input.foldable =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for brevity. Maybe, we can use:

case _ @NthValue(input, _, _) if !input.foldable =>

Ditto for Lead/Lag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is more friendly to changes in the number of parameters that may exist in multi-version support. Generally, we will not change the parameter names. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zml1206, it makes sense. Thanks!

@PHILO-HE PHILO-HE merged commit a85889c into apache:main Nov 27, 2024
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[VL] nth_value(1) throw VeloxRuntimeError
2 participants