@@ -21,6 +21,7 @@ use std::sync::Arc;
21
21
22
22
use arrow:: datatypes:: { Schema , SchemaRef } ;
23
23
24
+ use crate :: datasource:: file_format:: DEFAULT_SCHEMA_INFER_MAX_RECORD ;
24
25
use crate :: datasource:: {
25
26
file_format:: {
26
27
avro:: { AvroFormat , DEFAULT_AVRO_EXTENSION } ,
@@ -44,7 +45,7 @@ pub struct CsvReadOptions<'a> {
44
45
/// An optional schema representing the CSV files. If None, CSV reader will try to infer it
45
46
/// based on data in file.
46
47
pub schema : Option < & ' a Schema > ,
47
- /// Max number of rows to read from CSV files for schema inference if needed. Defaults to 1000 .
48
+ /// Max number of rows to read from CSV files for schema inference if needed. Defaults to `DEFAULT_SCHEMA_INFER_MAX_RECORD` .
48
49
pub schema_infer_max_records : usize ,
49
50
/// File extension; only files with this extension are selected for data input.
50
51
/// Defaults to DEFAULT_CSV_EXTENSION.
@@ -65,7 +66,7 @@ impl<'a> CsvReadOptions<'a> {
65
66
Self {
66
67
has_header : true ,
67
68
schema : None ,
68
- schema_infer_max_records : 1000 ,
69
+ schema_infer_max_records : DEFAULT_SCHEMA_INFER_MAX_RECORD ,
69
70
delimiter : b',' ,
70
71
file_extension : DEFAULT_CSV_EXTENSION ,
71
72
table_partition_cols : vec ! [ ] ,
@@ -234,7 +235,7 @@ pub struct NdJsonReadOptions<'a> {
234
235
/// The data source schema.
235
236
pub schema : Option < SchemaRef > ,
236
237
237
- /// Max number of rows to read from CSV files for schema inference if needed. Defaults to 1000 .
238
+ /// Max number of rows to read from JSON files for schema inference if needed. Defaults to `DEFAULT_SCHEMA_INFER_MAX_RECORD` .
238
239
pub schema_infer_max_records : usize ,
239
240
240
241
/// File extension; only files with this extension are selected for data input.
@@ -248,7 +249,7 @@ impl<'a> Default for NdJsonReadOptions<'a> {
248
249
fn default ( ) -> Self {
249
250
Self {
250
251
schema : None ,
251
- schema_infer_max_records : 1000 ,
252
+ schema_infer_max_records : DEFAULT_SCHEMA_INFER_MAX_RECORD ,
252
253
file_extension : DEFAULT_JSON_EXTENSION ,
253
254
table_partition_cols : vec ! [ ] ,
254
255
}
0 commit comments