[codex] add predefined RowBinary encoders#374
Draft
ruslandoga wants to merge 1 commit into
Draft
Conversation
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.
Summary
Adds
Ch.RowBinary.define_encoder/1for compile-time RowBinary encoders from a non-Ecto schema shape such asschema: [id: "UInt64", text: "String"]orschema: %{"id" => "UInt64"}.The generated encoder can:
rows: trueINSERT INTO ... FORMAT RowBinaryWithNamesAndTypesbody whentable:is provided, with the names/types prefix precomputedThe first specialization covers common hot insert paths and falls back to
Ch.RowBinary.encode/2for less common types.Benchmark
Updated
bench/encode.exsto compare current list/map paths against the generated encoder. Local Apple M2 result for 1,000,000 rows:Follow-up Issues
Validation
mix compile --warnings-as-errorsMIX_ENV=test mix compile --warnings-as-errorsMIX_ENV=test mix formatgit diff --checkmix run bench/encode.exsmix run -esmoke check comparing generated encoder bytes againstencode_row/2,encode_rows/2, andencode_names_and_types/2mix test test/ch/row_binary_test.exscould not run in this workspace because the Docker daemon/OrbStack socket is unavailable, so ClickHouse fromcompose.ymlcould not be started.