Repository navigation
Decode all LZ4 frames and enable Thrift CloudFetch compression - #643
Open
vuanhphung wants to merge 9 commits into
Open
vuanhphung wants to merge 9 commits into
vuanhphung wants to merge 9 commits into
Conversation
Bound every frame before decoding, preserve CloudFetch frame buffers, and validate decoded row counts before exposing results. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:18 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:18 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:18 — with
GitHub Actions
Inactive
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:28 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:28 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:28 — with
GitHub Actions
Inactive
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:36 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:36 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:36 — with
GitHub Actions
Inactive
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:43 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:43 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 08:43 — with
GitHub Actions
Inactive
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 10:54 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 10:54 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 10:54 — with
GitHub Actions
Inactive
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 20, 2026 10:59 — with
GitHub Actions
Inactive
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thrift CloudFetch disables LZ4 after failures in the former codec. The current native decoder reads only the first concatenated frame and accepts truncated footers, so removing the guard alone silently loses rows; live files contain up to 613 frames. Walk and bound every frame, preserve checksum/error context, and let the existing Arrow converter detect missing rows without a second parse while retaining its excess-row cap.
This approved default change requests LZ4 for all supported Thrift Arrow results, inline and CloudFetch, when the codec loads. Client/per-statement
useLZ4Compression: falsestill opts out; compression can change server-selected delivery to inline. Native kernel code is unchanged. Native async decoding was implemented and measured with the default libuv pool of 4, but raises RSS and the observed materialized tail. The selected allowed fallback yields between compressed files; decoding remains synchronous and loop stalls remain.Per-file yields do not interleave concurrent streams: decodes queued together can run back-to-back in the same check phase. Five concurrent 1gb reads raise loop p99 about 2.9× in the reviewer's run (45.1→129.6 ms), and about 1.8× in our table (68.9→125.4 ms). Like existing CloudFetch download errors, decode failures remain non-sticky: catching one and resuming iteration can continue with later files, so that result is incomplete.
The shared converter now raises
HiveDriverErrorwithArrow row count mismatchfor previously silent short reads on every Arrow path/backend, including metadata, inline Thrift, uncompressed CloudFetch and kernel results; excess rows retain the existing cap.Verification: 1,898 units, lint/Prettier/types/build, 31 live Thrift and 17 live kernel tests pass. All nine full ordered main/off/on checksums and lifecycle digests agree; three regression mutants fail. Across 123 final compressed queries / 11,594 files, no decode/checksum errors occur. CI passes Node 22/24/26; driver-test/kernel PR gates are stubs, not live passes.
Selected fallback, live Node 24.22.1, four CPUs, shared warehouse; five rotated fresh-process measurements per variant after warmup. Durations are median / p95=p99 (maximum at n=5); RSS is median process peak; loop is median per-run p99.
Catalog_sales transfers 3.69× fewer bytes. Labels are selectivities: 1gb/4gb emit 2.109/13.864 GB. Materialized latency improves only 2.1%; its RSS falls 33%. Small reads can use more memory, including ~2–3 MiB to load the codec (nation rerun 97→100 MiB). Extended-type medians improve 10–28%, but the struct maximum is slightly worse. All rows/outliers and backend/A/A controls remain in factory evidence; the kernel's 5.6% median increase has a comparable 4.9% identical-build A/A shift. No zero-regression claim is inferred from noisy controls.
Rejected async candidate, separately interleaved with its own main controls, same hardware/pool and n=5. It improves responsiveness, but 500mb RSS reaches 1160 MiB and materialized p95 48.698s; the historical checksum failure and native-memory mechanism are not independently root-caused.
Adversarial review: converged in round 2 with no open high findings; all follow-ups resolved or accepted with the concurrent-loop and non-sticky-error limitations disclosed above.
This pull request and its description were written by Isaac.