Skip to content

Apply patches from main#323

Merged
benfleis merged 7 commits into
duckdb:mainfrom
benfleis:apply-patches-from-main
Jul 8, 2026
Merged

Apply patches from main#323
benfleis merged 7 commits into
duckdb:mainfrom
benfleis:apply-patches-from-main

Conversation

@benfleis

@benfleis benfleis commented Jul 3, 2026

Copy link
Copy Markdown
Member

Applies the .github/patches/extensions/delta set from duckdb 2daa4fc, plus the fixups needed to build and pass tests against the diverged source.

Applied patches

Base URL: https://github.com/duckdb/duckdb/blob/2daa4fc9a48c638d10dcc613b1ed15d56c66f5b0/.github/patches/extensions/delta/

Patch Summary
0001-vector-fix WriteMetaData: stage values and emit one DataChunk (STANDARD_VECTOR_SIZE-aware) instead of per-row.
0002-expr Expression API: .alias =SetAlias(), ->typeGetExpressionType().
0003-const-expr ConstantExpression::valueGetValue().
0004-filter-refactor Migrate filter pushdown TableFilterExpressionFilter (PredicateVisitor).
0005-private-member-accessors Swap now-private field access for getters/setters (expression_functions, schema_entry).
0006-private-member-accessors More of the same (delta_utils, multi_file_list, expression_functions).
0007-bound-expression-more-private-member-accessors BoundConstantExpression::valueGetValue(); func.function.GetName().
0007-function-args FunctionExpression: iterate GetArguments()+GetExpression().Copy() instead of GetChildrenMutable().
0008-identifier-getname-accessors Big stringIdentifier/GetName() migration (17 files): EntryLookupInfo+GetEntry, child_list_t<Value> Identifier keys, etc.
0009-pin-brotli-decompressor Pin brotli-decompressor in CMakeLists.txtskipped (see fixups).
0010-create-info-accessors CreateInfo fields → accessors (SchemaMutable()/SetFunctionName()/GetTableName()).
0011-setqualifiedname Set CreateInfo schema/name via SetQualifiedName(QualifiedName(...)).

Fixups required afterward (not in the patches)

  • struct-extract pushdown (in no patch): 0004 dropped it to a TODO → restored the resolver in
    PredicateVisitor::VisitFilterExpression (TryGetStructExtractChildIndex + dotted-path rebuild),
    plus a RemoveUnusedColumns-rerun guard (max/min filtered-file counts). (9e274f5)
  • delta_domain_metadata.cpp (touched by no patch): needed Identifier/Bind-signature updates to compile.
  • Hand-resolved rejects: 0001 / 0004 / 0008 did not apply cleanly against the diverged tree.
  • 0009 skipped: Cargo.lock already resolves brotli-decompressor 5.0.0 (and brotli 8.0.2) — pin redundant.
  • Post-integration: deterministic filter-log output (std::sort in ReportFilterPushdown) + 4 fixtures
    re-baselined to current duckdb rendering. (f363b9b)
  • Fix incremental_snapshot.test -- test breaks against main, but was actually testing incorrectly; fix testing setup to use checkpoints and voila!

benfleis added 6 commits July 1, 2026 08:47
src/delta_utils.cpp — PredicateVisitor::VisitFilterExpression:

- Added ResolveFilterColumnPath, which walks struct_extract / struct_extract_at subjects (via duckdb's TryGetStructExtractChildIndex +
StructType::GetChildName) and rebuilds the dotted kernel path, e.g. i.a.b. Bare column refs still resolve to the top-level name.
- Added a guard: a bare ref on a nested (struct/list/map) column is skipped. The instrumentation showed the same predicate arrives twice —
once as struct_extract(struct_extract(i,'a'),'b') > 10 (resolvable) and once as #0 > 10 (path lost). The second was being pushed as a filter
on i (a struct) → MissingColumnError. The struct_extract form still gives the kernel the correct predicate.

src/functions/delta_scan/delta_multi_file_list.cpp — ReportFilterPushdown: made the file-count reporting tolerate multi-pass pushdown (keep
max total_files / min filtered_files instead of asserting equality). Now that struct filters actually skip files, projecting i.a.b makes
RemoveUnusedColumns re-run pushdown on the already-shrunken list, which tripped the old *_inconsistent assertions.

Verification

- write_stats_nested.test: 28 assertions, all pass (was erroring at :42).
- Full test/*: 11 → 8 failures, no regressions. The struct test and both golden-table tests now pass; file-skipping counts (Scanning Files:
1/5, 0/2, 1/2) are correct.

The remaining 8 are the non-struct items already triaged:
1. Partition-value type crash (part = 42 / part IS NULL) — real, duckdb#303 lineage, HIGH.
2. Stale .test fixtures vs new duckdb rendering (filter strings, EXPLAIN text, stats()) — LOW.
3. incremental_snapshot extra log reads — needs investigation, LOW.
DeltaMultiFileReader::BindOptions forwarded partition columns via hive_partitioning_indexes but never registered their types. Core's
GetHivePartitionValue defaults an unregistered partition column to VARCHAR, so the parsed value ("42") stayed VARCHAR while the pushed
ExpressionFilter was typed BIGINT → Vector::Reference type-mismatch crash in EvaluateWithConstant. One line registers the type:

options.hive_types_schema[part] = return_types[hive_partitioning_index];

Now core resolves the partition constant as the column type (and NULL partitions as a typed NULL), matching what the per-file constant_map
already did via DefaultCastAs.

Verification

- partition_equality_filter__issue_303: 11 assertions pass (was crashing on part = 42).
- write_null_partition: 10 assertions pass (was crashing on part IS NULL).
- Full test/*: 8 → 6 failures, no regressions.
@benfleis benfleis changed the title Apply patches from main [WIP] Apply patches from main Jul 3, 2026
@benfleis benfleis force-pushed the apply-patches-from-main branch 3 times, most recently from 1ed97cc to e4e416b Compare July 5, 2026 07:21
@benfleis benfleis force-pushed the apply-patches-from-main branch from 2b31a18 to 296737d Compare July 7, 2026 22:20
@benfleis benfleis merged commit a02531c into duckdb:main Jul 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant