duckdb 0.7.2-dev2740.0 → 0.7.2-dev2820.0
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 +21 -13
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
- package/src/duckdb/extension/json/include/json_functions.hpp +35 -37
- package/src/duckdb/extension/json/include/json_scan.hpp +1 -1
- package/src/duckdb/extension/json/include/json_transform.hpp +1 -1
- package/src/duckdb/extension/json/json-extension.cpp +10 -20
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_array_length.cpp +2 -3
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_create.cpp +20 -20
- package/src/duckdb/extension/json/json_functions/json_extract.cpp +4 -6
- package/src/duckdb/extension/json/json_functions/json_keys.cpp +2 -3
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +8 -8
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +4 -4
- package/src/duckdb/extension/json/json_functions/json_type.cpp +2 -3
- package/src/duckdb/extension/json/json_functions/json_valid.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/read_json.cpp +6 -6
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +4 -4
- package/src/duckdb/extension/json/json_functions.cpp +6 -6
- package/src/duckdb/extension/parquet/parquet-extension.cpp +11 -24
- package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +1 -2
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +1 -2
- package/src/duckdb/src/catalog/catalog_transaction.cpp +4 -0
- package/src/duckdb/src/catalog/duck_catalog.cpp +8 -1
- package/src/duckdb/src/common/enums/date_part_specifier.cpp +82 -0
- package/src/duckdb/src/common/types/vector.cpp +136 -3
- package/src/duckdb/src/{function → core_functions}/aggregate/algebraic/avg.cpp +9 -12
- package/src/duckdb/src/core_functions/aggregate/algebraic/corr.cpp +13 -0
- package/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp +21 -0
- package/src/duckdb/src/core_functions/aggregate/algebraic/stddev.cpp +34 -0
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/approx_count.cpp +3 -3
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/arg_min_max.cpp +7 -23
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bitagg.cpp +10 -10
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bitstring_agg.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bool.cpp +1 -17
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/entropy.cpp +5 -4
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/kurtosis.cpp +5 -6
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/minmax.cpp +5 -5
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/product.cpp +2 -11
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/skew.cpp +5 -6
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/string_agg.cpp +4 -6
- package/src/duckdb/src/{function → core_functions}/aggregate/distributive/sum.cpp +38 -46
- package/src/duckdb/src/{function → core_functions}/aggregate/holistic/approximate_quantile.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/aggregate/holistic/mode.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/aggregate/holistic/quantile.cpp +31 -23
- package/src/duckdb/src/{function → core_functions}/aggregate/holistic/reservoir_quantile.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/aggregate/nested/histogram.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/aggregate/nested/list.cpp +6 -10
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_avg.cpp +7 -11
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_count.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_intercept.cpp +5 -8
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_r2.cpp +5 -7
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_slope.cpp +5 -7
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_sxx_syy.cpp +8 -12
- package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_sxy.cpp +6 -8
- package/src/duckdb/src/core_functions/core_functions.cpp +50 -0
- package/src/duckdb/src/core_functions/function_list.cpp +352 -0
- package/src/duckdb/src/{function → core_functions}/scalar/bit/bitstring.cpp +12 -15
- package/src/duckdb/src/{function → core_functions}/scalar/blob/base64.cpp +6 -6
- package/src/duckdb/src/{function → core_functions}/scalar/blob/encode.cpp +7 -6
- package/src/duckdb/src/{function → core_functions}/scalar/date/age.cpp +3 -3
- package/src/duckdb/src/{function → core_functions}/scalar/date/current.cpp +8 -8
- package/src/duckdb/src/{function → core_functions}/scalar/date/date_diff.cpp +3 -6
- package/src/duckdb/src/{function → core_functions}/scalar/date/date_part.cpp +144 -148
- package/src/duckdb/src/{function → core_functions}/scalar/date/date_sub.cpp +3 -6
- package/src/duckdb/src/{function → core_functions}/scalar/date/date_trunc.cpp +3 -6
- package/src/duckdb/src/{function → core_functions}/scalar/date/epoch.cpp +7 -8
- package/src/duckdb/src/{function → core_functions}/scalar/date/make_date.cpp +14 -14
- package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +251 -0
- package/src/duckdb/src/{function → core_functions}/scalar/date/time_bucket.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/scalar/date/to_interval.cpp +39 -19
- package/src/duckdb/src/{function/scalar/enum/enum_functions_implementation.cpp → core_functions/scalar/enum/enum_functions.cpp} +18 -22
- package/src/duckdb/src/{function → core_functions}/scalar/generic/alias.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/scalar/generic/current_setting.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/scalar/generic/error.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/scalar/generic/hash.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/scalar/generic/least.cpp +8 -9
- package/src/duckdb/src/{function → core_functions}/scalar/generic/stats.cpp +4 -4
- package/src/duckdb/src/{function/scalar/system → core_functions/scalar/generic}/system_functions.cpp +24 -13
- package/src/duckdb/src/{function → core_functions}/scalar/generic/typeof.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/scalar/list/array_slice.cpp +3 -13
- package/src/duckdb/src/{function → core_functions}/scalar/list/flatten.cpp +5 -5
- package/src/duckdb/src/{function → core_functions}/scalar/list/list_aggregates.cpp +2 -13
- package/src/duckdb/src/{function → core_functions}/scalar/list/list_lambdas.cpp +9 -24
- package/src/duckdb/src/{function → core_functions}/scalar/list/list_sort.cpp +8 -22
- package/src/duckdb/src/{function → core_functions}/scalar/list/list_value.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/scalar/list/range.cpp +8 -6
- package/src/duckdb/src/{function → core_functions}/scalar/map/cardinality.cpp +5 -4
- package/src/duckdb/src/{function → core_functions}/scalar/map/map.cpp +6 -63
- package/src/duckdb/src/{function → core_functions}/scalar/map/map_entries.cpp +5 -4
- package/src/duckdb/src/{function → core_functions}/scalar/map/map_extract.cpp +22 -7
- package/src/duckdb/src/{function → core_functions}/scalar/map/map_from_entries.cpp +6 -5
- package/src/duckdb/src/{function → core_functions}/scalar/map/map_keys_values.cpp +8 -7
- package/src/duckdb/src/{function → core_functions}/scalar/math/numeric.cpp +110 -138
- package/src/duckdb/src/{function → core_functions}/scalar/operators/bitwise.cpp +19 -20
- package/src/duckdb/src/{function/scalar/math → core_functions/scalar/random}/random.cpp +5 -6
- package/src/duckdb/src/{function/scalar/math → core_functions/scalar/random}/setseed.cpp +3 -3
- package/src/duckdb/src/{function → core_functions}/scalar/string/ascii.cpp +4 -5
- package/src/duckdb/src/{function → core_functions}/scalar/string/bar.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/scalar/string/chr.cpp +5 -6
- package/src/duckdb/src/{function → core_functions}/scalar/string/damerau_levenshtein.cpp +4 -6
- package/src/duckdb/src/{function/scalar/string/mismatches.cpp → core_functions/scalar/string/hamming.cpp} +3 -12
- package/src/duckdb/src/{function → core_functions}/scalar/string/hex.cpp +15 -25
- package/src/duckdb/src/{function → core_functions}/scalar/string/instr.cpp +6 -13
- package/src/duckdb/src/{function → core_functions}/scalar/string/jaccard.cpp +3 -6
- package/src/duckdb/src/{function → core_functions}/scalar/string/jaro_winkler.cpp +7 -6
- package/src/duckdb/src/{function → core_functions}/scalar/string/left_right.cpp +18 -11
- package/src/duckdb/src/{function → core_functions}/scalar/string/levenshtein.cpp +3 -12
- package/src/duckdb/src/{function → core_functions}/scalar/string/md5.cpp +15 -21
- package/src/duckdb/src/{function → core_functions}/scalar/string/pad.cpp +7 -13
- package/src/duckdb/src/{function → core_functions}/scalar/string/printf.cpp +10 -10
- package/src/duckdb/src/{function → core_functions}/scalar/string/repeat.cpp +3 -6
- package/src/duckdb/src/{function → core_functions}/scalar/string/replace.cpp +4 -7
- package/src/duckdb/src/{function → core_functions}/scalar/string/reverse.cpp +3 -3
- package/src/duckdb/src/{function → core_functions}/scalar/string/starts_with.cpp +4 -8
- package/src/duckdb/src/{function → core_functions}/scalar/string/string_split.cpp +11 -11
- package/src/duckdb/src/{function → core_functions}/scalar/string/translate.cpp +4 -7
- package/src/duckdb/src/{function → core_functions}/scalar/string/trim.cpp +19 -14
- package/src/duckdb/src/core_functions/scalar/string/unicode.cpp +28 -0
- package/src/duckdb/src/{function → core_functions}/scalar/struct/struct_insert.cpp +4 -4
- package/src/duckdb/src/{function → core_functions}/scalar/struct/struct_pack.cpp +3 -4
- package/src/duckdb/src/{function → core_functions}/scalar/union/union_extract.cpp +4 -8
- package/src/duckdb/src/{function → core_functions}/scalar/union/union_tag.cpp +4 -8
- package/src/duckdb/src/{function → core_functions}/scalar/union/union_value.cpp +4 -59
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive_functions.cpp +0 -17
- package/src/duckdb/src/function/cast/string_cast.cpp +1 -1
- package/src/duckdb/src/function/function.cpp +0 -8
- package/src/duckdb/src/function/function_set.cpp +25 -0
- package/src/duckdb/src/function/scalar/generic_functions.cpp +1 -9
- package/src/duckdb/src/function/scalar/nested_functions.cpp +0 -22
- package/src/duckdb/src/function/scalar/operators.cpp +0 -6
- package/src/duckdb/src/function/scalar/{date/strftime.cpp → strftime_format.cpp} +1 -249
- package/src/duckdb/src/function/scalar/string/length.cpp +0 -19
- package/src/duckdb/src/function/scalar/string_functions.cpp +0 -40
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -0
- package/src/duckdb/src/function/table/arrow_conversion.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +27 -40
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/function_entry.hpp +33 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/algorithm.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +11 -1
- package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/corr.hpp +3 -4
- package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/covar.hpp +1 -1
- package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/stddev.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic_functions.hpp +124 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +229 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/holistic_functions.hpp +85 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/nested_functions.hpp +41 -0
- package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/regression/regr_count.hpp +3 -4
- package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/regression/regr_slope.hpp +2 -2
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression_functions.hpp +97 -0
- package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/sum_helpers.hpp +1 -1
- package/src/duckdb/src/include/duckdb/{function/scalar/uuid_functions.hpp → core_functions/core_functions.hpp} +7 -5
- package/src/duckdb/src/include/duckdb/core_functions/function_list.hpp +33 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +52 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/blob_functions.hpp +58 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +544 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/enum_functions.hpp +61 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +142 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +220 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +85 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +394 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/operators_functions.hpp +70 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/random_functions.hpp +49 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +439 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/struct_functions.hpp +40 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/union_functions.hpp +43 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +0 -85
- package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +0 -8
- package/src/duckdb/src/include/duckdb/function/function_set.hpp +7 -2
- package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +1 -36
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +0 -120
- package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +0 -24
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +1 -97
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/extension_util.hpp +48 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +6 -0
- package/src/duckdb/src/main/extension/extension_helper.cpp +1 -0
- package/src/duckdb/src/main/extension/extension_load.cpp +48 -4
- package/src/duckdb/src/main/extension/extension_util.cpp +90 -0
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +6 -7
- package/src/duckdb/ub_src_common_enums.cpp +2 -0
- package/src/duckdb/ub_src_core_functions.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp +8 -0
- package/src/duckdb/ub_src_core_functions_aggregate_distributive.cpp +24 -0
- package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +8 -0
- package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_aggregate_regression.cpp +14 -0
- package/src/duckdb/ub_src_core_functions_scalar_bit.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_date.cpp +22 -0
- package/src/duckdb/ub_src_core_functions_scalar_enum.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +16 -0
- package/src/duckdb/ub_src_core_functions_scalar_list.cpp +14 -0
- package/src/duckdb/ub_src_core_functions_scalar_map.cpp +12 -0
- package/src/duckdb/ub_src_core_functions_scalar_math.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_operators.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_random.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +44 -0
- package/src/duckdb/ub_src_core_functions_scalar_struct.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_union.cpp +6 -0
- package/src/duckdb/ub_src_function_aggregate.cpp +0 -8
- package/src/duckdb/ub_src_function_aggregate_distributive.cpp +0 -24
- package/src/duckdb/ub_src_function_scalar.cpp +2 -8
- package/src/duckdb/ub_src_function_scalar_generic.cpp +0 -14
- package/src/duckdb/ub_src_function_scalar_list.cpp +0 -14
- package/src/duckdb/ub_src_function_scalar_operators.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_string.cpp +0 -42
- package/src/duckdb/ub_src_function_scalar_struct.cpp +0 -4
- package/src/duckdb/ub_src_function_scalar_system.cpp +0 -2
- package/src/duckdb/ub_src_main_extension.cpp +2 -0
- package/src/duckdb/src/function/aggregate/algebraic/corr.cpp +0 -14
- package/src/duckdb/src/function/aggregate/algebraic/covar.cpp +0 -25
- package/src/duckdb/src/function/aggregate/algebraic/stddev.cpp +0 -54
- package/src/duckdb/src/function/aggregate/algebraic_functions.cpp +0 -21
- package/src/duckdb/src/function/aggregate/holistic_functions.cpp +0 -12
- package/src/duckdb/src/function/aggregate/nested_functions.cpp +0 -10
- package/src/duckdb/src/function/aggregate/regression_functions.cpp +0 -21
- package/src/duckdb/src/function/scalar/date_functions.cpp +0 -22
- package/src/duckdb/src/function/scalar/enum_functions.cpp +0 -13
- package/src/duckdb/src/function/scalar/math_functions.cpp +0 -50
- package/src/duckdb/src/function/scalar/trigonometrics_functions.cpp +0 -18
- package/src/duckdb/src/include/duckdb/function/aggregate/algebraic_functions.hpp +0 -56
- package/src/duckdb/src/include/duckdb/function/aggregate/holistic_functions.hpp +0 -33
- package/src/duckdb/src/include/duckdb/function/aggregate/nested_functions.hpp +0 -26
- package/src/duckdb/src/include/duckdb/function/aggregate/regression_functions.hpp +0 -53
- package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +0 -32
- package/src/duckdb/src/include/duckdb/function/scalar/blob_functions.hpp +0 -24
- package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +0 -73
- package/src/duckdb/src/include/duckdb/function/scalar/enum_functions.hpp +0 -37
- package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +0 -137
- package/src/duckdb/src/include/duckdb/function/scalar/trigonometric_functions.hpp +0 -49
- package/src/duckdb/ub_src_function_aggregate_algebraic.cpp +0 -8
- package/src/duckdb/ub_src_function_aggregate_holistic.cpp +0 -8
- package/src/duckdb/ub_src_function_aggregate_nested.cpp +0 -4
- package/src/duckdb/ub_src_function_aggregate_regression.cpp +0 -14
- package/src/duckdb/ub_src_function_scalar_bit.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_blob.cpp +0 -4
- package/src/duckdb/ub_src_function_scalar_date.cpp +0 -22
- package/src/duckdb/ub_src_function_scalar_enum.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_map.cpp +0 -12
- package/src/duckdb/ub_src_function_scalar_math.cpp +0 -6
- package/src/duckdb/ub_src_function_scalar_union.cpp +0 -6
- /package/src/duckdb/src/include/duckdb/function/scalar/{strftime.hpp → strftime_format.hpp} +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
1
2
|
#include "duckdb/common/exception.hpp"
|
2
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
|
-
#include "duckdb/function/aggregate/distributive_functions.hpp"
|
4
4
|
#include "duckdb/function/function_set.hpp"
|
5
5
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
6
6
|
#include "duckdb/common/operator/comparison_operators.hpp"
|
@@ -336,32 +336,16 @@ static void AddArgMinMaxFunctions(AggregateFunctionSet &fun) {
|
|
336
336
|
AddVectorArgMinMaxFunctionBy<VECTOR_OP, Vector *>(fun, LogicalType::ANY);
|
337
337
|
}
|
338
338
|
|
339
|
-
|
340
|
-
AggregateFunctionSet fun
|
339
|
+
AggregateFunctionSet ArgMinFun::GetFunctions() {
|
340
|
+
AggregateFunctionSet fun;
|
341
341
|
AddArgMinMaxFunctions<LessThan>(fun);
|
342
|
-
|
343
|
-
|
344
|
-
//! Add min_by alias
|
345
|
-
fun.name = "min_by";
|
346
|
-
set.AddFunction(fun);
|
347
|
-
|
348
|
-
//! Add arg_min alias
|
349
|
-
fun.name = "arg_min";
|
350
|
-
set.AddFunction(fun);
|
342
|
+
return fun;
|
351
343
|
}
|
352
344
|
|
353
|
-
|
354
|
-
AggregateFunctionSet fun
|
345
|
+
AggregateFunctionSet ArgMaxFun::GetFunctions() {
|
346
|
+
AggregateFunctionSet fun;
|
355
347
|
AddArgMinMaxFunctions<GreaterThan>(fun);
|
356
|
-
|
357
|
-
|
358
|
-
//! Add max_by alias
|
359
|
-
fun.name = "max_by";
|
360
|
-
set.AddFunction(fun);
|
361
|
-
|
362
|
-
//! Add arg_max alias
|
363
|
-
fun.name = "arg_max";
|
364
|
-
set.AddFunction(fun);
|
348
|
+
return fun;
|
365
349
|
}
|
366
350
|
|
367
351
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
2
2
|
#include "duckdb/common/exception.hpp"
|
3
3
|
#include "duckdb/common/types/null_value.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -189,8 +189,8 @@ struct BitStringXorOperation : public BitStringBitwiseOperation {
|
|
189
189
|
}
|
190
190
|
};
|
191
191
|
|
192
|
-
|
193
|
-
AggregateFunctionSet bit_and
|
192
|
+
AggregateFunctionSet BitAndFun::GetFunctions() {
|
193
|
+
AggregateFunctionSet bit_and;
|
194
194
|
for (auto &type : LogicalType::Integral()) {
|
195
195
|
bit_and.AddFunction(GetBitfieldUnaryAggregate<BitAndOperation>(type));
|
196
196
|
}
|
@@ -198,29 +198,29 @@ void BitAndFun::RegisterFunction(BuiltinFunctions &set) {
|
|
198
198
|
bit_and.AddFunction(
|
199
199
|
AggregateFunction::UnaryAggregateDestructor<BitState<string_t>, string_t, string_t, BitStringAndOperation>(
|
200
200
|
LogicalType::BIT, LogicalType::BIT));
|
201
|
-
|
201
|
+
return bit_and;
|
202
202
|
}
|
203
203
|
|
204
|
-
|
205
|
-
AggregateFunctionSet bit_or
|
204
|
+
AggregateFunctionSet BitOrFun::GetFunctions() {
|
205
|
+
AggregateFunctionSet bit_or;
|
206
206
|
for (auto &type : LogicalType::Integral()) {
|
207
207
|
bit_or.AddFunction(GetBitfieldUnaryAggregate<BitOrOperation>(type));
|
208
208
|
}
|
209
209
|
bit_or.AddFunction(
|
210
210
|
AggregateFunction::UnaryAggregateDestructor<BitState<string_t>, string_t, string_t, BitStringOrOperation>(
|
211
211
|
LogicalType::BIT, LogicalType::BIT));
|
212
|
-
|
212
|
+
return bit_or;
|
213
213
|
}
|
214
214
|
|
215
|
-
|
216
|
-
AggregateFunctionSet bit_xor
|
215
|
+
AggregateFunctionSet BitXorFun::GetFunctions() {
|
216
|
+
AggregateFunctionSet bit_xor;
|
217
217
|
for (auto &type : LogicalType::Integral()) {
|
218
218
|
bit_xor.AddFunction(GetBitfieldUnaryAggregate<BitXorOperation>(type));
|
219
219
|
}
|
220
220
|
bit_xor.AddFunction(
|
221
221
|
AggregateFunction::UnaryAggregateDestructor<BitState<string_t>, string_t, string_t, BitStringXorOperation>(
|
222
222
|
LogicalType::BIT, LogicalType::BIT));
|
223
|
-
|
223
|
+
return bit_xor;
|
224
224
|
}
|
225
225
|
|
226
226
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
2
2
|
#include "duckdb/common/exception.hpp"
|
3
3
|
#include "duckdb/common/types/null_value.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/aggregate_executor.hpp"
|
@@ -224,7 +224,7 @@ static void BindBitString(AggregateFunctionSet &bitstring_agg, const LogicalType
|
|
224
224
|
bitstring_agg.AddFunction(function);
|
225
225
|
}
|
226
226
|
|
227
|
-
void
|
227
|
+
void GetBitStringAggregate(const LogicalType &type, AggregateFunctionSet &bitstring_agg) {
|
228
228
|
switch (type.id()) {
|
229
229
|
case LogicalType::TINYINT: {
|
230
230
|
return BindBitString<int8_t>(bitstring_agg, type.id());
|
@@ -258,12 +258,12 @@ void BitStringAggFun::GetBitStringAggregate(const LogicalType &type, AggregateFu
|
|
258
258
|
}
|
259
259
|
}
|
260
260
|
|
261
|
-
|
261
|
+
AggregateFunctionSet BitstringAggFun::GetFunctions() {
|
262
262
|
AggregateFunctionSet bitstring_agg("bitstring_agg");
|
263
263
|
for (auto &type : LogicalType::Integral()) {
|
264
264
|
GetBitStringAggregate(type, bitstring_agg);
|
265
265
|
}
|
266
|
-
|
266
|
+
return bitstring_agg;
|
267
267
|
}
|
268
268
|
|
269
269
|
} // namespace duckdb
|
@@ -1,6 +1,6 @@
|
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
1
2
|
#include "duckdb/common/exception.hpp"
|
2
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
|
-
#include "duckdb/function/aggregate/distributive_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
5
5
|
#include "duckdb/function/function_set.hpp"
|
6
6
|
|
@@ -94,7 +94,6 @@ struct BoolOrFunFunction {
|
|
94
94
|
AggregateFunction BoolOrFun::GetFunction() {
|
95
95
|
auto fun = AggregateFunction::UnaryAggregate<BoolState, bool, bool, BoolOrFunFunction>(
|
96
96
|
LogicalType(LogicalTypeId::BOOLEAN), LogicalType::BOOLEAN);
|
97
|
-
fun.name = "bool_or";
|
98
97
|
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
99
98
|
return fun;
|
100
99
|
}
|
@@ -102,23 +101,8 @@ AggregateFunction BoolOrFun::GetFunction() {
|
|
102
101
|
AggregateFunction BoolAndFun::GetFunction() {
|
103
102
|
auto fun = AggregateFunction::UnaryAggregate<BoolState, bool, bool, BoolAndFunFunction>(
|
104
103
|
LogicalType(LogicalTypeId::BOOLEAN), LogicalType::BOOLEAN);
|
105
|
-
fun.name = "bool_and";
|
106
104
|
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
107
105
|
return fun;
|
108
106
|
}
|
109
107
|
|
110
|
-
void BoolOrFun::RegisterFunction(BuiltinFunctions &set) {
|
111
|
-
AggregateFunction bool_or_function = BoolOrFun::GetFunction();
|
112
|
-
AggregateFunctionSet bool_or("bool_or");
|
113
|
-
bool_or.AddFunction(bool_or_function);
|
114
|
-
set.AddFunction(bool_or);
|
115
|
-
}
|
116
|
-
|
117
|
-
void BoolAndFun::RegisterFunction(BuiltinFunctions &set) {
|
118
|
-
AggregateFunction bool_and_function = BoolAndFun::GetFunction();
|
119
|
-
AggregateFunctionSet bool_and("bool_and");
|
120
|
-
bool_and.AddFunction(bool_and_function);
|
121
|
-
set.AddFunction(bool_and);
|
122
|
-
}
|
123
|
-
|
124
108
|
} // namespace duckdb
|
@@ -1,9 +1,10 @@
|
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
1
2
|
#include "duckdb/common/exception.hpp"
|
2
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
|
-
#include "duckdb/function/aggregate/distributive_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
5
5
|
#include "duckdb/function/function_set.hpp"
|
6
|
-
#include
|
6
|
+
#include "duckdb/common/algorithm.hpp"
|
7
|
+
#include "duckdb/common/unordered_map.hpp"
|
7
8
|
|
8
9
|
namespace duckdb {
|
9
10
|
|
@@ -161,7 +162,7 @@ AggregateFunction GetEntropyFunction(PhysicalType type) {
|
|
161
162
|
return fun;
|
162
163
|
}
|
163
164
|
|
164
|
-
|
165
|
+
AggregateFunctionSet EntropyFun::GetFunctions() {
|
165
166
|
AggregateFunctionSet entropy("entropy");
|
166
167
|
entropy.AddFunction(GetEntropyFunction(PhysicalType::UINT16));
|
167
168
|
entropy.AddFunction(GetEntropyFunction(PhysicalType::UINT32));
|
@@ -174,7 +175,7 @@ void EntropyFun::RegisterFunction(BuiltinFunctions &set) {
|
|
174
175
|
entropy.AddFunction(GetEntropyFunction(PhysicalType::VARCHAR));
|
175
176
|
entropy.AddFunction(GetEntropyFunction<int64_t, double>(LogicalType::TIMESTAMP, LogicalType::DOUBLE));
|
176
177
|
entropy.AddFunction(GetEntropyFunction<int64_t, double>(LogicalType::TIMESTAMP_TZ, LogicalType::DOUBLE));
|
177
|
-
|
178
|
+
return entropy;
|
178
179
|
}
|
179
180
|
|
180
181
|
} // namespace duckdb
|
@@ -1,7 +1,8 @@
|
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
1
2
|
#include "duckdb/common/exception.hpp"
|
2
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
|
-
#include "duckdb/function/aggregate/distributive_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
5
|
+
#include "duckdb/common/algorithm.hpp"
|
5
6
|
|
6
7
|
namespace duckdb {
|
7
8
|
|
@@ -85,11 +86,9 @@ struct KurtosisOperation {
|
|
85
86
|
}
|
86
87
|
};
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
LogicalType::DOUBLE, LogicalType::DOUBLE));
|
92
|
-
set.AddFunction(function_set);
|
89
|
+
AggregateFunction KurtosisFun::GetFunction() {
|
90
|
+
return AggregateFunction::UnaryAggregate<KurtosisState, double, double, KurtosisOperation>(LogicalType::DOUBLE,
|
91
|
+
LogicalType::DOUBLE);
|
93
92
|
}
|
94
93
|
|
95
94
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
2
2
|
#include "duckdb/common/exception.hpp"
|
3
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
4
4
|
#include "duckdb/common/operator/comparison_operators.hpp"
|
@@ -560,16 +560,16 @@ static void AddMinMaxOperator(AggregateFunctionSet &set) {
|
|
560
560
|
nullptr, BindMinMax<OP, OP_STRING, OP_VECTOR>));
|
561
561
|
}
|
562
562
|
|
563
|
-
|
563
|
+
AggregateFunctionSet MinFun::GetFunctions() {
|
564
564
|
AggregateFunctionSet min("min");
|
565
565
|
AddMinMaxOperator<MinOperation, MinOperationString, MinOperationVector>(min);
|
566
|
-
|
566
|
+
return min;
|
567
567
|
}
|
568
568
|
|
569
|
-
|
569
|
+
AggregateFunctionSet MaxFun::GetFunctions() {
|
570
570
|
AggregateFunctionSet max("max");
|
571
571
|
AddMinMaxOperator<MaxOperation, MaxOperationString, MaxOperationVector>(max);
|
572
|
-
|
572
|
+
return max;
|
573
573
|
}
|
574
574
|
|
575
575
|
} // namespace duckdb
|
@@ -1,6 +1,6 @@
|
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
1
2
|
#include "duckdb/common/exception.hpp"
|
2
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
|
-
#include "duckdb/function/aggregate/distributive_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
5
5
|
#include "duckdb/function/function_set.hpp"
|
6
6
|
|
@@ -54,17 +54,8 @@ struct ProductFunction {
|
|
54
54
|
};
|
55
55
|
|
56
56
|
AggregateFunction ProductFun::GetFunction() {
|
57
|
-
|
57
|
+
return AggregateFunction::UnaryAggregate<ProductState, double, double, ProductFunction>(
|
58
58
|
LogicalType(LogicalTypeId::DOUBLE), LogicalType::DOUBLE);
|
59
|
-
fun.name = "product";
|
60
|
-
return fun;
|
61
|
-
}
|
62
|
-
|
63
|
-
void ProductFun::RegisterFunction(BuiltinFunctions &set) {
|
64
|
-
AggregateFunction product_function = ProductFun::GetFunction();
|
65
|
-
AggregateFunctionSet product("product");
|
66
|
-
product.AddFunction(product_function);
|
67
|
-
set.AddFunction(product);
|
68
59
|
}
|
69
60
|
|
70
61
|
} // namespace duckdb
|
@@ -1,7 +1,8 @@
|
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
1
2
|
#include "duckdb/common/exception.hpp"
|
2
3
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
|
-
#include "duckdb/function/aggregate/distributive_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
5
|
+
#include "duckdb/common/algorithm.hpp"
|
5
6
|
|
6
7
|
namespace duckdb {
|
7
8
|
|
@@ -79,11 +80,9 @@ struct SkewnessOperation {
|
|
79
80
|
}
|
80
81
|
};
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
LogicalType::DOUBLE, LogicalType::DOUBLE));
|
86
|
-
set.AddFunction(function_set);
|
83
|
+
AggregateFunction SkewnessFun::GetFunction() {
|
84
|
+
return AggregateFunction::UnaryAggregate<SkewState, double, double, SkewnessOperation>(LogicalType::DOUBLE,
|
85
|
+
LogicalType::DOUBLE);
|
87
86
|
}
|
88
87
|
|
89
88
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
2
2
|
#include "duckdb/common/exception.hpp"
|
3
3
|
#include "duckdb/common/types/null_value.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -151,8 +151,8 @@ unique_ptr<FunctionData> StringAggDeserialize(ClientContext &context, FieldReade
|
|
151
151
|
return make_uniq<StringAggBindData>(std::move(sep));
|
152
152
|
}
|
153
153
|
|
154
|
-
|
155
|
-
AggregateFunctionSet string_agg
|
154
|
+
AggregateFunctionSet StringAggFun::GetFunctions() {
|
155
|
+
AggregateFunctionSet string_agg;
|
156
156
|
AggregateFunction string_agg_param(
|
157
157
|
{LogicalType::VARCHAR}, LogicalType::VARCHAR, AggregateFunction::StateSize<StringAggState>,
|
158
158
|
AggregateFunction::StateInitialize<StringAggState, StringAggFunction>,
|
@@ -166,9 +166,7 @@ void StringAggFun::RegisterFunction(BuiltinFunctions &set) {
|
|
166
166
|
string_agg.AddFunction(string_agg_param);
|
167
167
|
string_agg_param.arguments.emplace_back(LogicalType::VARCHAR);
|
168
168
|
string_agg.AddFunction(string_agg_param);
|
169
|
-
|
170
|
-
string_agg.name = "group_concat";
|
171
|
-
set.AddFunction(string_agg);
|
169
|
+
return string_agg;
|
172
170
|
}
|
173
171
|
|
174
172
|
} // namespace duckdb
|
@@ -1,9 +1,8 @@
|
|
1
|
-
#include "duckdb/
|
2
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
|
2
|
+
#include "duckdb/core_functions/aggregate/sum_helpers.hpp"
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/types/decimal.hpp"
|
5
5
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
6
|
-
#include "duckdb/function/aggregate/algebraic_functions.hpp"
|
7
6
|
|
8
7
|
namespace duckdb {
|
9
8
|
|
@@ -70,6 +69,27 @@ struct HugeintSumOperation : public BaseSumOperation<SumSetOperation, RegularAdd
|
|
70
69
|
}
|
71
70
|
};
|
72
71
|
|
72
|
+
AggregateFunction GetSumAggregateNoOverflow(PhysicalType type) {
|
73
|
+
switch (type) {
|
74
|
+
case PhysicalType::INT32: {
|
75
|
+
auto function = AggregateFunction::UnaryAggregate<SumState<int64_t>, int32_t, hugeint_t, IntegerSumOperation>(
|
76
|
+
LogicalType::INTEGER, LogicalType::HUGEINT);
|
77
|
+
function.name = "sum_no_overflow";
|
78
|
+
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
79
|
+
return function;
|
80
|
+
}
|
81
|
+
case PhysicalType::INT64: {
|
82
|
+
auto function = AggregateFunction::UnaryAggregate<SumState<int64_t>, int64_t, hugeint_t, IntegerSumOperation>(
|
83
|
+
LogicalType::BIGINT, LogicalType::HUGEINT);
|
84
|
+
function.name = "sum_no_overflow";
|
85
|
+
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
86
|
+
return function;
|
87
|
+
}
|
88
|
+
default:
|
89
|
+
throw BinderException("Unsupported internal type for sum_no_overflow");
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
73
93
|
unique_ptr<BaseStatistics> SumPropagateStats(ClientContext &context, BoundAggregateExpression &expr,
|
74
94
|
AggregateStatisticsInput &input) {
|
75
95
|
if (input.node_stats && input.node_stats->has_max_cardinality) {
|
@@ -100,12 +120,12 @@ unique_ptr<BaseStatistics> SumPropagateStats(ClientContext &context, BoundAggreg
|
|
100
120
|
return nullptr;
|
101
121
|
}
|
102
122
|
// total sum is guaranteed to fit in a single int64: use int64 sum instead of hugeint sum
|
103
|
-
expr.function =
|
123
|
+
expr.function = GetSumAggregateNoOverflow(internal_type);
|
104
124
|
}
|
105
125
|
return nullptr;
|
106
126
|
}
|
107
127
|
|
108
|
-
AggregateFunction
|
128
|
+
AggregateFunction GetSumAggregate(PhysicalType type) {
|
109
129
|
switch (type) {
|
110
130
|
case PhysicalType::INT16: {
|
111
131
|
auto function = AggregateFunction::UnaryAggregate<SumState<int64_t>, int16_t, hugeint_t, IntegerSumOperation>(
|
@@ -142,31 +162,10 @@ AggregateFunction SumFun::GetSumAggregate(PhysicalType type) {
|
|
142
162
|
}
|
143
163
|
}
|
144
164
|
|
145
|
-
AggregateFunction SumFun::GetSumAggregateNoOverflow(PhysicalType type) {
|
146
|
-
switch (type) {
|
147
|
-
case PhysicalType::INT32: {
|
148
|
-
auto function = AggregateFunction::UnaryAggregate<SumState<int64_t>, int32_t, hugeint_t, IntegerSumOperation>(
|
149
|
-
LogicalType::INTEGER, LogicalType::HUGEINT);
|
150
|
-
function.name = "sum_no_overflow";
|
151
|
-
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
152
|
-
return function;
|
153
|
-
}
|
154
|
-
case PhysicalType::INT64: {
|
155
|
-
auto function = AggregateFunction::UnaryAggregate<SumState<int64_t>, int64_t, hugeint_t, IntegerSumOperation>(
|
156
|
-
LogicalType::BIGINT, LogicalType::HUGEINT);
|
157
|
-
function.name = "sum_no_overflow";
|
158
|
-
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
159
|
-
return function;
|
160
|
-
}
|
161
|
-
default:
|
162
|
-
throw BinderException("Unsupported internal type for sum_no_overflow");
|
163
|
-
}
|
164
|
-
}
|
165
|
-
|
166
165
|
unique_ptr<FunctionData> BindDecimalSum(ClientContext &context, AggregateFunction &function,
|
167
166
|
vector<unique_ptr<Expression>> &arguments) {
|
168
167
|
auto decimal_type = arguments[0]->return_type;
|
169
|
-
function =
|
168
|
+
function = GetSumAggregate(decimal_type.InternalType());
|
170
169
|
function.name = "sum";
|
171
170
|
function.arguments[0] = decimal_type;
|
172
171
|
function.return_type = LogicalType::DECIMAL(Decimal::MAX_WIDTH_DECIMAL, DecimalType::GetScale(decimal_type));
|
@@ -177,7 +176,7 @@ unique_ptr<FunctionData> BindDecimalSum(ClientContext &context, AggregateFunctio
|
|
177
176
|
unique_ptr<FunctionData> BindDecimalSumNoOverflow(ClientContext &context, AggregateFunction &function,
|
178
177
|
vector<unique_ptr<Expression>> &arguments) {
|
179
178
|
auto decimal_type = arguments[0]->return_type;
|
180
|
-
function =
|
179
|
+
function = GetSumAggregateNoOverflow(decimal_type.InternalType());
|
181
180
|
function.name = "sum_no_overflow";
|
182
181
|
function.arguments[0] = decimal_type;
|
183
182
|
function.return_type = LogicalType::DECIMAL(Decimal::MAX_WIDTH_DECIMAL, DecimalType::GetScale(decimal_type));
|
@@ -185,8 +184,8 @@ unique_ptr<FunctionData> BindDecimalSumNoOverflow(ClientContext &context, Aggreg
|
|
185
184
|
return nullptr;
|
186
185
|
}
|
187
186
|
|
188
|
-
|
189
|
-
AggregateFunctionSet sum
|
187
|
+
AggregateFunctionSet SumFun::GetFunctions() {
|
188
|
+
AggregateFunctionSet sum;
|
190
189
|
// decimal
|
191
190
|
sum.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr,
|
192
191
|
nullptr, nullptr, FunctionNullHandling::DEFAULT_NULL_HANDLING, nullptr,
|
@@ -197,29 +196,22 @@ void SumFun::RegisterFunction(BuiltinFunctions &set) {
|
|
197
196
|
sum.AddFunction(GetSumAggregate(PhysicalType::INT128));
|
198
197
|
sum.AddFunction(AggregateFunction::UnaryAggregate<SumState<double>, double, double, NumericSumOperation>(
|
199
198
|
LogicalType::DOUBLE, LogicalType::DOUBLE));
|
199
|
+
return sum;
|
200
|
+
}
|
200
201
|
|
201
|
-
|
202
|
-
|
203
|
-
AggregateFunctionSet sum_no_overflow("sum_no_overflow");
|
202
|
+
AggregateFunctionSet SumNoOverflowFun::GetFunctions() {
|
203
|
+
AggregateFunctionSet sum_no_overflow;
|
204
204
|
sum_no_overflow.AddFunction(GetSumAggregateNoOverflow(PhysicalType::INT32));
|
205
205
|
sum_no_overflow.AddFunction(GetSumAggregateNoOverflow(PhysicalType::INT64));
|
206
206
|
sum_no_overflow.AddFunction(
|
207
207
|
AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr, nullptr, nullptr,
|
208
208
|
FunctionNullHandling::DEFAULT_NULL_HANDLING, nullptr, BindDecimalSumNoOverflow));
|
209
|
-
|
210
|
-
|
211
|
-
// fsum
|
212
|
-
AggregateFunctionSet fsum("fsum");
|
213
|
-
fsum.AddFunction(AggregateFunction::UnaryAggregate<KahanSumState, double, double, KahanSumOperation>(
|
214
|
-
LogicalType::DOUBLE, LogicalType::DOUBLE));
|
215
|
-
|
216
|
-
set.AddFunction(fsum);
|
217
|
-
|
218
|
-
fsum.name = "kahan_sum";
|
219
|
-
set.AddFunction(fsum);
|
209
|
+
return sum_no_overflow;
|
210
|
+
}
|
220
211
|
|
221
|
-
|
222
|
-
|
212
|
+
AggregateFunction KahanSumFun::GetFunction() {
|
213
|
+
return AggregateFunction::UnaryAggregate<KahanSumState, double, double, KahanSumOperation>(LogicalType::DOUBLE,
|
214
|
+
LogicalType::DOUBLE);
|
223
215
|
}
|
224
216
|
|
225
217
|
} // namespace duckdb
|
package/src/duckdb/src/{function → core_functions}/aggregate/holistic/approximate_quantile.cpp
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
#include "duckdb/execution/expression_executor.hpp"
|
2
|
-
#include "duckdb/
|
2
|
+
#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
|
3
3
|
#include "t_digest.hpp"
|
4
4
|
#include "duckdb/planner/expression.hpp"
|
5
5
|
#include "duckdb/common/operator/cast_operators.hpp"
|
@@ -350,8 +350,8 @@ AggregateFunction GetApproxQuantileListAggregate(const LogicalType &type) {
|
|
350
350
|
return fun;
|
351
351
|
}
|
352
352
|
|
353
|
-
|
354
|
-
AggregateFunctionSet approx_quantile
|
353
|
+
AggregateFunctionSet ApproxQuantileFun::GetFunctions() {
|
354
|
+
AggregateFunctionSet approx_quantile;
|
355
355
|
approx_quantile.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL, LogicalType::FLOAT}, LogicalTypeId::DECIMAL,
|
356
356
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
357
357
|
BindApproxQuantileDecimal));
|
@@ -374,8 +374,7 @@ void ApproximateQuantileFun::RegisterFunction(BuiltinFunctions &set) {
|
|
374
374
|
approx_quantile.AddFunction(GetApproxQuantileListAggregate(LogicalTypeId::HUGEINT));
|
375
375
|
approx_quantile.AddFunction(GetApproxQuantileListAggregate(LogicalTypeId::FLOAT));
|
376
376
|
approx_quantile.AddFunction(GetApproxQuantileListAggregate(LogicalTypeId::DOUBLE));
|
377
|
-
|
378
|
-
set.AddFunction(approx_quantile);
|
377
|
+
return approx_quantile;
|
379
378
|
}
|
380
379
|
|
381
380
|
} // namespace duckdb
|
@@ -5,7 +5,7 @@
|
|
5
5
|
#include "duckdb/common/exception.hpp"
|
6
6
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
7
7
|
#include "duckdb/common/operator/comparison_operators.hpp"
|
8
|
-
#include "duckdb/
|
8
|
+
#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
|
9
9
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
10
10
|
#include "duckdb/common/unordered_map.hpp"
|
11
11
|
|
@@ -318,11 +318,11 @@ unique_ptr<FunctionData> BindModeDecimal(ClientContext &context, AggregateFuncti
|
|
318
318
|
return nullptr;
|
319
319
|
}
|
320
320
|
|
321
|
-
|
321
|
+
AggregateFunctionSet ModeFun::GetFunctions() {
|
322
322
|
const vector<LogicalType> TEMPORAL = {LogicalType::DATE, LogicalType::TIMESTAMP, LogicalType::TIME,
|
323
323
|
LogicalType::TIMESTAMP_TZ, LogicalType::TIME_TZ, LogicalType::INTERVAL};
|
324
324
|
|
325
|
-
AggregateFunctionSet mode
|
325
|
+
AggregateFunctionSet mode;
|
326
326
|
mode.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr,
|
327
327
|
nullptr, nullptr, nullptr, BindModeDecimal));
|
328
328
|
|
@@ -337,7 +337,6 @@ void ModeFun::RegisterFunction(BuiltinFunctions &set) {
|
|
337
337
|
}
|
338
338
|
|
339
339
|
mode.AddFunction(GetModeAggregate(LogicalType::VARCHAR));
|
340
|
-
|
341
|
-
set.AddFunction(mode);
|
340
|
+
return mode;
|
342
341
|
}
|
343
342
|
} // namespace duckdb
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#include "duckdb/execution/expression_executor.hpp"
|
2
|
-
#include "duckdb/
|
2
|
+
#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
|
3
3
|
#include "duckdb/planner/expression.hpp"
|
4
4
|
#include "duckdb/common/operator/cast_operators.hpp"
|
5
5
|
#include "duckdb/common/operator/abs.hpp"
|
@@ -1375,24 +1375,39 @@ AggregateFunction GetQuantileDecimalAggregate(const vector<LogicalType> &argumen
|
|
1375
1375
|
return fun;
|
1376
1376
|
}
|
1377
1377
|
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1378
|
+
vector<LogicalType> GetQuantileTypes() {
|
1379
|
+
return {LogicalType::TINYINT, LogicalType::SMALLINT, LogicalType::INTEGER, LogicalType::BIGINT,
|
1380
|
+
LogicalType::HUGEINT, LogicalType::FLOAT, LogicalType::DOUBLE, LogicalType::DATE,
|
1381
|
+
LogicalType::TIMESTAMP, LogicalType::TIME, LogicalType::TIMESTAMP_TZ, LogicalType::TIME_TZ,
|
1382
|
+
LogicalType::INTERVAL, LogicalType::VARCHAR};
|
1383
|
+
}
|
1384
1384
|
|
1385
|
+
AggregateFunctionSet MedianFun::GetFunctions() {
|
1385
1386
|
AggregateFunctionSet median("median");
|
1386
1387
|
median.AddFunction(
|
1387
1388
|
GetQuantileDecimalAggregate({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, BindMedianDecimal));
|
1389
|
+
for (const auto &type : GetQuantileTypes()) {
|
1390
|
+
median.AddFunction(GetMedianAggregate(type));
|
1391
|
+
}
|
1392
|
+
return median;
|
1393
|
+
}
|
1388
1394
|
|
1395
|
+
AggregateFunctionSet QuantileDiscFun::GetFunctions() {
|
1389
1396
|
AggregateFunctionSet quantile_disc("quantile_disc");
|
1390
1397
|
quantile_disc.AddFunction(GetQuantileDecimalAggregate({LogicalTypeId::DECIMAL, LogicalType::DOUBLE},
|
1391
1398
|
LogicalTypeId::DECIMAL, BindDiscreteQuantileDecimal));
|
1392
1399
|
quantile_disc.AddFunction(
|
1393
1400
|
GetQuantileDecimalAggregate({LogicalTypeId::DECIMAL, LogicalType::LIST(LogicalType::DOUBLE)},
|
1394
1401
|
LogicalType::LIST(LogicalTypeId::DECIMAL), BindDiscreteQuantileDecimalList));
|
1402
|
+
for (const auto &type : GetQuantileTypes()) {
|
1403
|
+
quantile_disc.AddFunction(GetDiscreteQuantileAggregate(type));
|
1404
|
+
quantile_disc.AddFunction(GetDiscreteQuantileListAggregate(type));
|
1405
|
+
}
|
1406
|
+
return quantile_disc;
|
1407
|
+
// quantile
|
1408
|
+
}
|
1395
1409
|
|
1410
|
+
AggregateFunctionSet QuantileContFun::GetFunctions() {
|
1396
1411
|
AggregateFunctionSet quantile_cont("quantile_cont");
|
1397
1412
|
quantile_cont.AddFunction(GetQuantileDecimalAggregate({LogicalTypeId::DECIMAL, LogicalType::DOUBLE},
|
1398
1413
|
LogicalTypeId::DECIMAL, BindContinuousQuantileDecimal));
|
@@ -1400,34 +1415,27 @@ void QuantileFun::RegisterFunction(BuiltinFunctions &set) {
|
|
1400
1415
|
GetQuantileDecimalAggregate({LogicalTypeId::DECIMAL, LogicalType::LIST(LogicalType::DOUBLE)},
|
1401
1416
|
LogicalType::LIST(LogicalTypeId::DECIMAL), BindContinuousQuantileDecimalList));
|
1402
1417
|
|
1403
|
-
for (const auto &type :
|
1404
|
-
median.AddFunction(GetMedianAggregate(type));
|
1405
|
-
quantile_disc.AddFunction(GetDiscreteQuantileAggregate(type));
|
1406
|
-
quantile_disc.AddFunction(GetDiscreteQuantileListAggregate(type));
|
1418
|
+
for (const auto &type : GetQuantileTypes()) {
|
1407
1419
|
if (CanInterpolate(type)) {
|
1408
1420
|
quantile_cont.AddFunction(GetContinuousQuantileAggregate(type));
|
1409
1421
|
quantile_cont.AddFunction(GetContinuousQuantileListAggregate(type));
|
1410
1422
|
}
|
1411
1423
|
}
|
1424
|
+
return quantile_cont;
|
1425
|
+
}
|
1412
1426
|
|
1413
|
-
|
1414
|
-
set.AddFunction(quantile_disc);
|
1415
|
-
set.AddFunction(quantile_cont);
|
1416
|
-
|
1417
|
-
quantile_disc.name = "quantile";
|
1418
|
-
set.AddFunction(quantile_disc);
|
1419
|
-
|
1427
|
+
AggregateFunctionSet MadFun::GetFunctions() {
|
1420
1428
|
AggregateFunctionSet mad("mad");
|
1421
1429
|
mad.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr,
|
1422
1430
|
nullptr, nullptr, nullptr, BindMedianAbsoluteDeviationDecimal));
|
1423
1431
|
|
1424
|
-
const vector<LogicalType>
|
1425
|
-
|
1426
|
-
|
1427
|
-
for (const auto &type :
|
1432
|
+
const vector<LogicalType> MAD_TYPES = {LogicalType::FLOAT, LogicalType::DOUBLE, LogicalType::DATE,
|
1433
|
+
LogicalType::TIMESTAMP, LogicalType::TIME, LogicalType::TIMESTAMP_TZ,
|
1434
|
+
LogicalType::TIME_TZ};
|
1435
|
+
for (const auto &type : MAD_TYPES) {
|
1428
1436
|
mad.AddFunction(GetMedianAbsoluteDeviationAggregateFunction(type));
|
1429
1437
|
}
|
1430
|
-
|
1438
|
+
return mad;
|
1431
1439
|
}
|
1432
1440
|
|
1433
1441
|
} // namespace duckdb
|