Skip to content

Commit e4e50f9

Browse files
authored
2 parents 70d238a + d29758c commit e4e50f9

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Diff for: data/csv/repromarket.csv

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+

Diff for: src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void CSVSniffer::AnalyzeDialectCandidate(unique_ptr<ColumnCountScanner> scanner,
234234
idx_t num_cols = sniffed_column_counts.result_position == 0 ? 1 : sniffed_column_counts[0].number_of_columns;
235235
const bool ignore_errors = options.ignore_errors.GetValue();
236236
// If we are ignoring errors and not null_padding , we pick the most frequent number of columns as the right one
237-
bool use_most_frequent_columns = ignore_errors && !options.null_padding;
237+
const bool use_most_frequent_columns = ignore_errors && !options.null_padding;
238238
if (use_most_frequent_columns) {
239239
num_cols = sniffed_column_counts.GetMostFrequentColumnCount();
240240
}
@@ -355,7 +355,7 @@ void CSVSniffer::AnalyzeDialectCandidate(unique_ptr<ColumnCountScanner> scanner,
355355
// - There's a single column before.
356356
// - There are more values and no additional padding is required.
357357
// - There's more than one column and less padding is required.
358-
if (columns_match_set && rows_consistent &&
358+
if (columns_match_set && (rows_consistent || (set_columns.IsSet() && ignore_errors)) &&
359359
(single_column_before || ((more_values || more_columns) && !require_more_padding) ||
360360
(more_than_one_column && require_less_padding) || quoted) &&
361361
!invalid_padding && comments_are_acceptable) {

Diff for: test/sql/copy/csv/auto/test_csv_auto.test

+18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ PRAGMA enable_verification
88
statement ok
99
PRAGMA verify_parallelism
1010

11+
query II
12+
FROM read_csv('data/csv/repromarket.csv',
13+
columns={
14+
'email': 'varchar',
15+
'password': 'varchar'
16+
},
17+
all_varchar=true,
18+
delim=':',
19+
header=false,
20+
skip=0,
21+
null_padding=true,
22+
ignore_errors=true
23+
);
24+
----
25+
26+
27+
28+
1129
query I
1230
FROM read_csv('data/csv/pipe_delim.csv', columns={'a': 'VARCHAR'}, auto_detect=False)
1331
----

0 commit comments

Comments
 (0)