Skip to content

docs: Clarify first_value usage in select vs aggregate#1348

Open
AdMub wants to merge 2 commits intoapache:mainfrom
AdMub:fix-docs-first-value
Open

docs: Clarify first_value usage in select vs aggregate#1348
AdMub wants to merge 2 commits intoapache:mainfrom
AdMub:fix-docs-first-value

Conversation

@AdMub
Copy link

@AdMub AdMub commented Jan 22, 2026

I investigated Issue #1300 and confirmed that the crash occurs because first_value (an aggregate function) is used inside .select(), which is not supported by the physical planner. This PR updates the docstring to explicitly warn users that first_value should be used with .aggregate() and not .select(). Closes #1300.

AdMub added 2 commits January 22, 2026 06:14
Clarifies that aggregate functions like first_value must be used within .aggregate() and not .select(). Closes apache#1300.
)


def last_value(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the same type of clarification be done on last_value as well?


For example::

df.select(first_value(col("a"), order_by="ts"))
Copy link
Contributor

Choose a reason for hiding this comment

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

This example also needs to be changed right?


For example::

df.select(last_value(col("a"), order_by="ts"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar example as the first_value one.

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.

first_value doesn't work when applied to window function output

2 participants