Skip to content

[SPARK-58293][ML] Delay VectorIndexerModel attribute initialization#57483

Closed
zhengruifeng wants to merge 3 commits into
apache:masterfrom
zhengruifeng:delay-partial-feature-attributes-dev3
Closed

[SPARK-58293][ML] Delay VectorIndexerModel attribute initialization#57483
zhengruifeng wants to merge 3 commits into
apache:masterfrom
zhengruifeng:delay-partial-feature-attributes-dev3

Conversation

@zhengruifeng

@zhengruifeng zhengruifeng commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Replaces the retained partialFeatureAttributes field in VectorIndexerModel with an on-demand private method. The attributes are now computed only when output metadata is prepared.

Why are the changes needed?

The attributes are derived state used only while preparing output metadata. Retaining them on every fitted or loaded model allocates one attribute per feature even when the model is never transformed. Computing them at the call site avoids that unnecessary retained state.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

The test suite was not run locally.

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

Generated-by: Codex

@zhengruifeng
zhengruifeng requested a review from HyukjinKwon July 24, 2026 02:02
@zhengruifeng
zhengruifeng force-pushed the delay-partial-feature-attributes-dev3 branch from e77f28c to 8f16db8 Compare July 24, 2026 02:13
zhengruifeng added a commit that referenced this pull request Jul 24, 2026
### What changes were proposed in this pull request?

Replaces the retained `partialFeatureAttributes` field in `VectorIndexerModel` with an on-demand private method. The attributes are now computed only when output metadata is prepared.

### Why are the changes needed?

The attributes are derived state used only while preparing output metadata. Retaining them on every fitted or loaded model allocates one attribute per feature even when the model is never transformed. Computing them at the call site avoids that unnecessary retained state.

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

No.

### How was this patch tested?

The test suite was not run locally.

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

Generated-by: Codex

Closes #57483 from zhengruifeng/delay-partial-feature-attributes-dev3.

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
(cherry picked from commit 6d6e2dc)
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
@zhengruifeng

Copy link
Copy Markdown
Contributor Author

Merge Summary:

Posted by merge_spark_pr.py

@zhengruifeng
zhengruifeng deleted the delay-partial-feature-attributes-dev3 branch July 24, 2026 10:28
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