Skip to content

[SPARK-58769][SQL][FOLLOWUP] Clarify the BoundFunction equality contract - #58363

Closed
szehon-ho wants to merge 1 commit into
apache:masterfrom
szehon-ho:codex/fix-boundfunction-javadoc
Closed

[SPARK-58769][SQL][FOLLOWUP] Clarify the BoundFunction equality contract#58363
szehon-ho wants to merge 1 commit into
apache:masterfrom
szehon-ho:codex/fix-boundfunction-javadoc

Conversation

@szehon-ho

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Clarify the BoundFunction.equals documentation by:

  • adding valid aggregate-query rejection to the existing list of consequences when separately bound functions do not compare equal;
  • adding concise connector examples for stateless functions and functions with bound state; and
  • correcting nearby test comments that implied UnboundFunction.bind must return a fresh instance.

Why are the changes needed?

The current documentation says missed equality matches affect performance only. However, if repeated scalar function calls bind to distinct objects that do not compare equal, a query that selects and groups by the same call may fail with MISSING_AGGREGATION.

Also, UnboundFunction.bind permits both shared and newly created bound-function instances.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Documentation and test-comment changes only. git diff --check passed.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex

@szehon-ho

Copy link
Copy Markdown
Member Author

cc @peter-toth , i think we miswrote the javadoc to say its perf problem only.

Also cc @zhengruifeng who I think found this issue in post-review

@peter-toth peter-toth left a comment

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.

LGTM, thanks for the additions.

@szehon-ho szehon-ho closed this in 024120d Aug 28, 2026
szehon-ho added a commit that referenced this pull request Aug 28, 2026
### What changes were proposed in this pull request?

Clarify the `BoundFunction.equals` documentation by:

- adding valid aggregate-query rejection to the existing list of consequences when separately bound functions do not compare equal;
- adding concise connector examples for stateless functions and functions with bound state; and
- correcting nearby test comments that implied `UnboundFunction.bind` must return a fresh instance.

### Why are the changes needed?

The current documentation says missed equality matches affect performance only. However, if repeated scalar function calls bind to distinct objects that do not compare equal, a query that selects and groups by the same call may fail with `MISSING_AGGREGATION`.

Also, `UnboundFunction.bind` permits both shared and newly created bound-function instances.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Documentation and test-comment changes only. `git diff --check` passed.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex

Closes #58363 from szehon-ho/codex/fix-boundfunction-javadoc.

Authored-by: Szehon Ho <szehon.apache@gmail.com>
Signed-off-by: Szehon Ho <szehon.apache@gmail.com>
(cherry picked from commit 024120d)
Signed-off-by: Szehon Ho <szehon.apache@gmail.com>
@szehon-ho

Copy link
Copy Markdown
Member Author

Merge Summary:

Posted by merge_spark_pr.py

@szehon-ho

Copy link
Copy Markdown
Member Author

Thank you all!

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.

4 participants