Skip to content

Commit 6becafa

Browse files
authored
Merge branch 'main' into main
2 parents 92af000 + a1d49c7 commit 6becafa

File tree

124 files changed

+18447
-17700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+18447
-17700
lines changed

CMakeLists.txt

+1-1
Large diffs are not rendered by default.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ unique_ptr<FunctionData> ICUDateFunc::Bind(ClientContext &context, ScalarFunctio
7272
}
7373

7474
void ICUDateFunc::SetTimeZone(icu::Calendar *calendar, const string_t &tz_id) {
75-
auto tz = icu_66::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(icu::StringPiece(tz_id.GetString())));
75+
auto tz = icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(icu::StringPiece(tz_id.GetString())));
7676
if (*tz == icu::TimeZone::getUnknown()) {
7777
delete tz;
7878
throw NotImplementedException("Unknown TimeZone '%s'", tz_id.GetString());

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

+6-8
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
#include "duckdb/execution/expression_executor.hpp"
1212
#include "duckdb/function/scalar/strftime_format.hpp"
1313
#include "duckdb/main/client_context.hpp"
14-
#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"
1514
#include "duckdb/planner/expression/bound_function_expression.hpp"
16-
#include "duckdb/function/function_binder.hpp"
17-
#include "duckdb/function/cast/default_casts.hpp"
1815
#include "duckdb/main/extension_util.hpp"
1916

2017
namespace duckdb {
@@ -75,13 +72,13 @@ struct ICUStrptime : public ICUDateFunc {
7572
calendar->set(UCAL_HOUR_OF_DAY, parsed.data[3]);
7673
calendar->set(UCAL_MINUTE, parsed.data[4]);
7774
calendar->set(UCAL_SECOND, parsed.data[5]);
78-
calendar->set(UCAL_MILLISECOND, micros / Interval::MICROS_PER_MSEC);
75+
calendar->set(UCAL_MILLISECOND, UnsafeNumericCast<int32_t>(micros / Interval::MICROS_PER_MSEC));
7976
micros %= Interval::MICROS_PER_MSEC;
8077

8178
// This overrides the TZ setting, so only use it if an offset was parsed.
8279
// Note that we don't bother/worry about the DST setting because the two just combine.
8380
if (format.HasFormatSpecifier(StrTimeSpecifier::UTC_OFFSET)) {
84-
calendar->set(UCAL_ZONE_OFFSET, parsed.data[7] * Interval::MSECS_PER_SEC * Interval::SECS_PER_MINUTE);
81+
calendar->set(UCAL_ZONE_OFFSET, UnsafeNumericCast<int32_t>(parsed.data[7] * Interval::MSECS_PER_SEC));
8582
}
8683

8784
return micros;
@@ -375,11 +372,11 @@ struct ICUStrftime : public ICUDateFunc {
375372
data[3] = ExtractField(calendar, UCAL_HOUR_OF_DAY);
376373
data[4] = ExtractField(calendar, UCAL_MINUTE);
377374
data[5] = ExtractField(calendar, UCAL_SECOND);
378-
data[6] = ExtractField(calendar, UCAL_MILLISECOND) * Interval::MICROS_PER_MSEC + micros;
375+
data[6] =
376+
UnsafeNumericCast<int32_t>(ExtractField(calendar, UCAL_MILLISECOND) * Interval::MICROS_PER_MSEC + micros);
379377

380378
data[7] = ExtractField(calendar, UCAL_ZONE_OFFSET) + ExtractField(calendar, UCAL_DST_OFFSET);
381379
data[7] /= Interval::MSECS_PER_SEC;
382-
data[7] /= Interval::SECS_PER_MINUTE;
383380

384381
const auto date = Date::FromDate(data[0], data[1], data[2]);
385382
const auto time = Time::FromTime(data[3], data[4], data[5], data[6]);
@@ -461,7 +458,8 @@ struct ICUStrftime : public ICUDateFunc {
461458
time_units[0] = ExtractField(calendar, UCAL_HOUR_OF_DAY);
462459
time_units[1] = ExtractField(calendar, UCAL_MINUTE);
463460
time_units[2] = ExtractField(calendar, UCAL_SECOND);
464-
time_units[3] = ExtractField(calendar, UCAL_MILLISECOND) * Interval::MICROS_PER_MSEC + micros;
461+
time_units[3] =
462+
UnsafeNumericCast<int32_t>(ExtractField(calendar, UCAL_MILLISECOND) * Interval::MICROS_PER_MSEC + micros);
465463

466464
idx_t year_length;
467465
bool add_bc;

src/duckdb/extension/icu/icu-table-range.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ struct ICUTableRange {
6363
bool inclusive_bound;
6464
bool greater_than_check;
6565

66+
bool empty_range = false;
67+
6668
bool Finished(timestamp_t current_value) const {
6769
if (greater_than_check) {
6870
if (inclusive_bound) {
@@ -113,14 +115,12 @@ struct ICUTableRange {
113115
}
114116
result.greater_than_check = true;
115117
if (result.start > result.end) {
116-
throw BinderException(
117-
"start is bigger than end, but increment is positive: cannot generate infinite series");
118+
result.empty_range = true;
118119
}
119120
} else {
120121
result.greater_than_check = false;
121122
if (result.start < result.end) {
122-
throw BinderException(
123-
"start is smaller than end, but increment is negative: cannot generate infinite series");
123+
result.empty_range = true;
124124
}
125125
}
126126
result.inclusive_bound = GENERATE_SERIES;
@@ -166,6 +166,13 @@ struct ICUTableRange {
166166
state.initialized_row = true;
167167
state.current_state = state.start;
168168
}
169+
if (state.empty_range) {
170+
// empty range
171+
output.SetCardinality(0);
172+
state.current_input_row++;
173+
state.initialized_row = false;
174+
return OperatorResultType::HAVE_MORE_OUTPUT;
175+
}
169176
idx_t size = 0;
170177
auto data = FlatVector::GetData<timestamp_t>(output.data[0]);
171178
while (true) {

0 commit comments

Comments
 (0)