Repository navigation
Fix usage of insertion table in table functions when optimize_trivial_insert_select is enabled - #105555
Conversation
…ion` from context When `optimize_trivial_insert_select` is enabled (the default), `applyTrivialInsertSelectOptimization` creates a copy of the select context and then calls `setInsertionTable` with only two arguments, omitting the `columns_description` parameter. This overwrites the `columns_description` that was already correctly copied by `Context::createCopy`, causing table functions like `file()` with schema-less formats (e.g. RowBinary) to fail with BAD_ARGUMENTS because the structure hint from the INSERT table is lost. Fix by removing the redundant `setInsertionTable` call in `applyTrivialInsertSelectOptimization` since `Context::createCopy` already preserves the full `insertion_table_info` including `columns_description`. Also fix the same pattern in `InterpreterExecuteAsQuery` and `StorageInMemoryMetadata` where `setInsertionTable` is called without the `columns_description` parameter when creating a new context from the global context. Closes #103083 Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Workflow [PR], commit [f545887] Summary: ✅
AI ReviewSummaryThis PR fixes Final VerdictStatus: ✅ Approve |
|
The failures of They were introduced by #104690 ("Add #104690 was merged in violation of the ClickHouse team rules: its own CI already showed these two tests failing (10 times between May 12 and June 1) before it was merged. Please update your branch to pick up the revert; the tests should pass again. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 13/13 (100.00%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 25 line(s) · Uncovered code |
|
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment. TL;DRFix usage of insertion table in table functions when ClickGap verified: reproduced it with the script below on ReproductionBisect
Affects
Suggested next stepThe fix has landed on master; the affected release branches above still need the backport. Component: cc fix PR author: @Avogar ClickGap · Finding: |
…_columns_description The inline-server-parsed INSERT path (send_table_structure_on_insert_with_inline_data=0) now applies destination column DEFAULTs through remote()/file() table functions, matching the legacy and HTTP paths. The behavior was fixed upstream by ClickHouse#105555 (insertion table columns_description is preserved in the context for table functions), so the test no longer needs to pin the setting to 1. Remove the pin so CI exercises both values, and replace the now-obsolete comment. Verified locally: the test output matches the reference with the setting at both 0 and 1 (15/15 alternating runs). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix usage of insertion table in table functions when
optimize_trivial_insert_selectis enabled. Closes #103083Version info
26.6.1.513