duckdb 0.8.1-dev96.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +8 -8
- package/package.json +3 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +1 -1
- package/src/duckdb/extension/icu/icu-makedate.cpp +5 -4
- package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp +0 -2
- package/src/duckdb/extension/json/buffered_json_reader.cpp +23 -14
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +6 -6
- package/src/duckdb/extension/json/include/json_common.hpp +12 -2
- package/src/duckdb/extension/json/include/json_scan.hpp +5 -2
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +5 -0
- package/src/duckdb/extension/json/json_functions/json_create.cpp +10 -10
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +5 -3
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +11 -11
- package/src/duckdb/extension/json/json_functions/read_json.cpp +2 -1
- package/src/duckdb/extension/json/json_functions.cpp +6 -3
- package/src/duckdb/extension/json/json_scan.cpp +43 -27
- package/src/duckdb/extension/parquet/column_reader.cpp +5 -1
- package/src/duckdb/extension/parquet/include/decode_utils.hpp +6 -0
- package/src/duckdb/extension/parquet/parquet-extension.cpp +26 -1
- package/src/duckdb/src/catalog/catalog.cpp +5 -17
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +7 -1
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +121 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +49 -12
- package/src/duckdb/src/catalog/default/default_types.cpp +9 -84
- package/src/duckdb/src/common/adbc/adbc.cpp +118 -12
- package/src/duckdb/src/common/adbc/driver_manager.cpp +0 -20
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +11 -12
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +4 -3
- package/src/duckdb/src/common/exception.cpp +4 -1
- package/src/duckdb/src/common/exception_format_value.cpp +24 -15
- package/src/duckdb/src/common/multi_file_reader.cpp +3 -0
- package/src/duckdb/src/common/random_engine.cpp +1 -1
- package/src/duckdb/src/common/types/row/row_data_collection_scanner.cpp +5 -4
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +44 -7
- package/src/duckdb/src/common/types/time.cpp +2 -8
- package/src/duckdb/src/common/types/timestamp.cpp +37 -1
- package/src/duckdb/src/common/types/value.cpp +1 -0
- package/src/duckdb/src/common/types.cpp +4 -0
- package/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp +30 -33
- package/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp +0 -4
- package/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp +30 -33
- package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +52 -65
- package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +48 -48
- package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +39 -40
- package/src/duckdb/src/core_functions/aggregate/distributive/bool.cpp +32 -32
- package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +34 -34
- package/src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp +30 -31
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +88 -100
- package/src/duckdb/src/core_functions/aggregate/distributive/product.cpp +17 -17
- package/src/duckdb/src/core_functions/aggregate/distributive/skew.cpp +25 -27
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +37 -38
- package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +22 -22
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +44 -80
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +49 -51
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +104 -122
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +57 -93
- package/src/duckdb/src/core_functions/aggregate/nested/histogram.cpp +22 -23
- package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +18 -19
- package/src/duckdb/src/core_functions/aggregate/regression/regr_avg.cpp +16 -18
- package/src/duckdb/src/core_functions/aggregate/regression/regr_intercept.cpp +22 -25
- package/src/duckdb/src/core_functions/aggregate/regression/regr_r2.cpp +19 -24
- package/src/duckdb/src/core_functions/aggregate/regression/regr_sxx_syy.cpp +18 -23
- package/src/duckdb/src/core_functions/aggregate/regression/regr_sxy.cpp +14 -18
- package/src/duckdb/src/core_functions/function_list.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/generic/system_functions.cpp +14 -0
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +23 -6
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +1 -2
- package/src/duckdb/src/core_functions/scalar/map/map_concat.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +3 -3
- package/src/duckdb/src/execution/index/art/art.cpp +80 -7
- package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +20 -1
- package/src/duckdb/src/execution/index/art/leaf.cpp +11 -11
- package/src/duckdb/src/execution/index/art/leaf_segment.cpp +10 -0
- package/src/duckdb/src/execution/index/art/node.cpp +48 -35
- package/src/duckdb/src/execution/index/art/node16.cpp +3 -0
- package/src/duckdb/src/execution/index/art/node256.cpp +1 -0
- package/src/duckdb/src/execution/index/art/node4.cpp +3 -0
- package/src/duckdb/src/execution/index/art/node48.cpp +2 -0
- package/src/duckdb/src/execution/index/art/prefix.cpp +2 -0
- package/src/duckdb/src/execution/join_hashtable.cpp +2 -0
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +26 -9
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +5 -2
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +5 -1
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +3 -6
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +1 -0
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +8 -3
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +0 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +29 -3
- package/src/duckdb/src/execution/reservoir_sample.cpp +18 -4
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +159 -21
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +67 -74
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +7 -7
- package/src/duckdb/src/function/cast/list_casts.cpp +2 -4
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +33 -23
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +1 -1
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/regexp/regexp_util.cpp +6 -2
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +2 -2
- package/src/duckdb/src/function/table/arrow.cpp +2 -2
- package/src/duckdb/src/function/table/checkpoint.cpp +3 -0
- package/src/duckdb/src/function/table/read_csv.cpp +15 -17
- package/src/duckdb/src/function/table/repeat.cpp +3 -0
- package/src/duckdb/src/function/table/repeat_row.cpp +8 -1
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +4 -4
- package/src/duckdb/src/function/table/system/test_vector_types.cpp +81 -25
- package/src/duckdb/src/function/table/table_scan.cpp +2 -2
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +0 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +11 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +8 -2
- package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +97 -0
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_options.hpp +8 -1
- package/src/duckdb/src/include/duckdb/common/arrow/result_arrow_wrapper.hpp +0 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +16 -22
- package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +4 -14
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +92 -57
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/corr.hpp +20 -24
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/covar.hpp +36 -39
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/stddev.hpp +57 -53
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_count.hpp +8 -9
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_slope.hpp +16 -18
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/sum_helpers.hpp +7 -8
- package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +9 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +2 -6
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +16 -36
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +10 -4
- package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +13 -3
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +9 -30
- package/src/duckdb/src/include/duckdb/function/aggregate_state.hpp +95 -0
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -2
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +142 -136
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +6 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +19 -0
- package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +12 -3
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +5 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +6 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +6 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +4 -0
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/byte_reader.hpp +4 -0
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/in_memory_block_manager.hpp +13 -13
- package/src/duckdb/src/include/duckdb/storage/index.hpp +4 -2
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +0 -6
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +0 -2
- package/src/duckdb/src/main/attached_database.cpp +8 -0
- package/src/duckdb/src/main/capi/arrow-c.cpp +4 -4
- package/src/duckdb/src/main/capi/config-c.cpp +2 -5
- package/src/duckdb/src/main/client_context.cpp +4 -3
- package/src/duckdb/src/main/config.cpp +2 -0
- package/src/duckdb/src/main/database.cpp +1 -0
- package/src/duckdb/src/main/database_manager.cpp +21 -0
- package/src/duckdb/src/main/query_result.cpp +6 -2
- package/src/duckdb/src/main/settings/settings.cpp +41 -6
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +27 -16
- package/src/duckdb/src/parallel/executor.cpp +38 -14
- package/src/duckdb/src/parallel/meta_pipeline.cpp +17 -3
- package/src/duckdb/src/parser/column_definition.cpp +5 -8
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +0 -3
- package/src/duckdb/src/parser/parser.cpp +95 -35
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +1 -0
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +3 -0
- package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +0 -2
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +0 -3
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
- package/src/duckdb/src/parser/transformer.cpp +0 -2
- package/src/duckdb/src/planner/bind_context.cpp +3 -4
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +0 -2
- package/src/duckdb/src/planner/binder/expression/bind_positional_reference_expression.cpp +8 -3
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +31 -15
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +0 -27
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +18 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +0 -25
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +2 -114
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +6 -1
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +5 -0
- package/src/duckdb/src/planner/bound_result_modifier.cpp +14 -0
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +6 -5
- package/src/duckdb/src/planner/expression/bound_default_expression.cpp +7 -1
- package/src/duckdb/src/planner/expression.cpp +3 -0
- package/src/duckdb/src/planner/expression_binder.cpp +3 -2
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +5 -4
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +14 -2
- package/src/duckdb/src/planner/planner.cpp +5 -15
- package/src/duckdb/src/storage/data_table.cpp +10 -8
- package/src/duckdb/src/storage/index.cpp +13 -0
- package/src/duckdb/src/storage/storage_manager.cpp +6 -0
- package/src/duckdb/src/storage/table/column_data.cpp +7 -3
- package/src/duckdb/src/storage/table/list_column_data.cpp +5 -4
- package/src/duckdb/src/storage/table/row_group.cpp +4 -3
- package/src/duckdb/src/storage/table/row_group_collection.cpp +6 -3
- package/src/duckdb/src/storage/table/standard_column_data.cpp +4 -3
- package/src/duckdb/src/storage/table/struct_column_data.cpp +4 -3
- package/src/duckdb/src/storage/wal_replay.cpp +4 -5
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +0 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +0 -14
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +12828 -12956
- package/src/duckdb/third_party/zstd/compress/zstd_compress.cpp +3 -0
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_cwksp.h +4 -0
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +5 -5
- package/src/duckdb/ub_src_parser_transform_statement.cpp +0 -2
- package/test/extension.test.ts +11 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +0 -46
- package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +0 -27
@@ -194,9 +194,7 @@ dtime_t Time::FromTime(int32_t hour, int32_t minute, int32_t second, int32_t mic
|
|
194
194
|
return dtime_t(result);
|
195
195
|
}
|
196
196
|
|
197
|
-
|
198
|
-
#ifdef DEBUG
|
199
|
-
static bool AssertValidTime(int32_t hour, int32_t minute, int32_t second, int32_t microseconds) {
|
197
|
+
bool Time::IsValidTime(int32_t hour, int32_t minute, int32_t second, int32_t microseconds) {
|
200
198
|
if (hour < 0 || hour >= 24) {
|
201
199
|
return false;
|
202
200
|
}
|
@@ -211,8 +209,6 @@ static bool AssertValidTime(int32_t hour, int32_t minute, int32_t second, int32_
|
|
211
209
|
}
|
212
210
|
return true;
|
213
211
|
}
|
214
|
-
#endif
|
215
|
-
// LCOV_EXCL_STOP
|
216
212
|
|
217
213
|
void Time::Convert(dtime_t dtime, int32_t &hour, int32_t &min, int32_t &sec, int32_t µs) {
|
218
214
|
int64_t time = dtime.micros;
|
@@ -223,9 +219,7 @@ void Time::Convert(dtime_t dtime, int32_t &hour, int32_t &min, int32_t &sec, int
|
|
223
219
|
sec = int32_t(time / Interval::MICROS_PER_SEC);
|
224
220
|
time -= int64_t(sec) * Interval::MICROS_PER_SEC;
|
225
221
|
micros = int32_t(time);
|
226
|
-
|
227
|
-
D_ASSERT(AssertValidTime(hour, min, sec, micros));
|
228
|
-
#endif
|
222
|
+
D_ASSERT(Time::IsValidTime(hour, min, sec, micros));
|
229
223
|
}
|
230
224
|
|
231
225
|
dtime_t Time::FromTimeMs(int64_t time_ms) {
|
@@ -8,6 +8,7 @@
|
|
8
8
|
#include "duckdb/common/chrono.hpp"
|
9
9
|
#include "duckdb/common/operator/add.hpp"
|
10
10
|
#include "duckdb/common/operator/multiply.hpp"
|
11
|
+
#include "duckdb/common/operator/subtract.hpp"
|
11
12
|
#include "duckdb/common/limits.hpp"
|
12
13
|
#include <ctime>
|
13
14
|
|
@@ -21,6 +22,38 @@ static_assert(sizeof(timestamp_t) == sizeof(int64_t), "timestamp_t was padded");
|
|
21
22
|
// Z is optional
|
22
23
|
// ISO 8601
|
23
24
|
|
25
|
+
// arithmetic operators
|
26
|
+
timestamp_t timestamp_t::operator+(const double &value) const {
|
27
|
+
timestamp_t result;
|
28
|
+
if (!TryAddOperator::Operation(this->value, int64_t(value), result.value)) {
|
29
|
+
throw OutOfRangeException("Overflow in timestamp addition");
|
30
|
+
}
|
31
|
+
return result;
|
32
|
+
}
|
33
|
+
|
34
|
+
int64_t timestamp_t::operator-(const timestamp_t &other) const {
|
35
|
+
int64_t result;
|
36
|
+
if (!TrySubtractOperator::Operation(value, int64_t(other.value), result)) {
|
37
|
+
throw OutOfRangeException("Overflow in timestamp subtraction");
|
38
|
+
}
|
39
|
+
return result;
|
40
|
+
}
|
41
|
+
|
42
|
+
// in-place operators
|
43
|
+
timestamp_t ×tamp_t::operator+=(const int64_t &delta) {
|
44
|
+
if (!TryAddOperator::Operation(value, delta, value)) {
|
45
|
+
throw OutOfRangeException("Overflow in timestamp increment");
|
46
|
+
}
|
47
|
+
return *this;
|
48
|
+
}
|
49
|
+
|
50
|
+
timestamp_t ×tamp_t::operator-=(const int64_t &delta) {
|
51
|
+
if (!TrySubtractOperator::Operation(value, delta, value)) {
|
52
|
+
throw OutOfRangeException("Overflow in timestamp decrement");
|
53
|
+
}
|
54
|
+
return *this;
|
55
|
+
}
|
56
|
+
|
24
57
|
bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, bool &has_offset, string_t &tz) {
|
25
58
|
idx_t pos;
|
26
59
|
date_t date;
|
@@ -59,7 +92,10 @@ bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &r
|
|
59
92
|
pos++;
|
60
93
|
has_offset = true;
|
61
94
|
} else if (Timestamp::TryParseUTCOffset(str, pos, len, hour_offset, minute_offset)) {
|
62
|
-
|
95
|
+
const int64_t delta = hour_offset * Interval::MICROS_PER_HOUR + minute_offset * Interval::MICROS_PER_MINUTE;
|
96
|
+
if (!TrySubtractOperator::Operation(result.value, delta, result.value)) {
|
97
|
+
return false;
|
98
|
+
}
|
63
99
|
has_offset = true;
|
64
100
|
} else {
|
65
101
|
// Parse a time zone: / [A-Za-z0-9/_]+/
|
@@ -1319,6 +1319,7 @@ string Value::ToSQLString() const {
|
|
1319
1319
|
case LogicalTypeId::BLOB:
|
1320
1320
|
return "'" + ToString() + "'::" + type_.ToString();
|
1321
1321
|
case LogicalTypeId::VARCHAR:
|
1322
|
+
case LogicalTypeId::ENUM:
|
1322
1323
|
return "'" + StringUtil::Replace(ToString(), "'", "''") + "'";
|
1323
1324
|
case LogicalTypeId::STRUCT: {
|
1324
1325
|
string ret = "{";
|
@@ -559,6 +559,10 @@ bool LogicalType::GetDecimalProperties(uint8_t &width, uint8_t &scale) const {
|
|
559
559
|
scale = DecimalType::GetScale(*this);
|
560
560
|
break;
|
561
561
|
default:
|
562
|
+
// Nonsense values to ensure initialization
|
563
|
+
width = 255u;
|
564
|
+
scale = 255u;
|
565
|
+
// FIXME(carlo): This should be probably a throw, requires checkign the various call-sites
|
562
566
|
return false;
|
563
567
|
}
|
564
568
|
return true;
|
@@ -59,21 +59,21 @@ public:
|
|
59
59
|
|
60
60
|
struct AverageSetOperation {
|
61
61
|
template <class STATE>
|
62
|
-
static void Initialize(STATE
|
63
|
-
state
|
62
|
+
static void Initialize(STATE &state) {
|
63
|
+
state.Initialize();
|
64
64
|
}
|
65
65
|
template <class STATE>
|
66
|
-
static void Combine(const STATE &source, STATE
|
67
|
-
target
|
66
|
+
static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
|
67
|
+
target.Combine(source);
|
68
68
|
}
|
69
69
|
template <class STATE>
|
70
|
-
static void AddValues(STATE
|
71
|
-
state
|
70
|
+
static void AddValues(STATE &state, idx_t count) {
|
71
|
+
state.count += count;
|
72
72
|
}
|
73
73
|
};
|
74
74
|
|
75
75
|
template <class T>
|
76
|
-
static T GetAverageDivident(uint64_t count, FunctionData
|
76
|
+
static T GetAverageDivident(uint64_t count, optional_ptr<FunctionData> bind_data) {
|
77
77
|
T divident = T(count);
|
78
78
|
if (bind_data) {
|
79
79
|
auto &avg_bind_data = bind_data->Cast<AverageDecimalBindData>();
|
@@ -84,61 +84,58 @@ static T GetAverageDivident(uint64_t count, FunctionData *bind_data) {
|
|
84
84
|
|
85
85
|
struct IntegerAverageOperation : public BaseSumOperation<AverageSetOperation, RegularAdd> {
|
86
86
|
template <class T, class STATE>
|
87
|
-
static void Finalize(
|
88
|
-
|
89
|
-
|
90
|
-
mask.SetInvalid(idx);
|
87
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
88
|
+
if (state.count == 0) {
|
89
|
+
finalize_data.ReturnNull();
|
91
90
|
} else {
|
92
|
-
double divident = GetAverageDivident<double>(state
|
93
|
-
target
|
91
|
+
double divident = GetAverageDivident<double>(state.count, finalize_data.input.bind_data);
|
92
|
+
target = double(state.value) / divident;
|
94
93
|
}
|
95
94
|
}
|
96
95
|
};
|
97
96
|
|
98
97
|
struct IntegerAverageOperationHugeint : public BaseSumOperation<AverageSetOperation, HugeintAdd> {
|
99
98
|
template <class T, class STATE>
|
100
|
-
static void Finalize(
|
101
|
-
|
102
|
-
|
103
|
-
mask.SetInvalid(idx);
|
99
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
100
|
+
if (state.count == 0) {
|
101
|
+
finalize_data.ReturnNull();
|
104
102
|
} else {
|
105
|
-
long double divident = GetAverageDivident<long double>(state
|
106
|
-
target
|
103
|
+
long double divident = GetAverageDivident<long double>(state.count, finalize_data.input.bind_data);
|
104
|
+
target = Hugeint::Cast<long double>(state.value) / divident;
|
107
105
|
}
|
108
106
|
}
|
109
107
|
};
|
110
108
|
|
111
109
|
struct HugeintAverageOperation : public BaseSumOperation<AverageSetOperation, RegularAdd> {
|
112
110
|
template <class T, class STATE>
|
113
|
-
static void Finalize(
|
114
|
-
|
115
|
-
|
116
|
-
mask.SetInvalid(idx);
|
111
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
112
|
+
if (state.count == 0) {
|
113
|
+
finalize_data.ReturnNull();
|
117
114
|
} else {
|
118
|
-
long double divident = GetAverageDivident<long double>(state
|
119
|
-
target
|
115
|
+
long double divident = GetAverageDivident<long double>(state.count, finalize_data.input.bind_data);
|
116
|
+
target = Hugeint::Cast<long double>(state.value) / divident;
|
120
117
|
}
|
121
118
|
}
|
122
119
|
};
|
123
120
|
|
124
121
|
struct NumericAverageOperation : public BaseSumOperation<AverageSetOperation, RegularAdd> {
|
125
122
|
template <class T, class STATE>
|
126
|
-
static void Finalize(
|
127
|
-
if (state
|
128
|
-
|
123
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
124
|
+
if (state.count == 0) {
|
125
|
+
finalize_data.ReturnNull();
|
129
126
|
} else {
|
130
|
-
target
|
127
|
+
target = state.value / state.count;
|
131
128
|
}
|
132
129
|
}
|
133
130
|
};
|
134
131
|
|
135
132
|
struct KahanAverageOperation : public BaseSumOperation<AverageSetOperation, KahanAdd> {
|
136
133
|
template <class T, class STATE>
|
137
|
-
static void Finalize(
|
138
|
-
if (state
|
139
|
-
|
134
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
135
|
+
if (state.count == 0) {
|
136
|
+
finalize_data.ReturnNull();
|
140
137
|
} else {
|
141
|
-
target
|
138
|
+
target = (state.value / state.count) + (state.err / state.count);
|
142
139
|
}
|
143
140
|
}
|
144
141
|
};
|
@@ -1,10 +1,6 @@
|
|
1
1
|
#include "duckdb/core_functions/aggregate/algebraic_functions.hpp"
|
2
|
-
#include "duckdb/common/exception.hpp"
|
3
2
|
#include "duckdb/common/types/null_value.hpp"
|
4
|
-
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
|
-
#include "duckdb/function/function_set.hpp"
|
6
3
|
#include "duckdb/core_functions/aggregate/algebraic/covar.hpp"
|
7
|
-
#include <cmath>
|
8
4
|
|
9
5
|
namespace duckdb {
|
10
6
|
|
@@ -2,7 +2,6 @@
|
|
2
2
|
#include "duckdb/common/exception.hpp"
|
3
3
|
#include "duckdb/common/types/hash.hpp"
|
4
4
|
#include "duckdb/common/types/hyperloglog.hpp"
|
5
|
-
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
6
5
|
#include "duckdb/function/function_set.hpp"
|
7
6
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
8
7
|
|
@@ -16,52 +15,50 @@ struct ApproxDistinctCountState {
|
|
16
15
|
delete log;
|
17
16
|
}
|
18
17
|
}
|
19
|
-
void Resize(idx_t count) {
|
20
|
-
indices.resize(count);
|
21
|
-
counts.resize(count);
|
22
|
-
}
|
23
18
|
|
24
19
|
HyperLogLog *log;
|
25
|
-
vector<uint64_t> indices;
|
26
|
-
vector<uint8_t> counts;
|
27
20
|
};
|
28
21
|
|
29
22
|
struct ApproxCountDistinctFunction {
|
30
23
|
template <class STATE>
|
31
|
-
static void Initialize(STATE
|
32
|
-
|
24
|
+
static void Initialize(STATE &state) {
|
25
|
+
state.log = nullptr;
|
33
26
|
}
|
34
27
|
|
35
28
|
template <class STATE, class OP>
|
36
|
-
static void Combine(const STATE &source, STATE
|
29
|
+
static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
|
37
30
|
if (!source.log) {
|
38
31
|
return;
|
39
32
|
}
|
40
|
-
if (!target
|
41
|
-
target
|
33
|
+
if (!target.log) {
|
34
|
+
target.log = new HyperLogLog();
|
42
35
|
}
|
43
|
-
D_ASSERT(target
|
36
|
+
D_ASSERT(target.log);
|
44
37
|
D_ASSERT(source.log);
|
45
|
-
auto new_log = target
|
46
|
-
delete target
|
47
|
-
target
|
38
|
+
auto new_log = target.log->MergePointer(*source.log);
|
39
|
+
delete target.log;
|
40
|
+
target.log = new_log;
|
48
41
|
}
|
49
42
|
|
50
43
|
template <class T, class STATE>
|
51
|
-
static void Finalize(
|
52
|
-
if (state
|
53
|
-
target
|
44
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
45
|
+
if (state.log) {
|
46
|
+
target = state.log->Count();
|
54
47
|
} else {
|
55
|
-
target
|
48
|
+
target = 0;
|
56
49
|
}
|
57
50
|
}
|
58
51
|
|
59
52
|
static bool IgnoreNull() {
|
60
53
|
return true;
|
61
54
|
}
|
55
|
+
|
62
56
|
template <class STATE>
|
63
|
-
static void Destroy(
|
64
|
-
state
|
57
|
+
static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
|
58
|
+
if (state.log) {
|
59
|
+
delete state.log;
|
60
|
+
state.log = nullptr;
|
61
|
+
}
|
65
62
|
}
|
66
63
|
};
|
67
64
|
|
@@ -77,10 +74,11 @@ static void ApproxCountDistinctSimpleUpdateFunction(Vector inputs[], AggregateIn
|
|
77
74
|
UnifiedVectorFormat vdata;
|
78
75
|
inputs[0].ToUnifiedFormat(count, vdata);
|
79
76
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
77
|
+
if (count > STANDARD_VECTOR_SIZE) {
|
78
|
+
throw InternalException("ApproxCountDistinct - count must be at most vector size");
|
79
|
+
}
|
80
|
+
uint64_t indices[STANDARD_VECTOR_SIZE];
|
81
|
+
uint8_t counts[STANDARD_VECTOR_SIZE];
|
84
82
|
HyperLogLog::ProcessEntries(vdata, inputs[0].GetType(), indices, counts, count);
|
85
83
|
agg_state->log->AddToLog(vdata, count, indices, counts);
|
86
84
|
}
|
@@ -93,23 +91,21 @@ static void ApproxCountDistinctUpdateFunction(Vector inputs[], AggregateInputDat
|
|
93
91
|
state_vector.ToUnifiedFormat(count, sdata);
|
94
92
|
auto states = UnifiedVectorFormat::GetDataNoConst<ApproxDistinctCountState *>(sdata);
|
95
93
|
|
96
|
-
uint64_t *indices = nullptr;
|
97
|
-
uint8_t *counts = nullptr;
|
98
94
|
for (idx_t i = 0; i < count; i++) {
|
99
95
|
auto agg_state = states[sdata.sel->get_index(i)];
|
100
96
|
if (!agg_state->log) {
|
101
97
|
agg_state->log = new HyperLogLog();
|
102
98
|
}
|
103
|
-
if (i == 0) {
|
104
|
-
agg_state->Resize(count);
|
105
|
-
indices = agg_state->indices.data();
|
106
|
-
counts = agg_state->counts.data();
|
107
|
-
}
|
108
99
|
}
|
109
100
|
|
110
101
|
UnifiedVectorFormat vdata;
|
111
102
|
inputs[0].ToUnifiedFormat(count, vdata);
|
112
103
|
|
104
|
+
if (count > STANDARD_VECTOR_SIZE) {
|
105
|
+
throw InternalException("ApproxCountDistinct - count must be at most vector size");
|
106
|
+
}
|
107
|
+
uint64_t indices[STANDARD_VECTOR_SIZE];
|
108
|
+
uint8_t counts[STANDARD_VECTOR_SIZE];
|
113
109
|
HyperLogLog::ProcessEntries(vdata, inputs[0].GetType(), indices, counts, count);
|
114
110
|
HyperLogLog::AddToLogs(vdata, count, indices, counts, reinterpret_cast<HyperLogLog ***>(states), sdata.sel);
|
115
111
|
}
|
@@ -142,6 +138,7 @@ AggregateFunctionSet ApproxCountDistinctFun::GetFunctions() {
|
|
142
138
|
approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::VARCHAR));
|
143
139
|
approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::TIMESTAMP));
|
144
140
|
approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::TIMESTAMP_TZ));
|
141
|
+
approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::BLOB));
|
145
142
|
return approx_count;
|
146
143
|
}
|
147
144
|
|
@@ -25,8 +25,8 @@ struct ArgMinMaxStateBase {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
template <typename T>
|
28
|
-
static inline void ReadValue(Vector &result, T &arg, T
|
29
|
-
target
|
28
|
+
static inline void ReadValue(Vector &result, T &arg, T &target) {
|
29
|
+
target = arg;
|
30
30
|
}
|
31
31
|
|
32
32
|
bool is_initialized;
|
@@ -69,8 +69,8 @@ void ArgMinMaxStateBase::AssignValue(string_t &target, string_t new_value, bool
|
|
69
69
|
}
|
70
70
|
|
71
71
|
template <>
|
72
|
-
void ArgMinMaxStateBase::ReadValue(Vector &result, string_t &arg, string_t
|
73
|
-
target
|
72
|
+
void ArgMinMaxStateBase::ReadValue(Vector &result, string_t &arg, string_t &target) {
|
73
|
+
target = StringVector::AddStringOrBlob(result, arg);
|
74
74
|
}
|
75
75
|
|
76
76
|
template <class A, class B>
|
@@ -97,54 +97,54 @@ struct ArgMinMaxState : public ArgMinMaxStateBase {
|
|
97
97
|
|
98
98
|
template <class COMPARATOR>
|
99
99
|
struct ArgMinMaxBase {
|
100
|
+
|
100
101
|
template <class STATE>
|
101
|
-
static void
|
102
|
-
state
|
102
|
+
static void Initialize(STATE &state) {
|
103
|
+
new (&state) STATE;
|
103
104
|
}
|
104
105
|
|
105
106
|
template <class STATE>
|
106
|
-
static void
|
107
|
-
|
107
|
+
static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
|
108
|
+
state.~STATE();
|
108
109
|
}
|
109
110
|
|
110
111
|
template <class A_TYPE, class B_TYPE, class STATE, class OP>
|
111
|
-
static void Operation(STATE
|
112
|
-
|
113
|
-
|
114
|
-
STATE::template AssignValue<
|
115
|
-
|
116
|
-
state->is_initialized = true;
|
112
|
+
static void Operation(STATE &state, const A_TYPE &x, const B_TYPE &y, AggregateBinaryInput &) {
|
113
|
+
if (!state.is_initialized) {
|
114
|
+
STATE::template AssignValue<A_TYPE>(state.arg, x, false);
|
115
|
+
STATE::template AssignValue<B_TYPE>(state.value, y, false);
|
116
|
+
state.is_initialized = true;
|
117
117
|
} else {
|
118
|
-
OP::template Execute<A_TYPE, B_TYPE, STATE>(state,
|
118
|
+
OP::template Execute<A_TYPE, B_TYPE, STATE>(state, x, y);
|
119
119
|
}
|
120
120
|
}
|
121
121
|
|
122
122
|
template <class A_TYPE, class B_TYPE, class STATE>
|
123
|
-
static void Execute(STATE
|
124
|
-
if (COMPARATOR::Operation(y_data, state
|
125
|
-
STATE::template AssignValue<A_TYPE>(state
|
126
|
-
STATE::template AssignValue<B_TYPE>(state
|
123
|
+
static void Execute(STATE &state, A_TYPE x_data, B_TYPE y_data) {
|
124
|
+
if (COMPARATOR::Operation(y_data, state.value)) {
|
125
|
+
STATE::template AssignValue<A_TYPE>(state.arg, x_data, true);
|
126
|
+
STATE::template AssignValue<B_TYPE>(state.value, y_data, true);
|
127
127
|
}
|
128
128
|
}
|
129
129
|
|
130
130
|
template <class STATE, class OP>
|
131
|
-
static void Combine(const STATE &source, STATE
|
131
|
+
static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
|
132
132
|
if (!source.is_initialized) {
|
133
133
|
return;
|
134
134
|
}
|
135
|
-
if (!target
|
136
|
-
STATE::template AssignValue(target
|
137
|
-
STATE::template AssignValue(target
|
138
|
-
target
|
135
|
+
if (!target.is_initialized || COMPARATOR::Operation(source.value, target.value)) {
|
136
|
+
STATE::template AssignValue(target.arg, source.arg, target.is_initialized);
|
137
|
+
STATE::template AssignValue(target.value, source.value, target.is_initialized);
|
138
|
+
target.is_initialized = true;
|
139
139
|
}
|
140
140
|
}
|
141
141
|
|
142
142
|
template <class T, class STATE>
|
143
|
-
static void Finalize(
|
144
|
-
if (!state
|
145
|
-
|
143
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
144
|
+
if (!state.is_initialized) {
|
145
|
+
finalize_data.ReturnNull();
|
146
146
|
} else {
|
147
|
-
STATE::template ReadValue(result, state
|
147
|
+
STATE::template ReadValue(finalize_data.result, state.arg, target);
|
148
148
|
}
|
149
149
|
}
|
150
150
|
|
@@ -156,14 +156,14 @@ struct ArgMinMaxBase {
|
|
156
156
|
template <typename COMPARATOR>
|
157
157
|
struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR> {
|
158
158
|
template <class STATE>
|
159
|
-
static void AssignVector(STATE
|
160
|
-
if (!state
|
161
|
-
state
|
162
|
-
state
|
159
|
+
static void AssignVector(STATE &state, Vector &arg, const idx_t idx) {
|
160
|
+
if (!state.is_initialized) {
|
161
|
+
state.arg = new Vector(arg.GetType());
|
162
|
+
state.arg->SetVectorType(VectorType::CONSTANT_VECTOR);
|
163
163
|
}
|
164
164
|
sel_t selv = idx;
|
165
165
|
SelectionVector sel(&selv);
|
166
|
-
VectorOperations::Copy(arg, *state
|
166
|
+
VectorOperations::Copy(arg, *state.arg, sel, 1, 0, 0);
|
167
167
|
}
|
168
168
|
|
169
169
|
template <class STATE>
|
@@ -190,49 +190,37 @@ struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR> {
|
|
190
190
|
const auto bval = bys[bidx];
|
191
191
|
|
192
192
|
const auto sidx = sdata.sel->get_index(i);
|
193
|
-
auto state = states[sidx];
|
194
|
-
if (!state
|
195
|
-
STATE::template AssignValue<BY_TYPE>(state
|
193
|
+
auto &state = *states[sidx];
|
194
|
+
if (!state.is_initialized) {
|
195
|
+
STATE::template AssignValue<BY_TYPE>(state.value, bval, false);
|
196
196
|
AssignVector(state, arg, i);
|
197
|
-
state
|
197
|
+
state.is_initialized = true;
|
198
198
|
|
199
|
-
} else if (COMPARATOR::template Operation<BY_TYPE>(bval, state
|
200
|
-
STATE::template AssignValue<BY_TYPE>(state
|
199
|
+
} else if (COMPARATOR::template Operation<BY_TYPE>(bval, state.value)) {
|
200
|
+
STATE::template AssignValue<BY_TYPE>(state.value, bval, true);
|
201
201
|
AssignVector(state, arg, i);
|
202
202
|
}
|
203
203
|
}
|
204
204
|
}
|
205
205
|
|
206
206
|
template <class STATE, class OP>
|
207
|
-
static void Combine(const STATE &source, STATE
|
207
|
+
static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
|
208
208
|
if (!source.is_initialized) {
|
209
209
|
return;
|
210
210
|
}
|
211
|
-
if (!target
|
212
|
-
STATE::template AssignValue(target
|
211
|
+
if (!target.is_initialized || COMPARATOR::Operation(source.value, target.value)) {
|
212
|
+
STATE::template AssignValue(target.value, source.value, target.is_initialized);
|
213
213
|
AssignVector(target, *source.arg, 0);
|
214
|
-
target
|
214
|
+
target.is_initialized = true;
|
215
215
|
}
|
216
216
|
}
|
217
217
|
|
218
|
-
template <class
|
219
|
-
static void Finalize(
|
220
|
-
if (!state
|
221
|
-
|
222
|
-
// since for STRUCT columns only setting the validity mask of the struct is incorrect
|
223
|
-
// as for a struct column, we need to also set ALL child columns to NULL
|
224
|
-
switch (result.GetVectorType()) {
|
225
|
-
case VectorType::FLAT_VECTOR:
|
226
|
-
FlatVector::SetNull(result, idx, true);
|
227
|
-
break;
|
228
|
-
case VectorType::CONSTANT_VECTOR:
|
229
|
-
ConstantVector::SetNull(result, true);
|
230
|
-
break;
|
231
|
-
default:
|
232
|
-
throw InternalException("Invalid result vector type for nested arg_min/max");
|
233
|
-
}
|
218
|
+
template <class STATE>
|
219
|
+
static void Finalize(STATE &state, AggregateFinalizeData &finalize_data) {
|
220
|
+
if (!state.is_initialized) {
|
221
|
+
finalize_data.ReturnNull();
|
234
222
|
} else {
|
235
|
-
VectorOperations::Copy(*state
|
223
|
+
VectorOperations::Copy(*state.arg, finalize_data.result, 1, 0, finalize_data.result_idx);
|
236
224
|
}
|
237
225
|
}
|
238
226
|
|
@@ -247,11 +235,10 @@ struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR> {
|
|
247
235
|
template <class OP, class ARG_TYPE, class BY_TYPE>
|
248
236
|
AggregateFunction GetVectorArgMinMaxFunctionInternal(const LogicalType &by_type, const LogicalType &type) {
|
249
237
|
using STATE = ArgMinMaxState<ARG_TYPE, BY_TYPE>;
|
250
|
-
return AggregateFunction(
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
AggregateFunction::StateDestroy<STATE, OP>);
|
238
|
+
return AggregateFunction(
|
239
|
+
{type, by_type}, type, AggregateFunction::StateSize<STATE>, AggregateFunction::StateInitialize<STATE, OP>,
|
240
|
+
OP::template Update<STATE>, AggregateFunction::StateCombine<STATE, OP>,
|
241
|
+
AggregateFunction::StateVoidFinalize<STATE, OP>, nullptr, OP::Bind, AggregateFunction::StateDestroy<STATE, OP>);
|
255
242
|
}
|
256
243
|
|
257
244
|
template <class OP, class ARG_TYPE>
|