Skip to content

[SPARK-56546][SQL][FOLLOWUP] Address review comments in segment-tree window frame#55815

Open
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:cloud-fan/SPARK-56546-followup
Open

[SPARK-56546][SQL][FOLLOWUP] Address review comments in segment-tree window frame#55815
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:cloud-fan/SPARK-56546-followup

Conversation

@cloud-fan
Copy link
Copy Markdown
Contributor

@cloud-fan cloud-fan commented May 12, 2026

What changes were proposed in this pull request?

Four small cleanups in the segment-tree moving-frame window code introduced by #55422:

  1. WindowEvaluatorFactoryBase.scala -- fix terminology in the def processor comment. The comment says Keep as def (by-name), but def processor(index: Int) is a parameterized method, not a by-name parameter (=> T). Reword to Keep as def (lazy / per-call).

  2. WindowEvaluatorFactoryBase.eligibleForSegTree -- add a defensive case _ => false to the frameType match so future additions to the sealed FrameType trait do not silently throw MatchError at runtime.

  3. WindowEvaluatorFactoryBase.estimateMaxCachedBlocks -- add a comment justifying the + 2 slack in the cached-block budget (one boundary block at each end of the frame's interval), since the magic number was not previously explained.

  4. WindowSegmentTreeSuite.scala -- fix indentation of 11 test( blocks that were declared at 4-space indent (inconsistent with the file's 2-space convention and the 3 other correctly-indented tests in the same file).

A separate follow-up is needed to add RANGE-frame coverage to WindowBenchmark -- the current benchmark is RowFrame-only -- but that requires regenerating the committed JDK 17/21/25 results files and is deferred.

Why are the changes needed?

Review-comment-style follow-ups. Pure comment / defensive-default / whitespace changes -- no behavior change.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests cover all touched code paths. The test indentation fix is whitespace-only; the comment and case _ changes have no runtime effect.

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

Yes, Claude assisted in identifying and drafting these cleanups.

…window frame

### What changes were proposed in this pull request?

Four small cleanups in the segment-tree moving-frame window code:

1. `WindowEvaluatorFactoryBase.scala` -- fix terminology in the `def
   processor` comment. The comment says `Keep as def (by-name)`, but
   `def processor(index: Int)` is a parameterized method, not a by-name
   parameter (`=> T`). Reword to `Keep as def (lazy / per-call)`.

2. `WindowEvaluatorFactoryBase.eligibleForSegTree` -- add a defensive
   `case _ => false` to the `frameType match` so future additions to the
   sealed `FrameType` trait do not silently throw `MatchError` at runtime.

3. `WindowEvaluatorFactoryBase.estimateMaxCachedBlocks` -- add a comment
   justifying the `+ 2` slack in the cached-block budget (one boundary
   block at each end of the frame's interval), since the magic number was
   not previously explained.

4. `WindowSegmentTreeSuite.scala` -- fix indentation of 11 `test(` blocks
   that were declared at 4-space indent (inconsistent with the file's
   2-space convention and the 3 other correctly-indented tests in the
   same file).

### Why are the changes needed?

Review-comment-style follow-ups. Pure comment / defensive-default /
whitespace changes -- no behavior change.

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

No.

### How was this patch tested?

Existing tests cover all touched code paths. The test indentation fix is
whitespace-only; the comment and `case _` changes have no runtime effect.

A separate follow-up is needed to add RANGE-frame coverage to
`WindowBenchmark` -- the current benchmark is RowFrame-only -- but that
requires regenerating the committed JDK 17/21/25 results files and is
deferred.

Co-authored-by: Isaac
@cloud-fan cloud-fan force-pushed the cloud-fan/SPARK-56546-followup branch from 8872c3c to bdca187 Compare May 12, 2026 05:07
@cloud-fan
Copy link
Copy Markdown
Contributor Author

cc @yaooqinn

Copy link
Copy Markdown
Member

@yaooqinn yaooqinn left a comment

Choose a reason for hiding this comment

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

LGTM

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