`config_namespace!` structs lost `#[non_exhaustive]`, so adding a config option is a breaking change
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:
- #4771 introduced
config_namespace!with#[non_exhaustive]on the generated struct. - #9382 removed it. I couldn't find any discussion of the removal there. It looks like a side effect of the changes. The macro's doc comment still shows
#[non_exhaustive].
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.
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.