Repository navigation
Conversation
…ld copies ClickHouse: walk lines and fields in place with memchr, make each unescaped field's String in one copy, reserve rows, and use the same walk in classify without copying the body. A leading byte order mark now stays in the value. SQL Server: read the column types once per result, share one dbconvert buffer, read integers and bit from their bytes, and convert a buffered result row by row so it is not held twice.
This branch has not been 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.
Summary
ClickHouse (TableProPluginKit, no public API change):
memchr; no[ArraySlice]per line or per body. A row reserves its width.Stringin one copy, validated in place; only a field holding an escape is unescaped into a buffer first. A value that is not UTF-8 stays.bytes, as before.classify(uncapped and parameterized reads) uses the same walk over the body's own bytes instead of copying the body into[UInt8]and building a line array first.String(bytes:encoding:)dropped a leading BOM, so such aStringvalue read back three bytes short.SQL Server (FreeTDS reader, iOS shares it):
dbcoltypeper cell.dbconvertspells them (MSSQLNativeCellText, TableProMSSQLCore). Every other type, and a length that is not the type's, still goes throughdbconvert.Left for later, in a comment on #4550: dates and times through
dbanydatecrack(needs the column type corpus on a live server to prove the spelling for every scale), and moving uncapped ClickHouse reads onto the streaming shape.Measure
ClickHouse decoder, local benchmark against the public decoder API (release build, best of 3, 64 KB chunks for the stream):
SQL Server was not measured: it needs a live server, and
check-column-type-corpus.sh mssqlwas not run in this pass. Integer and bit spelling is covered by unit tests against FreeTDS's own conversion rules.Test plan
ClickHouseTabSeparatedRowDecoderTests: a leading BOM is kept (fails on main), streaming, byte-by-byte and buffered reads of one body give the same rows; the existing decoder, chunking and classifier suites pass (82 tests).MSSQLNativeCellTextTests: every integer type across its range, bit, an unaligned read, and the types and lengths that fall back todbconvert; the TableProMSSQLCore suites pass (409 tests).verify.sh pluginsand lint. The ClickHouse driver suites and the iOS build run on CI.Closes #4550