Skip to content

[SPARK-2307] SparkUI - storage tab displays incorrect RDDs - #1249

Closed
andrewor14 wants to merge 1 commit into
apache:masterfrom
andrewor14:storage-ui-fix
Closed

andrewor14 wants to merge 1 commit into
apache:masterfrom
andrewor14:storage-ui-fix

Conversation

@andrewor14

Copy link
Copy Markdown
Contributor

The issue here is that the StorageTab listens for updates from the StorageStatusListener, but when a block is kicked out of the cache, StorageStatusListener removes it from its list. Thus, there is no way for the StorageTab to know whether a block has been dropped.

This issue was introduced in #1080, which was itself a bug fix. Here we revert that PR and offer a different fix for the original bug (SPARK-2144).

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished. All automated tests passed.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16217/

asfgit pushed a commit that referenced this pull request Jun 27, 2014
The issue here is that the `StorageTab` listens for updates from the `StorageStatusListener`, but when a block is kicked out of the cache, `StorageStatusListener` removes it from its list. Thus, there is no way for the `StorageTab` to know whether a block has been dropped.

This issue was introduced in #1080, which was itself a bug fix. Here we revert that PR and offer a different fix for the original bug (SPARK-2144).

Author: Andrew Or <andrewor14@gmail.com>

Closes #1249 from andrewor14/storage-ui-fix and squashes the following commits:

af019ce [Andrew Or] Fix SPARK-2307
(cherry picked from commit 21e0f77)

Signed-off-by: Patrick Wendell <pwendell@gmail.com>
@asfgit asfgit closed this in 21e0f77 Jun 27, 2014
@andrewor14
andrewor14 deleted the storage-ui-fix branch June 28, 2014 01:44
asfgit pushed a commit that referenced this pull request Jul 4, 2014
**Problem.** The existing code in `ExecutorPage.scala` requires a linear scan through all the blocks to filter out the uncached ones. Every refresh could be expensive if there are many blocks and many executors.

**Solution.** The proper semantics should be the following: `StorageStatusListener` should contain only block statuses that are cached. This means as soon as a block is unpersisted by any mean, its status should be removed. This is reflected in the changes made in `StorageStatusListener.scala`.

Further, the `StorageTab` must stop relying on the `StorageStatusListener` changing a dropped block's status to `StorageLevel.NONE` (which no longer happens). This is reflected in the changes made in `StorageTab.scala` and `StorageUtils.scala`.

----------

If you have been following this chain of PRs like pwendell, you will quickly notice that this reverts the changes in #1249, which reverts the changes in #1080. In other words, we are adding back the changes from #1080, and fixing SPARK-2307 on top of those changes. Please ask questions if you are confused.

Author: Andrew Or <andrewor14@gmail.com>

Closes #1255 from andrewor14/storage-ui-fix-reprise and squashes the following commits:

45416fa [Andrew Or] Merge branch 'master' of github.com:apache/spark into storage-ui-fix-reprise
a82ea25 [Andrew Or] Add tests for StorageStatusListener
8773b01 [Andrew Or] Update comment / minor changes
3afde3f [Andrew Or] Correctly report the number of blocks on SparkUI
(cherry picked from commit 3894a49)

Signed-off-by: Patrick Wendell <pwendell@gmail.com>
asfgit pushed a commit that referenced this pull request Jul 4, 2014
**Problem.** The existing code in `ExecutorPage.scala` requires a linear scan through all the blocks to filter out the uncached ones. Every refresh could be expensive if there are many blocks and many executors.

**Solution.** The proper semantics should be the following: `StorageStatusListener` should contain only block statuses that are cached. This means as soon as a block is unpersisted by any mean, its status should be removed. This is reflected in the changes made in `StorageStatusListener.scala`.

Further, the `StorageTab` must stop relying on the `StorageStatusListener` changing a dropped block's status to `StorageLevel.NONE` (which no longer happens). This is reflected in the changes made in `StorageTab.scala` and `StorageUtils.scala`.

----------

If you have been following this chain of PRs like pwendell, you will quickly notice that this reverts the changes in #1249, which reverts the changes in #1080. In other words, we are adding back the changes from #1080, and fixing SPARK-2307 on top of those changes. Please ask questions if you are confused.

Author: Andrew Or <andrewor14@gmail.com>

Closes #1255 from andrewor14/storage-ui-fix-reprise and squashes the following commits:

45416fa [Andrew Or] Merge branch 'master' of github.com:apache/spark into storage-ui-fix-reprise
a82ea25 [Andrew Or] Add tests for StorageStatusListener
8773b01 [Andrew Or] Update comment / minor changes
3afde3f [Andrew Or] Correctly report the number of blocks on SparkUI
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
The issue here is that the `StorageTab` listens for updates from the `StorageStatusListener`, but when a block is kicked out of the cache, `StorageStatusListener` removes it from its list. Thus, there is no way for the `StorageTab` to know whether a block has been dropped.

This issue was introduced in apache#1080, which was itself a bug fix. Here we revert that PR and offer a different fix for the original bug (SPARK-2144).

Author: Andrew Or <andrewor14@gmail.com>

Closes apache#1249 from andrewor14/storage-ui-fix and squashes the following commits:

af019ce [Andrew Or] Fix SPARK-2307
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
**Problem.** The existing code in `ExecutorPage.scala` requires a linear scan through all the blocks to filter out the uncached ones. Every refresh could be expensive if there are many blocks and many executors.

