Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace duckdb {
CSVSniffer::CSVSniffer(CSVReaderOptions &options_p, shared_ptr<CSVBufferManager> buffer_manager_p,
CSVStateMachineCache &state_machine_cache_p, bool default_null_to_varchar_p)
: state_machine_cache(state_machine_cache_p), options(options_p), buffer_manager(std::move(buffer_manager_p)),
default_null_to_varchar(default_null_to_varchar_p) {
lines_sniffed(0), default_null_to_varchar(default_null_to_varchar_p) {
// Initialize Format Candidates
for (const auto &format_template : format_template_candidates) {
auto &logical_type = format_template.first;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ string DialectCandidates::Print() {

DialectCandidates::DialectCandidates(const CSVStateMachineOptions &options) {
// assert that quotes escapes and rules have equal size
auto default_quote = GetDefaultQuote();
auto default_escape = GetDefaultEscape();
auto default_quote_rule = GetDefaultQuoteRule();
auto default_delimiter = GetDefaultDelimiter();
auto default_comment = GetDefaultComment();
const auto default_quote = GetDefaultQuote();
const auto default_escape = GetDefaultEscape();
const auto default_quote_rule = GetDefaultQuoteRule();
const auto default_delimiter = GetDefaultDelimiter();
const auto default_comment = GetDefaultComment();

D_ASSERT(default_quote.size() == default_quote_rule.size() && default_quote_rule.size() == default_escape.size());
// fill the escapes
Expand Down Expand Up @@ -187,6 +187,9 @@ void CSVSniffer::GenerateStateMachineSearchSpace(vector<unique_ptr<ColumnCountSc

// Returns true if a comment is acceptable
bool AreCommentsAcceptable(const ColumnCountResult &result, idx_t num_cols, bool comment_set_by_user) {
if (comment_set_by_user) {
return true;
}
// For a comment to be acceptable, we want 3/5th's the majority of unmatched in the columns
constexpr double min_majority = 0.6;
// detected comments, are all lines that started with a comment character.
Expand All @@ -208,7 +211,7 @@ bool AreCommentsAcceptable(const ColumnCountResult &result, idx_t num_cols, bool
}
}
// If we do not encounter at least one full line comment, we do not consider this comment option.
if (valid_comments == 0 || (!has_full_line_comment && !comment_set_by_user)) {
if (valid_comments == 0 || !has_full_line_comment) {
// this is only valid if our comment character is \0
if (result.state_machine.state_machine_options.comment.GetValue() == '\0') {
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "4-dev3739"
#define DUCKDB_PATCH_VERSION "4-dev3741"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 1
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.1.4-dev3739"
#define DUCKDB_VERSION "v1.1.4-dev3741"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "e4e50f923c"
#define DUCKDB_SOURCE_ID "ab8c909857"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down