Repository navigation
perf(convert): write shorter DuckDB SQL for casts, division, zones and VARIANTs - #277
Merged
Merged
Conversation
Work in progress. Items 1-15 of the batch written; the FLOAT-in-VARIANT writer macro is not. Not run: cargo tests, make check-ci, the full verify. A first full replay of the earlier items is running.
…macro Work in progress. All batch items written. Crate tests passed before the zone change; not run since: make check-ci, the full verify.
…aseline The recorded corpus replays with 0 failures and the SQL size baseline falls from 13,940,273 to 11,337,947 bytes. Not run on this head yet: make check-ci, the full verify.
A spare place there would make the scaling literal 0.<37 zeros>1, which DuckDB types as DOUBLE. Also pins variant_written_v1 by the hash of its definition statement.
kvlonge
enabled auto-merge
November 24, 2026 22:51
…does not fold The short argument was a text literal, which a FLOAT cast now folds to a plain cast, so the length difference counted the whole block as copies.
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.
Why
Converted SQL often spelled a value out at greater length than DuckDB needs. Text was trimmed three times, literals the compiler could fold were parsed at run time, and rounding used a doubling step when the result cast already rounds. Some checks repeated ones the surrounding SQL already makes. Each change shortens the SQL and keeps the same rows, types, NULLs and raised error tags.
Changes
nanosecond().%.15edirectly.json_checked_v1.variant_written_v1.Verification
make verify-recorded(strict errors) on the final head: 0 failed, the same 397 agreeing error checks, 0 translation result changes.make check-cipasses. The blocks and convert crate tests pass.