You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Which issue does this PR close?
- Closes#23293.
## Rationale for this change
`FileStream` sibling work-stealing (`WorkSource::Shared`, added in
#21351 and extended by #23285) seeds one shared work queue from every
file group and lets whichever output partition goes idle first steal the
next unopened file (or byte-range morsel). This assumes all output
partitions of a scan are polled concurrently in one process.
Executors that run each output partition as an isolated task in a
separate process — Ballista and datafusion-distributed — never poll the
sibling partitions. The single polled partition drains the whole shared
queue and reads files belonging to other partitions, so every isolated
task reads the entire input and the scan output is inflated by the
partition count. This is a correctness bug for those executors, not just
a performance one.
The existing escape hatches (`preserve_order`,
`partitioned_by_file_group`) are plan-level flags on `FileScanConfig`,
not something a distributed executor can set centrally through the
session config, and a plain repartitioned scan does not set
`partitioned_by_file_group`. There is no session-level off switch,
unlike `datafusion.optimizer.enable_dynamic_filter_pushdown`, which
exists precisely so consumers that cannot support runtime
cross-partition state can disable it.
## What changes are included in this PR?
- Add `datafusion.execution.enable_file_stream_work_stealing` (default
`true`). When `false`, `FileScanConfig::create_sibling_state` returns
`None`, so each partition falls back to `WorkSource::Local` and reads
only its own file group.
- Thread `&ConfigOptions` into `DataSource::create_sibling_state` so the
flag is read from the session config at `execute` time. As a session
config value it round-trips through `datafusion-proto` with no proto
schema change.
- Regenerate `configs.md` and add the setting to
`information_schema.slt`.
- Turn the previously `#[ignore]`d reproduction test into a passing
regression test that drives only partition 0 (as an isolated task does)
and asserts both behaviors: with the default (stealing on) partition 0
also reads partition 1's file, and with the flag off it reads only its
own.
## Are these changes tested?
Yes. `isolated_partition_respects_work_stealing_config` in
`datafusion/datasource/src/file_stream/mod.rs` covers both the default
(shared-queue) behavior and the flag-off behavior. The existing sibling
work-stealing tests continue to pass with the default.
`information_schema` sqllogictests pass with the new setting listed.
## Are there any user-facing changes?
A new session config,
`datafusion.execution.enable_file_stream_work_stealing` (default
`true`), so existing behavior is unchanged.
`DataSource::create_sibling_state` gains a `&ConfigOptions` parameter
(an API change for anyone implementing the `DataSource` trait directly).
@@ -375,6 +376,7 @@ datafusion.execution.batch_size 8192 Default batch size while creating new batch
375
376
datafusion.execution.coalesce_batches true When set to true, record batches will be examined between each operator and small batches will be coalesced into larger batches. This is helpful when there are highly selective filters or joins that could produce tiny output batches. The target batch size is determined by the configuration setting
376
377
datafusion.execution.collect_statistics true Should DataFusion collect statistics when first creating a table. Has no effect after the table is created. Defaults to true.
377
378
datafusion.execution.enable_ansi_mode false Whether to enable ANSI SQL mode. The flag is experimental and relevant only for DataFusion Spark built-in functions When `enable_ansi_mode` is set to `true`, the query engine follows ANSI SQL semantics for expressions, casting, and error handling. This means: - **Strict type coercion rules:** implicit casts between incompatible types are disallowed. - **Standard SQL arithmetic behavior:** operations such as division by zero, numeric overflow, or invalid casts raise runtime errors rather than returning `NULL` or adjusted values. - **Consistent ANSI behavior** for string concatenation, comparisons, and `NULL` handling. When `enable_ansi_mode` is `false` (the default), the engine uses a more permissive, non-ANSI mode designed for user convenience and backward compatibility. In this mode: - Implicit casts between types are allowed (e.g., string to integer when possible). - Arithmetic operations are more lenient — for example, `abs()` on the minimum representable integer value returns the input value instead of raising overflow. - Division by zero or invalid casts may return `NULL` instead of failing. # Default `false` — ANSI SQL mode is disabled by default.
379
+
datafusion.execution.enable_file_stream_work_stealing true When `true` (the default), DataFusion's built-in file scans dynamically rebalance files across partitions at query execution time: a partition that goes idle reads files (or byte-range morsels) originally assigned to a sibling partition, which keeps all partitions busy in a single process. Executors that depend on the plan-time partition assignment — such as Ballista and datafusion-distributed, which run each partition as an isolated task and never poll the siblings — should set this to `false` so each partition reads only its own file group and no runtime reassignment occurs.
378
380
datafusion.execution.enable_migration_aggregate true Temporary switch for aggregate stream implementations that are being migrated from `GroupedHashAggregateStream`. When set to true, DataFusion tries the migrated implementations when their preconditions are satisfied. When set to false, grouped aggregation falls back to `GroupedHashAggregateStream`. This option will be removed after the migration is finished. See <https://github.com/apache/datafusion/issues/22710> for details.
379
381
datafusion.execution.enable_recursive_ctes true Should DataFusion support recursive CTEs
380
382
datafusion.execution.enforce_batch_size_in_joins false Should DataFusion enforce batch size in joins or not. By default, DataFusion will not enforce batch size in joins. Enforcing batch size in joins can reduce memory usage when joining large tables with a highly-selective join filter, but is also slightly slower.
0 commit comments