duckdb 0.7.2-dev2706.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/extension/parquet/parquet_metadata.cpp +46 -20
- 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/execution/operator/persistent/physical_insert.cpp +19 -12
- 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/range.cpp +1 -0
- package/src/duckdb/src/function/table/repeat_row.cpp +60 -0
- 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/execution/operator/persistent/physical_insert.hpp +4 -3
- 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/range.hpp +4 -0
- 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/src/planner/binder/tableref/bind_table_function.cpp +5 -4
- 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_function_table.cpp +2 -0
- 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,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
3
3
|
#include "duckdb/common/limits.hpp"
|
4
4
|
#include "fmt/format.h"
|
@@ -152,20 +152,20 @@ static void PrintfFunction(DataChunk &args, ExpressionState &state, Vector &resu
|
|
152
152
|
}
|
153
153
|
}
|
154
154
|
|
155
|
-
|
155
|
+
ScalarFunction PrintfFun::GetFunction() {
|
156
156
|
// duckdb_fmt::printf_context, duckdb_fmt::vsprintf
|
157
|
-
ScalarFunction printf_fun
|
158
|
-
|
159
|
-
PrintfFunction<FMTPrintf, duckdb_fmt::printf_context>, BindPrintfFunction);
|
157
|
+
ScalarFunction printf_fun({LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
158
|
+
PrintfFunction<FMTPrintf, duckdb_fmt::printf_context>, BindPrintfFunction);
|
160
159
|
printf_fun.varargs = LogicalType::ANY;
|
161
|
-
|
160
|
+
return printf_fun;
|
161
|
+
}
|
162
162
|
|
163
|
+
ScalarFunction FormatFun::GetFunction() {
|
163
164
|
// duckdb_fmt::format_context, duckdb_fmt::vformat
|
164
|
-
ScalarFunction format_fun
|
165
|
-
|
166
|
-
PrintfFunction<FMTFormat, duckdb_fmt::format_context>, BindPrintfFunction);
|
165
|
+
ScalarFunction format_fun({LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
166
|
+
PrintfFunction<FMTFormat, duckdb_fmt::format_context>, BindPrintfFunction);
|
167
167
|
format_fun.varargs = LogicalType::ANY;
|
168
|
-
|
168
|
+
return format_fun;
|
169
169
|
}
|
170
170
|
|
171
171
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/binary_executor.hpp"
|
@@ -33,11 +33,8 @@ static void RepeatFunction(DataChunk &args, ExpressionState &state, Vector &resu
|
|
33
33
|
});
|
34
34
|
}
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
{LogicalType::VARCHAR, LogicalType::BIGINT}, // argument list
|
39
|
-
LogicalType::VARCHAR, // return type
|
40
|
-
RepeatFunction)); // pointer to function implementation
|
36
|
+
ScalarFunction RepeatFun::GetFunction() {
|
37
|
+
return ScalarFunction({LogicalType::VARCHAR, LogicalType::BIGINT}, LogicalType::VARCHAR, RepeatFunction);
|
41
38
|
}
|
42
39
|
|
43
40
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -76,12 +76,9 @@ static void ReplaceFunction(DataChunk &args, ExpressionState &state, Vector &res
|
|
76
76
|
});
|
77
77
|
}
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
LogicalType::VARCHAR, LogicalType::VARCHAR},
|
83
|
-
LogicalType::VARCHAR, // return type
|
84
|
-
ReplaceFunction)); // pointer to function implementation
|
79
|
+
ScalarFunction ReplaceFun::GetFunction() {
|
80
|
+
return ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
81
|
+
ReplaceFunction);
|
85
82
|
}
|
86
83
|
|
87
84
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -49,8 +49,8 @@ static void ReverseFunction(DataChunk &args, ExpressionState &state, Vector &res
|
|
49
49
|
UnaryExecutor::ExecuteString<string_t, string_t, ReverseOperator>(args.data[0], result, args.size());
|
50
50
|
}
|
51
51
|
|
52
|
-
|
53
|
-
|
52
|
+
ScalarFunction ReverseFun::GetFunction() {
|
53
|
+
return ScalarFunction("reverse", {LogicalType::VARCHAR}, LogicalType::VARCHAR, ReverseFunction);
|
54
54
|
}
|
55
55
|
|
56
56
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -35,13 +35,9 @@ struct StartsWithOperator {
|
|
35
35
|
}
|
36
36
|
};
|
37
37
|
|
38
|
-
|
39
|
-
ScalarFunction
|
40
|
-
|
41
|
-
ScalarFunction::BinaryFunction<string_t, string_t, bool, StartsWithOperator>);
|
42
|
-
set.AddFunction(starts_with);
|
43
|
-
starts_with.name = "^@";
|
44
|
-
set.AddFunction(starts_with);
|
38
|
+
ScalarFunction StartsWithOperatorFun::GetFunction() {
|
39
|
+
return ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BOOLEAN,
|
40
|
+
ScalarFunction::BinaryFunction<string_t, string_t, bool, StartsWithOperator>);
|
45
41
|
}
|
46
42
|
|
47
43
|
} // namespace duckdb
|
@@ -3,8 +3,9 @@
|
|
3
3
|
#include "duckdb/common/types/vector.hpp"
|
4
4
|
#include "duckdb/common/vector_size.hpp"
|
5
5
|
#include "duckdb/function/scalar/regexp.hpp"
|
6
|
-
#include "duckdb/
|
6
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
7
7
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
8
|
+
#include "duckdb/function/scalar/string_functions.hpp"
|
8
9
|
|
9
10
|
namespace duckdb {
|
10
11
|
|
@@ -171,15 +172,17 @@ static void StringSplitRegexFunction(DataChunk &args, ExpressionState &state, Ve
|
|
171
172
|
}
|
172
173
|
}
|
173
174
|
|
174
|
-
|
175
|
+
ScalarFunction StringSplitFun::GetFunction() {
|
175
176
|
auto varchar_list_type = LogicalType::LIST(LogicalType::VARCHAR);
|
176
177
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
178
|
+
ScalarFunction string_split({LogicalType::VARCHAR, LogicalType::VARCHAR}, varchar_list_type, StringSplitFunction);
|
179
|
+
string_split.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
180
|
+
return string_split;
|
181
|
+
}
|
181
182
|
|
182
|
-
|
183
|
+
ScalarFunctionSet StringSplitRegexFun::GetFunctions() {
|
184
|
+
auto varchar_list_type = LogicalType::LIST(LogicalType::VARCHAR);
|
185
|
+
ScalarFunctionSet regexp_split;
|
183
186
|
ScalarFunction regex_fun({LogicalType::VARCHAR, LogicalType::VARCHAR}, varchar_list_type, StringSplitRegexFunction,
|
184
187
|
RegexpMatchesBind, nullptr, nullptr, RegexInitLocalState, LogicalType::INVALID,
|
185
188
|
FunctionSideEffects::NO_SIDE_EFFECTS, FunctionNullHandling::SPECIAL_HANDLING);
|
@@ -187,10 +190,7 @@ void StringSplitFun::RegisterFunction(BuiltinFunctions &set) {
|
|
187
190
|
// regexp options
|
188
191
|
regex_fun.arguments.emplace_back(LogicalType::VARCHAR);
|
189
192
|
regexp_split.AddFunction(regex_fun);
|
190
|
-
|
191
|
-
regexp_split.name = name;
|
192
|
-
set.AddFunction(regexp_split);
|
193
|
-
}
|
193
|
+
return regexp_split;
|
194
194
|
}
|
195
195
|
|
196
196
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -88,12 +88,9 @@ static void TranslateFunction(DataChunk &args, ExpressionState &state, Vector &r
|
|
88
88
|
});
|
89
89
|
}
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
LogicalType::VARCHAR, LogicalType::VARCHAR},
|
95
|
-
LogicalType::VARCHAR, // return type
|
96
|
-
TranslateFunction)); // pointer to function implementation
|
91
|
+
ScalarFunction TranslateFun::GetFunction() {
|
92
|
+
return ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
93
|
+
TranslateFunction);
|
97
94
|
}
|
98
95
|
|
99
96
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -125,25 +125,30 @@ static void BinaryTrimFunction(DataChunk &input, ExpressionState &state, Vector
|
|
125
125
|
});
|
126
126
|
}
|
127
127
|
|
128
|
-
|
129
|
-
ScalarFunctionSet
|
130
|
-
ScalarFunctionSet rtrim("rtrim");
|
131
|
-
ScalarFunctionSet trim("trim");
|
132
|
-
|
133
|
-
ltrim.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, UnaryTrimFunction<true, false>));
|
134
|
-
rtrim.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, UnaryTrimFunction<false, true>));
|
128
|
+
ScalarFunctionSet TrimFun::GetFunctions() {
|
129
|
+
ScalarFunctionSet trim;
|
135
130
|
trim.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, UnaryTrimFunction<true, true>));
|
136
131
|
|
132
|
+
trim.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
133
|
+
BinaryTrimFunction<true, true>));
|
134
|
+
return trim;
|
135
|
+
}
|
136
|
+
|
137
|
+
ScalarFunctionSet LtrimFun::GetFunctions() {
|
138
|
+
ScalarFunctionSet ltrim;
|
139
|
+
ltrim.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, UnaryTrimFunction<true, false>));
|
137
140
|
ltrim.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
138
141
|
BinaryTrimFunction<true, false>));
|
142
|
+
return ltrim;
|
143
|
+
}
|
144
|
+
|
145
|
+
ScalarFunctionSet RtrimFun::GetFunctions() {
|
146
|
+
ScalarFunctionSet rtrim;
|
147
|
+
rtrim.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, UnaryTrimFunction<false, true>));
|
148
|
+
|
139
149
|
rtrim.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
140
150
|
BinaryTrimFunction<false, true>));
|
141
|
-
|
142
|
-
BinaryTrimFunction<true, true>));
|
143
|
-
|
144
|
-
set.AddFunction(ltrim);
|
145
|
-
set.AddFunction(rtrim);
|
146
|
-
set.AddFunction(trim);
|
151
|
+
return rtrim;
|
147
152
|
}
|
148
153
|
|
149
154
|
} // namespace duckdb
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
|
+
|
3
|
+
#include "duckdb/common/exception.hpp"
|
4
|
+
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
|
+
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
6
|
+
#include "utf8proc.hpp"
|
7
|
+
|
8
|
+
#include <string.h>
|
9
|
+
|
10
|
+
namespace duckdb {
|
11
|
+
|
12
|
+
struct UnicodeOperator {
|
13
|
+
template <class TA, class TR>
|
14
|
+
static inline TR Operation(const TA &input) {
|
15
|
+
auto str = reinterpret_cast<const utf8proc_uint8_t *>(input.GetData());
|
16
|
+
auto len = input.GetSize();
|
17
|
+
utf8proc_int32_t codepoint;
|
18
|
+
(void)utf8proc_iterate(str, len, &codepoint);
|
19
|
+
return codepoint;
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
ScalarFunction UnicodeFun::GetFunction() {
|
24
|
+
return ScalarFunction({LogicalType::VARCHAR}, LogicalType::INTEGER,
|
25
|
+
ScalarFunction::UnaryFunction<string_t, int32_t, UnicodeOperator>);
|
26
|
+
}
|
27
|
+
|
28
|
+
} // namespace duckdb
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/struct_functions.hpp"
|
1
2
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
2
3
|
#include "duckdb/common/string_util.hpp"
|
3
4
|
#include "duckdb/parser/expression/bound_expression.hpp"
|
@@ -96,14 +97,13 @@ unique_ptr<BaseStatistics> StructInsertStats(ClientContext &context, FunctionSta
|
|
96
97
|
return new_struct_stats.ToUnique();
|
97
98
|
}
|
98
99
|
|
99
|
-
|
100
|
+
ScalarFunction StructInsertFun::GetFunction() {
|
100
101
|
// the arguments and return types are actually set in the binder function
|
101
|
-
ScalarFunction fun(
|
102
|
-
StructInsertStats);
|
102
|
+
ScalarFunction fun({}, LogicalTypeId::STRUCT, StructInsertFunction, StructInsertBind, nullptr, StructInsertStats);
|
103
103
|
fun.varargs = LogicalType::ANY;
|
104
104
|
fun.serialize = VariableReturnBindData::Serialize;
|
105
105
|
fun.deserialize = VariableReturnBindData::Deserialize;
|
106
|
-
|
106
|
+
return fun;
|
107
107
|
}
|
108
108
|
|
109
109
|
} // namespace duckdb
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/struct_functions.hpp"
|
1
2
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
2
3
|
#include "duckdb/common/string_util.hpp"
|
3
4
|
#include "duckdb/parser/expression/bound_expression.hpp"
|
@@ -68,7 +69,7 @@ unique_ptr<BaseStatistics> StructPackStats(ClientContext &context, FunctionStati
|
|
68
69
|
return struct_stats.ToUnique();
|
69
70
|
}
|
70
71
|
|
71
|
-
|
72
|
+
ScalarFunction StructPackFun::GetFunction() {
|
72
73
|
// the arguments and return types are actually set in the binder function
|
73
74
|
ScalarFunction fun("struct_pack", {}, LogicalTypeId::STRUCT, StructPackFunction, StructPackBind, nullptr,
|
74
75
|
StructPackStats);
|
@@ -76,9 +77,7 @@ void StructPackFun::RegisterFunction(BuiltinFunctions &set) {
|
|
76
77
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
77
78
|
fun.serialize = VariableReturnBindData::Serialize;
|
78
79
|
fun.deserialize = VariableReturnBindData::Deserialize;
|
79
|
-
|
80
|
-
fun.name = "row";
|
81
|
-
set.AddFunction(fun);
|
80
|
+
return fun;
|
82
81
|
}
|
83
82
|
|
84
83
|
} // namespace duckdb
|
@@ -1,6 +1,6 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/union_functions.hpp"
|
1
2
|
#include "duckdb/common/string_util.hpp"
|
2
3
|
#include "duckdb/execution/expression_executor.hpp"
|
3
|
-
#include "duckdb/function/scalar/nested_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
5
5
|
#include "duckdb/planner/expression/bound_parameter_expression.hpp"
|
6
6
|
|
@@ -97,14 +97,10 @@ static unique_ptr<FunctionData> UnionExtractBind(ClientContext &context, ScalarF
|
|
97
97
|
return make_uniq<UnionExtractBindData>(key, key_index, return_type);
|
98
98
|
}
|
99
99
|
|
100
|
-
|
100
|
+
ScalarFunction UnionExtractFun::GetFunction() {
|
101
101
|
// the arguments and return types are actually set in the binder function
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
ScalarFunctionSet extract("union_extract");
|
106
|
-
extract.AddFunction(fun);
|
107
|
-
set.AddFunction(extract);
|
102
|
+
return ScalarFunction({LogicalTypeId::UNION, LogicalType::VARCHAR}, LogicalType::ANY, UnionExtractFunction,
|
103
|
+
UnionExtractBind, nullptr, nullptr);
|
108
104
|
}
|
109
105
|
|
110
106
|
} // namespace duckdb
|
@@ -1,6 +1,6 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/union_functions.hpp"
|
1
2
|
#include "duckdb/common/string_util.hpp"
|
2
3
|
#include "duckdb/execution/expression_executor.hpp"
|
3
|
-
#include "duckdb/function/scalar/nested_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
5
5
|
#include "duckdb/planner/expression/bound_parameter_expression.hpp"
|
6
6
|
|
@@ -50,13 +50,9 @@ static void UnionTagFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
50
50
|
result.Reinterpret(UnionVector::GetTags(args.data[0]));
|
51
51
|
}
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
ScalarFunctionSet union_tag("union_tag");
|
58
|
-
union_tag.AddFunction(fun);
|
59
|
-
set.AddFunction(union_tag);
|
53
|
+
ScalarFunction UnionTagFun::GetFunction() {
|
54
|
+
return ScalarFunction({LogicalTypeId::UNION}, LogicalTypeId::ANY, UnionTagFunction, UnionTagBind, nullptr,
|
55
|
+
nullptr); // TODO: Statistics?
|
60
56
|
}
|
61
57
|
|
62
58
|
} // namespace duckdb
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/union_functions.hpp"
|
1
2
|
#include "duckdb/common/string_util.hpp"
|
2
3
|
#include "duckdb/execution/expression_executor.hpp"
|
3
4
|
#include "duckdb/function/scalar/nested_functions.hpp"
|
@@ -6,57 +7,6 @@
|
|
6
7
|
|
7
8
|
namespace duckdb {
|
8
9
|
|
9
|
-
UnionInvalidReason CheckUnionValidity(Vector &vector, idx_t count, const SelectionVector &sel) {
|
10
|
-
D_ASSERT(vector.GetType().id() == LogicalTypeId::UNION);
|
11
|
-
auto member_count = UnionType::GetMemberCount(vector.GetType());
|
12
|
-
if (member_count == 0) {
|
13
|
-
return UnionInvalidReason::NO_MEMBERS;
|
14
|
-
}
|
15
|
-
|
16
|
-
UnifiedVectorFormat union_vdata;
|
17
|
-
vector.ToUnifiedFormat(count, union_vdata);
|
18
|
-
|
19
|
-
UnifiedVectorFormat tags_vdata;
|
20
|
-
auto &tag_vector = UnionVector::GetTags(vector);
|
21
|
-
tag_vector.ToUnifiedFormat(count, tags_vdata);
|
22
|
-
|
23
|
-
// check that only one member is valid at a time
|
24
|
-
for (idx_t row_idx = 0; row_idx < count; row_idx++) {
|
25
|
-
auto union_mapped_row_idx = sel.get_index(row_idx);
|
26
|
-
if (!union_vdata.validity.RowIsValid(union_mapped_row_idx)) {
|
27
|
-
continue;
|
28
|
-
}
|
29
|
-
|
30
|
-
auto tag_mapped_row_idx = tags_vdata.sel->get_index(row_idx);
|
31
|
-
if (!tags_vdata.validity.RowIsValid(tag_mapped_row_idx)) {
|
32
|
-
continue;
|
33
|
-
}
|
34
|
-
|
35
|
-
auto tag = ((union_tag_t *)tags_vdata.data)[tag_mapped_row_idx];
|
36
|
-
if (tag >= member_count) {
|
37
|
-
return UnionInvalidReason::TAG_OUT_OF_RANGE;
|
38
|
-
}
|
39
|
-
|
40
|
-
bool found_valid = false;
|
41
|
-
for (idx_t member_idx = 0; member_idx < member_count; member_idx++) {
|
42
|
-
|
43
|
-
UnifiedVectorFormat member_vdata;
|
44
|
-
auto &member = UnionVector::GetMember(vector, member_idx);
|
45
|
-
member.ToUnifiedFormat(count, member_vdata);
|
46
|
-
|
47
|
-
auto mapped_row_idx = member_vdata.sel->get_index(row_idx);
|
48
|
-
if (member_vdata.validity.RowIsValid(mapped_row_idx)) {
|
49
|
-
if (found_valid) {
|
50
|
-
return UnionInvalidReason::VALIDITY_OVERLAP;
|
51
|
-
}
|
52
|
-
found_valid = true;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
return UnionInvalidReason::VALID;
|
58
|
-
}
|
59
|
-
|
60
10
|
struct UnionValueBindData : public FunctionData {
|
61
11
|
UnionValueBindData() {
|
62
12
|
}
|
@@ -106,18 +56,13 @@ static unique_ptr<FunctionData> UnionValueBind(ClientContext &context, ScalarFun
|
|
106
56
|
return make_uniq<VariableReturnBindData>(bound_function.return_type);
|
107
57
|
}
|
108
58
|
|
109
|
-
|
110
|
-
|
111
|
-
auto fun =
|
112
|
-
ScalarFunction("union_value", {}, LogicalTypeId::UNION, UnionValueFunction, UnionValueBind, nullptr, nullptr);
|
59
|
+
ScalarFunction UnionValueFun::GetFunction() {
|
60
|
+
ScalarFunction fun("union_value", {}, LogicalTypeId::UNION, UnionValueFunction, UnionValueBind, nullptr, nullptr);
|
113
61
|
fun.varargs = LogicalType::ANY;
|
114
62
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
115
63
|
fun.serialize = VariableReturnBindData::Serialize;
|
116
64
|
fun.deserialize = VariableReturnBindData::Deserialize;
|
117
|
-
|
118
|
-
ScalarFunctionSet union_value("union_value");
|
119
|
-
union_value.AddFunction(fun);
|
120
|
-
set.AddFunction(union_value);
|
65
|
+
return fun;
|
121
66
|
}
|
122
67
|
|
123
68
|
} // namespace duckdb
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#include "duckdb/common/operator/decimal_cast_operators.hpp"
|
10
10
|
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
11
11
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
12
|
-
#include "duckdb/function/scalar/
|
12
|
+
#include "duckdb/function/scalar/strftime_format.hpp"
|
13
13
|
#include "duckdb/main/database.hpp"
|
14
14
|
#include "duckdb/parser/column_definition.hpp"
|
15
15
|
#include "duckdb/storage/data_table.hpp"
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#include "duckdb/common/types/cast_helpers.hpp"
|
8
8
|
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
9
9
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
10
|
-
#include "duckdb/function/scalar/
|
10
|
+
#include "duckdb/function/scalar/strftime_format.hpp"
|
11
11
|
#include "duckdb/main/database.hpp"
|
12
12
|
#include "duckdb/parser/column_definition.hpp"
|
13
13
|
#include "duckdb/storage/data_table.hpp"
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#include "duckdb/common/types/cast_helpers.hpp"
|
8
8
|
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
9
9
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
10
|
-
#include "duckdb/function/scalar/
|
10
|
+
#include "duckdb/function/scalar/strftime_format.hpp"
|
11
11
|
#include "duckdb/main/database.hpp"
|
12
12
|
#include "duckdb/parser/column_definition.hpp"
|
13
13
|
#include "duckdb/storage/data_table.hpp"
|
@@ -102,6 +102,7 @@ public:
|
|
102
102
|
optional_ptr<OptimisticDataWriter> writer;
|
103
103
|
// Rows that have been updated by a DO UPDATE conflict
|
104
104
|
unordered_set<row_t> updated_rows;
|
105
|
+
idx_t update_count = 0;
|
105
106
|
};
|
106
107
|
|
107
108
|
unique_ptr<GlobalSinkState> PhysicalInsert::GetGlobalSinkState(ClientContext &context) const {
|
@@ -217,10 +218,10 @@ void PhysicalInsert::CombineExistingAndInsertTuples(DataChunk &result, DataChunk
|
|
217
218
|
result.SetCardinality(input_chunk.size());
|
218
219
|
}
|
219
220
|
|
220
|
-
|
221
|
-
|
221
|
+
idx_t PhysicalInsert::PerformOnConflictAction(ExecutionContext &context, DataChunk &chunk, TableCatalogEntry &table,
|
222
|
+
Vector &row_ids) const {
|
222
223
|
if (action_type == OnConflictAction::NOTHING) {
|
223
|
-
return;
|
224
|
+
return 0;
|
224
225
|
}
|
225
226
|
|
226
227
|
DataChunk update_chunk; // contains only the to-update columns
|
@@ -259,6 +260,7 @@ void PhysicalInsert::PerformOnConflictAction(ExecutionContext &context, DataChun
|
|
259
260
|
auto &data_table = table.GetStorage();
|
260
261
|
// Perform the update, using the results of the SET expressions
|
261
262
|
data_table.Update(table, context.client, row_ids, set_columns, update_chunk);
|
263
|
+
return update_chunk.size();
|
262
264
|
}
|
263
265
|
|
264
266
|
// TODO: should we use a hash table to keep track of this instead?
|
@@ -275,12 +277,12 @@ void PhysicalInsert::RegisterUpdatedRows(InsertLocalState &lstate, const Vector
|
|
275
277
|
}
|
276
278
|
}
|
277
279
|
|
278
|
-
|
279
|
-
|
280
|
+
idx_t PhysicalInsert::OnConflictHandling(TableCatalogEntry &table, ExecutionContext &context,
|
281
|
+
InsertLocalState &lstate) const {
|
280
282
|
auto &data_table = table.GetStorage();
|
281
283
|
if (action_type == OnConflictAction::THROW) {
|
282
284
|
data_table.VerifyAppendConstraints(table, context.client, lstate.insert_chunk, nullptr);
|
283
|
-
return;
|
285
|
+
return 0;
|
284
286
|
}
|
285
287
|
// Check whether any conflicts arise, and if they all meet the conflict_target + condition
|
286
288
|
// If that's not the case - We throw the first error
|
@@ -291,8 +293,8 @@ void PhysicalInsert::OnConflictHandling(TableCatalogEntry &table, ExecutionConte
|
|
291
293
|
data_table.VerifyAppendConstraints(table, context.client, lstate.insert_chunk, &conflict_manager);
|
292
294
|
conflict_manager.Finalize();
|
293
295
|
if (conflict_manager.ConflictCount() == 0) {
|
294
|
-
// No conflicts found
|
295
|
-
return;
|
296
|
+
// No conflicts found, 0 updates performed
|
297
|
+
return 0;
|
296
298
|
}
|
297
299
|
auto &conflicts = conflict_manager.Conflicts();
|
298
300
|
auto &row_ids = conflict_manager.RowIds();
|
@@ -343,7 +345,7 @@ void PhysicalInsert::OnConflictHandling(TableCatalogEntry &table, ExecutionConte
|
|
343
345
|
|
344
346
|
RegisterUpdatedRows(lstate, row_ids, combined_chunk.size());
|
345
347
|
|
346
|
-
PerformOnConflictAction(context, combined_chunk, table, row_ids);
|
348
|
+
idx_t updated_tuples = PerformOnConflictAction(context, combined_chunk, table, row_ids);
|
347
349
|
|
348
350
|
// Remove the conflicting tuples from the insert chunk
|
349
351
|
SelectionVector sel_vec(lstate.insert_chunk.size());
|
@@ -351,6 +353,7 @@ void PhysicalInsert::OnConflictHandling(TableCatalogEntry &table, ExecutionConte
|
|
351
353
|
SelectionVector::Inverted(conflicts.Selection(), sel_vec, conflicts.Count(), lstate.insert_chunk.size());
|
352
354
|
lstate.insert_chunk.Slice(sel_vec, new_size);
|
353
355
|
lstate.insert_chunk.SetCardinality(new_size);
|
356
|
+
return updated_tuples;
|
354
357
|
}
|
355
358
|
|
356
359
|
SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate_p,
|
@@ -368,13 +371,14 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &
|
|
368
371
|
gstate.initialized = true;
|
369
372
|
}
|
370
373
|
|
371
|
-
OnConflictHandling(table, context, lstate);
|
374
|
+
idx_t updated_tuples = OnConflictHandling(table, context, lstate);
|
372
375
|
storage.LocalAppend(gstate.append_state, table, context.client, lstate.insert_chunk, true);
|
373
376
|
|
374
377
|
if (return_chunk) {
|
375
378
|
gstate.return_collection.Append(lstate.insert_chunk);
|
376
379
|
}
|
377
|
-
gstate.insert_count +=
|
380
|
+
gstate.insert_count += lstate.insert_chunk.size();
|
381
|
+
gstate.insert_count += updated_tuples;
|
378
382
|
} else {
|
379
383
|
D_ASSERT(!return_chunk);
|
380
384
|
// parallel append
|
@@ -388,7 +392,8 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &
|
|
388
392
|
lstate.local_collection->InitializeAppend(lstate.local_append_state);
|
389
393
|
lstate.writer = &gstate.table.GetStorage().CreateOptimisticWriter(context.client);
|
390
394
|
}
|
391
|
-
OnConflictHandling(table, context, lstate);
|
395
|
+
lstate.update_count += OnConflictHandling(table, context, lstate);
|
396
|
+
|
392
397
|
auto new_row_group = lstate.local_collection->Append(lstate.insert_chunk, lstate.local_append_state);
|
393
398
|
if (new_row_group) {
|
394
399
|
lstate.writer->CheckFlushToDisk(*lstate.local_collection);
|
@@ -421,6 +426,7 @@ void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate_
|
|
421
426
|
// we have few rows - append to the local storage directly
|
422
427
|
lock_guard<mutex> lock(gstate.lock);
|
423
428
|
gstate.insert_count += append_count;
|
429
|
+
gstate.insert_count += lstate.update_count;
|
424
430
|
auto &table = gstate.table;
|
425
431
|
auto &storage = table.GetStorage();
|
426
432
|
storage.InitializeLocalAppend(gstate.append_state, context.client);
|
@@ -438,6 +444,7 @@ void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate_
|
|
438
444
|
|
439
445
|
lock_guard<mutex> lock(gstate.lock);
|
440
446
|
gstate.insert_count += append_count;
|
447
|
+
gstate.insert_count += lstate.update_count;
|
441
448
|
gstate.table.GetStorage().LocalMerge(context.client, *lstate.local_collection);
|
442
449
|
}
|
443
450
|
}
|
@@ -7,26 +7,9 @@
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
9
|
void BuiltinFunctions::RegisterDistributiveAggregates() {
|
10
|
-
Register<BitAndFun>();
|
11
|
-
Register<BitOrFun>();
|
12
|
-
Register<BitXorFun>();
|
13
|
-
Register<BitStringAggFun>();
|
14
10
|
Register<CountStarFun>();
|
15
11
|
Register<CountFun>();
|
16
12
|
Register<FirstFun>();
|
17
|
-
Register<MaxFun>();
|
18
|
-
Register<MinFun>();
|
19
|
-
Register<SumFun>();
|
20
|
-
Register<StringAggFun>();
|
21
|
-
Register<ApproxCountDistinctFun>();
|
22
|
-
Register<ProductFun>();
|
23
|
-
Register<BoolOrFun>();
|
24
|
-
Register<BoolAndFun>();
|
25
|
-
Register<ArgMinFun>();
|
26
|
-
Register<ArgMaxFun>();
|
27
|
-
Register<SkewFun>();
|
28
|
-
Register<KurtosisFun>();
|
29
|
-
Register<EntropyFun>();
|
30
13
|
}
|
31
14
|
|
32
15
|
} // namespace duckdb
|