Copilot commented on code in PR #19432:
URL: https://github.com/apache/datafusion/pull/19432#discussion_r2637532638
##########
datafusion/datasource-csv/src/file_format.rs:
##########
@@ -619,12 +620,20 @@ impl CsvFormat {
}
}
- let schema = build_schema_helper(column_names,
column_type_possibilities);
+ let schema = build_schema_helper(
+ column_names,
+ column_type_possibilities,
+ initial_records_to_read == 0,
+ );
Ok((schema, total_records_read))
}
}
-fn build_schema_helper(names: Vec<String>, types: Vec<HashSet<DataType>>) ->
Schema {
+fn build_schema_helper(
+ names: Vec<String>,
+ types: Vec<HashSet<DataType>>,
+ disable_inference: bool,
Review Comment:
The parameter name `disable_inference` could be misleading. When set to
`true`, it doesn't actually disable inference entirely - it changes the default
type from Null to Utf8 when no data is read. Consider renaming to something
more descriptive like `records_to_read_is_zero` or
`use_utf8_when_no_types_inferred` to better reflect its actual purpose.
--
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]