Repository navigation
Use lookup tables for string and bytes parameter escaping - #1167
Merged
joe-clickhouse merged 3 commits intoNov 10, 2026
Merged
Conversation
patrick-immometrica
marked this pull request as ready for review
November 9, 2026 12:07
Signed-off-by: Joe Spadola <joe.spadola@clickhouse.com>
joe-clickhouse
previously approved these changes
Nov 9, 2026
joe-clickhouse
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Thanks!
chernser
previously approved these changes
Nov 10, 2026
Conflict in CHANGELOG.md: kept both Improvements entries. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
polyglotAI-bot
dismissed stale reviews from chernser and joe-clickhouse
via
November 10, 2026 16:52
d6d2015
joe-clickhouse
approved these changes
Nov 10, 2026
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
escape_strandescape_bytesbuild their output one character/byte at a time in a generator with an f-string per item. They run for every string and bytes parameter, client-side and server-side, plus identifier quoting, so largeINlists and binary params spend most of their bind time in them.escape_strnow usesstr.translatewith a table built frommust_escape, andescape_bytesa precomputed 256-entry table. Output is identical (checked against the old functions on random input, including bytearray and memoryview).bind_querytimings, Python 3.14:IN %(ids)s, 10k strings{ids:Array(String)}, 10k strings{b:String}, 1 MB bytesChecklist