Skip to content
Query.Farm
Talk with Us

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.

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.

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.

Internal helpers are not public API

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.