Repository navigation
Conversation
|
QA tests have started for PR 1478. This patch merges cleanly. |
|
QA tests have started for PR 1478. This patch merges cleanly. |
|
QA results for PR 1478: |
|
QA results for PR 1478: |
There was a problem hiding this comment.
Please use a deterministic seed passed as an argument.
|
QA tests have started for PR 1478. This patch merges cleanly. |
|
QA results for PR 1478: |
|
Jenkins, retest this please. |
|
QA tests have started for PR 1478. This patch merges cleanly. |
|
QA results for PR 1478: |
|
Merging in master. |
This is going to be used in https://issues.apache.org/jira/browse/SPARK-2568 Author: Reynold Xin <rxin@apache.org> Closes apache#1478 from rxin/reservoirSample and squashes the following commits: 17bcbf3 [Reynold Xin] Added seed. badf20d [Reynold Xin] Renamed the method. 6940010 [Reynold Xin] Reservoir sampling implementation.
### What changes were proposed in this pull request? Build sheets for four milestone 8 rows - 502, 567, 566 and 495 - and the file of rules they share. **What a build sheet is.** A build sheet is a section at the end of a row's plan file. It is detailed enough that a coding agent can build the row with no judgment calls and stop at a local commit. Review, push and CI stay with the lead. Each sheet has the same ten parts: - a premise re-check: greps with the output they must print, read at `c62f492fc89`; - the scope by file and symbol, with the code shape and an explicit out-of-scope list; - the tests and the oracle each is held to; - planted faults that must make a named test fail; - the commands in order, with their expected results; - a done-when a script can check; - a size estimate; - stop rules; - the decisions already taken, quoted; - what the lead does afterwards. **`sql/varka/plans/m8/BUILD_SHEETS.md`** holds the rules every sheet shares, so each sheet says "Follow BUILD_SHEETS.md" instead of repeating them: - the environment exports (`SPARK_LOCAL_IP`, the ruff venv, `VARKA_HEAVY_LOCK`), and never printing the environment; - `flock` only around plain `build/sbt`. The regeneration script and the push check run bare, because they take the lock themselves. The sanitizer flag goes in through `Test / javaOptions`; - processes stopped by PID, never by pattern, and no `git stash`; - the generated files, with `--all` after a merge or rebase; - the linters in order; - the commit format, with one `Generated-by:` line; - no push, pull request or dispatch, and stopping at a local commit; - the stop rules common to all sheets. **The four rows.** - **502, every IR node replays.** The sheet adds the five boolean parse arms to `VarkaCanonicalIr` and deletes `NOT_PARSED_YET`. It specifies the reflective variant sweep exactly: the canonical constructor, the trailing `hash` component, and that only an `IllegalArgumentException` cause skips a value. It also covers record equality, `VarkaReplay.sameClass`, and two catalyst replays (boolean and decimal) whose shapes it fixes. The end-to-end query is fixed too: `CASE WHEN b THEN i > 400 END`, a coverage row's form; if it does not fuse, that is a stop, not a search for another query. The sheet records that the plan's section 5 has landed and that apache#1236 merged. It puts `dev/varka_push_check.py` in scope, which names `NOT_PARSED_YET`. If `sameClass` fails on an existing replay, that is a stop rule. - **567, one In-to-InSet rewrite.** One helper, `VarkaSqlResolve.inSetAsClaimed`, which Java can call. `VarkaWarmupReach` and the bytes oracle call it. The Scala copy's behaviour wins: a row that claims `InSet` and does not resolve to an `In` of foldable elements fails. The oracle is Spark's own `optimizeIn`, and `emitted_bytes.json` stays unchanged. The sheet also found a third copy, `VarkaWidthAuditShapes.asCatalystClaims`, which matches `Literal`s only. It stays out of this row, because changing it could move `width_audit.json` and apache#1478 and apache#1484 edit that file. It is left for the lead to file. - **566, one function from a type to its output width.** The function is `VarkaTypes.outputWidth(DataType)`, read from the registry's `Storage`: 16 bytes for a decimal's slot at every precision, `BIT_OUTPUT` for BOOLEAN, the plain width otherwise. It replaces `VarkaKernelRunner.outputWidth(vector)` and the literal in `kernelReady`. The warm-up takes the same widths with a floor of eight bytes, so its sizes do not change. The 8-byte `start` overload is deleted, and its three test callers are named. The brief's note "16 above 18 digits, else 8" contradicts master and would re-create the fault apache#1348 caught, so the sheet says so and does not use it. Two tests carry a decimal output: `VarkaLaneArrowSuite` against Arrow's own type widths, and a sanitizer-on warm-up test. - **495, one home for the coverage table's columns.** `VarkaCoverageRows.columns` reads the file's columns in order. The two 35-column copies go. A row that does not resolve fails the bytes oracle, naming the row and the column, and `coverage_rows_skipped` stays an empty list. Question 1 is yes (the plan's recommendation, taken by the lead), with a different assertion per fixture: the Spark fuzz fixture builds only the 18 columns its draws read. `dev/varka_new_lane.py` reads the width audit's copy, so it loses that site, and the sheet says so. The sheet also orders 495 after 567, since both edit `VarkaEmittedBytesSuite.coverage`. ### Why are the changes needed? The owner wants these rows built next week by a cheaper coding agent, with no judgment calls. Each plan file left open choices or had gone stale against master: - 502's plan predates five merges. - 495's plan counts 28 columns where there are 35. - 566 and 567 had only their row text. - One selection note was wrong for master: the decimal width rule. A sheet that leaves a choice open gets that choice made silently. So each sheet either decides the choice or makes it a stop. ### Does this PR introduce _any_ user-facing change? No. Plan files only. ### How was this patch tested? - Every premise grep in the four sheets was run at `c62f492fc89` and prints what the sheet says. - `python3 dev/varka_plan_lint.py --check --offline`: 0 findings. - `dev/varka_quote_check.py`: no orphan. One decimal literal list in the 567 sheet was replaced by the command that prints it from `coverage.json`. - A baseline run at `c62f492fc89`, one locked sbt call: `catalyst/testOnly *VarkaReproductionSuite *VarkaEmittedBytesSuite *VarkaWarmupReachSuite` passed (22 tests; the bytes suite's two opt-in audits cancel by design). With `set LocalProject("sql") / Test / javaOptions += "-Dvarka.sanitizeMemory=true"`, `sql/testOnly *VarkaLaneArrowSuite *VarkaWarmupEndToEndSuite *VarkaReproductionEndToEndSuite` passed 20 tests with none canceled. That confirms the sanitizer form the sheets prescribe reaches the forked JVM. - `python3 dev/varka_push_check.py`: passed (R4: pre-commit over the range, plan lint, quote check, census check; 935 counted lines, under the cap). **Cold read.** Each sheet was given, with `BUILD_SHEETS.md` and the repository only, to a read-only agent on a smaller model. Each agent listed (a) every choice the sheet does not decide and (b) every step it cannot run as written. The sheets were fixed and the read repeated, at most three rounds: - **Round 1** (one agent per sheet) found real gaps, all fixed: - 502: a premise grep whose escaped `|` matched nothing; the `sameClass` threading through `done`/`failed`; the replay files' constructor arguments; the push check's `.class` alternative. - 567: the Java types, building the columns once, a done-when count. - 566: a done-when grep that matched plan text and an unrelated test local; a missing import. - 495: the seven `coverage` destructurings, not two; the claim call inside `coverageOf`. - All four sheets: the commit subjects, where predictions are scored, how a planted fault is checked. - **Round 2** (fresh agents) found: - 495: `read`'s self-shadowing local and the compile block's `Option`; - 566: a name clash in the history probe and the javadoc to move; - 502: the branch and base, the revert of uncommitted work, the ruff command. All fixed. - **Round 3** (one agent over all four) found nothing open in 567 and 566. It found one premise wording in 502 and, in 495, no check of whether 567 had merged. Both are fixed. Left: none known; what only a run can show (whether the boolean query fuses, whether `sameClass` holds on today's replays, whether the `InSet` equalities hold) is covered by each sheet's stop rules. - **The coordinator's two points** on `BUILD_SHEETS.md` (from apache#1512's cold reads) are settled here. The push check now runs after the commit, amending if it changes anything. The attribution is stated as `Generated-by: <tool name> (<model name>)`. **Merge order.** apache#1511 and apache#1512 (groups 2 and 3) reference `BUILD_SHEETS.md`, so this pull request merges first. **Review.** One `/code-review high` pass (branch `varka-buildsheets-1`): found 10 / fixed 8 / left 2. Fixed: - the branch-exists check's glob and order; - 566's done-when count, and its prescribed line, which was over 100 columns; - 502's dropped `Probe` fault, replaced by planted fault 5, and the dropped `emitter-and-ir.md` edit, both stated; - the ASCII check's two-dot diff; - `dev/varka_new_lane.py`'s docstring; - a `withOptions` call written as a helper that does not exist. Left: - **`dev/varka_task_new.sh`.** The sheets tell the agent not to run it, because the plan file exists and the template would replace it. - **566's per-batch `outputWidth` call.** It does the same `idOf` lookup the allocator already makes per batch, and caching it is a design change beyond the row. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
### What changes were proposed in this pull request? Build sheets for three rows of milestone 8: 599, 602 and 548 (its first pull request only). A build sheet is a section, "Build sheet (11 November 2026)", at the end of a row's plan file. It is detailed enough that a cheaper coding agent can build the row without making judgment calls and stop at a local commit. Each sheet has a premise re-check (greps with expected output, read at `c62f492fc89`), the scope by file and symbol with the code shape and an OUT OF SCOPE list, tests with independent oracles, a planted-fault step, exact commands with expected output, a done-when check, a size estimate, stop rules, the decisions already taken, and what the owner must do afterwards. The rules every sheet shares (worktree, lock, environment, regeneration, linters, commit format, no push) are in `sql/varka/plans/m8/BUILD_SHEETS.md`, which comes from the group-1 pull request. These sheets reference it and do not write it. - **599** (`VARKA-599.md`, new): `dev/varka_bench_sections.py restore` also lists untracked results files. A new pure function, `runner_target`, maps a run's plain `<Class>-jdk25-results.txt` to the committed `-runner-epyc7763` file (or its `-128bit` companion at `-XX:MaxVectorSize=16`). It does so only when the run's CPU check passed against `AMD EPYC 7763`, and refuses otherwise (only for a file holding the requested sections). The workflow passes two raw facts, `--cpu-checked` (from `steps.probe.outcome` and `expected-cpu`) and `--java-options`. Seven self-test cases in a scratch git repository are the oracle, and the self-test joins the Build's house-rules step. The proving dispatch, with run 42900850708's inputs, is listed as the owner's. Counted lines in this PR: 986 of the 1000 cap, nearly all of it code the agents will paste. - **602** (`VARKA-602.md`, new): the composition fuzzer's three filters become `VarkaCoverageRows.Filter` values with an `owedBy` field (decided: a field, not a map; all three are owed by VARKA-352). A new test does four things. It checks each filter against the column types of the row's resolved expression, which serve as the oracle. It asserts that the drawn rows plus those declined alone match the oracle's count of rows that read no filtered type. It prints four `coverage accounting:` lines. And it fails on a filter that names no owing row. The nightly's summary grep picks those lines up. The row's 686 rows have become 700 on master (205 left out), and the sheet hard-codes no count. - **548**, PR 1 (appended to `VARKA-548.md`): the `arch-list` rule in `dev/varka_lint.py`, with five self-test cases. One of them is a non-Varka file, since upstream `NativeDataSourcePackage.scala` holds two literals on one line. The sheet also moves three test lines onto `VarkaHostIsa.isX86`, and marks `hostTest`'s two pinned lines `arch-list: ok`. It records that 548 Q1 = (a) is the plan's recommendation, taken by the lead on 11 November 2026, and lists apache#1461 and apache#1478 with "rebase if merged first". The `global-fault` rule and the fault move stay out. The Python and workflow changes in the 599 and 548 sheets were prototyped in a throwaway worktree and then discarded. The self-test counts, the planted-fault messages, the `actionlint` counts and the push check's suite choice quoted in the sheets come from those runs. ### Why are the changes needed? The owner asked for these rows to be buildable next week by a cheaper agent, with review and push staying with the lead. A sheet that leaves a choice open, or quotes a stale line number, sends that agent either into guessing or back to the lead. ### Does this PR introduce _any_ user-facing change? No. Plans only. ### How was this patch tested? - `python3 dev/varka_plan_lint.py --check --offline` and the same check on the three plan files: 0 findings. `dev/varka_push_check.py`: passed (no suite chosen). - Every S0 grep in the sheets was run at `c62f492fc89` and its output written in as the expected one. - Cold read (a haiku agent given only a sheet, `BUILD_SHEETS.md` and the repository; three rounds, each round's findings fixed before the next): - 548: round 1 found 12 items (unscored predictions, revert method, count wording); round 2 had none of substance; round 3 found none. - 599: round 1 found 11 items (check order against `BUILD_SHEETS.md`, expected self-test output, the reason for the open-PR overlap); round 2 found one (the exact `AMD EPYC 7763` match, now stated as intended); round 3 found two (a usage line over 100 columns, the docstring position), both fixed. - 602: round 1 found 9 items, including a planted fault that could not fail (no row reads `d8` alone, so it is replaced by a `b2` fault) and a caller grep with false hits; round 3 found two (the import width, now justified by scalastyle's `ignoreImports`). - Left for the lead: whether `DECIMAL`'s filter is owed to `VARKA-347`, as `VARKA-352.md` 5 and `types.tsv` have it for the Spark-level site, rather than to 352 as the row says. The sheet builds 352 and says the lead may re-point it in review. The step labels follow the `BUILD_SHEETS.md` draft's `B0` to `B9`. One `/code-review high` pass: found 9 / fixed 8 / left 1. Fixed: - 599: `restore` refused a runner-named class's plain file before checking whether it held the sections, so a wildcard run would fail. It now refuses only a file holding them, and a new self-test case covers it. Also fixed: the usage line width, and a repeated `git show`. - 602: the accounting identity was true by construction. It now compares the drawn pools with the oracle's count of rows that read no filtered type. The stop rule on rows matching two filters now has a check that can fire. - 548: `hostTest` would have looped over `VarkaHostIsa`'s own list. It now keeps its literals under an `arch-list: ok` marker, with a fifth self-test case, so `VarkaHostIsa.java` is no longer touched and cannot conflict with apache#1461. Also dropped: a stale `SparkBuild.scala` mention. - All three: a premise check that `BUILD_SHEETS.md` is present. Left: the `steps.probe.outcome == 'success'` guard in 599's `CPU_CHECKED`. It is redundant while `continue-on-error` is tied to a blank `expected-cpu`, and is kept so the check still holds if that tie changes. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
### What changes were proposed in this pull request? Plan documents only: six compiler improvements, accepted by the owner on 11 November 2026, are added to the milestone 9 scope catalogue (`sql/varka/plans/m9/SCOPE.md`). Each is a proposal to be measured, not a committed design. Three of them were already partly in the catalogue, so they extend an existing item with a dated paragraph rather than adding a duplicate. The other three are new items 134 to 136. 1. **Check the host's capabilities when emitting, not only when benchmarking: new item 134.** `operator_census.json` records, per host and vector width, whether C2 vectorizes each operator, allocates, or falls back to the Vector API's Java code. No main source reads it. Row 597's decimal readers fuse at 128 bits on x86, where the EPYC 7763's census cells put their slot load in the fallback, and a benchmark found the loss. The item makes each lowering name the census cells it depends on. Planning then treats a fallback cell on the target host as a predicted cost, which item 131's admission step weighs. It is not a refusal by itself, because apache#1262 kept two-lane projections that win although their compare cell reads fallback. It is new rather than part of row 551 or items 127 and 131, because those read HotSpot's feature list or decide *where* a choice is made. None of them use the measured census as the source, and the item sets out how it relates to each. 2. **Compute node properties instead of keeping hand-written lists: extends item 47.** Item 47, "One place per node", was deferred until a second concrete case arrived. The new paragraph records that case. Facts that consumers need sit in `instanceof` lists that miss nodes: the apache#1462 review found `mayHoldOtherNaN` skipping its blend without checking the rounding mode, and row 597 records that apache#1478's `readsDecimal` misses `bigintPair`. The paragraph proposes finishing row 489's descriptor, so the analysis derives these facts bottom-up. The descriptor has to be rebuilt over master, because its branch predates apache#1329. Item 51's mapping type is noted as one more field of the same record. 3. **One admission decision instead of a decline rule per row: extends item 131.** Item 131 already proposes letting the cost model make the two-lane decline. The extension widens it to rows 503, 596, 597 and 603 as one admission step per shape, host and width. That step reads measured costs and item 134's table and refuses with a named reason. It also records that `VarkaEmitCost.kindOf` counts `rint` with and without apache#1462's blend as one feature, which a refit would average. 4. **A hash-consed IR: new item 135.** No item proposes interning. Item 11 has only a one-line design note, and item 85 is about jegg and storage layout. The item starts from row 559 (apache#1329), which cached node hashes and chose that over interning, and lists the walks that still run once per path: the lane lifts, and `equals` over disjoint copies. 5. **Tests that prove they reach the code they claim to test: new item 136.** No item covers this. Two cases from the 11 November reviews show the problem: a test on apache#1436 that passes on an earlier output-type decline, and apache#1425's body claiming checked answers for a test that only asserts no fusion. The item proposes two fixes. Each decline carries the name of the rule that produced it, as `VarkaKernelPlan.Refusal` already carries a kind. The harness records which nodes and lowerings a test reached. `VarkaCompileObserver` is the starting point, but it needs a second listener slot and a lowering report. Item 82's mutation runs are cited as the related check. 6. **Generated files that stop conflicting on every merge: extends item 121.** Item 121 was moved to milestone 8 as row 546, whose merge driver (apache#1293) merged. The new paragraph records what is still left. Every merge still regenerates `option_arms` and the docs blocks and needs another Build, and apache#1448 found four option-arm digests stale on master with no text conflict. The paragraph proposes splitting the files and digests per shape or family, or committing an input digest that CI checks. It notes that row 546 had ruled out CI committing files, because the fork has no token for it. A note further out, folded into **item 1** (decimal lanes) as the owner asked: a general multi-word integer lane for decimals above 18 digits, instead of the per-operation work of rows 359 to 364. Corrections to the evidence as first stated, made after checking it against the tree: - Item 135 does not claim the coverage harness's 45% planning share. `m8/results/VARKA-510-planning-local.txt` puts 45.1% in Spark's analyzer and optimizer, and only 11.7% in Varka's compile and emit, which is the share an interned IR can cut. - The "planning doubles per level" cost of row 561 was fixed for hashing by row 559 (apache#1329), so item 135 cites only the walks that remain. - Row 541's CSE mismatch is between two of Spark's own code generators on the fallback path, so the item says it is outside the IR. - The "60 to 75 minute regeneration" is left out. No committed file records it, and the laptop's regeneration logs of 10 and 11 November show 1 to 23 minutes of sbt time. - The note's rows are 359 to 364, which is the lane-pair range in the milestone 8 header. Row 365 is a read-path fix and row 366 a cast to floating point. One `/code-review high` pass: found 10 / fixed 9 / left 1 (the title says "compiler items" though item 121 is harness work, kept because the owner's brief names the six that way). Fixed: item 134 now treats a census cell that reads F as a predicted cost for item 131's admission step to weigh, not as a refusal on its own, because apache#1262 kept the two-lane projections whose cells read F; items 131 and 134 are one piece of work, with the table built first; item 135 says interning still needs one shared identity memo for the walks; item 47 limits "may raise" to fused subtrees, notes that the 489 branch predates apache#1329, and points its done-when at what apache#1462 and apache#1478 bring to master; item 121's note marks that it stays in milestone 9 and depends on item 129's merge-result build for the stale-digest case; item 136 states `VarkaCompileObserver`'s single listener and that it reports no lowerings; item 131 takes a node's key from row 489's cost kind, and keeps a test for a second lowering of an existing node. A follow-up self-check also tightened four citations: the census's `long.LT` cell, row 559's "every node with a child", row 541's two gates, and the regeneration command's name. ### Why are the changes needed? Several recent problems follow the same patterns. A form known to fall back on a host was still emitted, and only a later EPYC run found it. A hand-written list missed a node or a mode. A decline rule was added for one row at a time. A test passed for a reason other than the one it names. Generated files cost every merge a regeneration and a Build. Recording these as scope items, with their evidence, keeps the fixes general instead of patched one row at a time. Extending the existing items, rather than adding near-duplicates, keeps the catalogue with one entry per idea. ### Does this PR introduce _any_ user-facing change? No. Plan documents only. ### How was this patch tested? `python3 dev/varka_plan_lint.py --check --offline` reports 0 findings. `python3 dev/varka_push_check.py` passes: pre-commit, plan lint, quote check, census check, and 138 counted lines against the cap of 1000. Every row, pull request, file and identifier cited in the new text was checked against `sql/varka/plans/m8/PLAN.md`, the tree at `origin/master`, or the open branches it names. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
…sources (apache#1514) ### What changes were proposed in this pull request? Adds row 607 to the task table of milestone 8 (`sql/varka/plans/m8/PLAN.md`, section 3). It is a plan-only change; no code moves. The test sources rewrite an `In` row into an `InSet` row in three places. Row 567 already plans to merge two of them, in `VarkaWarmupReach.java` and `VarkaEmittedBytesSuite.scala`, into one helper, `VarkaSqlResolve.inSetAsClaimed`. The third copy is `VarkaWidthAuditShapes.asCatalystClaims`. It rewrites only lists made entirely of `Literal`s, so the decimal row `d18 IN (...)`, whose elements arrive under a cast, reaches the width audit as an `In`. Row 607 moves that copy onto the helper too. Done when: `asCatalystClaims` is gone and the audit calls `inSetAsClaimed` and fails loudly the way the helper does. A grep for the `InSet` claim reads finds no rewrite outside the helper, and a test shows the audit's `d18` row arrives as an `InSet`. `VarkaMaskOfWordSuite` passes. Running `dev/varka_regen_generated.sh --all` on the audit's host leaves `width_audit.json`, `coverage.json` and the docs blocks unchanged, or the PR explains each row that moves. The row starts after row 567 lands and after apache#1478 and apache#1484 merge. ### Why are the changes needed? With three copies, a fix can land in one and miss the others. That already happened once: only one copy knew that a decimal row's elements arrive under a cast, and the reach suite failed on the new decimal rows. Row 567's build sheet (apache#1513) left this third copy out because changing it could move `sql/varka/width_audit.json`, which the open PRs apache#1478 and apache#1484 also edit. Without a row of its own, nothing would track it. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? `dev/varka_plan_lint.py --check --offline`, `dev/varka_census.py --check` and `dev/varka_push_check.py` pass. One `/code-review high` pass: found 9 / fixed 9 / left 0. All nine were about the done-when: it named no exact grep, did not require `--all` or say which host, did not cover `VarkaMaskOfWordSuite`, had no test showing the fix took effect, and did not say whether the audit fails loudly. The review also noted that the helper does not exist yet, which the row's wording now says, and that the references column left out the row's dependencies. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
…ould fuse (apache#1486) ### What changes were proposed in this pull request? When the Varka predicate compiler would fuse only `IS NOT NULL` tests of columns, with at least one other conjunct left on the row path, it now declines the whole filter. The filter then stays as Spark's own whole-stage `Filter`, the same plan the row path runs. How such a filter looked before this change. Spark's optimizer infers `IS NOT NULL` for each column that a null-intolerant condition reads. So `WHERE x * y < z` reaches the plan as `isnotnull(x) AND isnotnull(y) AND isnotnull(z) AND x * y < z`. For a `DECIMAL(15, 2)` product, or a checked `BIGINT` sum, no lowering computes the comparison, so it declines. The three null tests still fused, and the plan was split in two: ``` *(1) Filter ((x15 * y15) < cast(z15 as decimal(31,4))) +- VarkaFilterColumnarToRow ((isnotnull(x15) AND isnotnull(y15)) AND isnotnull(z15)), ... ``` The kernel reads the validity words and sets a selection bitmap. The to-row node then copies every selected row into an `UnsafeRow`, with every column the residual reads. The row `Filter` above evaluates the comparison over those rows. Spark's own plan reads the batch's vectors in place inside one whole-stage loop, where the null checks cost close to nothing. The inferred tests pass nearly every row, so the kernel saves the row filter almost no work. The extra pass and the copy are pure overhead. The rule is `nullTestsAlone` in `VarkaExpressionCompiler.predicate`. It runs inside the demotion loop, beside the conjunct-order rule (VARKA-380), so it is asked again after every demotion. A size demotion that leaves only these tests fused therefore declines them too. Each demoted test carries the reason in the compiler's per-conjunct explanation (`explainPredicate`): "only IS NOT NULL tests would fuse while another conjunct stays on the row path, ...". No Varka node is planned, so EXPLAIN shows Spark's own `Filter`. The decline belongs to the compiler, so the rule at planning and the task-side compile agree. It does not depend on the host. The cost is on the row side, and no lane width or emit level changes it, so no admission setting or configuration is added. What still fuses, both measured faster than the row path (below): - `IS NOT NULL` tests with nothing left over: there the kernel is the whole filter. - `IS NULL` beside a residual: written by a user, it usually passes few rows, so the kernel spares the row filter most of its work. It ties with no row passing and wins with one row in ten passing. A filter whose fused part reads a value (`isnotnull(l) AND l < 5 AND <residual>`) keeps its split. This PR does not measure that shape. The baselines' declared classes follow. In `VarkaDecimalBaselineBenchmark` the twelve `NULL_TESTS` sections become `NONE`: the lane pair's `-x < y` and `abs(x) < y` filters, at two precisions and two densities, and the `x + y < z` and `x * y < z` widening filters, at two densities. In `VarkaDayTimeIntervalBaselineBenchmark` the two `extract(HOUR FROM dt) >= 12` filters become `NONE`. In `VarkaBigintArithmeticBaselineBenchmark` (apache#1455) the two `filter l + l2 > 0, ANSI` sections, one per null density, become `NONE`. The other classes, and the two-lane refusal's lists, are unchanged. The committed runner results are not regenerated. Their varka on arm timed the split, and it now times Spark's plan, the same as the row path arm. `VarkaCoverageSuite` counts `Attribute` as infrastructure, next to `BoundReference`, because the rule asks it of a null test's operand. Two lessons go into `sql/varka/skills/`: the split's cost, and the fact that `dev/varka_regen_generated.sh --all` does not regenerate the golden corpus. ### Why are the changes needed? On the EPYC 7763 at 256 bits, every baseline section of this shape ran slower with Varka on than on Spark's row path: - `VarkaBigintArithmeticBaselineBenchmark`'s `filter l + l2 > 0, ANSI`: 0.74x without nulls and 0.82x at one row in ten null (apache#1455's runner results). - `VarkaDecimalBaselineBenchmark`'s `DECIMAL(15, 2) x * y < z filter`: 0.77x and 0.87x (apache#1475). - The eighteen other sections that the committed decimal runner file notes as fusing only their null tests, all slower. - The day-time baseline's `extract(HOUR)` filter (apache#1351). At 128 bits these sections tie, because the two-lane refusal already leaves their conditions to the row path there. The cause was measured on the laptop with a probe, `VarkaNullTestFilterProbe`, at the runners' level and width (`-XX:UseAVX=2 -XX:MaxVectorSize=32`), over the decimal baseline's 2,000,000 Arrow-cached rows. Best times in ms, row path then Varka on: | query | no nulls | one row in ten null | |---|---|---| | `x * y < z`, the baseline's section | 366 / 425 (0.86x) | 266 / 349 (0.76x) | | the three `IS NOT NULL` alone, `x` out | 126 / 44 | 106 / 64 | | the three `IS NOT NULL` alone, `x, y, z` out | 145 / 47 | 147 / 66 | | `y IS NULL AND (x * y) IS NULL` | 29 / 25 | 75 / 44 | The split's extra time over the row path is 59 and 83 ms. That is about the null-test kernel with all three columns copied out, 47 and 66 ms. So the row filter above costs about what Spark's whole filter does, and the kernel's pass plus the copy accounts for about the whole loss. A cheaper handoff would have to let the row filter read the batch in place, and that is Spark's plan, so declining is the cheapest handoff. The same kernel with nothing above it beats the row path by 2.2x to 3.1x. The selective `IS NULL` arm ties with no row passing (1.1x to 1.2x over the runs, under the 1.3x a claim needs) and wins at one row in ten (1.4x to 1.7x). That is why the rule covers only `IS NOT NULL`. After the change the section's two arms plan alike and time alike: 334 / 311 and 218 / 211 ms. The full output, three runs with the machine's load, is in `sql/varka/plans/m8/results/VARKA-598-probe.txt`. The laptop was shared with other jobs, so the arms are compared within a run. ### Does this PR introduce _any_ user-facing change? No. Answers are unchanged. With Varka enabled, a filter of this shape now runs as Spark's own plan instead of a Varka filter under a row filter. ### How was this patch tested? - `VarkaExpressionCompilerSuite`, new test, at `useAVX` -1, 2 and 3 (the unnamed level and the named ones). `isnotnull(i) AND sh > 5` declines whole, the reason is on the null test, and the residual keeps its own reason. A value conjunct beside the null test keeps the split. `IS NOT NULL` with nothing left over fuses. `IS NULL` beside the residual fuses. - `VarkaDecimalBaselineQueriesSuite`, new test, over the baseline's table at both densities and the three levels. The `x * y < z` filter plans no Varka filter and is `NONE`. `x IS NOT NULL` is `WHOLE`. `y IS NULL AND (x * y) IS NULL` keeps its Varka filter. Both sessions answer all three alike. The existing class check holds every section's new class, with the two-lane refusal off and on. - `VarkaDayTimeIntervalBaselineQueriesSuite` and `VarkaBigintArithmeticBaselineQueriesSuite`: the filters' classes are `NONE`. - `dev/varka_regen_generated.sh --all` moved no generated file. The golden corpus has its own regeneration (`VARKA_GOLDEN_REGEN=true`), and it moves all 139 of its `PARTIAL` filters to `PLAIN`. These are its `(expr) IS NOT NULL` filters, whose only fused part was the inferred column tests under a row filter. - Suites on the laptop, all green: - `VarkaExpressionCompilerSuite` and `VarkaConjunctOrderSuite`. - The decimal and day-time queries suites, `VarkaFilterExecSuite`, `VarkaFallbackReasonSuite`, `VarkaFamilySwitchQuerySuite`, `VarkaDifferentialSuite`, `VarkaDecimalReadPathSuite`, `VarkaLongLaneSuite`, `VarkaFloatingLaneSuite`, `VarkaCoverageDifferentialSuite`, `VarkaGoldenCorpusSuite` and `VarkaTwoLaneDefault128Suite`: 368 tests. - The regeneration's own suites. - `dev/varka_matrix.sh --defaults --split 4 -j 4`, every Varka suite at the defaults (198 suites), on the AVX-512 laptop at its native width and again with `--jvm-arg -XX:MaxVectorSize=16`: 4481 passed, 0 failed, 102 canceled by design, at both widths. - Every baseline benchmark passes its plan-only dry run (`-Dvarka.bench.dryRun=true`) under `-XX:UseAVX=2`, at `MaxVectorSize=32` and at `MaxVectorSize=16`. There were eleven on master before the merge. - Merged with master on 11 November 2026 (to apache#1483), which brought the BIGINT baseline (apache#1455) and the decimal conformance suites (apache#1448). The merge had no conflicts. `dev/varka_regen_generated.sh --all` ran on the merge, and the BIGINT sections' classes were changed as above. After the merge, on the laptop, all green: `VarkaExpressionCompilerSuite`, `VarkaConjunctOrderSuite`, `VarkaCoverageSuite` and the two decimal conformance suites (205 tests, 12 canceled by design: owed register rows and an opt-in dump); every `*BaselineQueriesSuite` (12), `VarkaGoldenCorpusSuite` and `VarkaTwoLaneDefault128Suite` (47 tests); and the plan-only dry runs of the BIGINT, decimal and day-time baselines under `-XX:UseAVX=2` at `MaxVectorSize=32` and `MaxVectorSize=16`. - A second review (`/code-review high`) of the merge and the BIGINT commit asked for the plan's files and tests lists to name the BIGINT baseline and for its `sections` doc to say why no class reads the refusal flag now; both done. The committed BIGINT runner results still note the filter fusing its null tests, kept like the decimal and day-time ones. - Review (`/code-review high`) found two suites that this change moves: - `VarkaTwoLaneDefault128Suite` expected `WHERE i < l` at two long lanes to keep the inferred `isnotnull(i)` as a kernel next to the refused long comparison. That is exactly this shape, so the expectation is now that it stays whole. - The golden corpus, regenerated as above. It also asked for a `PinsDefaults` tag on the new queries test and for the `NULL_TESTS` class doc to be updated. Both are done. Kept as trade-offs: - The rule reads syntax, so a user's selective `IS NOT NULL` over a mostly null column, next to a residual, now declines too. Plan time has no null count. - The decline sits in the compiler, not in the columnar rule, so that the planning compile, `explainPredicate` and the task's compile give the same answer and reason, as the size and order demotions already do. - A declined filter is compiled once before it is demoted. That is a planning cost only. Overlaps: - apache#1478 (row 596) edits the comment and the `VALUE` entry next to this PR's `NEGATED`/`ABS` entries in `VarkaDecimalBaselineBenchmark.sections`. The textual conflict is trivial, and the two rules compose: 596 declines a projection's boolean output at two long lanes, and this PR declines a filter at every width. - apache#1442 (row 339) changes NTZ month forms, which this PR does not touch. - apache#1484 (row 104) makes the BIGINT baseline's two `filter l + l2 > 0, ANSI` sections fuse `WHOLE` at 256 bits; whichever of apache#1484 and this PR merges second takes apache#1484's classes for those two sections. - Merged master e48a856. In `VarkaDecimalBaselineBenchmark`, two rules touch different sections, and both are kept: VARKA-596's (the projected decimal comparison is `NONE` where the session refuses 64-bit conditions) and this PR's (a filter of which only inferred null tests would fuse is `NONE`). The class's fuse check passes with the refusal on and off. `golden_corpus.json` was regenerated with `VARKA_GOLDEN_REGEN=true`; against master, the only change is 140 filters moving from `PARTIAL` to `PLAIN`. PLAN.md keeps master's rows 603 and 605 to 607 beside row 598, with rows 361 and 601 updated to match. Checks: both modules' test compile, `VarkaExpressionCompilerSuite` (177), `VarkaGoldenCorpusSuite` (4), `VarkaDecimalBaselineQueriesSuite` (21, the fuse check among them) and `VarkaTwoLaneDefault128Suite` (25), `dev/varka_regen_generated.sh --all` and `dev/varka_push_check.py`. One `/code-review high` pass on the resolution: found 6, fixed 4, left 2 (two ragged javadoc lines, and a sentence in `VarkaSqlBenchmarkBase`'s `NULL_TESTS` description whose neighbour reads as if it described `NONE`). - The EPYC 7763 runs of `VarkaDecimalBaselineBenchmark` and `VarkaDayTimeIntervalBaselineBenchmark` on this branch are not in this PR. The DayTime run passed, but the Decimal run never landed on a 7763 in six attempts. Both sets of numbers follow in a results PR, measured after this one merges, and row 598 stays Started until then. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
### What changes were proposed in this pull request? `VarkaHostIsa` holds the one list of the `os.arch` names x86 HotSpot uses (`amd64`, `x86_64`), and a test that repeats the pair in its own list is a second copy of a fact the compiler reads from one place. The two copies drift: when one changes and not the other, a host test either stops covering x86 without failing, or tests names the host cannot report, and nothing says so. The two-lane decline's branch (apache#1262) found exactly that in a test helper, and master had five such test lines in four files. This adds the `arch-list` rule to `dev/varka_lint.py`. It reports a line of a Varka `.java` or `.scala` file, with its comment removed, that holds two or more distinct literals among `"amd64"`, `"x86_64"` and `"aarch64"`, and points at `VarkaHostIsa.isX86(arch)`. Files whose basename starts with `VarkaHostIsa` are exempt: `VarkaHostIsa` holds the list, and its suite must pin the names `os.arch` actually reports rather than loop over the list it is testing, which would test the list against itself. A line that has to pin the names on purpose says `arch-list: ok`, as `nan-compare`'s lines do. The rule is scoped to written lines like the other line rules, so a commit is judged only on what it writes, and five self-test cases cover the reported loop, a single literal, the exempt suite, a non-Varka file and the marker. The five test lines on master stop naming the list themselves. `VarkaTwoLaneConditionSuite`'s two loops keep their literals and gain `// arch-list: ok, the os.arch names pinned`, because that test exists to check the two names `os.arch` gives x86. `VarkaAvx2SelectSuite`, `VarkaAssemblySuite` and `VarkaShapeCacheSuite` call `VarkaHostIsa.isX86(arch)`; `VarkaAssemblySuite`'s `supportedArches` value and its scaladoc are gone, the scaladoc moving to `requireSupportedArch`, whose `assume` now calls `isX86`. `VarkaHostIsa.java` is untouched. This is the first of the row's two pull requests. The second, the `global-fault` rule and the move of the floating fault into the emit options, is separate and waits on the row's remaining questions. ### Why are the changes needed? A second list of CPU architectures drifts from the compiler's host fact, and the drift is silent: a host test that named a stale pair would keep passing on the machine that has the new name or quietly stop running on the one that has the old. A reviewer can catch the copy in a diff, but not the next one. The lint makes it a finding at commit time, with the shared accessor named in the message, so the fix is the one place the fact lives; the two places that must pin the names say why they do. ### Does this PR introduce _any_ user-facing change? No. The lint is a development check and the five edited suites keep their assertions; `VarkaHostIsa.isX86(arch)` is the same `X86.contains(arch)` that the deleted `supportedArches.contains(arch)` and the two comparisons spelled out. No SQL answer, plan decision, emitted kernel or generated file changes. ### How was this patch tested? - Premise re-check on the branch point: pull requests apache#1461 and apache#1478 had merged, so the branch was cut from master `fb661840a3e` and the checks repeated there. The seven `os.arch` pair lines are the same as the plan's, the two in `VarkaTwoLaneConditionSuite` now at `:74` and `:89`; the self-test still held 49 cases before this change. - `python3 dev/varka_lint.py --selftest`: `varka_lint selftest: ok (60 cases)` — the original five, five more from the review round (a Varka `.scala` path, the `aarch64` alternative, one name twice, a Javadoc line, a text block) and a canary probe. - `ruff format --check dev/varka_lint.py && ruff check dev/varka_lint.py`: `1 file already formatted`, `All checks passed!`; `ruff check dev && ruff format --check dev`: `All checks passed!`, `82 files already formatted`. - Unscoped over every Varka source (`git ls-files -z '*.java' '*.scala' | grep -z Varka | xargs -0 python3 dev/varka_lint.py`): `arch-list` finds `0`; the only finding is the known `import-root` at `VarkaMaskOfWordSuite.java:29`. - `build/sbt catalyst/Test/compile` under the heavy lock: `[success]` in 110 s. - `dev/varka_matrix.sh --defaults --out target/varka-548 -j 2 --module catalyst --suites VarkaTwoLaneConditionSuite,VarkaAvx2SelectSuite,VarkaHostIsaSuite,VarkaAssemblySuite,VarkaShapeCacheSuite`: exit 0; 50 succeeded, 0 failed, 14 canceled, all `VarkaAssemblySuite`'s `assume` for a missing hsdis disassembler, which this host does not have. - Planted faults, each reverted by hand. (1) The rule's `>= 2` as `>= 3` printed `varka_lint selftest: arch-list True: m/src/test/java/VarkaZSuite.java: expected True, got False` and exited 1. (2) Putting `val x86 = arch == "amd64" || arch == "x86_64"` back in `VarkaShapeCacheSuite` printed one `arch-list` line at `VarkaShapeCacheSuite.scala:317`; after the revert the unscoped run was `0` again. - `git diff --exit-code origin/master -- sql/varka/emitted_bytes.json sql/varka/coverage.json sql/varka/width_audit.json`: exit 0. - `dev/varka_precommit.sh`: 7 files, no findings. `dev/varka_errorprone.sh --master fb66184`: 122 files, 10 s, exit 0 (37 classes pending NullAway). `dev/lint-scala`: "Scalastyle checks passed. Scalafmt checks passed." `dev/lint-java`: "Checkstyle checks passed." `python3 dev/varka_plan_lint.py --check --offline`: 0 findings. - `python3 dev/varka_push_check.py` passes on the final head: 154 counted lines of 154 changed against `fb661840a3e`, under the 1000-line cap; it chose no suite, since no Varka main file changed. The build sheet's estimate was about 65, so this is over its half-again stop: the overrun is the review round's six self-test cases and this record, and the change stays one commit. **Review.** One `/code-review high` pass found fourteen points. Fixed: the rule counted the os.arch names inside block comments and text blocks — a Javadoc line or a message naming two architectures would have been reported as a second list — so it now skips comment lines and a text block's delimiters and content, and the new self-test cases pin that; it also lints the `dev/varka_canary/` probes, as `nan-compare` does; the finding's advice now says "for an x86 check call `VarkaHostIsa.isX86(arch)`, and mark a line that pins the names", since `isX86` answers false on aarch64; six self-test cases were added (a Varka `.scala` path, the `aarch64` alternative, one name twice, a Javadoc line, a text block, a canary probe) and every case's failure message now quotes its fixture. Left, with the reason: the `VarkaHostIsa` prefix exemption is the plan's question 1 decision; the rule's own copy of the three names is the sheet's design (distinct literals count, the docstring is the only documentation); the two identical pinned lines in `VarkaTwoLaneConditionSuite` are B1's; matching the marker on the raw line lets a string literal contain it, which the marker's own comment form keeps harmless; the file-scan preamble follows the other rules' shape; and the per-line `without_comment` call costs about 15 ms a commit, as the review measured. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (deepseek-flash[1m])
This is going to be used in https://issues.apache.org/jira/browse/SPARK-2568