Repository navigation
Conversation
|
QA tests have started for PR 1366. This patch merges cleanly. |
|
QA results for PR 1366: |
|
This operation seems to assume that a single partition fits in memory -- perhaps this is an assumption of SparkSQL, but it is not a general assumption in Spark, and it can lead to some very hard-to-diagnose failure conditions. Has this been taken into account? |
|
@aarondav, you are totally right. However, the For the 1.2 release I'd like to focus on external algorithms and hopefully start using more of sparks built in data structures for this. |
|
Merging this in master & branch-1.0. Thanks! |
Author: Michael Armbrust <michael@databricks.com> Closes apache#1366 from marmbrus/partialDistinct and squashes the following commits: 12a31ab [Michael Armbrust] Add more efficient distinct operator.
…pache#1366) ### What changes were proposed in this pull request? Brings ten rows of milestone 8's plan up to date with the pull requests that merged their work. Row 572 asked for it, and this is its first part. - **Rows 560, 562 and 568 are `Done`.** 560 and 562 said "done when it merges", and apache#1326 and apache#1335 merged. Row 568's three done-when clauses hold on master since apache#1363: `nanByNess` is gone, the lint rule flags each shape in its self-test and finds no expression in the tree, and the opt-in sweeps passed 46 of 46. - **Rows 554, 555, 557, 558, 559, 563 and 546 stay `Started`,** each now naming the pull request that merged it (apache#1312, apache#1313, apache#1332, apache#1320, apache#1329, apache#1340 with apache#1344, and apache#1293) and its date. I did not mark them `Done`: their done-when clauses name checks, such as a Build failing a change over the cap or a matrix no longer failing a test, that I have not confirmed from a run. Row 563's text no longer lists its pull request as left. - **Row 572 is `Started`** and lists what is left: rows 497, 365 and 503, and the rows the triage named whose text is behind merged work (157, 348, 349, 538, 332, 333, 343, 341, 331, 340, 342, 344, 377 and 330). The PR numbers and merge dates were read from the pull requests. ### Why are the changes needed? A row is the only record of why a change exists. A row that still says "Started" or "left: the pull request" after the pull request merged misleads a reader and any count of the milestone's finished rows. ### Does this PR introduce _any_ user-facing change? No. It changes the plan only. ### How was this patch tested? - `dev/varka_plan_lint.py --check --offline`: 0 findings. - `dev/varka_quote_check.py`: 0 orphans. - The pre-commit rules pass. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Sonnet 5.5)
…pache#1516) ### What changes were proposed in this pull request? This is a plan-only change to milestone 8's task table (`sql/varka/plans/m8/PLAN.md`, section 3). No code moves. It closes one row, corrects the text of another, and adds two rows on the owner's word. | row | change | evidence | | ---: | :--- | :--- | | 572 | Started -> Done | The row asked for every row whose text lagged merged work to be read against its pull requests and corrected in a plan-only PR. apache#1366 and apache#1370 (merged 5 November) did the first readings. apache#1509 (merged 11 November) read every row not `Done` and closed eleven. Of the rows apache#1509 read and left alone, 591 still read as before its merge, and this change fixes it. Row 414 already names apache#1454. Rows whose PRs merged after apache#1509 (578, 592, 593, 596, 603 and 606, all on 12 November) do not name those PRs yet. They are past this reading and are not corrected here. | | 591 | Started (text) | "built" now reads "built and merged as apache#1464 on 11 November 2026". The post-merge check is still owed, so the row stays Started. | | 608 | new, Planned | The filter fallback evaluates the left fold of the fused conjuncts, not Spark's tree (below). | | 609 | new, Planned | A guard in an `IfElse` condition is never qualified by the arms around the `IfElse` (below). | **Row 608.** When no conjunct is residual, `VarkaColumnarRule.rewriteFilter` builds the Varka node's condition as `fusedConjuncts.reduceLeft(And(_, _))` and passes no `wholeCondition`. `VarkaExpressionCompiler.conjuncts` flattens every `AND` of the spine first. When the filter is not whole-stage compiled, `VarkaFilterExecBase.fallbackCondition` returns that fold unchanged, so a batch the kernel declines is filtered by `Predicate.create` over the fold, while Spark's `FilterExec` uses `Predicate.create` over its own tree. With subexpression elimination on, `GeneratePredicate` uses `generateConjunctsWithSubexprCodes`. That keeps an `AND` of the spine that is itself a common subexpression as one conjunct, and evaluates the subexpressions it contains just before it, which is ahead of its first operand (SPARK-61197's mechanism). An `AND` that only Spark's tree has can therefore make Spark raise where Varka answers. The row carries a reproducer worked out by hand and not run, under ANSI with codegen off: `j > 0 AND (i > 1 AND make_date(2021, m, 1) < d) AND IF(i > 1 AND make_date(2021, m, 1) < d, d0, d1) < make_date(2021, m, 1)`. It also notes that this corrects `VARKA-541.md` 0 item 7, which says the two agree by construction when Spark does not compile the filter. Done when the fallback evaluates the filter's own tree and a differential test agrees with Spark under both settings of subexpression elimination. The row starts after row 541, and coordinates with row 386, because both edit `fallbackCondition`. Found in row 541's build. The cause predates that build and is outside 541's scope. **Row 609.** `Analysis.assignArmChain` enters every `IfElse` condition with the empty chain, and the empty chain means unqualified. A guarded node that a condition reads therefore condemns the batch from any lane, including lanes of an enclosing arm that is not taken. The result is lost fusion: the batch declines to the row path, which answers as Spark does. The example on master, found by reading the code: `abs` of a year-month interval is `IfElse(x < 0, -x, x)`, and `ym - ymm` is a checked subtraction. In `CASE WHEN <guard> < 0 THEN abs(ym - ymm) ELSE <column> END`, and as a later COALESCE argument, the extremes row's overflow condemns the batch. Spark answers there. Once step 103a1 lands, `abs(dt * 3)` is the same case. Done when an `IfElse` condition inherits the chain that its `IfElse` is reached by. The existing own-condition and cycle rules must still hold (`VarkaGuardEdgeSuite`), and a coverage row `abs(ym - ymm)` must be served in the untaken CASE arm and the COALESCE position. Found in step 103a2's build. ### Why are the changes needed? The owner approved this change on 12 November 2026. Row 572's work is finished, so it should stop counting as open. Both findings are outside the builds that found them, and without rows of their own nothing would track them. Row 608 is a case where Varka answers a query that vanilla Spark rejects with an error. Row 609 costs fusion on every batch that holds such a row. ### Does this PR introduce _any_ user-facing change? No. Only the plan changes. ### How was this patch tested? - `python3 dev/varka_plan_lint.py --check --offline`: 0 findings. - `python3 dev/varka_quote_check.py`: 0 orphans. - `python3 dev/varka_msg_check.py size`: 6 counted lines. - `dev/varka_push_check.py` passes. - Every code claim in rows 608 and 609 was checked by reading master at `e48a856f5a8`. Neither reproducer was run, and each row says so. One `/code-review high` pass: found 5 / fixed 4 / left 1. All five were in row 608. - The sketch first used `i = 2`. `ConstantPropagation.moveEqualitiesFirst` would move that equality first and substitute it into the `IF`, so the example would show nothing. It now uses `i > 1`. - The row contradicted `VARKA-541.md` 0 item 7 without saying so. It now names the correction and SPARK-61197. - The done-when asked for a served-kernel cell that no raising batch can reach. That cell is dropped. - The row did not mention row 386, which edits the same method. It does now. - Left as a trade-off: the dated note on `VARKA-541.md` 0 item 7 itself. Row 541's open build rewrites that file, so the note is part of row 608's done-when instead of this change. This keeps the PR to `PLAN.md` and avoids a conflict with that build. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
No description provided.