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

Bump to DuckDB v1.1.0 #117

Merged
merged 4 commits into from
Sep 17, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/NodeJS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jobs:

win-nodejs:
name: node.js Windows
runs-on: windows-latest
runs-on: windows-2019
needs: set-up-npm
continue-on-error: ${{ matrix.node != '18' && matrix.node != '20' && matrix.node != '21' }}
env:
Expand Down
41 changes: 41 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"src/duckdb/ub_src_common_row_operations.cpp",
"src/duckdb/ub_src_common_serializer.cpp",
"src/duckdb/ub_src_common_sort.cpp",
"src/duckdb/ub_src_common_tree_renderer.cpp",
"src/duckdb/ub_src_common_types.cpp",
"src/duckdb/ub_src_common_types_column.cpp",
"src/duckdb/ub_src_common_types_row.cpp",
Expand Down Expand Up @@ -243,6 +244,7 @@
"src/duckdb/extension/parquet/parquet_writer.cpp",
"src/duckdb/extension/parquet/serialize_parquet.cpp",
"src/duckdb/extension/parquet/zstd_file_system.cpp",
"src/duckdb/extension/parquet/geo_parquet.cpp",
"src/duckdb/third_party/parquet/parquet_constants.cpp",
"src/duckdb/third_party/parquet/parquet_types.cpp",
"src/duckdb/third_party/thrift/thrift/protocol/TProtocol.cpp",
Expand Down Expand Up @@ -272,6 +274,37 @@
"src/duckdb/third_party/zstd/compress/zstd_ldm.cpp",
"src/duckdb/third_party/zstd/compress/zstd_opt.cpp",
"src/duckdb/third_party/lz4/lz4.cpp",
"src/duckdb/third_party/brotli/common/constants.cpp",
"src/duckdb/third_party/brotli/common/context.cpp",
"src/duckdb/third_party/brotli/common/dictionary.cpp",
"src/duckdb/third_party/brotli/common/platform.cpp",
"src/duckdb/third_party/brotli/common/shared_dictionary.cpp",
"src/duckdb/third_party/brotli/common/transform.cpp",
"src/duckdb/third_party/brotli/dec/bit_reader.cpp",
"src/duckdb/third_party/brotli/dec/decode.cpp",
"src/duckdb/third_party/brotli/dec/huffman.cpp",
"src/duckdb/third_party/brotli/dec/state.cpp",
"src/duckdb/third_party/brotli/enc/backward_references.cpp",
"src/duckdb/third_party/brotli/enc/backward_references_hq.cpp",
"src/duckdb/third_party/brotli/enc/bit_cost.cpp",
"src/duckdb/third_party/brotli/enc/block_splitter.cpp",
"src/duckdb/third_party/brotli/enc/brotli_bit_stream.cpp",
"src/duckdb/third_party/brotli/enc/cluster.cpp",
"src/duckdb/third_party/brotli/enc/command.cpp",
"src/duckdb/third_party/brotli/enc/compound_dictionary.cpp",
"src/duckdb/third_party/brotli/enc/compress_fragment.cpp",
"src/duckdb/third_party/brotli/enc/compress_fragment_two_pass.cpp",
"src/duckdb/third_party/brotli/enc/dictionary_hash.cpp",
"src/duckdb/third_party/brotli/enc/encode.cpp",
"src/duckdb/third_party/brotli/enc/encoder_dict.cpp",
"src/duckdb/third_party/brotli/enc/entropy_encode.cpp",
"src/duckdb/third_party/brotli/enc/fast_log.cpp",
"src/duckdb/third_party/brotli/enc/histogram.cpp",
"src/duckdb/third_party/brotli/enc/literal_cost.cpp",
"src/duckdb/third_party/brotli/enc/memory.cpp",
"src/duckdb/third_party/brotli/enc/metablock.cpp",
"src/duckdb/third_party/brotli/enc/static_dict.cpp",
"src/duckdb/third_party/brotli/enc/utf8_util.cpp",
"src/duckdb/extension/icu/./icu-table-range.cpp",
"src/duckdb/extension/icu/./icu-makedate.cpp",
"src/duckdb/extension/icu/./icu-list-range.cpp",
Expand Down Expand Up @@ -313,6 +346,10 @@
"src/duckdb/third_party/libpg_query",
"src/duckdb/third_party/libpg_query/include",
"src/duckdb/third_party/lz4",
"src/duckdb/third_party/brotli/include",
"src/duckdb/third_party/brotli/common",
"src/duckdb/third_party/brotli/dec",
"src/duckdb/third_party/brotli/enc",
"src/duckdb/third_party/mbedtls",
"src/duckdb/third_party/mbedtls/include",
"src/duckdb/third_party/mbedtls/library",
Expand All @@ -328,6 +365,10 @@
"src/duckdb/third_party/parquet",
"src/duckdb/third_party/thrift",
"src/duckdb/third_party/lz4",
"src/duckdb/third_party/brotli/include",
"src/duckdb/third_party/brotli/common",
"src/duckdb/third_party/brotli/dec",
"src/duckdb/third_party/brotli/enc",
"src/duckdb/third_party/snappy",
"src/duckdb/third_party/zstd/include",
"src/duckdb/third_party/mbedtls",
Expand Down
6 changes: 4 additions & 2 deletions src/duckdb/extension/icu/icu-dateadd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ timestamp_t ICUCalendarAdd::Operation(timestamp_t timestamp, interval_t interval
calendar->add(UCAL_MINUTE, interval_m, status);
CalendarAddHour(calendar, interval_h, status);

calendar->add(UCAL_DATE, interval.days, status);
// PG Adds months before days
calendar->add(UCAL_MONTH, interval.months, status);
calendar->add(UCAL_DATE, interval.days, status);
} else {
// Add interval fields from highest to lowest (ragged to non-ragged)
// PG Adds months before days
calendar->add(UCAL_MONTH, interval.months, status);
calendar->add(UCAL_DATE, interval.days, status);

// Add interval fields from highest to lowest (ragged to non-ragged)
CalendarAddHour(calendar, interval_h, status);
calendar->add(UCAL_MINUTE, interval_m, status);
calendar->add(UCAL_SECOND, interval_s, status);
Expand Down
8 changes: 6 additions & 2 deletions src/duckdb/extension/icu/icu-datefunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ unique_ptr<FunctionData> ICUDateFunc::Bind(ClientContext &context, ScalarFunctio

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

Expand All @@ -83,7 +87,7 @@ timestamp_t ICUDateFunc::GetTimeUnsafe(icu::Calendar *calendar, uint64_t micros)
if (U_FAILURE(status)) {
throw InternalException("Unable to get ICU calendar time.");
}
return timestamp_t(millis * Interval::MICROS_PER_MSEC + micros);
return timestamp_t(millis * Interval::MICROS_PER_MSEC + int64_t(micros));
}

bool ICUDateFunc::TryGetTime(icu::Calendar *calendar, uint64_t micros, timestamp_t &result) {
Expand All @@ -98,7 +102,7 @@ bool ICUDateFunc::TryGetTime(icu::Calendar *calendar, uint64_t micros, timestamp
if (!TryMultiplyOperator::Operation<int64_t, int64_t, int64_t>(millis, Interval::MICROS_PER_MSEC, millis)) {
return false;
}
if (!TryAddOperator::Operation<int64_t, int64_t, int64_t>(millis, micros, millis)) {
if (!TryAddOperator::Operation<int64_t, int64_t, int64_t>(millis, int64_t(micros), millis)) {
return false;
}

Expand Down
15 changes: 13 additions & 2 deletions src/duckdb/extension/icu/icu-datesub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ struct ICUCalendarDiff : public ICUDateFunc {
return sub_func(calendar, start_date, end_date);
}

static part_trunc_t DiffTruncationFactory(DatePartSpecifier type) {
switch (type) {
case DatePartSpecifier::WEEK:
// Weeks are computed without anchors
return TruncationFactory(DatePartSpecifier::DAY);
default:
break;
}
return TruncationFactory(type);
}

template <typename T>
static void ICUDateDiffFunction(DataChunk &args, ExpressionState &state, Vector &result) {
D_ASSERT(args.ColumnCount() == 3);
Expand All @@ -229,7 +240,7 @@ struct ICUCalendarDiff : public ICUDateFunc {
} else {
const auto specifier = ConstantVector::GetData<string_t>(part_arg)->GetString();
const auto part = GetDatePartSpecifier(specifier);
auto trunc_func = TruncationFactory(part);
auto trunc_func = DiffTruncationFactory(part);
auto sub_func = SubtractFactory(part);
BinaryExecutor::ExecuteWithNulls<T, T, int64_t>(
startdate_arg, enddate_arg, result, args.size(),
Expand All @@ -248,7 +259,7 @@ struct ICUCalendarDiff : public ICUDateFunc {
[&](string_t specifier, T start_date, T end_date, ValidityMask &mask, idx_t idx) {
if (Timestamp::IsFinite(start_date) && Timestamp::IsFinite(end_date)) {
const auto part = GetDatePartSpecifier(specifier.GetString());
auto trunc_func = TruncationFactory(part);
auto trunc_func = DiffTruncationFactory(part);
auto sub_func = SubtractFactory(part);
return DifferenceFunc<T>(calendar, start_date, end_date, trunc_func, sub_func);
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/duckdb/extension/icu/icu-strptime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ struct ICUStrptime : public ICUDateFunc {
}

// Now get the parts in the given time zone
uint64_t micros = 0;
uint64_t micros = parsed.GetMicros();
calendar->set(UCAL_EXTENDED_YEAR, parsed.data[0]); // strptime doesn't understand eras
calendar->set(UCAL_MONTH, parsed.data[1] - 1);
calendar->set(UCAL_DATE, parsed.data[2]);
calendar->set(UCAL_HOUR_OF_DAY, parsed.data[3]);
calendar->set(UCAL_MINUTE, parsed.data[4]);
calendar->set(UCAL_SECOND, parsed.data[5]);
calendar->set(UCAL_MILLISECOND, parsed.data[6] / Interval::MICROS_PER_MSEC);
micros = parsed.data[6] % Interval::MICROS_PER_MSEC;
calendar->set(UCAL_MILLISECOND, micros / Interval::MICROS_PER_MSEC);
micros %= Interval::MICROS_PER_MSEC;

// This overrides the TZ setting, so only use it if an offset was parsed.
// Note that we don't bother/worry about the DST setting because the two just combine.
Expand Down Expand Up @@ -158,7 +158,7 @@ struct ICUStrptime : public ICUDateFunc {
}
}

static bind_scalar_function_t bind_strptime;
static bind_scalar_function_t bind_strptime; // NOLINT

static duckdb::unique_ptr<FunctionData> StrpTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
vector<duckdb::unique_ptr<Expression>> &arguments) {
Expand Down Expand Up @@ -194,7 +194,7 @@ struct ICUStrptime : public ICUDateFunc {
throw InvalidInputException("strptime format list must not be empty");
}
vector<StrpTimeFormat> formats;
bool has_tz = true;
bool has_tz = false;
for (const auto &child : children) {
format_string = child.ToString();
format.format_specifier = format_string;
Expand Down Expand Up @@ -341,7 +341,7 @@ struct ICUStrptime : public ICUDateFunc {
}
};

bind_scalar_function_t ICUStrptime::bind_strptime = nullptr;
bind_scalar_function_t ICUStrptime::bind_strptime = nullptr; // NOLINT

struct ICUStrftime : public ICUDateFunc {
static void ParseFormatSpecifier(string_t &format_str, StrfTimeFormat &format) {
Expand Down
Loading
Loading