Skip to content

SPARK-2596 A tool for mirroring github pull requests on JIRA. - #1496

Closed
pwendell wants to merge 4 commits into
apache:masterfrom
pwendell:github-integration
Closed

pwendell wants to merge 4 commits into
apache:masterfrom
pwendell:github-integration

Conversation

@pwendell

Copy link
Copy Markdown
Contributor

For a bunch of reasons we should automatically populate a JIRA with information about new pull requests when they arrive. I've written a small python script to do this that we can run from Jenkins every 5 or 10 minutes to keep things in sync.

@SparkQA

SparkQA commented Jul 19, 2014

Copy link
Copy Markdown

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

@SparkQA

SparkQA commented Jul 19, 2014

Copy link
Copy Markdown

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

@SparkQA

SparkQA commented Jul 20, 2014

Copy link
Copy Markdown

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

@SparkQA

SparkQA commented Jul 20, 2014

Copy link
Copy Markdown

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

@SparkQA

SparkQA commented Jul 20, 2014

Copy link
Copy Markdown

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

@asfgit asfgit closed this in 49e4727 Jul 20, 2014
@SparkQA

SparkQA commented Jul 20, 2014

Copy link
Copy Markdown

QA results for PR 1496:
- 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/16859/consoleFull

xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
For a bunch of reasons we should automatically populate a JIRA with information about new pull requests when they arrive. I've written a small python script to do this that we can run from Jenkins every 5 or 10 minutes to keep things in sync.

Author: Patrick Wendell <pwendell@gmail.com>

Closes apache#1496 from pwendell/github-integration and squashes the following commits:

55ad226 [Patrick Wendell] Small fix
afda547 [Patrick Wendell] Use sequence instead of dictiory for JIRA's
3e18cc1 [Patrick Wendell] Small edits
84c5606 [Patrick Wendell] SPARK-2596 A tool for mirroring github pull requests on JIRA.
github-actions Bot pushed a commit to MaxGekk/spark that referenced this pull request Nov 11, 2026
…ache#1496)

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

Varka's 64-bit decimal kernels were proven in `sql/varka/proofs/refinement.smt2` by rows written by hand: each row typed the kernel as an SMT string, such as `(< (jlong.mul a 100) c)`, beside Spark's rule, such as `(< (* a 10000) (* c 100))`. Nothing tied either string to the code. This pull request renders those proofs instead: the kernel side from the IR the compiler actually builds, the specification side from Spark's own analyzed expression.

1. **`sql/varka/proofs/decimal_refinement.smt2`, rendered by the new test class `VarkaDecimalRefinementFile`.** It covers the 43 rows of the coverage table's families "DECIMAL columns" and "DECIMAL arithmetic". Each row is compiled as `VarkaCoverageSuite` compiles a predicate (`compilePredicate`, default options, no host refusal), once under an ANSI session and once under a LEGACY one. Each gets the five checks `refinement.smt2` uses: a satisfiable precondition; a decline wherever the specification raises; equal validity; equal values on valid lanes; and a decline only where the specification raises.
   - **The kernel side** is the proof printer's outcome (`VarkaSmtNodes`) for the kernel's one fused root, with the kernel's own literal tables, every long in the printer's word form.
   - **The specification side** is read from Spark's analyzed `Expression`, one rule per Catalyst node, into `decimal_spec.smt2`'s `spec.dec.*` definitions from apache#1493. A column raises on a valid slot past its precision wherever it is read, as Spark's reader does. A cast rescales up exactly or cuts `HALF_UP`. A sum, difference or product is exact, then fitted to its result type: past it, a raise under ANSI and a null otherwise. Comparisons compare the rationals. `<=>`, `IS NULL`, `greatest`, `coalesce`, `CASE`/`IF`, `IN` and `InSet` follow Spark's semantics, and a later `coalesce` operand or an untaken `CASE` arm raises only where Spark evaluates it. Any other node is refused, not guessed.
   - A row whose two sessions print the same text is checked once. 42 rows render, 320 checks in all. The file's header lists the one refused row, `d8 * d9 <= d9b`: its kernel multiplies two column values, which the printer does not yet render (a product of two unknowns needs the planned limb-product layer).
2. **The retired hand rows.** 31 hand rows go from `refinement.smt2` (226 checks left, from 381). Only `d8 * d9 <= d9b` stays hand-written, in both modes. `try_multiply(d8, d9) IS NULL` renders after all: the compiler reads only its operands' validity, so its kernel has no product.
3. **The coverage table names the rendered file.** The two families' rows now say `rendered: decimal_refinement.smt2`, a new verification kind with its own column in `docs/sql-varka.md`'s counts. `VarkaCoverageSuite` fails a row of either family that the file does not echo, so a row added later is rendered or the build says why not. The equal-scale comparisons, until now checked only differentially, are refined for the first time.
4. **The printed decline is the emitter's, read rather than restated.** The printer's templates used to state by hand which `IfElse` arms qualify a guard. The emitter (`Analysis.armChainsOf`) leaves a guard unqualified in more cases: a decimal slot check, `guardUnderArm` off, past `MAX_ARM_CHAINS` chains, on an arm cycle, and a stored-value guard with several chains. So a printed decline could be smaller than the emitted one, which would make check 5 unsound. The new `VarkaSmtNodes.kernel` takes the guards `VarkaLoopEmitter.guardsForTest` reports, each with its chains. It declines on each guarded node's own check on the lanes some chain selects, or on every lane where there is no chain. A node whose template declines but which the emitter never checks is refused. A stored-value guard (VARKA-379) also reads null rows, as the emitter's does. The samples' oracle reads the same guards, evaluated through `VarkaReference`, and the suite holds the two together on the sampled trees; the hand set gains the date contract guard. The per-node templates go back to their own rule.
5. **No more unshared slot-check walk.** The old arm rule re-walked each choice's subtree for slot checks, quadratic in CASE depth. It is removed, and `kernel` visits each node once.
6. **The printer's compare covers the IEEE compares.** The floating literal compares master gained (`IEEE_EQ`, `IEEE_LT`, `IEEE_LE`) are refused in `VarkaSmtNodes.compare`, as the floating lane they belong to already is, so the switch is exhaustive again and catalyst's tests compile; the arm is byte-identical to a separate fix on master, so the two merge cleanly.
7. **The plans.** `VARKA-506.md` gains section 10.3, `PLAN.md` row 506 is updated, and the proofs README lists the new file.

### Why are the changes needed?

A hand-written kernel string proves the kernel someone typed, not the one the compiler builds. Row 506's own admission check found exactly that gap elsewhere: `year(d) * 2` is proven as a checked multiply while the compiler builds a wrapping one. Rendering the kernel from the compiled IR removes the transcription for the 64-bit decimals. A later change to the compiler's lowering, or to Spark's decimal rules, then moves the proof with it, and `VarkaProofFilesSuite` fails until the file is regenerated and the solvers agree.

Before removing the hand rows, a scratch file paired each of the 31 with its rendered row, the columns mapped by name, and asked Z3 whether any claim differs: the specification's raise, the kernel's decline, the kernel's validity and data, and the specification's value and validity, each where it is read. All 155 queries were `unsat`, so the hand rows were right and nothing proven is lost. The only difference was outside the claims: under LEGACY, five arithmetic rows' hand-written validity ignored a cast's precision check, and that differs only on a slot past its precision, where both specifications raise.

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

No. Test sources, proof files and documentation only. No emitted byte moves.

### How was this patch tested?

- `VarkaProofFilesSuite`, `VarkaSmtNodesSuite`, `VarkaSmtTermSuite` and `VarkaCoverageSuite` (catalyst), after `VARKA_PROOFS_REGEN=true` and `dev/varka_regen_generated.sh --all`.
- `dev/varka_prove.sh --solver both`: every proof holds under Z3 and cvc5. Laptop times: `decimal_refinement.smt2` 0.47 s (Z3) and 0.55 s (cvc5); `refinement.smt2` 2.94 s and 4.13 s, from 2.96 s and 4.22 s; `smt_nodes_check.smt2` 0.03 s and 0.07 s. `--lint` takes 45 s for all files, from 56 s.
- Planted faults on the rendered text, each run and reverted, each failing its own check under both solvers: `d9 < d9s4`'s rescale factor as 10 instead of 100 (check 4); the slot check of `d9 + d9b < d18`'s first column dropped from the decline (check 2); the specification rescaling a column by one digit instead of two (check 4).
- The scratch diff of the 31 retired rows described above.
- `dev/varka_errorprone.sh`, checkstyle on the catalyst tests, `dev/varka_push_check.py`.

### Review

`/code-review high` found ten points. Fixed: the rendered file regenerated after a wording change; `IN` raising only on the items Spark evaluates (none for a null value, none after a match); an `InSet` holding a null, or a literal past a long, refused and listed instead of aborting the render; `kernel` also refusing a node the emitter guards whose template states no check; the variables' sorts taken from the terms rather than their names; `docs/sql-varka.md`'s prose and row 506's stale clause updated.

A second `/code-review high`, after apache#1493 merged, found ten more points. Fixed: a row that does not compile or fuse as one root, and a literal past a long, are refused and listed instead of aborting the render or hiding an unrelated `ArithmeticException` under a false reason; a one-item `IN` prints no one-argument `or`, and its raise term is linear in the list (one running no-earlier-match term); a decimal operator with no rule is no longer reported as a cut scale; `kernel`'s javadoc points at `Analysis.armChainsOf` instead of restating it; the plans record apache#1493's merge.

Left, as trade-offs (both reviews):
- The renderer's seven decimal columns and the `InSet`'s elements copy `VarkaCoverageSuite`'s fixtures. Only the rows' SQL ties the two, because that suite's fixtures are private Scala. A changed fixture type would refine a different kernel than the table runs, until someone updates both.
- The last hand row's helper keeps a `try_` branch no row reaches now; removing it would push the change past the size cap.
- `VarkaSmtNodesSuite` skips a sampled tree for which `guardsForTest` throws an `IllegalArgumentException` or `IllegalStateException`, rather than telling the expected rejection from a regression; the suite's floor of 300 trees held to the emitter's decline still catches a broad one.
- A widening cast keeps its ANSI overflow raise, which can never fire, so 22 rows print differently per session and are checked twice: 110 extra checks, about half a second under both solvers.

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