Skip to content

Commit a73e03c

Browse files
rustyconoverclaude
andcommitted
partition_columns: schema-driven PartitionKind opt-in for Hive-style GROUP BY
Companion half of batch_index v1. Workers declare ``Meta.partition_kind`` (one of NOT_PARTITIONED / SINGLE_VALUE_PARTITIONS / OVERLAPPING / DISJOINT) and annotate the partition fields in the bind schema via the new ``partition_field()`` helper (per-field Arrow metadata ``vgi.partition_column``). At emit time the framework auto-extracts ``(min, max)`` per column from the chunk and encodes a 2-row Arrow IPC RecordBatch into the ``vgi_partition_values#b64`` custom_metadata key; explicit overrides via ``out.emit(..., partition_values={"c": (min, max)})`` take ``pa.Scalar`` pairs so type round-trip is exact. DuckDB's planner only consumes SINGLE_VALUE_PARTITIONS today (unlocks PhysicalPartitionedAggregate at plan_aggregate.cpp:108); the other three kinds round-trip on the wire for forward compat and fall back to HASH_GROUP_BY upstream. Adds four reference fixtures (country / region+year / explicit override / disjoint range) and four broken fixtures driving the contract tests on the C++ side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 932a0c9 commit a73e03c

9 files changed

Lines changed: 1239 additions & 10 deletions

File tree

‎vgi/_test_fixtures/table/__init__.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929
MissingBatchIndexTagFunction,
3030
NonMonotoneBatchIndexFunction,
3131
)
32+
from vgi._test_fixtures.table.partition_columns import (
33+
CountryPartitionedSalesFunction,
34+
DisjointRangePartitionedFunction,
35+
PartitionedWithExplicitOverrideFunction,
36+
RegionYearPartitionedFunction,
37+
)
38+
from vgi._test_fixtures.table.partition_columns_broken import (
39+
BrokenMissingPartitionValuesFunction,
40+
BrokenPartitionColumnAbsentFromBatchFunction,
41+
BrokenPartitionMinNeqMaxFunction,
42+
BrokenPartitionValuesNoAnnotationFunction,
43+
)
3244
from vgi._test_fixtures.table.catalog_scans import (
3345
ColorsScanFunction,
3446
DepartmentsScanFunction,
@@ -110,8 +122,14 @@
110122
"_VERSIONED_DATA",
111123
"_VERSIONED_SCHEMAS",
112124
"BatchIndexOverflowFunction",
125+
"BrokenMissingPartitionValuesFunction",
126+
"BrokenPartitionColumnAbsentFromBatchFunction",
127+
"BrokenPartitionMinNeqMaxFunction",
128+
"BrokenPartitionValuesNoAnnotationFunction",
113129
"ColorsScanFunction",
114130
"ConstantColumnsFunction",
131+
"CountryPartitionedSalesFunction",
132+
"DisjointRangePartitionedFunction",
115133
"DepartmentsScanFunction",
116134
"DoubleSequenceFunction",
117135
"DynamicFilterEchoFunction",
@@ -140,10 +158,12 @@
140158
"PartitionedNoOrderGuaranteeFunction",
141159
"PartitionedPreservesOrderFunction",
142160
"PartitionedSequenceFunction",
161+
"PartitionedWithExplicitOverrideFunction",
143162
"ProductsScanFunction",
144163
"ProfilingDemoFunction",
145164
"ProjectedDataFunction",
146165
"ProjectsScanFunction",
166+
"RegionYearPartitionedFunction",
147167
"RepeatValueIntFunction",
148168
"RepeatValueStrFunction",
149169
"RowIdSequenceFunction",

0 commit comments

Comments
 (0)