Skip to content

[SPARK-58589][SS] Drop redundant .apply on Function1 encoders in StateTypesEncoderUtils - #57792

Closed
uros-b wants to merge 1 commit into
apache:masterfrom
uros-b:style-statetypesencoder-apply
Closed

[SPARK-58589][SS] Drop redundant .apply on Function1 encoders in StateTypesEncoderUtils#57792
uros-b wants to merge 1 commit into
apache:masterfrom
uros-b:style-statetypesencoder-apply

Conversation

@uros-b

@uros-b uros-b commented Aug 5, 2026

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Replaces the explicit .apply(...) calls with direct invocation on the encoder serializers, deserializers and unsafe projections in StateTypesEncoderUtils (19 call sites).

Why are the changes needed?

All of these receivers are Function1 subtypes: ExpressionEncoder.Serializer extends (T => InternalRow), ExpressionEncoder.Deserializer extends (InternalRow => T), and UnsafeProjection extends Projection, which extends (InternalRow => InternalRow). For a Function1, f(x) is exactly f.apply(x), so the explicit form adds noise without meaning. The same file already calls several projections directly, so this removes an internal inconsistency rather than introducing a new style.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Syntactic change with identical semantics; existing transformWithState tests cover these paths. No new tests needed.

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

Generated-by: Claude Code (Opus 4.8)

@uros-b uros-b left a comment

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.

Waiting for CI and adding @HeartSaVioR for review

@uros-b
uros-b requested a review from HeartSaVioR August 5, 2026 11:16

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, LGTM.

@HeartSaVioR HeartSaVioR 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.

+1

@HeartSaVioR

Copy link
Copy Markdown
Contributor

Thanks! Merging to master/4.x.

HeartSaVioR pushed a commit that referenced this pull request Aug 6, 2026
…eTypesEncoderUtils

### What changes were proposed in this pull request?
Replaces the explicit `.apply(...)` calls with direct invocation on the encoder serializers, deserializers and unsafe projections in `StateTypesEncoderUtils` (19 call sites).

### Why are the changes needed?
All of these receivers are `Function1` subtypes: `ExpressionEncoder.Serializer` extends `(T => InternalRow)`, `ExpressionEncoder.Deserializer` extends `(InternalRow => T)`, and `UnsafeProjection` extends `Projection`, which extends `(InternalRow => InternalRow)`. For a `Function1`, `f(x)` is exactly `f.apply(x)`, so the explicit form adds noise without meaning. The same file already calls several projections directly, so this removes an internal inconsistency rather than introducing a new style.

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

### How was this patch tested?
Syntactic change with identical semantics; existing transformWithState tests cover these paths. No new tests needed.

### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)

Closes #57792 from uros-b/style-statetypesencoder-apply.

Authored-by: Uros Bojanic <221401595+uros-b@users.noreply.github.com>
Signed-off-by: Jungtaek Lim <kabhwan.opensource@gmail.com>
(cherry picked from commit 41144ce)
Signed-off-by: Jungtaek Lim <kabhwan.opensource@gmail.com>
@HeartSaVioR

Copy link
Copy Markdown
Contributor

Merge Summary:

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.

3 participants