Skip to content

[WIP][ML] Avoid VectorUDT deserialization in Summarizer - #57967

Draft
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:summarizer-avoid-vector-deserialize
Draft

[WIP][ML] Avoid VectorUDT deserialization in Summarizer#57967
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:summarizer-avoid-vector-deserialize

Conversation

@zhengruifeng

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Update the DataFrame Summarizer aggregate to consume vectors from their internal SQL
representation. A nonzero iterator reads dense values and sparse index-value pairs directly from
Catalyst ArrayData. Count-only summaries avoid iterating over vector values.

Why are the changes needed?

Summarizer currently calls VectorUDT.deserialize for every input row. This copies the dense values
array, or both sparse indices and values arrays, and then allocates a Vector wrapper before
aggregation. Reading the internal row directly avoids these per-row copies and Vector allocation.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

The existing SummarizerSuite covers dense, sparse, weighted, count-only, and multi-metric summary
behavior.

build/sbt 'mllib/testOnly org.apache.spark.ml.stat.SummarizerSuite'
build/sbt mllib/scalastyle

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

Generated-by: Codex (GPT-5)

@zhengruifeng zhengruifeng changed the title [ML] Avoid VectorUDT deserialization in Summarizer [WIP][ML] Avoid VectorUDT deserialization in Summarizer Aug 12, 2026
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.

1 participant