Skip to content

Commit

Permalink
bump duckdb
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes committed Jan 15, 2025
1 parent 45a6166 commit d001b3f
Show file tree
Hide file tree
Showing 1,423 changed files with 107,664 additions and 44,193 deletions.
96 changes: 46 additions & 50 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,14 @@
"src/duckdb/src/common/vector_operations/vector_copy.cpp",
"src/duckdb/src/common/vector_operations/vector_hash.cpp",
"src/duckdb/src/common/vector_operations/vector_storage.cpp",
"src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp",
"src/duckdb/ub_src_core_functions_aggregate_distributive.cpp",
"src/duckdb/ub_src_core_functions_aggregate_holistic.cpp",
"src/duckdb/ub_src_core_functions_aggregate_nested.cpp",
"src/duckdb/ub_src_core_functions_aggregate_regression.cpp",
"src/duckdb/ub_src_core_functions.cpp",
"src/duckdb/ub_src_core_functions_scalar_array.cpp",
"src/duckdb/ub_src_core_functions_scalar_bit.cpp",
"src/duckdb/ub_src_core_functions_scalar_blob.cpp",
"src/duckdb/ub_src_core_functions_scalar_date.cpp",
"src/duckdb/ub_src_core_functions_scalar_debug.cpp",
"src/duckdb/ub_src_core_functions_scalar_enum.cpp",
"src/duckdb/ub_src_core_functions_scalar_generic.cpp",
"src/duckdb/ub_src_core_functions_scalar_list.cpp",
"src/duckdb/ub_src_core_functions_scalar_map.cpp",
"src/duckdb/ub_src_core_functions_scalar_math.cpp",
"src/duckdb/ub_src_core_functions_scalar_operators.cpp",
"src/duckdb/ub_src_core_functions_scalar_random.cpp",
"src/duckdb/ub_src_core_functions_scalar_string.cpp",
"src/duckdb/ub_src_core_functions_scalar_struct.cpp",
"src/duckdb/ub_src_core_functions_scalar_union.cpp",
"src/duckdb/ub_src_execution.cpp",
"src/duckdb/ub_src_execution_expression_executor.cpp",
"src/duckdb/ub_src_execution_index_art.cpp",
"src/duckdb/ub_src_execution_index.cpp",
"src/duckdb/ub_src_execution_nested_loop_join.cpp",
"src/duckdb/ub_src_execution_operator_aggregate.cpp",
"src/duckdb/ub_src_execution_operator_csv_scanner_buffer_manager.cpp",
"src/duckdb/ub_src_execution_operator_csv_scanner_encode.cpp",
"src/duckdb/ub_src_execution_operator_csv_scanner_scanner.cpp",
"src/duckdb/ub_src_execution_operator_csv_scanner_sniffer.cpp",
"src/duckdb/ub_src_execution_operator_csv_scanner_state_machine.cpp",
Expand All @@ -84,6 +64,7 @@
"src/duckdb/ub_src_execution_operator_schema.cpp",
"src/duckdb/ub_src_execution_operator_set.cpp",
"src/duckdb/ub_src_execution_physical_plan.cpp",
"src/duckdb/ub_src_execution_sample.cpp",
"src/duckdb/ub_src_function_aggregate_distributive.cpp",
"src/duckdb/ub_src_function_aggregate.cpp",
"src/duckdb/ub_src_function.cpp",
Expand All @@ -92,9 +73,11 @@
"src/duckdb/ub_src_function_pragma.cpp",
"src/duckdb/ub_src_function_scalar_compressed_materialization.cpp",
"src/duckdb/ub_src_function_scalar.cpp",
"src/duckdb/ub_src_function_scalar_date.cpp",
"src/duckdb/ub_src_function_scalar_generic.cpp",
"src/duckdb/ub_src_function_scalar_list.cpp",
"src/duckdb/ub_src_function_scalar_operators.cpp",
"src/duckdb/ub_src_function_scalar_map.cpp",
"src/duckdb/ub_src_function_scalar_operator.cpp",
"src/duckdb/ub_src_function_scalar_sequence.cpp",
"src/duckdb/ub_src_function_scalar_string.cpp",
"src/duckdb/ub_src_function_scalar_string_regexp.cpp",
Expand All @@ -104,6 +87,8 @@
"src/duckdb/ub_src_function_table.cpp",
"src/duckdb/ub_src_function_table_system.cpp",
"src/duckdb/ub_src_function_table_version.cpp",
"src/duckdb/ub_src_function_window.cpp",
"src/duckdb/ub_src_logging.cpp",
"src/duckdb/ub_src_main.cpp",
"src/duckdb/ub_src_main_buffered_data.cpp",
"src/duckdb/ub_src_main_capi.cpp",
Expand Down Expand Up @@ -151,6 +136,8 @@
"src/duckdb/ub_src_storage_compression_alp.cpp",
"src/duckdb/ub_src_storage_compression.cpp",
"src/duckdb/ub_src_storage_compression_chimp.cpp",
"src/duckdb/ub_src_storage_compression_dictionary.cpp",
"src/duckdb/ub_src_storage_compression_roaring.cpp",
"src/duckdb/ub_src_storage_metadata.cpp",
"src/duckdb/ub_src_storage_serialization.cpp",
"src/duckdb/ub_src_storage_statistics.cpp",
Expand Down Expand Up @@ -233,6 +220,38 @@
"src/duckdb/third_party/mbedtls/library/sha512.cpp",
"src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp",
"src/duckdb/third_party/yyjson/yyjson.cpp",
"src/duckdb/third_party/zstd/common/debug.cpp",
"src/duckdb/third_party/zstd/common/entropy_common.cpp",
"src/duckdb/third_party/zstd/common/error_private.cpp",
"src/duckdb/third_party/zstd/common/fse_decompress.cpp",
"src/duckdb/third_party/zstd/common/pool.cpp",
"src/duckdb/third_party/zstd/common/threading.cpp",
"src/duckdb/third_party/zstd/common/xxhash.cpp",
"src/duckdb/third_party/zstd/common/zstd_common.cpp",
"src/duckdb/third_party/zstd/compress/fse_compress.cpp",
"src/duckdb/third_party/zstd/compress/hist.cpp",
"src/duckdb/third_party/zstd/compress/huf_compress.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress_literals.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress_sequences.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress_superblock.cpp",
"src/duckdb/third_party/zstd/compress/zstd_double_fast.cpp",
"src/duckdb/third_party/zstd/compress/zstd_fast.cpp",
"src/duckdb/third_party/zstd/compress/zstd_lazy.cpp",
"src/duckdb/third_party/zstd/compress/zstd_ldm.cpp",
"src/duckdb/third_party/zstd/compress/zstd_opt.cpp",
"src/duckdb/third_party/zstd/compress/zstdmt_compress.cpp",
"src/duckdb/third_party/zstd/decompress/huf_decompress.cpp",
"src/duckdb/third_party/zstd/decompress/zstd_ddict.cpp",
"src/duckdb/third_party/zstd/decompress/zstd_decompress.cpp",
"src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp",
"src/duckdb/third_party/zstd/deprecated/zbuff_common.cpp",
"src/duckdb/third_party/zstd/deprecated/zbuff_compress.cpp",
"src/duckdb/third_party/zstd/deprecated/zbuff_decompress.cpp",
"src/duckdb/third_party/zstd/dict/cover.cpp",
"src/duckdb/third_party/zstd/dict/divsufsort.cpp",
"src/duckdb/third_party/zstd/dict/fastcover.cpp",
"src/duckdb/third_party/zstd/dict/zdict.cpp",
"src/duckdb/extension/parquet/column_reader.cpp",
"src/duckdb/extension/parquet/column_writer.cpp",
"src/duckdb/extension/parquet/parquet_crypto.cpp",
Expand All @@ -245,34 +264,12 @@
"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",
"src/duckdb/third_party/thrift/thrift/transport/TTransportException.cpp",
"src/duckdb/third_party/thrift/thrift/transport/TBufferTransports.cpp",
"src/duckdb/third_party/snappy/snappy.cc",
"src/duckdb/third_party/snappy/snappy-sinksource.cc",
"src/duckdb/third_party/zstd/decompress/zstd_ddict.cpp",
"src/duckdb/third_party/zstd/decompress/huf_decompress.cpp",
"src/duckdb/third_party/zstd/decompress/zstd_decompress.cpp",
"src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp",
"src/duckdb/third_party/zstd/common/entropy_common.cpp",
"src/duckdb/third_party/zstd/common/fse_decompress.cpp",
"src/duckdb/third_party/zstd/common/zstd_common.cpp",
"src/duckdb/third_party/zstd/common/error_private.cpp",
"src/duckdb/third_party/zstd/common/xxhash.cpp",
"src/duckdb/third_party/zstd/compress/fse_compress.cpp",
"src/duckdb/third_party/zstd/compress/hist.cpp",
"src/duckdb/third_party/zstd/compress/huf_compress.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress_literals.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress_sequences.cpp",
"src/duckdb/third_party/zstd/compress/zstd_compress_superblock.cpp",
"src/duckdb/third_party/zstd/compress/zstd_double_fast.cpp",
"src/duckdb/third_party/zstd/compress/zstd_fast.cpp",
"src/duckdb/third_party/zstd/compress/zstd_lazy.cpp",
"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",
Expand Down Expand Up @@ -361,6 +358,7 @@
"src/duckdb/third_party/utf8proc",
"src/duckdb/third_party/utf8proc/include",
"src/duckdb/third_party/yyjson/include",
"src/duckdb/third_party/zstd/include",
"src/duckdb/extension/parquet/include",
"src/duckdb/third_party/parquet",
"src/duckdb/third_party/thrift",
Expand All @@ -370,9 +368,9 @@
"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",
"src/duckdb/third_party/mbedtls/include",
"src/duckdb/third_party/zstd/include",
"src/duckdb/extension/icu/include",
"src/duckdb/extension/icu/third_party/icu/common",
"src/duckdb/extension/icu/third_party/icu/i18n",
Expand All @@ -384,7 +382,7 @@
"DUCKDB_EXTENSION_ICU_LINKED",
"DUCKDB_EXTENSION_JSON_LINKED",
"DUCKDB_EXTENSION_AUTOLOAD_DEFAULT=1",
"DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1",
"DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1",
"NDEBUG"
],
"cflags_cc": [
Expand Down Expand Up @@ -420,12 +418,10 @@
},
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeLibrary": 2,
"ExceptionHandling": 1,
"AdditionalOptions": [
"/bigobj",
"/GR",
"/MD"
"/GR"
]
}
},
Expand Down
27 changes: 16 additions & 11 deletions src/duckdb/extension/icu/icu-dateadd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ static inline void CalendarAddHour(icu::Calendar *calendar, int64_t interval_hou
while (interval_hour > 0) {
calendar->add(UCAL_HOUR,
interval_hour > NumericLimits<int32_t>::Maximum() ? NumericLimits<int32_t>::Maximum()
: interval_hour,
: static_cast<int32_t>(interval_hour),
status);
interval_hour -= NumericLimits<int32_t>::Maximum();
}
} else {
while (interval_hour < 0) {
calendar->add(UCAL_HOUR,
interval_hour < NumericLimits<int32_t>::Minimum() ? NumericLimits<int32_t>::Minimum()
: interval_hour,
: static_cast<int32_t>(interval_hour),
status);
interval_hour -= NumericLimits<int32_t>::Minimum();
}
Expand Down Expand Up @@ -85,13 +85,13 @@ timestamp_t ICUCalendarAdd::Operation(timestamp_t timestamp, interval_t interval
// Break units apart to avoid overflow
auto interval_h = interval.micros / Interval::MICROS_PER_MSEC;

const auto interval_ms = interval_h % Interval::MSECS_PER_SEC;
const auto interval_ms = static_cast<int32_t>(interval_h % Interval::MSECS_PER_SEC);
interval_h /= Interval::MSECS_PER_SEC;

const auto interval_s = interval_h % Interval::SECS_PER_MINUTE;
const auto interval_s = static_cast<int32_t>(interval_h % Interval::SECS_PER_MINUTE);
interval_h /= Interval::SECS_PER_MINUTE;

const auto interval_m = interval_h % Interval::MINS_PER_HOUR;
const auto interval_m = static_cast<int32_t>(interval_h % Interval::MINS_PER_HOUR);
interval_h /= Interval::MINS_PER_HOUR;

if (interval.months < 0 || interval.days < 0 || interval.micros < 0) {
Expand Down Expand Up @@ -132,6 +132,9 @@ timestamp_t ICUCalendarSub::Operation(timestamp_t timestamp, interval_t interval

template <>
interval_t ICUCalendarSub::Operation(timestamp_t end_date, timestamp_t start_date, icu::Calendar *calendar) {
if (!Timestamp::IsFinite(end_date) || !Timestamp::IsFinite(start_date)) {
throw InvalidInputException("Cannot subtract infinite timestamps");
}
if (start_date > end_date) {
auto negated = Operation<timestamp_t, timestamp_t, interval_t>(start_date, end_date, calendar);
return {-negated.months, -negated.days, -negated.micros};
Expand All @@ -156,7 +159,7 @@ interval_t ICUCalendarSub::Operation(timestamp_t end_date, timestamp_t start_dat
auto min_diff = SubtractField(calendar, UCAL_MINUTE, end_date);
auto sec_diff = SubtractField(calendar, UCAL_SECOND, end_date);
auto ms_diff = SubtractField(calendar, UCAL_MILLISECOND, end_date);
auto micros_diff = ms_diff * Interval::MICROS_PER_MSEC + (end_micros - start_micros);
auto micros_diff = UnsafeNumericCast<int32_t>(ms_diff * Interval::MICROS_PER_MSEC + (end_micros - start_micros));
result.micros = Time::FromTime(hour_diff, min_diff, sec_diff, micros_diff).micros;

return result;
Expand Down Expand Up @@ -188,7 +191,7 @@ interval_t ICUCalendarAge::Operation(timestamp_t end_date, timestamp_t start_dat
auto min_diff = SubtractField(calendar, UCAL_MINUTE, end_date);
auto sec_diff = SubtractField(calendar, UCAL_SECOND, end_date);
auto ms_diff = SubtractField(calendar, UCAL_MILLISECOND, end_date);
auto micros_diff = ms_diff * Interval::MICROS_PER_MSEC + (end_micros - start_micros);
auto micros_diff = UnsafeNumericCast<int32_t>(ms_diff * Interval::MICROS_PER_MSEC + (end_micros - start_micros));
result.micros = Time::FromTime(hour_diff, min_diff, sec_diff, micros_diff).micros;

return result;
Expand All @@ -204,7 +207,9 @@ struct ICUDateAdd : public ICUDateFunc {
auto &info = func_expr.bind_info->Cast<BindData>();
CalendarPtr calendar(info.calendar->clone());

auto end_date = Timestamp::GetCurrentTimestamp();
// Subtract argument from current_date (at midnight)
const auto end_date = CurrentMidnight(calendar.get(), state);

UnaryExecutor::Execute<TA, TR>(args.data[0], result, args.size(), [&](TA start_date) {
return OP::template Operation<timestamp_t, TA, TR>(end_date, start_date, calendar.get());
});
Expand Down Expand Up @@ -247,7 +252,7 @@ struct ICUDateAdd : public ICUDateFunc {
LogicalType::INTERVAL));
set.AddFunction(GetDateAddFunction<interval_t, timestamp_t, ICUCalendarAdd>(LogicalType::INTERVAL,
LogicalType::TIMESTAMP_TZ));
ExtensionUtil::AddFunctionOverload(db, set);
ExtensionUtil::RegisterFunction(db, set);
}

template <typename TA, typename OP>
Expand All @@ -269,7 +274,7 @@ struct ICUDateAdd : public ICUDateFunc {
// temporal - temporal
set.AddFunction(GetBinaryAgeFunction<timestamp_t, timestamp_t, ICUCalendarSub>(LogicalType::TIMESTAMP_TZ,
LogicalType::TIMESTAMP_TZ));
ExtensionUtil::AddFunctionOverload(db, set);
ExtensionUtil::RegisterFunction(db, set);
}

static void AddDateAgeFunctions(const string &name, DatabaseInstance &db) {
Expand All @@ -278,7 +283,7 @@ struct ICUDateAdd : public ICUDateFunc {
set.AddFunction(GetBinaryAgeFunction<timestamp_t, timestamp_t, ICUCalendarAge>(LogicalType::TIMESTAMP_TZ,
LogicalType::TIMESTAMP_TZ));
set.AddFunction(GetUnaryAgeFunction<timestamp_t, ICUCalendarAge>(LogicalType::TIMESTAMP_TZ));
ExtensionUtil::AddFunctionOverload(db, set);
ExtensionUtil::RegisterFunction(db, set);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/duckdb/extension/icu/icu-datefunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bool ICUDateFunc::TryGetTime(icu::Calendar *calendar, uint64_t micros, timestamp
timestamp_t ICUDateFunc::GetTime(icu::Calendar *calendar, uint64_t micros) {
timestamp_t result;
if (!TryGetTime(calendar, micros, result)) {
throw ConversionException("Unable to convert ICU date to timestamp");
throw ConversionException("ICU date overflows timestamp range");
}
return result;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ int32_t ICUDateFunc::ExtractField(icu::Calendar *calendar, UCalendarDateFields f
return result;
}

int64_t ICUDateFunc::SubtractField(icu::Calendar *calendar, UCalendarDateFields field, timestamp_t end_date) {
int32_t ICUDateFunc::SubtractField(icu::Calendar *calendar, UCalendarDateFields field, timestamp_t end_date) {
const int64_t millis = end_date.value / Interval::MICROS_PER_MSEC;
const auto when = UDate(millis);
UErrorCode status = U_ZERO_ERROR;
Expand Down
Loading

0 comments on commit d001b3f

Please sign in to comment.