Skip to content

[SPARK-2509][SQL] Add optimization for Substring. - #1428

Closed
ueshin wants to merge 1 commit into
apache:masterfrom
ueshin:issues/SPARK-2509
Closed

ueshin wants to merge 1 commit into
apache:masterfrom
ueshin:issues/SPARK-2509

Conversation

@ueshin

@ueshin ueshin commented Jul 16, 2014

Copy link
Copy Markdown
Member

Substring including null literal cases could be added to NullPropagation.

@SparkQA

SparkQA commented Jul 16, 2014

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this not doable with constant folding?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now I think about it more, this is probably ok to leave it here since in constant folding we don't really special case for null literals. However, I looked into other rules in NullPropagation and a lot of them don't really belong there... (has nothing to do with your PR though)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@rxin, thank you for your comment.
The rule ConstantFolding can be applied only if the expression is foldable, i.e. ALL of the child expressions are foldable, and the NullPropagation covers the case there exists at least one null literal regardless of foldabilities of the others.
So I think the cases are needed.

BTW, Substring can be foldable, right?

@SparkQA

SparkQA commented Jul 16, 2014

Copy link
Copy Markdown

QA results for PR 1428:
- 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/16705/consoleFull

@rxin

rxin commented Jul 16, 2014

Copy link
Copy Markdown
Contributor

Thanks. Merging this in master & branch-1.0.

asfgit pushed a commit that referenced this pull request Jul 16, 2014
`Substring` including `null` literal cases could be added to `NullPropagation`.

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes #1428 from ueshin/issues/SPARK-2509 and squashes the following commits:

d9eb85f [Takuya UESHIN] Add Substring cases to NullPropagation.

(cherry picked from commit 9b38b7c)
Signed-off-by: Reynold Xin <rxin@apache.org>
@asfgit asfgit closed this in 9b38b7c Jul 16, 2014
@ueshin

ueshin commented Jul 16, 2014

Copy link
Copy Markdown
Member Author

@rxin Ah, wait for a moment.
What do you think about foldability of the Substring I mentioned above?

@ueshin

ueshin commented Jul 16, 2014

Copy link
Copy Markdown
Member Author

I'll open another issue about foldability of Substring.

@rxin

rxin commented Jul 16, 2014

Copy link
Copy Markdown
Contributor

I've already merged this. I think we should re-evaluate in the future whether we would want to push some stuff into expression foldability. I think that might also lead to higher planner performance (although that's probably less important). More importantly, it does feel more natural to me that this stuff goes into each expression, rather than having a rule for each NullPropagation.

cc @marmbrus

@ueshin

ueshin commented Jul 16, 2014

Copy link
Copy Markdown
Member Author

@rxin I agree that we need the better way for NullPropagation instead of too much pattern matching.

@marmbrus

Copy link
Copy Markdown
Contributor

You are right that this rule does more than null propagation now. I'm not sure what a better name would be. DegenerateExpressionSimplification?

Regarding moving null propagation into the expressions, you could do it... but what would it look like? You specify which of the children make the entire expression null if they are null? Seems like a lot of refactoring for little benefit...

asfgit pushed a commit that referenced this pull request Jul 16, 2014
This is a follow-up of #1428.

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes #1432 from ueshin/issues/SPARK-2518 and squashes the following commits:

37d1ace [Takuya UESHIN] Fix foldability of Substring expression.
asfgit pushed a commit that referenced this pull request Jul 16, 2014
This is a follow-up of #1428.

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes #1432 from ueshin/issues/SPARK-2518 and squashes the following commits:

37d1ace [Takuya UESHIN] Fix foldability of Substring expression.

(cherry picked from commit cc965ee)
Signed-off-by: Reynold Xin <rxin@apache.org>
@rxin

rxin commented Jul 16, 2014

Copy link
Copy Markdown
Contributor

It doesn't bring much benefit right now, but what we are doing here is creating patterns in NullPropagation to specify the semantics of each individual expression ... not very scalable in maintaining this code base.

@marmbrus

Copy link
Copy Markdown
Contributor

I'm not sure I agree with that. This is a pretty niche optimization not something fundamental about the expressions that is required for correct evaluation (and the first version of this code had a bunch of mistakes). Having all of these rules in one place made it easier for me to realize that when doing the review.

@rxin

rxin commented Jul 16, 2014

Copy link
Copy Markdown
Contributor

Well with that argument we shouldn't have any of the constant folding logic in expressions themselves either since they don't affect correctness.

