Skip to content

Commit

Permalink
Rename method as a homage to my tenage years
Browse files Browse the repository at this point in the history
  • Loading branch information
pdet committed Apr 19, 2024
1 parent 9da0f63 commit bc18ac8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ bool CSVSniffer::DetectHeaderWithSetColumn() {
const auto &sql_type = (*set_columns.types)[col];
if (sql_type != LogicalType::VARCHAR) {
all_varchar = false;
if (!IsCasteable(best_header_row[col].value, sql_type, options.dialect_options,
best_header_row[col].IsNull())) {
if (!CanYouCastIt(best_header_row[col].value, sql_type, options.dialect_options,
best_header_row[col].IsNull())) {
first_row_consistent = false;
}
}
Expand Down Expand Up @@ -176,8 +176,8 @@ void CSVSniffer::DetectHeader() {
const auto &sql_type = best_sql_types_candidates_per_column_idx[col].back();
if (sql_type != LogicalType::VARCHAR) {
all_varchar = false;
if (!IsCasteable(best_header_row[col].value, sql_type, sniffer_state_machine.dialect_options,
best_header_row[col].IsNull())) {
if (!CanYouCastIt(best_header_row[col].value, sql_type, sniffer_state_machine.dialect_options,
best_header_row[col].IsNull())) {
first_row_consistent = false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/execution/operator/csv_scanner/sniffer/type_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ void CSVSniffer::SetDateFormat(CSVStateMachine &candidate, const string &format_
candidate.dialect_options.date_format[sql_type].Set(strpformat, false);
}

bool CSVSniffer::IsCasteable(const string_t value, const LogicalType &type, const DialectOptions &dialect_options,
const bool is_null) {
bool CSVSniffer::CanYouCastIt(const string_t value, const LogicalType &type, const DialectOptions &dialect_options,
const bool is_null) {
if (is_null) {
return true;
}
Expand Down Expand Up @@ -315,8 +315,8 @@ void CSVSniffer::DetectTypes() {
// Nothing to convert it to
continue;
}
if (IsCasteable(vector_data[row_idx], sql_type, sniffing_state_machine.dialect_options,
!null_mask.RowIsValid(row_idx))) {
if (CanYouCastIt(vector_data[row_idx], sql_type, sniffing_state_machine.dialect_options,
!null_mask.RowIsValid(row_idx))) {
break;
} else {
if (row_idx != start_idx_detection && cur_top_candidate == LogicalType::BOOLEAN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ class CSVSniffer {
void DetectDateAndTimeStampFormats(CSVStateMachine &candidate, const LogicalType &sql_type, const string &separator,
string_t &dummy_val);
//! If a string_t value can be cast to a type
bool IsCasteable(const string_t value, const LogicalType &type, const DialectOptions &dialect_options,
const bool is_null);
bool CanYouCastIt(const string_t value, const LogicalType &type, const DialectOptions &dialect_options,
const bool is_null);

//! Variables for Type Detection
//! Format Candidates for Date and Timestamp Types
Expand Down

0 comments on commit bc18ac8

Please sign in to comment.