Repository navigation
Bound the search for the structure of a Freeform row - #122447
alexey-milovidov merged 5 commits into
Conversation
`buildSolutions` recursed once per matcher kept by `readNextFields`, and for a field that only reads as a string every matcher that reads it is kept. A word in a tab-separated row is read alike by `Raw` and `Escaped`, so a row of N such fields produced at least 2^N candidate solutions, each holding N columns, and schema inference exhausted memory from about 16 fields on. The search now gives up after `max_search_steps` calls with a `BAD_ARGUMENTS` error that asks for a format with a fixed structure. The bound keeps every row of up to 14 such fields inferring as before. ClickHouse#122412
|
@alexey-milovidov @Avogar Could you review this? It bounds the |
|
Workflow [PR], commit [c69227b] Summary: ✅
AI ReviewSummaryThis PR bounds the Final Verdict✅ No new blocking or major issues found in the current PR head, so I did not post any new inline review comments. LLVM Coverage ReportMeasured on commit c69227b.
Changed lines: Changed C/C++ lines covered: 48/48 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units3222 translation units recompiled, 16924 s compile time in total, 3222 of them have a recent master baseline. |
With 65536 steps, refusing a wide row took minutes when several queries ran at once, so `05258_freeform_schema_inference_search_bound` timed out in the flaky checks. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122447&sha=26acf79a0413e25aaf4b6288c85bde0cd74fd80f&name_0=PR PR: ClickHouse#122447
|
@clickgapai Thanks for the report. The only failing check is @alexey-milovidov @Avogar, it is ready for review. |
|
@msohail22 PR #122447 isn't merged yet, so there's no review of it here so far. |
…-inference-exponential
…n the test The bound of the search for the structure of a `Freeform` row is now the `input_format_freeform_max_search_steps` setting (default 4096, 0 means unlimited). Its history entry records 0 for versions before 26.10, so `compatibility` restores the previous unbounded search. The test now checks the exact boundary under the default (10 tab-separated strings infer, 11 are refused), that raising or removing the bound, or `compatibility = '26.9'`, infers the 11-field row, and requires exactly `BAD_ARGUMENTS` for the refused rows, so a regression back to `MEMORY_LIMIT_EXCEEDED` fails it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🕵 Pushed b875212: merged master and addressed the three review threads. The @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122447&sha=7755fb18b4ef219932b2ea1479cd2dd4c47db4af&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%206%2F6%29 ( |
|
Acknowledged.
Both binaries have the same static TLS size, so the in-progress #122550 is inert here, and the in-tree fallback I asked about on #100330 would not clear it either, because the shard's own report also marks both queries slower. I'm investigating the cause and will follow up here with a fix PR or my findings. |
|
Investigated: the cause is the position-independent release binary, which came from my #117449 (merged 2026-09-09, reverted in #119279 on 2026-09-10, re-landed in #119284 on 2026-09-15). On arm, a server process started from the PIE binary sometimes runs Correction to my note above: a restart usually redraws the mode. Since 2026-09-10 the harness's confirmation restart demoted 70 of the 75 such Share of arm server processes more than 20% slower than the other server of the same master run:
amd has 0 to 2 per query in every period. @alexey-milovidov, which fix do you want?
I recommend (A): (B) filters these runs out of the verdict, but arm servers running the PIE build would keep a start-dependent speed for these queries. |
… schema cache key The search bound decides whether `Freeform` schema inference succeeds, so a schema cached under a raised bound (or `compatibility = '26.9'`) must not be reused under the default bound. Test 05258 now checks that with `schema_inference_use_cache_for_file = 1`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Correction to my comment above: amd has the same per-process slow mode, in other queries, so (A) as I wrote it would leave the amd reds in place. It showed up as the Share of amd server processes more than 20% slower than the other server of the same master run (raw samples in
On arm these queries have at most 1 per period. In a slow process @alexey-milovidov, so the choice becomes:
I still recommend (A), for the same reason as above. |
|
|
Closes: #122412
Related: #43449
Schema inference for
Freeformexhausted memory on a wide row of strings.buildSolutionsrecursed once per matcher kept byreadNextFields, and for a string field every matcher that reads it is kept (best_score <= 1).RawandEscapedread a word in a tab-separated row alike, so N such fields gave at least 2^N candidate solutions. On master, 16 fields already fail withMEMORY_LIMIT_EXCEEDEDunder a 150 MB limit.The search now gives up after
input_format_freeform_max_search_stepssteps (a new setting, default 4096, 0 means unlimited) with aBAD_ARGUMENTSerror that asks for a format with a fixed structure.compatibilitybelow 26.10 restores the previous unbounded search. Under the default, rows of up to 10 tab-separated string fields infer as before, and a row of 24 numbers is unaffected. Merging matchers that read a field alike was rejected:RawandEscapedcan split a later row differently, and validation needs both candidates.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Schema inference for the
Freeformformat no longer exhausts memory on a wide row of strings: the search for the row structure is bounded by the new settinginput_format_freeform_max_search_steps(default 4096, 0 means unlimited).Workflow [PR]
Sync PR [sync-upstream/pr/122447]
Version info
26.10.1.1120-master(included in26.10and later)