datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

`config_namespace!` structs lost `#[non_exhaustive]`, so adding a config option is a breaking change

Open kamilk-pal opened this issue 2 weeks ago • 1 comments

Is your feature request related to a problem or challenge?

Adding a field to any struct generated by config_namespace! (ExecutionOptions, OptimizerOptions, ParquetOptions, CsvOptions, ...) is a semver-breaking change. These are plain structs with all-pub fields, so downstream code can build or match them exhaustively. For example, #23296 added enable_file_stream_work_stealing to ExecutionOptions in 54.1.0, and this compiles against 54.0.0 but not 54.1.0:

let ExecutionOptions { batch_size: _, /* ...every other 54.0.0 field... */ } = options;
// error[E0027]: pattern does not mention field `enable_file_stream_work_stealing`

The structs used to be protected against this:

Describe the solution you'd like

Emit #[non_exhaustive] from config_namespace! again, so that adding a config option isn't a breaking change. This is itself a breaking change. Struct literals, even ones that use ..Default::default(), would no longer compile outside datafusion-common, and callers would start from Default::default() and set fields.

Describe alternatives you've considered

Keep the current structs. Document that struct literals for config structs aren't covered by semver. Explicitly allow for adding config fields -- semver breaking changes -- in minor/patch releases.

Additional context

  • Came up in #27562, which discusses adding a config option on branch-54.
  • Was discussed in #27308, resulting in not adding a config field.

kamilk-pal avatar Nov 20 '26 12:11 kamilk-pal

I'd be interested in working on this , restoring #[non-exaustive] looks straight forward but it would introduce breaking change for the downstream struct literals . Would maintainers be ok with making this change in upcoming release ? if so , i can start working on this issue.

rizzabhdwaj avatar Nov 22 '26 16:11 rizzabhdwaj