alamb commented on code in PR #11633:
URL: https://github.com/apache/datafusion/pull/11633#discussion_r1690317475
##########
datafusion/core/src/datasource/physical_plan/csv.rs:
##########
@@ -67,27 +87,124 @@ pub struct CsvExec {
cache: PlanProperties,
}
-impl CsvExec {
- /// Create a new CSV reader execution plan provided base and specific
configurations
- #[allow(clippy::too_many_arguments)]
- pub fn new(
- base_config: FileScanConfig,
- has_header: bool,
- delimiter: u8,
- quote: u8,
- escape: Option<u8>,
- comment: Option<u8>,
- newlines_in_values: bool,
+/// Builder for [`CsvExec`].
+///
+/// See example on [`CsvExec`].
+#[derive(Debug, Clone)]
+pub struct CsvExecBuilder {
+ file_scan_config: FileScanConfig,
+ file_compression_type: FileCompressionType,
+ // TODO: it seems like these format options could be reused across all the
various CSV config
+ has_header: bool,
+ delimiter: u8,
+ quote: u8,
+ escape: Option<u8>,
+ comment: Option<u8>,
+ newlines_in_values: bool,
+}
+
+impl CsvExecBuilder {
+ /// Create a new builder to read the provided file scan configuration.
+ pub fn new(file_scan_config: FileScanConfig) -> Self {
+ Self {
+ file_scan_config,
+ // TODO: these defaults are duplicated from `CsvOptions` - should
they be computed?
Review Comment:
> As in, a test that makes sure that the default settings in a CsvExec
matches the default CsvOptions? I'm happy to add that. I likely won't get to it
in the next ~24h so happy to either hold this PR or follow-up after.
Yes, that is what I was thinking -- that way if the default `CsvOptions` are
ever changed the test will fail until we also update the deafult values in
`CsvExecBuilder`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]