Integrate with the optimizer
An ITableFunction can advertise projection, filter, limit, order, sampling, partition, and
late-materialization capabilities. Bind and init parameters then carry the corresponding request.
Statistics
Section titled “Statistics”Return column statistics from Statistics when they are cheap and reliable:
public IReadOnlyDictionary<string, ColumnStatisticsInput>? Statistics(TableBindParams p)
{
var count = p.Arguments.Int64(0);
if (count <= 0) return null;
return new Dictionary<string, ColumnStatisticsInput>
{
["n"] = new() { Min = 0L, Max = count - 1, HasNull = false, HasNotNull = true,
DistinctCount = count },
};
}
DuckDB can eliminate impossible filters or estimate joins without scanning the worker.
Pushdown is a correctness contract
Section titled “Pushdown is a correctness contract”Set FilterPushdown => true only if every producer applies TableInitParams.PushdownFilters and
JoinKeys. The C++ operator may omit a residual filter once a function claims it handled the
predicate. Ignoring pushed filters after advertising support can return wrong rows, not merely run
slowly.
The SDK’s fixture worker uses internal codecs and evaluators to exercise every protocol feature.
Application code should not depend on QueryFarm.Vgi.Internal; prefer public contracts or pin and
wrap any unavoidable low-level work until a public helper is added.
Projection-aware producers must emit initParams.ProjectedSchema, with arrays in exactly that
schema’s order. For split planning, tokens must remain valid for their advertised lifetime and be
decodable by any worker process in the pool.