Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit Cast for any Date/Timestamp #11733

Merged
merged 5 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Removing 4x sleep function
  • Loading branch information
pdet committed Apr 19, 2024
commit 9f57957c13bbdd798b82d99ce71696d884478cc3
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ StringValueResult::StringValueResult(CSVStates &states, CSVStateMachine &state_m
null_str_ptr[i] = state_machine.options.null_str[i].c_str();
null_str_size[i] = state_machine.options.null_str[i].size();
}
date_format = state_machine.options.dialect_options.date_format.at(LogicalTypeId::DATE).GetValue();
timestamp_format = state_machine.options.dialect_options.date_format.at(LogicalTypeId::TIMESTAMP).GetValue();
}

StringValueResult::~StringValueResult() {
Expand Down Expand Up @@ -215,11 +217,9 @@ void StringValueResult::AddValueToVector(const char *value_ptr, const idx_t size
false, state_machine.options.decimal_separator[0]);
break;
case LogicalTypeId::DATE: {
if (!state_machine.dialect_options.date_format.find(LogicalTypeId::DATE)->second.GetValue().Empty()) {
success =
state_machine.dialect_options.date_format.find(LogicalTypeId::DATE)
->second.GetValue()
.TryParseDate(value_ptr, size, static_cast<date_t *>(vector_ptr[chunk_col_id])[number_of_rows]);
if (!date_format.Empty()) {
success = date_format.TryParseDate(value_ptr, size,
static_cast<date_t *>(vector_ptr[chunk_col_id])[number_of_rows]);
} else {
idx_t pos;
bool special;
Expand All @@ -229,11 +229,9 @@ void StringValueResult::AddValueToVector(const char *value_ptr, const idx_t size
break;
}
case LogicalTypeId::TIMESTAMP: {
if (!state_machine.dialect_options.date_format.find(LogicalTypeId::TIMESTAMP)->second.GetValue().Empty()) {
success = state_machine.dialect_options.date_format.find(LogicalTypeId::TIMESTAMP)
->second.GetValue()
.TryParseTimestamp(value_ptr, size,
static_cast<timestamp_t *>(vector_ptr[chunk_col_id])[number_of_rows]);
if (!timestamp_format.Empty()) {
success = timestamp_format.TryParseTimestamp(
value_ptr, size, static_cast<timestamp_t *>(vector_ptr[chunk_col_id])[number_of_rows]);
} else {
success = Timestamp::TryConvertTimestamp(
value_ptr, size, static_cast<timestamp_t *>(vector_ptr[chunk_col_id])[number_of_rows]) ==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class StringValueResult : public ScannerResult {

//! Errors happening in the current line (if any)
vector<CurrentError> current_errors;

StrpTimeFormat date_format, timestamp_format;
bool sniffing;
//! Specialized code for quoted values, makes sure to remove quotes and escapes
static inline void AddQuotedValue(StringValueResult &result, const idx_t buffer_pos);
Expand Down