**Solution.** The proper semantics should be the following: `StorageStatusListener` should contain only block statuses that are cached. This means as soon as a block is unpersisted by any mean, its status should be removed. This is reflected in the changes made in `StorageStatusListener.scala`.

Further, the `StorageTab` must stop relying on the `StorageStatusListener` changing a dropped block's status to `StorageLevel.NONE` (which no longer happens). This is reflected in the changes made in `StorageTab.scala` and `StorageUtils.scala`.

----------

If you have been following this chain of PRs like pwendell, you will quickly notice that this reverts the changes in apache#1249, which reverts the changes in apache#1080. In other words, we are adding back the changes from apache#1080, and fixing SPARK-2307 on top of those changes. Please ask questions if you are confused.

Author: Andrew Or <andrewor14@gmail.com>

Closes apache#1255 from andrewor14/storage-ui-fix-reprise and squashes the following commits:

45416fa [Andrew Or] Merge branch 'master' of github.com:apache/spark into storage-ui-fix-reprise
a82ea25 [Andrew Or] Add tests for StorageStatusListener
8773b01 [Andrew Or] Update comment / minor changes
3afde3f [Andrew Or] Correctly report the number of blocks on SparkUI
wangyum pushed a commit that referenced this pull request May 26, 2023
github-actions Bot pushed a commit to MaxGekk/spark that referenced this pull request Nov 1, 2026
…'s slots (apache#1249)

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

Varka kernels can now write a decimal output of precision 18 or less straight into Arrow's sixteen-byte decimal slots. Until now a kernel had no decimal output at all: a decimal result ended the fused region and the widening ran on Spark's row path.

**What a slot must hold.** Every writer Spark has stores a decimal as `Decimal(p, s, 128)`: the unscaled value's low word at byte 0 and its sign extension, `lo >> 63`, at byte 8. `ArrowColumnVector` reads both words and treats a high word that is not the sign extension as a value of at least 2^63, which fails with `NUMERIC_VALUE_OUT_OF_RANGE`. The store therefore writes exactly those two words, and the destination vector carries Spark's own field, so its precision and scale are the output type's.

**The store.** A new IR node, `WidenDecimal(child)`, takes a long-lane value at an output root. Its emitter computes the high words with one arithmetic shift, interleaves the two word vectors into slot order, and stores two vectors per lane group: whole in the loop, under the two epilogue masks at the tail. The interleave has two forms, chosen by a new emit option `decimalStore`: `REARRANGE` (the default) and `SELECT_FROM`. The losing form is kept, since the winner can depend on the machine. The slot addressing and masks are one helper shared with the decimal load, which reads the same layout in the other direction.

**What it refuses.** A decimal output above precision 18, or with a negative scale, is refused when the plan is built, so such a shape never fuses. The two-word store above precision 18 is separate work. No expression lowers to a decimal output yet: the decimal producers that will use this store come in a later change, so in this change the store is reached through the emitter and its tests.

**What checks it:**
- **Byte-exact against Arrow's writer.** `VarkaDecimalStoreSuite` writes over a long column at 1, 2, 4 and 8 lanes, in both loop bodies and with both interleave forms. It plants zero, -1, the precision-18 limits and random values at the first group, a middle one and the last row. Each valid slot must equal `DecimalVector.set(int, long)`'s bytes and read back through `ArrowColumnVector.getDecimal`. A planted wrong high word fails five of its seven tests.
- **One long lane.** A second suite runs the same tables in a JVM limited to 64-bit vectors, where the preferred species has a single long lane. It caught an interleave index that held only at an even lane count; the decimal load now runs there too.
- **A guard page.** The slots end on a mapped page whose successor is unreadable, so a store past the end faults.
- **The fuzzer.** A new decimal draw feeds random long trees, under a null guard where their bound does not fit, into a decimal root beside other outputs. It is checked against the reference evaluator, and the harness fails on any high word that is not the sign extension. Steering redraws the store option only for a case that holds a decimal output, so every other case mutates as before.
- **Census.** Six new census cells measure the interleave as the kernel builds it. Built by `VectorShuffle.makeZip`, the shuffle allocates, so the kernel builds it lanewise from an iota in the prologue. At 128 bits only the two-vector `selectFrom` is native, which is why both forms are kept.

**Generated files:** `operator_census.json` gains the laptop's column of the six cells and nothing else. `emitted_bytes.json` is unchanged: no committed shape holds a decimal output.

### Why are the changes needed?

A query whose result is a decimal could not keep its last step in a Varka kernel, because no kernel could write a decimal column. The decimal producers Varka is about to fuse all end in this store. The baseline that times today's scalar widening has merged, and the store is measured against it once a producer reaches it.

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

No. No expression produces a decimal output through Varka yet, and a new emit option, `decimalStore`, chooses between two equal-answer forms.

### How was this patch tested?

- On the laptop, after the master merge and four review rounds: the decimal store and load suites (at 1, 2, 4 and 8 lanes and at one long lane), `VarkaIrFuzzSuite`, `VarkaVariantSuite`, `VarkaEmittedBytesSuite`, `VarkaExpressionCompilerSuite`, `VarkaTypesSuite`, `VarkaLaneArrowSuite`, `VarkaWarmupReachSuite` and the emitter budget suite, with none failing.
- A self-review (`/code-review high`, then medium rounds on the fixes) found and fixed: the one-lane interleave index, output roots offered as replacements by the fuzzer's variants, and gaps in the tests.
- Errorprone, lint-java and lint-scala are clean. The PR Build and the option matrix run on this head.

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

Generated-by: Claude Code (Opus 5.5)
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