Skip to content

Commit e847388

Browse files
duckdblabs-botgithub-actions[bot]
authored andcommitted
Update vendored DuckDB sources to 617ca0423b
1 parent 699ecbd commit e847388

File tree

27 files changed

+13915
-13655
lines changed

27 files changed

+13915
-13655
lines changed

src/duckdb/extension/icu/icu-strptime.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ struct ICUStrptime : public ICUDateFunc {
270270
auto &info = cast_data.info->Cast<BindData>();
271271
CalendarPtr cal(info.calendar->clone());
272272

273-
UnaryExecutor::ExecuteWithNulls<string_t, timestamp_t>(
273+
UnaryExecutor::ExecuteWithNulls<string_t, timestamp_tz_t>(
274274
source, result, count, [&](string_t input, ValidityMask &mask, idx_t idx) {
275-
timestamp_t result;
275+
timestamp_tz_t result;
276276
const auto str = input.GetData();
277277
const auto len = input.GetSize();
278278
string_t tz(nullptr, 0);
279279
bool has_offset = false;
280-
auto success = Timestamp::TryConvertTimestampTZ(str, len, result, has_offset, tz);
280+
auto success = Timestamp::TryConvertTimestampTZ(str, len, result, true, has_offset, tz);
281281
if (success != TimestampCastResult::SUCCESS) {
282282
string msg;
283283
if (success == TimestampCastResult::ERROR_RANGE) {
@@ -302,7 +302,7 @@ struct ICUStrptime : public ICUDateFunc {
302302
}
303303

304304
// Now get the parts in the given time zone
305-
result = FromNaive(calendar, result);
305+
result = timestamp_tz_t(FromNaive(calendar, result));
306306
}
307307

308308
return result;

src/duckdb/src/common/file_system.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,11 @@ vector<OpenFileInfo> FileSystem::GlobFiles(const string &pattern, ClientContext
668668
throw InternalException("FALLBACK_GLOB requires an extension to be specified");
669669
}
670670
string new_pattern = JoinPath(JoinPath(pattern, "**"), "*." + input.extension);
671-
return GlobFiles(new_pattern, context, FileGlobOptions::DISALLOW_EMPTY);
671+
result = GlobFiles(new_pattern, context, FileGlobOptions::ALLOW_EMPTY);
672+
if (!result.empty()) {
673+
// we found files by globbing the target as if it was a directory - return them
674+
return result;
675+
}
672676
}
673677
}
674678
if (input.behavior == FileGlobOptions::FALLBACK_GLOB || input.behavior == FileGlobOptions::DISALLOW_EMPTY) {

src/duckdb/src/common/operator/cast_operators.cpp

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,26 @@ dtime_tz_t Cast::Operation(string_t input) {
16841684
//===--------------------------------------------------------------------===//
16851685
template <>
16861686
bool TryCastErrorMessage::Operation(string_t input, timestamp_t &result, CastParameters &parameters) {
1687-
switch (Timestamp::TryConvertTimestamp(input.GetData(), input.GetSize(), result)) {
1687+
switch (Timestamp::TryConvertTimestamp(input.GetData(), input.GetSize(), result, false)) {
1688+
case TimestampCastResult::SUCCESS:
1689+
case TimestampCastResult::STRICT_UTC:
1690+
return true;
1691+
case TimestampCastResult::ERROR_INCORRECT_FORMAT:
1692+
HandleCastError::AssignError(Timestamp::FormatError(input), parameters);
1693+
break;
1694+
case TimestampCastResult::ERROR_NON_UTC_TIMEZONE:
1695+
HandleCastError::AssignError(Timestamp::UnsupportedTimezoneError(input), parameters);
1696+
break;
1697+
case TimestampCastResult::ERROR_RANGE:
1698+
HandleCastError::AssignError(Timestamp::RangeError(input), parameters);
1699+
break;
1700+
}
1701+
return false;
1702+
}
1703+
1704+
template <>
1705+
bool TryCastErrorMessage::Operation(string_t input, timestamp_tz_t &result, CastParameters &parameters) {
1706+
switch (Timestamp::TryConvertTimestamp(input.GetData(), input.GetSize(), result, true)) {
16881707
case TimestampCastResult::SUCCESS:
16891708
case TimestampCastResult::STRICT_UTC:
16901709
return true;
@@ -1703,7 +1722,14 @@ bool TryCastErrorMessage::Operation(string_t input, timestamp_t &result, CastPar
17031722

17041723
template <>
17051724
bool TryCast::Operation(string_t input, timestamp_t &result, bool strict) {
1706-
return Timestamp::TryConvertTimestamp(input.GetData(), input.GetSize(), result) == TimestampCastResult::SUCCESS;
1725+
return Timestamp::TryConvertTimestamp(input.GetData(), input.GetSize(), result, false) ==
1726+
TimestampCastResult::SUCCESS;
1727+
}
1728+
1729+
template <>
1730+
bool TryCast::Operation(string_t input, timestamp_tz_t &result, bool strict) {
1731+
return Timestamp::TryConvertTimestamp(input.GetData(), input.GetSize(), result, true) ==
1732+
TimestampCastResult::SUCCESS;
17071733
}
17081734

17091735
template <>
@@ -1713,13 +1739,18 @@ bool TryCast::Operation(string_t input, timestamp_ns_t &result, bool strict) {
17131739

17141740
template <>
17151741
timestamp_t Cast::Operation(string_t input) {
1716-
return Timestamp::FromCString(input.GetData(), input.GetSize());
1742+
return Timestamp::FromCString(input.GetData(), input.GetSize(), false);
1743+
}
1744+
1745+
template <>
1746+
timestamp_tz_t Cast::Operation(string_t input) {
1747+
return timestamp_tz_t(Timestamp::FromCString(input.GetData(), input.GetSize(), true));
17171748
}
17181749

17191750
template <>
17201751
timestamp_ns_t Cast::Operation(string_t input) {
17211752
int32_t nanos;
1722-
const auto ts = Timestamp::FromCString(input.GetData(), input.GetSize(), &nanos);
1753+
const auto ts = Timestamp::FromCString(input.GetData(), input.GetSize(), false, &nanos);
17231754
timestamp_ns_t result;
17241755
if (!Timestamp::TryFromTimestampNanos(ts, nanos, result)) {
17251756
throw ConversionException(Timestamp::RangeError(input));

src/duckdb/src/common/progress_bar/terminal_progress_bar_display.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ void TerminalProgressBarDisplay::Update(double percentage) {
124124

125125
double estimated_seconds_remaining = ukf.GetEstimatedRemainingSeconds();
126126
auto percentage_int = NormalizePercentage(percentage);
127-
PrintProgressInternal(percentage_int, estimated_seconds_remaining);
128-
Printer::Flush(OutputStream::STREAM_STDOUT);
127+
128+
TerminalProgressBarDisplayedProgressInfo updated_progress_info = {percentage_int,
129+
(int32_t)estimated_seconds_remaining};
130+
if (displayed_progress_info != updated_progress_info) {
131+
PrintProgressInternal(percentage_int, estimated_seconds_remaining);
132+
Printer::Flush(OutputStream::STREAM_STDOUT);
133+
displayed_progress_info = updated_progress_info;
134+
}
129135
}
130136

131137
void TerminalProgressBarDisplay::Finish() {

src/duckdb/src/common/sorting/hashed_sort.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ SinkFinalizeType HashedSort::MaterializeHashGroups(Pipeline &pipeline, Event &ev
651651
}
652652

653653
// Schedule all the sorts for maximum thread utilisation
654-
HashedSortMaterializeEvent fnord(gsink, pipeline, op, callback);
655654
auto sort_event = make_shared_ptr<HashedSortMaterializeEvent>(gsink, pipeline, op, callback);
656655
event.InsertEvent(std::move(sort_event));
657656

src/duckdb/src/common/types/time.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool Time::TryConvertTime(const char *buf, idx_t len, idx_t &pos, dtime_t &resul
143143
if (!strict) {
144144
// last chance, check if we can parse as timestamp
145145
timestamp_t timestamp;
146-
if (Timestamp::TryConvertTimestamp(buf, len, timestamp, nanos) == TimestampCastResult::SUCCESS) {
146+
if (Timestamp::TryConvertTimestamp(buf, len, timestamp, false, nanos) == TimestampCastResult::SUCCESS) {
147147
if (!Timestamp::IsFinite(timestamp)) {
148148
return false;
149149
}
@@ -164,7 +164,7 @@ bool Time::TryConvertTimeTZ(const char *buf, idx_t len, idx_t &pos, dtime_tz_t &
164164
if (!strict) {
165165
// last chance, check if we can parse as timestamp
166166
timestamp_t timestamp;
167-
if (Timestamp::TryConvertTimestamp(buf, len, timestamp, nanos) == TimestampCastResult::SUCCESS) {
167+
if (Timestamp::TryConvertTimestamp(buf, len, timestamp, true, nanos) == TimestampCastResult::SUCCESS) {
168168
if (!Timestamp::IsFinite(timestamp)) {
169169
return false;
170170
}

src/duckdb/src/common/types/timestamp.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ timestamp_t &timestamp_t::operator-=(const int64_t &delta) {
6464
return *this;
6565
}
6666

67-
TimestampCastResult Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, bool &has_offset,
68-
string_t &tz, optional_ptr<int32_t> nanos) {
67+
TimestampCastResult Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, bool use_offset,
68+
bool &has_offset, string_t &tz, optional_ptr<int32_t> nanos) {
6969
idx_t pos;
7070
date_t date;
7171
dtime_t time;
@@ -118,7 +118,7 @@ TimestampCastResult Timestamp::TryConvertTimestampTZ(const char *str, idx_t len,
118118
} else if (Timestamp::TryParseUTCOffset(str, pos, len, hh, mm, ss)) {
119119
const int64_t delta =
120120
hh * Interval::MICROS_PER_HOUR + mm * Interval::MICROS_PER_MINUTE + ss * Interval::MICROS_PER_SEC;
121-
if (!TrySubtractOperator::Operation(result.value, delta, result.value)) {
121+
if (use_offset && !TrySubtractOperator::Operation(result.value, delta, result.value)) {
122122
return TimestampCastResult::ERROR_RANGE;
123123
}
124124
has_offset = true;
@@ -149,12 +149,12 @@ TimestampCastResult Timestamp::TryConvertTimestampTZ(const char *str, idx_t len,
149149
return TimestampCastResult::SUCCESS;
150150
}
151151

152-
TimestampCastResult Timestamp::TryConvertTimestamp(const char *str, idx_t len, timestamp_t &result,
152+
TimestampCastResult Timestamp::TryConvertTimestamp(const char *str, idx_t len, timestamp_t &result, bool use_offset,
153153
optional_ptr<int32_t> nanos, bool strict) {
154154
string_t tz(nullptr, 0);
155155
bool has_offset = false;
156156
// We don't understand TZ without an extension, so fail if one was provided.
157-
auto success = TryConvertTimestampTZ(str, len, result, has_offset, tz, nanos);
157+
auto success = TryConvertTimestampTZ(str, len, result, use_offset, has_offset, tz, nanos);
158158
if (success != TimestampCastResult::SUCCESS) {
159159
return success;
160160
}
@@ -198,7 +198,7 @@ bool Timestamp::TryFromTimestampNanos(timestamp_t input, int32_t nanos, timestam
198198

199199
TimestampCastResult Timestamp::TryConvertTimestamp(const char *str, idx_t len, timestamp_ns_t &result) {
200200
int32_t nanos = 0;
201-
auto success = TryConvertTimestamp(str, len, result, &nanos);
201+
auto success = TryConvertTimestamp(str, len, result, true, &nanos);
202202
if (success != TimestampCastResult::SUCCESS) {
203203
return success;
204204
}
@@ -236,9 +236,9 @@ string Timestamp::RangeError(string_t str) {
236236
return Timestamp::RangeError(str.GetString());
237237
}
238238

239-
timestamp_t Timestamp::FromCString(const char *str, idx_t len, optional_ptr<int32_t> nanos) {
239+
timestamp_t Timestamp::FromCString(const char *str, idx_t len, bool use_offset, optional_ptr<int32_t> nanos) {
240240
timestamp_t result;
241-
switch (Timestamp::TryConvertTimestamp(str, len, result, nanos)) {
241+
switch (Timestamp::TryConvertTimestamp(str, len, result, use_offset, nanos)) {
242242
case TimestampCastResult::SUCCESS:
243243
case TimestampCastResult::STRICT_UTC:
244244
break;
@@ -324,8 +324,8 @@ bool Timestamp::TryParseUTCOffset(const char *str, idx_t &pos, idx_t len, int &h
324324
return true;
325325
}
326326

327-
timestamp_t Timestamp::FromString(const string &str) {
328-
return Timestamp::FromCString(str.c_str(), str.size());
327+
timestamp_t Timestamp::FromString(const string &str, bool use_offset) {
328+
return Timestamp::FromCString(str.c_str(), str.size(), use_offset);
329329
}
330330

331331
string Timestamp::ToString(timestamp_t timestamp) {

src/duckdb/src/common/types/vector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,12 @@ Value Vector::GetValueInternal(const Vector &v_p, idx_t index_p) {
755755
case LogicalTypeId::STRUCT: {
756756
// we can derive the value schema from the vector schema
757757
auto &child_entries = StructVector::GetEntries(*vector);
758-
child_list_t<Value> children;
758+
duckdb::vector<Value> children;
759759
for (idx_t child_idx = 0; child_idx < child_entries.size(); child_idx++) {
760760
auto &struct_child = child_entries[child_idx];
761-
children.push_back(make_pair(StructType::GetChildName(type, child_idx), struct_child->GetValue(index_p)));
761+
children.push_back(struct_child->GetValue(index_p));
762762
}
763-
return Value::STRUCT(std::move(children));
763+
return Value::STRUCT(type, std::move(children));
764764
}
765765
case LogicalTypeId::LIST: {
766766
auto offlen = reinterpret_cast<list_entry_t *>(data)[index];

0 commit comments

Comments
 (0)