Repository navigation
Conversation
Busy wait for the channel to be ready before writing to it to prevent the buffer from exploding. Also making some small code changes for clarity.
|
Merged build triggered. |
|
Merged build started. |
There was a problem hiding this comment.
This method is incorrect - if channel was writable initially, it will exit immediately without any write.
Has this patch been tested ?
There was a problem hiding this comment.
good catch! Will test it.
|
The config changes look promising (btw, you will need to read them from SparkConf and not hardcode values) - rest can be ommitted. |
|
Merged build finished. |
|
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16345/ |
|
Merged build triggered. |
|
Merged build started. |
|
Merged build finished. All automated tests passed. |
|
All automated tests passed. |
+ plus documentation
|
Merged build triggered. |
|
Merged build started. |
|
Merged build finished. All automated tests passed. |
|
All automated tests passed. |
|
@mridulm please take another look. Thanks |
|
Hi @ngbinh, thanks for your PR. It appears that we are exposing a lot of configs to the user, and this might be confusing if there are all these extra knobs that we can tune. I think it's ok to keep the configs, but I wonder whether we should actually document them. Also, many of these configs are under the Can you up merge this once you have the chance? |
|
@andrewor14 -- Reynold has changed a lot of these files as a part of the shuffle refactoring (In fact I think most of these java files don't exist anymore). @rxin Could you incorporate these options as a part of your netty changes ? |
|
I agree that these changes look outdated now. I believe Akka-http streaming http://typesafe.com/blog/typesafe-announces-akka-streams is the future. I remember seeing a ticket where @rxin listed a number of improvements on Spark network code that should cover these changes. Close for now. |
…nts (apache#1328) ### What changes were proposed in this pull request? Varka now fuses casts to `FLOAT` and `DOUBLE` that need values of two widths in one kernel, and the arithmetic that mixes them. Before this change only the one-count pair, `INT` to `FLOAT`, fused (apache#1317). `CAST(i AS DOUBLE)`, `FLOAT` with `DOUBLE`, a narrow column cast to a floating type, a condition read as a number, and trees such as `x + i` or `f * i` all went to Spark's row path. **Kernels of two lane counts.** - **The width rules.** The kernel plan now drives a tree by width, not by lane: at the long lane if it holds a `BIGINT` value, else at the double lane if it holds a `DOUBLE`, else at 32 bits. `Analysis`, `Slots` and the walk follow the same rule. - **A 32-bit value in a 64-bit kernel** fills the low half of its species at the drive's width, as an int value already does in a long kernel. The loop's bound stops one group early, so the extra lanes are never read as answers, and the epilogue is masked to the remainder. - **The conversions:** `I2F`, `I2D`, `F2D` and `D2F` through the Vector API's `convertShape`. They match Spark's casts, which are Java's `(float)` and `(double)` in every mode: round to nearest even, overflow to infinity, subnormals kept. A `BOOLEAN` is read as 1 or 0 on the int lane first, so it never needs a long conversion. - **Masks across lanes.** A guard's mask and a condition of the other kind at the drive's width cross by `VectorMask.cast`, both ways and at both widths, and so does the epilogue's bounds mask. Masks of another lane count cross through the validity word, as before. - **Narrow columns.** `CAST(y AS DOUBLE)` over a `TINYINT` or `SMALLINT` column reuses the narrow load at the long width that `CAST(y AS BIGINT)` already has. Only a narrow column read as a value is admitted; its null test alone, and every other narrow node, still declines. - **The warm-up** gains `F2D`, `D2F` and the four mask casts between the two lanes of one width. **What still declines.** Roots of two kinds in one kernel. A filter's floating conjunct next to an integral one, including the `IS NOT NULL` the optimizer infers on a cast's source, still declines, and so do an integral and a floating output in one projection. That join is the next part (`VARKA-343.md` section 4, part 343a3b), and `VarkaAnsiForm.DECLINED` lists each form it costs. `BIGINT` to a floating type needs AVX512DQ, so it comes in a later part. **Tests.** - **`VarkaEmitterFloatingCastSuite`** holds each conversion and the two-lane kernels to the reference evaluator at three widths, ten lengths, four null patterns and both bodies. Its guard test runs a zero divisor at both a loop row and an epilogue row: a live zero must decline in the dense body and in the forced masked body, and a null zero only in the dense one. A crossed guard mask that came out empty or full would fail it. - **Coverage rows**, checked against Spark by the differential and harness suites: - `CAST(i AS DOUBLE)`, `CAST(f AS DOUBLE)`, `CAST(x AS FLOAT)`; - `CAST(y1|s1 AS FLOAT|DOUBLE)` and `CAST(CAST(y1 AS INT) * CAST(y2 AS INT) AS FLOAT)`; - `CAST(b AS FLOAT|DOUBLE)`, `CAST(i > 3 AS DOUBLE)`, and `CAST(l > 5 AS FLOAT|DOUBLE)`, a long-driven kernel holding a floating value; - `x + i`, `f * i`, `f + x`, `i / 2.0D`. - **The conformance suites** for `FLOAT`, `DOUBLE` and `BOOLEAN` now run each in a JVM of its own, as the `INT` suite already did. Their casts make kernels of two widths, and under a pinned lane count a second 32-bit species in a shared JVM trips Varka's species guard, which exists to prevent JIT slowdowns, not wrong answers. **Expected declines under two matrix configurations** (`sql/varka/ci/skips.tsv`). With `validityByWidth=false` no lane count is baked, so the narrow casts to `FLOAT` and `DOUBLE` have no widening load; with `lanesOverride=16` there is no 1024-bit long species for a narrow column cast to `DOUBLE`. Six lines record those rows as declining there; the row engine answers them. **A known limit.** The projection's literal check plans under the default options. On a 128-bit host with `lanesOverride=4`, a narrow column cast to `DOUBLE` with a double literal is admitted by the session but refused by the defaults, and planning raises `INTERNAL_ERROR`. No CI step pairs that width with that option, and no SQL configuration sets it. The fix, checking under the session's options, is owed by part 343a3b; a narrow load from an earlier row has the same pattern. **This is the third of nine parts** of row 343, the floating casts, which lands in pull requests under the 1000-line cap, cut from the draft apache#1303. The parts table is in `sql/varka/plans/m8/VARKA-343.md` section 4, and this part's outcome in section 10. **Generated files**, regenerated with `dev/varka_regen_generated.sh --all`: `coverage.json`, `width_audit.json` and `docs/sql-varka.md` gain the new rows; `emitted_bytes.json` gains the new shapes, no existing shape's bytes move, and only the option-arm digests change; the census records the new casts. ### Why are the changes needed? A `DOUBLE` computed from an `INT` column, a `FLOAT` column compared with a `DOUBLE` one, and arithmetic mixing an integer with a floating value are everyday SQL, and each of them sent its whole projection or filter back to Spark's row path. This part makes them fuse, and it builds the two-width kernel that the remaining floating casts and the floating functions over a cast need. ### Does this PR introduce _any_ user-facing change? Yes, for users who enable Varka: these casts and mixed-width expressions now run in Varka's kernels, with the same answers as Spark. ### How was this patch tested? - The tests above, plus the coverage, emitted-bytes, width-audit, lane-type, mixed-lane and narrow emitter suites, the conformance suites, the cast matrix and warm-up reach in catalyst, and the coverage differential, coverage harness, floating-lane, filter and evaluator suites in sql core. - The three failures the draft's last option matrix found are fixed here and were reproduced locally under their configurations before and after: a stale test that expected a decline row 332 had since made fuse, the species guard under `lanesOverride`, and an `INTERNAL_ERROR` from a test that handed the emitter a plan the planner had already refused (SQL cannot reach it: both admission paths ask the planner first). The local option matrix for sql under `lanesOverride=4` and at the defaults passed with no failures. - An independent high review found no wrong answers. Its findings were fixed and had a medium review, and a second medium review checked the last fixes: a long-driven floating kernel with no Spark check, a guard test that could not fail, a lane test that missed the long lane, and plan text that misstated two limits. - Error Prone, scalastyle, lint-java and the census, generated-file, plan, quote and pre-commit checks pass. The change counts 998 hand-written lines. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
Busy wait for the channel to be ready before writing to it to prevent
the buffer from exploding.
Also making some small code changes to improve clarity.