Skip to content

[SPARK-2561][SQL] Fix apply schema - #1470

Closed
marmbrus wants to merge 2 commits into
apache:masterfrom
marmbrus:fixApplySchema
Closed

marmbrus wants to merge 2 commits into
apache:masterfrom
marmbrus:fixApplySchema

Conversation

@marmbrus

Copy link
Copy Markdown
Contributor

We need to use the analyzed attributes otherwise we end up with a tree that will never resolve.

@SparkQA

SparkQA commented Jul 17, 2014

Copy link
Copy Markdown

QA tests have started for PR 1470. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16790/consoleFull

@SparkQA

SparkQA commented Jul 17, 2014

Copy link
Copy Markdown

QA results for PR 1470:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16790/consoleFull

@concretevitamin

Copy link
Copy Markdown
Contributor

LGTM.

@marmbrus

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing. Merged to master and 1.0

asfgit pushed a commit that referenced this pull request Jul 22, 2014
We need to use the analyzed attributes otherwise we end up with a tree that will never resolve.

Author: Michael Armbrust <michael@databricks.com>

Closes #1470 from marmbrus/fixApplySchema and squashes the following commits:

f968195 [Michael Armbrust] Use analyzed attributes when applying the schema.
4969015 [Michael Armbrust] Add test case.

(cherry picked from commit 511a731)
Signed-off-by: Michael Armbrust <michael@databricks.com>
@asfgit asfgit closed this in 511a731 Jul 22, 2014
@marmbrus
marmbrus deleted the fixApplySchema branch August 27, 2014 20:44
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
We need to use the analyzed attributes otherwise we end up with a tree that will never resolve.

Author: Michael Armbrust <michael@databricks.com>

Closes apache#1470 from marmbrus/fixApplySchema and squashes the following commits:

f968195 [Michael Armbrust] Use analyzed attributes when applying the schema.
4969015 [Michael Armbrust] Add test case.
sunchao pushed a commit to sunchao/spark that referenced this pull request Jun 2, 2023
…#1470)

Updates parquet to include fix for rdar://95861938
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 11, 2026
…e them (apache#1483)

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

This PR commits the EPYC 7763 runner results of `VarkaDecimalRemainderSpikeBenchmark` and scores the predictions the spike registered before it was timed. The benchmark merged in apache#1470 without its numbers.

**What was timed.** The spike compares three ways to compute the remainder of a 128-bit decimal by a divisor that differs per row. It times `x % y` and `pmod(x, y)` over two `DECIMAL(38, s)` columns at one scale, held as two long vectors per lane group (one of low words, one of high words). The three forms:
- **E**: a floating-point estimate of the quotient, in three rounds, each followed by an exact multiply-subtract.
- **D**: a long division at base 2, branch-free per lane.
- **B**: a `BigInteger` call per row.

Each loop is checked against `BigInteger` before it is timed. An intrinsic check then compiles each loop in a child JVM and reads C2's inlining tree. Any arm whose Vector API calls stay in their Java fallback is labelled `[Java fallback]`.

**How.** Two runs of `benchmark.yml` on vecbricks/varka, both on the EPYC 7763:
- run 42883478096 at 256 bits;
- run 42883499519 at 128 bits, with `-XX:MaxVectorSize=16`.

Both ran with `-XX:CompileCommand=dontinline,...::loop*` and `-XX:CompileCommand=inline,...::body*`, on `4c793f02383`, apache#1470's head. Its benchmark and suite are identical to master's. The artifacts are committed unchanged, under the runner's file names (`-jdk25-runner-epyc7763-results.txt` and the `-128bit-` companion, each with its provenance file).

**What they show**, in ns a row, at the in-L2 rung (the other rungs agree):

| Width | `x % y`: E / D / B | `pmod`: E / D / B | Winner |
|---|---|---|---|
| 256 bits | 21.2 / 109.0 / 270.1 | 22.1 / 107.2 / 286.1 | E |
| 128 bits | 915.2 [fallback] / 9990.6 [fallback] / 258.9 | 975.2 [fallback] / 9932.9 [fallback] / 283.6 | B |

- At 256 bits, all six loops are intrinsified.
- At 128 bits, the check labels four arms as Java fallbacks: E's `x % y` (72 calls left in Java), E's `pmod` (80), D's `x % y` (62) and D's `pmod` (70). These are the same counts a laptop run found under `UseAVX=2 -XX:MaxVectorSize=16`.
- B is scalar, so its time should not depend on the vector width. It stays within 5% between the two runs, which shows the runs can be compared.

**The predictions**, scored on `Rate(M/s)`:
1. *E's rate is at least 1.3 times B's at every rung at 256 bits*: **held**. It is 11 to 13 times B's.
2. *E's rate is at least 1.3 times D's at every rung at 256 bits*: **held**. It is about 5 times D's.

Not measured yet: a 512-bit reading on a host with a 512-bit datapath (the laptop runs 512-bit operations on 256-bit units), the laptop's three widths, the Arm runner's two-lane column (where the pair runs natively), and the 64-bit decimals.

**What it means for the build.**
- The 128-bit remainder builds E at 256 bits, and at 512 bits unless a 512-bit host overturns it. Its predictions are registered from these figures before it is built.
- B is 11 to 13 times slower than E at 256 bits, so a hand-written scalar remainder in `long`s is not needed there.
- At two long lanes on x86, E runs the Java fallback at 915.2 to 978.7 ns a row. The row path's whole query (from apache#1475) costs 771.3 ns a row for `%` and 973.4 for `pmod`, so E shows no win there (both gaps are under 1.3 times). This comparison is indicative only: the spike is a hand loop and the baseline is a whole query.
- Whether the remainder declines at 128 bits on x86, or fuses there with a scalar form, is a new question for the owner.

The plan's outcome section (`VARKA-577.md` 10.3) records all of this, with the full table. Section 10.1 gets a dated note that the decimal baseline's reading landed in apache#1475. Row 577's status in `PLAN.md` is updated.

### Why are the changes needed?

The spike exists to choose which division form the 128-bit decimal remainder is built with. Its predictions were registered before it ran, and the plan's rules require them scored against committed runner numbers before the build picks a form.

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

No. Benchmark results and a plan update only.

### How was this patch tested?

No code changes. The provenance files record each run, its commit, its JVM options and the runner's CPU. `git diff 4c793f0 master` over the benchmark and its suite is empty. `dev/varka_push_check.py` passes, including `dev/varka_quote_check.py` over the quoted numbers.

### 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.

3 participants