This is a situation that it is not obvious where to put the stuff. Anyway I think it's ok for them to be here for now, since it is not too long yet. As the list gets longer, we can revisit.

@marmbrus

Copy link
Copy Markdown
Contributor

That is exactly the argument I made when the folding logic was added. :) I suggested that we add deterministic instead and then have a rule that folds things that are deterministic and have no references. deterministic I would argue is something fundamental about the expression itself, unlike these optimizations we are making.

@marmbrus

Copy link
Copy Markdown
Contributor

I would be supportive of changing it to match my original proposal...

xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
`Substring` including `null` literal cases could be added to `NullPropagation`.

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#1428 from ueshin/issues/SPARK-2509 and squashes the following commits:

d9eb85f [Takuya UESHIN] Add Substring cases to NullPropagation.
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
This is a follow-up of apache#1428.

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#1432 from ueshin/issues/SPARK-2518 and squashes the following commits:

37d1ace [Takuya UESHIN] Fix foldability of Substring expression.
sunchao pushed a commit to sunchao/spark that referenced this pull request Jun 2, 2023
…nsitivity (apache#1428)

### What changes were proposed in this pull request?
Previously alignment was checked by comparing the exact attribute references between
Spark and the underlying table, which failed with case insensitive SQL configurations. To
fix this we use the configuration's resolver to compare references.

### Why are the changes needed?
This was breaking some migrations from Spark 3.1 where the alignment check was not present. A query which attempted
to do a MergeInto with column names which matched in a case-insensitive way would fail to trigger our plan rewrite
rules leading to an opaque MERGE INTO is temporarily not supported exception.

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

### How was this patch tested?
This patch is a cherry pick of the code fixed and released in Apache Iceberg. apache/iceberg#4848 

The test for this specific case is in the Iceberg codebase and we will back-port this to ADT following the merge of the fix in Spark.
@ueshin
ueshin deleted the issues/SPARK-2509 branch August 3, 2026 22:59
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 10, 2026
…hes solvers (apache#1439)

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

Plan changes for CI stability, from what failed on 9 November 2026:

- **Row 590: a pull request's Build tests it merged with Varka's master.** Today the Build checks out the branch's own commit. It deliberately stopped merging onto apache/spark's master, which broke every branch whenever upstream edited a file Varka rewrote. Testing the head alone means a branch runs without the fixes master gained since it forked. apache#1413's Build hung for 2.5 hours, and apache#1418's and apache#1426's failed, on the width-audit hang that apache#1416 had fixed on master that morning. Separately, two pull requests that were each green alone broke master together (apache#1392 and apache#1393). The row merges onto Varka's own master only, with a fallback to the head when the merge conflicts.
- **Row 591: a benchmark that lands on the wrong CPU is rerun by CI.** `benchmark.yml` rightly fails a run that lands on anything but an EPYC 7763, but the retry has been a laptop script rerunning hourly. apache#1414's 128-bit run took four tries over about five hours.
- **Row 592: the proof solvers install from a cache, and a download retries.** The cvc5 download returned HTTP 504 twice today and failed the lint job before any proof ran.
- **Row 508 (note):** run a pull request's new coverage rows at PR time under `lanesOverride=16`, `validityByWidth=false` and 128-bit vectors. apache#1418, apache#1425 and apache#1428 each failed their option matrix hours in on new rows those configurations decline by design.
- **Row 513 (note, reopened in part):** bin b150 of apache#1426's matrix still failed at "Download the classpath, again", so the existing retry is not enough.

### Why are the changes needed?

Each of these cost hours of queue time or a manual merge-and-re-push on 9 November, and together they made most of the day's red CI runs that were not about the code under review.

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

No. It changes only the milestone plan.

### How was this patch tested?

`dev/varka_plan_lint.py --check --offline` reports no findings.

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

Generated-by: Claude Code (claude-opus-5-5)
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 13, 2026
…pache#1428)

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

This adds the switch for an opt-in faster mode of Spark's math functions (`sin`, `exp`, `log`, `pow` and the rest), and the expression family that will hold them. The default stays bit for bit Spark's answer. Nothing fuses yet: each function declines by name. This is the first of two stacked pull requests. The second adds the evidence the mode depends on (which native routine the JDK binds, the table of contracted bounds, and the coverage table's form column).

**The two modes.** Spark computes each math function with one scalar call a row, `java.lang.Math.<fn>` or `java.lang.StrictMath.<fn>`. When a later pull request fuses a function, Varka will make the same call once per lane inside the vector kernel (or run a lane-wise port of the same fdlibm sequence), so its answer is Spark's bit for bit; this stays the default. The Vector API's own math operators call a native library instead (SVML on x86, SLEEF on aarch64), which is several times faster but differs from Spark's answer in the last bits on a share of inputs. The new setting `spark.sql.codegen.varka.math.ulpContract.enabled` lets a session accept that. Under it, a function may use the library where a bound for that function, library symbol and JDK build is contracted, and its answer is then within that many representable doubles of Spark's.

**The configuration and its emit option.** The setting is an internal `SQLConf` entry with binding policy `NOT_APPLICABLE`: it is read by the Varka rule after analysis, so no view body resolves differently. It has no default value. Unset leaves the emit options' value, which is off, and an explicit `true` or `false` is laid over the options. This is how `spark.sql.codegen.varka.emit.exactRefusalStatus` works, so a session that sets nothing never undoes a value a test suite set through the options. In `VarkaEmitOptions` it is the flag `mathUlpContract`, default false. It renders in the shape key as the tag `|ulpContract` only when true, so every existing shape keeps its key. Its reason in the options table is a new one, `VarkaEmitOption.Reason.CONTRACT`: a deliberate departure from Spark's answers that a session opts into. The IR fuzzer and the option matrix do not draw an option of that reason, because their oracles compare every answer bit for bit, which a value under the contract need not be. No IR node reads the flag yet, so both of its values emit the same bytes.

**The family.** `VarkaFamily.MATH` (switch `spark.sql.codegen.varka.family.math.enabled`) and its arm `VarkaMathCompiler` claim the 26 Catalyst classes behind the 27 functions over `DOUBLE` operands: `log` with one or two arguments is `Logarithm`, and `ln` is `Log`. Before any family is asked, `floatingDecline` refuses every floating node it has no lowering for. It now lets these classes through by asking `VarkaMathCompiler.ownerOf`, the same way it asks the floating cast family. Each function then declines with its own reason, which names the plan row that will fuse it, for example `sin is row 356's: no math function fuses yet` (trigonometric functions 356, hyperbolic 357, exponential, logarithm, power and root 358). With the family switched off, the reason names the switch instead. These reasons appear in the verbose `EXPLAIN` where a generic "an operation over floating values that no floating lowering serves" used to.

**The bound.** `VarkaMathBound.steps(a, r)` counts the representable doubles between a kernel's lane and the row engine's answer. Two NaNs are 0 apart whatever their payloads. An infinity is 0 from itself. Every other pair with a NaN or an infinity in it, and every pair of opposite signs (so `-0.0` against `+0.0`), is refused at any bound. Two finite values of one sign are the difference of their raw bits. That difference cannot overflow, unlike the `Math.abs(bits(a) - bits(b))` of the current probe, which is `Long.MIN_VALUE` for `-0.0` against `+0.0`. `within(a, r, k)` is `steps(a, r) <= k`. A multiple of `Math.ulp(r)` is not used, because at `r = 1.0` it admits the double two steps below and at `r = +inf` it admits anything.

**Records.** The configuration's entry in `docs/sql-varka.md`. Dated corrections recording the exact default in `SCOPE_FUNCTIONS.md` section 3, `SCOPE_STANDARD_MODE.md` 3.4 and `m9/SCOPE.md` item 36. An edit of `PLAN.md` 2.7.1 marking its composition rule unsound (`exp(x) - 1.0` at `x = 1e-10` turns one step of `exp` into about `10^10` steps of the difference) and recording the missing default. The outcome in `VARKA-345.md` 10.1 and row 345's status.

### Why are the changes needed?

The math functions run on Spark's row engine today. Each is a scalar call a row, and Varka has nowhere to put them. The rows that fuse them (356 to 358) need the family to add their lowerings to, the switch, the emit option that will choose a function's form, and the step count that every check of the opt-in mode uses. This change adds those without fusing anything, so the rows that come next only add lowerings.

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

No change to any answer, plan or emitted kernel. Two new internal settings exist, `spark.sql.codegen.varka.math.ulpContract.enabled` and `spark.sql.codegen.varka.family.math.enabled`, and neither changes a plan today. The verbose `EXPLAIN` gives a math function over a double the reason naming its row instead of the generic floating decline.

### How was this patch tested?

On the laptop (AVX-512), 9 November 2026:

- `VarkaMathCompilerSuite` (new): each of the 27 functions, and `exp` of an int column through its cast, declines with its row's reason with the mode off and on. With the family off, each names the switch. The family claims exactly the math classes and not `+`, `sqrt`, `abs`, `rint` or a column.
- `VarkaMathBoundSuite` (new): at a bound `k`, a lane `k` steps out passes and `k + 1` and `k + 2` fail, on 10000 random finite references of both signs. NaN against a number, `+inf` against `Double.MAX_VALUE`, `-0.0` against `+0.0`, `-Double.MIN_VALUE` against `+Double.MIN_VALUE` and other opposite-sign pairs are refused at every bound. Two NaN payloads pass. The count is exact either side of a power of two at seven exponents, where `Math.ulp` admits two steps.
- `VarkaFamilySwitchSuite`: the switch test needs a coverage row of every family. A family that fuses nothing yet, the math family, is checked on `sin(x)` instead (its own reason with the family on, the switch's with it off), and the exemption fails as soon as a coverage row holds the family.
- `VarkaEmitOptionSuite`: the option's reason, that it is not drawn, its default and its tag. `VarkaShapeCacheSuite`: its component walk finds the new field changing the rendering. `VarkaEvaluatorComponentsSuite`: unset leaves the base's value, and each value set is laid over a base holding the other.
- `VarkaEmittedBytesSuite`: `option_arms` pins `mathUlpContract=true`. Its digest is the defaults', and no other hash moves.
- The runs, on the tree with both parts applied: `catalyst/testOnly` over `VarkaMathCompilerSuite`, `VarkaMathBoundSuite`, `VarkaFamilySwitchSuite`, `VarkaEmitOptionSuite`, `VarkaShapeCacheSuite`, `VarkaTypesSuite`, `VarkaMatrixSuite`, `VarkaCoverageSuite`, `VarkaEmittedBytesSuite` and `VarkaIrFuzzSuite` at its default iterations, every test passed (the opt-in ones canceled); `sql/testOnly` over `VarkaEvaluatorComponentsSuite`, `VarkaFamilySwitchQuerySuite` and `VarkaCoverageDifferentialSuite`, 80 passed; `hive/testOnly *SparkConfigBindingPolicySuite` under `-Phive`, the configuration audit, 3 passed.
- After the review's fixes, on this part's tree alone (the second part's files absent): `dev/varka_regen_generated.sh --all`, then `VarkaEmitOptionSuite`, `VarkaMathBoundSuite`, `VarkaMathCompilerSuite`, `VarkaIrFuzzSuite`, `VarkaMatrixSuite`, `VarkaShapeCacheSuite`, `VarkaFamilySwitchSuite` and `VarkaEmittedBytesSuite`: 101 passed, 4 opt-in tests canceled.
- Generated files regenerated with `dev/varka_regen_generated.sh --all`: the family switch table in `docs/sql-varka.md` gains the math family, `emitted_bytes.json` gains the pinned arm, and nothing else moves.
- Added test time: `VarkaMathCompilerSuite` ran in 1.1 s and `VarkaMathBoundSuite` in under 0.1 s on the laptop, in the Build's catalyst step; no gate or nightly step changes.
- `dev/varka_precommit.sh`, `dev/varka_errorprone.sh`, `dev/lint-java` and `dev/varka_quote_check.py` pass.

**Accepted trade-offs**

- `VarkaMathBound` lives in catalyst's main code with no main-code caller yet, as the plan places it, so that the coverage docs and the contract cross-check of the next part read the same class as the oracles will.
- The family and its switch ship before any function fuses, so `VarkaFamilySwitchSuite` carries an exemption for a family with no fused coverage row, checked on `sin(x)` and failing once a row holds the family.
- `floatingDecline` and the math arm both call `VarkaMathCompiler.ownerOf` for a math node, a second 26-case type switch at compile time only.
- `ownerOf` claims a math class without checking its operands' types: each class takes `DOUBLE` inputs by `ImplicitCastInputTypes`, so the analyzer has cast every other operand before a plan reaches the compiler.
- `mathUlpContract` is part of every shape's key whenever it is true, not only for shapes that hold a math function. Until a function fuses, a session that sets the option to true emits and caches each kernel a second time with the default's bytes, as a session naming a `useAVX` level already does. Keying it per shape would need the key to know which nodes read the flag, and dropping it from the key now would have to be undone, unnoticed by any test, the day the first function fuses.
- The source scan in `VarkaCoverageSuite` does not read `VarkaMathCompiler`, so `coverage.json`'s `catalyst_classes_admitted` does not list classes that only decline; the row that fuses the first function adds the file to the scan, and `VarkaMathCompilerSuite` fails the day a function fuses.

**The review.** `/code-review high` on this branch found ten points. Fixed: the option was drawn by the fuzzer and the matrix, which would have shifted every steered fuzz sequence, given the matrix a configuration that emits the defaults' bytes, and later run library lanes against bit-for-bit oracles, so `CONTRACT` is not drawn; `Reason.CONTRACT`'s and `VarkaMathBound`'s javadoc described oracles that do not exist yet; the bound suite's random references masked away every odd exponent; the bytes oracle's description still called `useAVX` the only emit option a configuration reaches; and the compiler suite's table lost its order. The rest are the trade-offs above. A second `/code-review high` round fixed: the bound suite's walk past `MAX_VALUE` could reach a NaN bit pattern under another seed; the option's SQLConf doc said any session that sets it caches its own classes, though `false` keeps the default key, and disagreed with `docs/sql-varka.md` on whether it does anything today; the math family's description nested dashes in the generated docs; the families were listed with math ahead of rounding, against the chain's claim order; and several comments (the chain's javadoc, the bytes suite's pinned arm, the compiler suite's int operand) named the wrong families or overstated what they cover.

- On the merge with master at e48a856, the one conflict was in `VarkaSessionEmit`'s Javadoc. The resolution keeps VARKA-596's wording for `declineTwoLaneConditions` and this PR's `@param mathUlpContract`. VARKA-596 also changed `VarkaExpressionCompiler.declines` to take a `VarkaAdmission`, so `VarkaMathCompilerSuite` now passes `new VarkaAdmission(off, false)`, which is what the old overload did. After regeneration the `mathUlpContract=true` arm in `emitted_bytes.json` follows master's new default digest, since no node reads the flag yet. Checks: regeneration, both modules' test compile, `VarkaMathCompilerSuite`, `VarkaFamilySwitchSuite`, `VarkaEmitOptionSuite` and `VarkaMathBoundSuite` (19 of 19), `VarkaEvaluatorComponentsSuite`, `VarkaKernelEvaluatorSuite` and `VarkaTwoLaneDefault128Suite` (40 of 40), and `dev/varka_push_check.py`. The option matrix passed on 21f5a7b, before this merge. One `/code-review high` pass on the resolution: found 5, fixed 0, left 5, all documentation or patterns already in master's code.

- Re-merged master at `6f5786d7a4e` (apache#1425) on 13 November 2026: no code conflict, only `PLAN.md` and the generated files, which were regenerated with `dev/varka_regen_generated.sh --all`; `dev/varka_push_check.py` passes (737 counted lines). The option matrix above was on `21f5a7bba33`, before both merges, so no matrix has run on this head.

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

Generated-by: Claude Code (claude-opus-5-5)
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 13, 2026
…#1522)

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

Two test helpers rewrote a coverage row that `sql/varka/coverage.json` records as an `InSet` into one, and they had drifted apart. The copy in the emitted-bytes oracle folded each element with `eval` before building the set; the copy in the warm-up reach suite did not, so a decimal row, whose elements arrive as casts over decimal literals rather than as plain literals, kept expression objects in the set where an `InSet` needs values. That threw a `ClassCastException` in the reach suite on the new decimal rows and failed four option-matrix bins. This change moves both suites onto one helper, `VarkaSqlResolve.inSetAsClaimed(e, claimsInSet)`: for a row the coverage table records as an `InSet` it builds `OptimizeIn`'s form, folding each element with `eval` first, and it throws an `IllegalArgumentException` when such a row resolves to anything but an `In` of foldable elements; a row that does not claim `InSet` comes back as the same object. The bytes oracle (`VarkaEmittedBytesSuite.coverage`) and the reach suite (`VarkaWarmupReach.coverageShapes`) now both call it, and their two copies of the rewrite are gone.

A third copy, `VarkaWidthAuditShapes.asCatalystClaims`, matches only `Literal` elements and passes anything else through, which is why the decimal row reaches the width audit as an `In` rather than an `InSet`. Changing it could move the committed `sql/varka/width_audit.json`, so it is deliberately left alone here and filed as row 607.

Two tests in `VarkaDecimalInSuite` hold the helper to its oracle. `inSetRewriteIsTheOptimizers` parses the two coverage rows' `executable` spellings, the int row and the decimal row of eleven literals, asserts the helper's `InSet` equals `VarkaSqlResolve.optimizeIn`'s for each, and asserts a row that does not claim `InSet` is returned unchanged. `inSetClaimIsRefused` asserts the refusal for `d18 > 0.42`, whose message names `GreaterThan`, and for `i IN (1, i)`, whose message names `In`.

### Why are the changes needed?

The rewrite of an `In` row into an `InSet` row was written twice in the test sources with two different behaviours, and only one of them had learned that a decimal row's elements arrive under a cast. The reach suite's copy evaluated each element, so it could not throw on a well-formed row, and the bytes oracle's copy checked that the elements were foldable and failed loudly when a row whose spelling and `catalyst` field disagree was parsed. The second behaviour is the one that catches a coverage table that has drifted, so it wins: a row that claims `InSet` can no longer be pinned through the compiler's `In` arm silently, and the two suites cannot diverge again. The reach suite had already fixed its own copy after the `ClassCastException`; this removes the duplication that let the two copies drift in the first place.

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

No. Only test sources change: the coverage oracle and the reach suite share one helper, and two tests are added. The committed `emitted_bytes.json`, `width_audit.json` and `coverage.json` do not move, and no main source is touched.

### How was this patch tested?

- `build/sbt 'catalyst/testOnly *VarkaDecimalInSuite'`: 9 tests, 0 failed, 2.9 s of test time, including the two new tests.
- `build/sbt 'catalyst/testOnly *VarkaEmittedBytesSuite *VarkaWarmupReachSuite'`: 9 passed, 2 canceled by their own opt-in `assume` (the option and pairs audits, which cancel without their environment variables), 0 failed; the committed-bytes pin took 58.6 s and `VarkaWarmupReachSuite`'s three tests 45.0 s.
- `git diff --exit-code -- sql/varka/emitted_bytes.json sql/varka/width_audit.json sql/varka/coverage.json` exits 0.
- Planted faults, each reverted before the next: building the set without the `eval` fold failed `inSetRewriteIsTheOptimizers` on the int row, the set holding expressions rather than values; deleting the refusal arm failed `inSetClaimIsRefused` with "Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown."
- `dev/varka_precommit.sh` passes; `dev/varka_errorprone.sh --master 6f5786d` passes over 120 files in 11 s; `dev/lint-scala` (scalastyle and scalafmt) and `dev/lint-java` (checkstyle) pass; `python3 dev/varka_plan_lint.py --check --offline` reports 0 findings.
- After the review's fixes, the same commands ran again on the amended head: `*VarkaDecimalInSuite` 9 of 9, `*VarkaEmittedBytesSuite *VarkaWarmupReachSuite` 6 passed and 2 canceled by their own `assume` with 0 failed, the three generated files unchanged, and `dev/varka_push_check.py` passes.
- `python3 dev/varka_push_check.py` passes, with 165 counted lines of 165 changed against `6f5786d7a4e`, under the cap of 1000. The build sheet's estimate was about 90; the overrun is the review round's javadoc, comment correction and the plan's record of it, and the work stays one commit.
- Re-merged master at `5c49b359f6f` (apache#1425 and apache#1428) on 13 November 2026: no code conflict, `PLAN.md` and the generated files regenerated, and `dev/varka_push_check.py` passes again. The option matrix passed on this head (MaxGekk/spark run 43451663202), as `sql/varka/AGENTS.md` asks of a Varka pull request's configurations, and the Build passed too.

**Review.** One `/code-review high` pass on this branch found six points, and it reproduced the suites' numbers on the branch. Fixed: the refusal message now says a claimed row resolved to X "rather than an In of foldable elements", where it said "resolved to In" for a row that is an `In` whose elements are not foldable, and the test that pins it follows; the width audit's comment no longer names the bytes oracle's deleted rule; and the helper's scaladoc no longer claims the optimizer's cast-unwrapping rule has run. Left, with the reason: the helper applies `OptimizeIn`'s rewrite by hand and not the cast-unwrapping rule that precedes it in production (no table row has that shape, and the rule needs the columns, which the helper does not take); `coverage.json`'s `catalyst` set is tree-wide while the helper accepts a root `In`, so a future row whose `InSet` sits under an `And` would be refused by this suite as well as by the bytes oracle, which refused it before this change (no such row exists, and rewriting nested `In`s would change what the oracle pins); and `inSetRewriteIsTheOptimizers` pastes the two rows' spellings rather than reading the coverage table, which is the two-row test the build sheet specifies.

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

Generated-by: Claude Code (deepseek-flash[1m])
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