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
@@ -63,14 +63,18 @@ public:
|
|
63
63
|
|
64
64
|
class ScalarFunctionSet : public FunctionSet<ScalarFunction> {
|
65
65
|
public:
|
66
|
+
DUCKDB_API explicit ScalarFunctionSet();
|
66
67
|
DUCKDB_API explicit ScalarFunctionSet(string name);
|
68
|
+
DUCKDB_API explicit ScalarFunctionSet(ScalarFunction fun);
|
67
69
|
|
68
70
|
DUCKDB_API ScalarFunction GetFunctionByArguments(ClientContext &context, const vector<LogicalType> &arguments);
|
69
71
|
};
|
70
72
|
|
71
73
|
class AggregateFunctionSet : public FunctionSet<AggregateFunction> {
|
72
74
|
public:
|
75
|
+
DUCKDB_API explicit AggregateFunctionSet();
|
73
76
|
DUCKDB_API explicit AggregateFunctionSet(string name);
|
77
|
+
DUCKDB_API explicit AggregateFunctionSet(AggregateFunction fun);
|
74
78
|
|
75
79
|
DUCKDB_API AggregateFunction GetFunctionByArguments(ClientContext &context, const vector<LogicalType> &arguments);
|
76
80
|
};
|
@@ -78,14 +82,15 @@ public:
|
|
78
82
|
class TableFunctionSet : public FunctionSet<TableFunction> {
|
79
83
|
public:
|
80
84
|
DUCKDB_API explicit TableFunctionSet(string name);
|
85
|
+
DUCKDB_API explicit TableFunctionSet(TableFunction fun);
|
81
86
|
|
82
87
|
TableFunction GetFunctionByArguments(ClientContext &context, const vector<LogicalType> &arguments);
|
83
88
|
};
|
84
89
|
|
85
90
|
class PragmaFunctionSet : public FunctionSet<PragmaFunction> {
|
86
91
|
public:
|
87
|
-
explicit PragmaFunctionSet(string name)
|
88
|
-
|
92
|
+
DUCKDB_API explicit PragmaFunctionSet(string name);
|
93
|
+
DUCKDB_API explicit PragmaFunctionSet(PragmaFunction fun);
|
89
94
|
};
|
90
95
|
|
91
96
|
} // namespace duckdb
|
@@ -15,34 +15,6 @@
|
|
15
15
|
namespace duckdb {
|
16
16
|
class BoundFunctionExpression;
|
17
17
|
|
18
|
-
struct AliasFun {
|
19
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
20
|
-
};
|
21
|
-
|
22
|
-
struct HashFun {
|
23
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
24
|
-
};
|
25
|
-
|
26
|
-
struct LeastFun {
|
27
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
28
|
-
};
|
29
|
-
|
30
|
-
struct GreatestFun {
|
31
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
32
|
-
};
|
33
|
-
|
34
|
-
struct StatsFun {
|
35
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
36
|
-
};
|
37
|
-
|
38
|
-
struct TypeOfFun {
|
39
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
40
|
-
};
|
41
|
-
|
42
|
-
struct ErrorFun {
|
43
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
44
|
-
};
|
45
|
-
|
46
18
|
struct ConstantOrNull {
|
47
19
|
static ScalarFunction GetFunction(const LogicalType &return_type);
|
48
20
|
static unique_ptr<FunctionData> Bind(Value value);
|
@@ -50,14 +22,6 @@ struct ConstantOrNull {
|
|
50
22
|
static void RegisterFunction(BuiltinFunctions &set);
|
51
23
|
};
|
52
24
|
|
53
|
-
struct CurrentSettingFun {
|
54
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
55
|
-
};
|
56
|
-
|
57
|
-
struct SystemFun {
|
58
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
59
|
-
};
|
60
|
-
|
61
25
|
struct ExportAggregateFunctionBindData : public FunctionData {
|
62
26
|
unique_ptr<BoundAggregateExpression> aggregate;
|
63
27
|
explicit ExportAggregateFunctionBindData(unique_ptr<Expression> aggregate_p);
|
@@ -69,6 +33,7 @@ struct ExportAggregateFunction {
|
|
69
33
|
static unique_ptr<BoundAggregateExpression> Bind(unique_ptr<BoundAggregateExpression> child_aggregate);
|
70
34
|
static ScalarFunction GetCombine();
|
71
35
|
static ScalarFunction GetFinalize();
|
36
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
72
37
|
};
|
73
38
|
|
74
39
|
} // namespace duckdb
|
@@ -18,9 +18,6 @@
|
|
18
18
|
|
19
19
|
namespace duckdb {
|
20
20
|
|
21
|
-
enum class MapInvalidReason : uint8_t { VALID, NULL_KEY_LIST, NULL_KEY, DUPLICATE_KEY };
|
22
|
-
enum class UnionInvalidReason : uint8_t { VALID, TAG_OUT_OF_RANGE, NO_MEMBERS, VALIDITY_OVERLAP };
|
23
|
-
|
24
21
|
struct ListArgFunctor {
|
25
22
|
static Vector &GetList(Vector &list) {
|
26
23
|
return list;
|
@@ -33,22 +30,6 @@ struct ListArgFunctor {
|
|
33
30
|
}
|
34
31
|
};
|
35
32
|
|
36
|
-
struct MapKeyArgFunctor {
|
37
|
-
// MAP is a LIST(STRUCT(K,V))
|
38
|
-
// meaning the MAP itself is a List, but the child vector that we're interested in (the keys)
|
39
|
-
// are a level deeper than the initial child vector
|
40
|
-
|
41
|
-
static Vector &GetList(Vector &map) {
|
42
|
-
return map;
|
43
|
-
}
|
44
|
-
static idx_t GetListSize(Vector &map) {
|
45
|
-
return ListVector::GetListSize(map);
|
46
|
-
}
|
47
|
-
static Vector &GetEntry(Vector &map) {
|
48
|
-
return MapVector::GetKeys(map);
|
49
|
-
}
|
50
|
-
};
|
51
|
-
|
52
33
|
struct ContainsFunctor {
|
53
34
|
static inline bool Initialize() {
|
54
35
|
return false;
|
@@ -99,76 +80,10 @@ struct HistogramAggState {
|
|
99
80
|
MAP_TYPE *hist;
|
100
81
|
};
|
101
82
|
|
102
|
-
struct ArraySliceFun {
|
103
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
104
|
-
};
|
105
|
-
|
106
|
-
struct StructPackFun {
|
107
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
108
|
-
};
|
109
|
-
|
110
|
-
struct StructInsertFun {
|
111
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
112
|
-
};
|
113
|
-
|
114
|
-
struct ListValueFun {
|
115
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
116
|
-
};
|
117
|
-
|
118
|
-
struct ListRangeFun {
|
119
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
120
|
-
};
|
121
|
-
|
122
|
-
struct MapFun {
|
123
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
124
|
-
};
|
125
|
-
|
126
|
-
struct MapFromEntriesFun {
|
127
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
128
|
-
};
|
129
|
-
|
130
|
-
struct MapEntriesFun {
|
131
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
132
|
-
};
|
133
|
-
|
134
|
-
struct MapValuesFun {
|
135
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
136
|
-
};
|
137
|
-
|
138
|
-
struct MapKeysFun {
|
139
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
140
|
-
};
|
141
|
-
|
142
|
-
struct MapExtractFun {
|
143
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
144
|
-
};
|
145
|
-
|
146
|
-
struct UnionValueFun {
|
147
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
148
|
-
};
|
149
|
-
|
150
|
-
struct UnionExtractFun {
|
151
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
152
|
-
};
|
153
|
-
|
154
|
-
struct UnionTagFun {
|
155
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
156
|
-
};
|
157
|
-
|
158
83
|
struct ListExtractFun {
|
159
84
|
static void RegisterFunction(BuiltinFunctions &set);
|
160
85
|
};
|
161
86
|
|
162
|
-
struct ListTransformFun {
|
163
|
-
static ScalarFunction GetFunction();
|
164
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
165
|
-
};
|
166
|
-
|
167
|
-
struct ListFilterFun {
|
168
|
-
static ScalarFunction GetFunction();
|
169
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
170
|
-
};
|
171
|
-
|
172
87
|
struct ListConcatFun {
|
173
88
|
static ScalarFunction GetFunction();
|
174
89
|
static void RegisterFunction(BuiltinFunctions &set);
|
@@ -179,49 +94,14 @@ struct ListContainsFun {
|
|
179
94
|
static void RegisterFunction(BuiltinFunctions &set);
|
180
95
|
};
|
181
96
|
|
182
|
-
struct ListFlattenFun {
|
183
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
184
|
-
};
|
185
|
-
|
186
97
|
struct ListPositionFun {
|
187
98
|
static ScalarFunction GetFunction();
|
188
99
|
static void RegisterFunction(BuiltinFunctions &set);
|
189
100
|
};
|
190
101
|
|
191
|
-
struct ListAggregateFun {
|
192
|
-
static ScalarFunction GetFunction();
|
193
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
194
|
-
};
|
195
|
-
|
196
|
-
struct ListDistinctFun {
|
197
|
-
static ScalarFunction GetFunction();
|
198
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
199
|
-
};
|
200
|
-
|
201
|
-
struct ListUniqueFun {
|
202
|
-
static ScalarFunction GetFunction();
|
203
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
204
|
-
};
|
205
|
-
|
206
|
-
struct ListSortFun {
|
207
|
-
static ScalarFunction GetFunction();
|
208
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
209
|
-
};
|
210
|
-
|
211
|
-
struct CardinalityFun {
|
212
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
213
|
-
};
|
214
|
-
|
215
102
|
struct StructExtractFun {
|
216
103
|
static ScalarFunction GetFunction();
|
217
104
|
static void RegisterFunction(BuiltinFunctions &set);
|
218
105
|
};
|
219
106
|
|
220
|
-
MapInvalidReason CheckMapValidity(Vector &map, idx_t count,
|
221
|
-
const SelectionVector &sel = *FlatVector::IncrementalSelectionVector());
|
222
|
-
void MapConversionVerify(Vector &vector, idx_t count);
|
223
|
-
|
224
|
-
UnionInvalidReason CheckUnionValidity(Vector &vector, idx_t count,
|
225
|
-
const SelectionVector &sel = *FlatVector::IncrementalSelectionVector());
|
226
|
-
|
227
107
|
} // namespace duckdb
|
@@ -38,28 +38,4 @@ struct ModFun {
|
|
38
38
|
static void RegisterFunction(BuiltinFunctions &set);
|
39
39
|
};
|
40
40
|
|
41
|
-
struct LeftShiftFun {
|
42
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
43
|
-
};
|
44
|
-
|
45
|
-
struct RightShiftFun {
|
46
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
47
|
-
};
|
48
|
-
|
49
|
-
struct BitwiseAndFun {
|
50
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
51
|
-
};
|
52
|
-
|
53
|
-
struct BitwiseOrFun {
|
54
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
55
|
-
};
|
56
|
-
|
57
|
-
struct BitwiseXorFun {
|
58
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
59
|
-
};
|
60
|
-
|
61
|
-
struct BitwiseNotFun {
|
62
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
63
|
-
};
|
64
|
-
|
65
41
|
} // namespace duckdb
|
@@ -18,10 +18,6 @@ class RE2;
|
|
18
18
|
|
19
19
|
namespace duckdb {
|
20
20
|
|
21
|
-
struct ReverseFun {
|
22
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
23
|
-
};
|
24
|
-
|
25
21
|
struct LowerFun {
|
26
22
|
static uint8_t ascii_to_lower_map[];
|
27
23
|
|
@@ -96,75 +92,27 @@ struct LikeEscapeFun {
|
|
96
92
|
static void RegisterFunction(BuiltinFunctions &set);
|
97
93
|
};
|
98
94
|
|
99
|
-
struct LpadFun {
|
100
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
101
|
-
};
|
102
|
-
|
103
|
-
struct LeftFun {
|
104
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
105
|
-
};
|
106
|
-
|
107
|
-
struct MD5Fun {
|
108
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
109
|
-
};
|
110
|
-
|
111
95
|
struct NFCNormalizeFun {
|
112
96
|
static ScalarFunction GetFunction();
|
113
97
|
static void RegisterFunction(BuiltinFunctions &set);
|
114
98
|
};
|
115
99
|
|
116
|
-
struct RightFun {
|
117
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
118
|
-
};
|
119
|
-
|
120
|
-
struct RegexpFun {
|
121
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
122
|
-
};
|
123
|
-
|
124
100
|
struct SubstringFun {
|
125
101
|
static void RegisterFunction(BuiltinFunctions &set);
|
126
102
|
static string_t SubstringUnicode(Vector &result, string_t input, int64_t offset, int64_t length);
|
127
103
|
static string_t SubstringGrapheme(Vector &result, string_t input, int64_t offset, int64_t length);
|
128
104
|
};
|
129
105
|
|
130
|
-
struct PrintfFun {
|
131
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
132
|
-
};
|
133
|
-
|
134
|
-
struct InstrFun {
|
135
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
136
|
-
};
|
137
|
-
|
138
106
|
struct PrefixFun {
|
139
107
|
static ScalarFunction GetFunction();
|
140
108
|
static void RegisterFunction(BuiltinFunctions &set);
|
141
109
|
};
|
142
110
|
|
143
|
-
struct RepeatFun {
|
144
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
145
|
-
};
|
146
|
-
|
147
|
-
struct ReplaceFun {
|
148
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
149
|
-
};
|
150
|
-
|
151
|
-
struct TranslateFun {
|
152
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
153
|
-
};
|
154
|
-
|
155
|
-
struct RpadFun {
|
156
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
157
|
-
};
|
158
|
-
|
159
111
|
struct SuffixFun {
|
160
112
|
static ScalarFunction GetFunction();
|
161
113
|
static void RegisterFunction(BuiltinFunctions &set);
|
162
114
|
};
|
163
115
|
|
164
|
-
struct TrimFun {
|
165
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
166
|
-
};
|
167
|
-
|
168
116
|
struct ContainsFun {
|
169
117
|
static ScalarFunction GetFunction();
|
170
118
|
static void RegisterFunction(BuiltinFunctions &set);
|
@@ -173,51 +121,7 @@ struct ContainsFun {
|
|
173
121
|
idx_t needle_size);
|
174
122
|
};
|
175
123
|
|
176
|
-
struct
|
177
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
178
|
-
};
|
179
|
-
|
180
|
-
struct UnicodeFun {
|
181
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
182
|
-
};
|
183
|
-
|
184
|
-
struct StringSplitFun {
|
185
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
186
|
-
};
|
187
|
-
|
188
|
-
struct BarFun {
|
189
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
190
|
-
};
|
191
|
-
|
192
|
-
struct ASCII {
|
193
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
194
|
-
};
|
195
|
-
|
196
|
-
struct CHR {
|
197
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
198
|
-
};
|
199
|
-
|
200
|
-
struct MismatchesFun {
|
201
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
202
|
-
};
|
203
|
-
|
204
|
-
struct LevenshteinFun {
|
205
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
206
|
-
};
|
207
|
-
|
208
|
-
struct DamerauLevenshteinFun {
|
209
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
210
|
-
};
|
211
|
-
|
212
|
-
struct JaccardFun {
|
213
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
214
|
-
};
|
215
|
-
|
216
|
-
struct JaroWinklerFun {
|
217
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
218
|
-
};
|
219
|
-
|
220
|
-
struct HexFun {
|
124
|
+
struct RegexpFun {
|
221
125
|
static void RegisterFunction(BuiltinFunctions &set);
|
222
126
|
};
|
223
127
|
|
@@ -29,6 +29,10 @@ struct RepeatTableFunction {
|
|
29
29
|
static void RegisterFunction(BuiltinFunctions &set);
|
30
30
|
};
|
31
31
|
|
32
|
+
struct RepeatRowTableFunction {
|
33
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
34
|
+
};
|
35
|
+
|
32
36
|
struct UnnestTableFunction {
|
33
37
|
static void RegisterFunction(BuiltinFunctions &set);
|
34
38
|
};
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/function/table_function.hpp"
|
12
|
-
#include "duckdb/function/scalar/
|
12
|
+
#include "duckdb/function/scalar/strftime_format.hpp"
|
13
13
|
#include "duckdb/execution/operator/persistent/csv_reader_options.hpp"
|
14
14
|
#include "duckdb/execution/operator/persistent/buffered_csv_reader.hpp"
|
15
15
|
#include "duckdb/execution/operator/persistent/parallel_csv_reader.hpp"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/main/extension_util.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/common/constants.hpp"
|
12
|
+
#include "duckdb/function/cast/cast_function_set.hpp"
|
13
|
+
#include "duckdb/function/function_set.hpp"
|
14
|
+
|
15
|
+
namespace duckdb {
|
16
|
+
struct CreateMacroInfo;
|
17
|
+
class DatabaseInstance;
|
18
|
+
|
19
|
+
//! The ExtensionUtil class contains methods that are useful for extensions
|
20
|
+
class ExtensionUtil {
|
21
|
+
public:
|
22
|
+
//! Register a new scalar function - throw an exception if the function already exists
|
23
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, ScalarFunction function);
|
24
|
+
//! Register a new scalar function set - throw an exception if the function already exists
|
25
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, ScalarFunctionSet function);
|
26
|
+
//! Register a new table function - throw an exception if the function already exists
|
27
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, TableFunction function);
|
28
|
+
//! Register a new table function set - throw an exception if the function already exists
|
29
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, TableFunctionSet function);
|
30
|
+
//! Register a new pragma function - throw an exception if the function already exists
|
31
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, PragmaFunction function);
|
32
|
+
//! Register a new pragma function set - throw an exception if the function already exists
|
33
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, PragmaFunctionSet function);
|
34
|
+
//! Register a new copy function - throw an exception if the function already exists
|
35
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, CopyFunction function);
|
36
|
+
//! Register a new macro function - throw an exception if the function already exists
|
37
|
+
DUCKDB_API static void RegisterFunction(DatabaseInstance &db, CreateMacroInfo &info);
|
38
|
+
|
39
|
+
//! Registers a new type
|
40
|
+
DUCKDB_API static void RegisterType(DatabaseInstance &db, string type_name, LogicalType type);
|
41
|
+
|
42
|
+
//! Registers a cast between two types
|
43
|
+
DUCKDB_API static void RegisterCastFunction(DatabaseInstance &db, const LogicalType &source,
|
44
|
+
const LogicalType &target, BoundCastInfo function,
|
45
|
+
int64_t implicit_cast_cost = -1);
|
46
|
+
};
|
47
|
+
|
48
|
+
} // namespace duckdb
|
@@ -22,6 +22,12 @@ struct CreateFunctionInfo : public CreateInfo {
|
|
22
22
|
|
23
23
|
//! Function name
|
24
24
|
string name;
|
25
|
+
//! The description (if any)
|
26
|
+
string description;
|
27
|
+
//! Parameter names (if any)
|
28
|
+
vector<string> parameter_names;
|
29
|
+
//! The example (if any)
|
30
|
+
string example;
|
25
31
|
|
26
32
|
protected:
|
27
33
|
void SerializeInternal(Serializer &serializer) const override {
|
@@ -109,6 +109,7 @@ static DefaultExtension internal_extensions[] = {
|
|
109
109
|
{"sqlite_scanner", "Adds support for reading SQLite database files", false},
|
110
110
|
{"postgres_scanner", "Adds support for reading from a Postgres database", false},
|
111
111
|
{"inet", "Adds support for IP-related data types and functions", false},
|
112
|
+
{"spatial", "Geospatial extension that adds support for working with spatial data and functions", false},
|
112
113
|
{nullptr, nullptr, false}};
|
113
114
|
|
114
115
|
idx_t ExtensionHelper::DefaultExtensionCount() {
|
@@ -4,6 +4,10 @@
|
|
4
4
|
#include "duckdb/main/error_manager.hpp"
|
5
5
|
#include "mbedtls_wrapper.hpp"
|
6
6
|
|
7
|
+
#ifndef DUCKDB_NO_THREADS
|
8
|
+
#include <thread>
|
9
|
+
#endif // DUCKDB_NO_THREADS
|
10
|
+
|
7
11
|
#ifdef WASM_LOADABLE_EXTENSIONS
|
8
12
|
#include <emscripten.h>
|
9
13
|
#endif
|
@@ -26,6 +30,16 @@ static T LoadFunctionFromDLL(void *dll, const string &function_name, const strin
|
|
26
30
|
return (T)function;
|
27
31
|
}
|
28
32
|
|
33
|
+
void ComputeSHA256(FileHandle *handle, const idx_t start, const idx_t end, std::string *res) {
|
34
|
+
const idx_t len = end - start;
|
35
|
+
string file_content;
|
36
|
+
file_content.resize(len);
|
37
|
+
handle->Read((void *)file_content.data(), len, start);
|
38
|
+
|
39
|
+
// Invoke MbedTls function to actually compute sha256
|
40
|
+
*res = duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(file_content);
|
41
|
+
}
|
42
|
+
|
29
43
|
bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileOpener *opener, const string &extension,
|
30
44
|
ExtensionInitResult &result, string &error) {
|
31
45
|
if (!config.options.enable_external_access) {
|
@@ -70,15 +84,45 @@ bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileOpener *opener, const
|
|
70
84
|
|
71
85
|
auto signature_offset = handle->GetFileSize() - signature.size();
|
72
86
|
|
87
|
+
const idx_t maxLenChunks = 1024 * 1024;
|
88
|
+
const idx_t numChunks = (signature_offset + maxLenChunks - 1) / maxLenChunks;
|
89
|
+
std::vector<std::string> chunks(numChunks);
|
90
|
+
std::vector<idx_t> splits(numChunks + 1);
|
91
|
+
|
92
|
+
splits.back() = signature_offset;
|
93
|
+
for (idx_t i = 0; i < chunks.size(); i++) {
|
94
|
+
splits[i] = maxLenChunks * i;
|
95
|
+
}
|
96
|
+
|
97
|
+
#ifndef DUCKDB_NO_THREADS
|
98
|
+
std::vector<std::thread> threads;
|
99
|
+
threads.reserve(numChunks);
|
100
|
+
for (idx_t i = 0; i < numChunks; i++) {
|
101
|
+
threads.emplace_back(ComputeSHA256, handle.get(), splits[i], splits[i + 1], &chunks[i]);
|
102
|
+
}
|
103
|
+
|
104
|
+
for (auto &thread : threads) {
|
105
|
+
thread.join();
|
106
|
+
}
|
107
|
+
#else
|
108
|
+
for (idx_t i = 0; i < numChunks; i++) {
|
109
|
+
ComputeSHA256(handle.get(), splits[i], splits[i + 1], &chunks[i]);
|
110
|
+
}
|
111
|
+
#endif // DUCKDB_NO_THREADS
|
112
|
+
|
73
113
|
string file_content;
|
74
|
-
file_content.
|
75
|
-
|
114
|
+
file_content.reserve(256 * numChunks);
|
115
|
+
|
116
|
+
for (auto &chunk : chunks) {
|
117
|
+
file_content += chunk;
|
118
|
+
}
|
119
|
+
|
120
|
+
string hash;
|
121
|
+
ComputeSHA256(handle.get(), 0, file_content.size(), &hash);
|
76
122
|
|
77
123
|
// TODO maybe we should do a stream read / hash update here
|
78
124
|
handle->Read((void *)signature.data(), signature.size(), signature_offset);
|
79
125
|
|
80
|
-
auto hash = duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(file_content);
|
81
|
-
|
82
126
|
bool any_valid = false;
|
83
127
|
for (auto &key : ExtensionHelper::GetPublicKeys()) {
|
84
128
|
if (duckdb_mbedtls::MbedTlsWrapper::IsValidSha256Signature(key, signature, hash)) {
|
@@ -0,0 +1,90 @@
|
|
1
|
+
#include "duckdb/main/extension_util.hpp"
|
2
|
+
#include "duckdb/function/scalar_function.hpp"
|
3
|
+
#include "duckdb/parser/parsed_data/create_type_info.hpp"
|
4
|
+
#include "duckdb/parser/parsed_data/create_copy_function_info.hpp"
|
5
|
+
#include "duckdb/parser/parsed_data/create_pragma_function_info.hpp"
|
6
|
+
#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"
|
7
|
+
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
|
8
|
+
#include "duckdb/parser/parsed_data/create_macro_info.hpp"
|
9
|
+
#include "duckdb/catalog/catalog.hpp"
|
10
|
+
#include "duckdb/main/config.hpp"
|
11
|
+
|
12
|
+
namespace duckdb {
|
13
|
+
|
14
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, ScalarFunctionSet set) {
|
15
|
+
D_ASSERT(!set.name.empty());
|
16
|
+
CreateScalarFunctionInfo info(std::move(set));
|
17
|
+
auto &system_catalog = Catalog::GetSystemCatalog(db);
|
18
|
+
auto data = CatalogTransaction::GetSystemTransaction(db);
|
19
|
+
system_catalog.CreateFunction(data, info);
|
20
|
+
}
|
21
|
+
|
22
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, ScalarFunction function) {
|
23
|
+
D_ASSERT(!function.name.empty());
|
24
|
+
ScalarFunctionSet set(function.name);
|
25
|
+
set.AddFunction(std::move(function));
|
26
|
+
RegisterFunction(db, std::move(set));
|
27
|
+
}
|
28
|
+
|
29
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, TableFunction function) {
|
30
|
+
D_ASSERT(!function.name.empty());
|
31
|
+
TableFunctionSet set(function.name);
|
32
|
+
set.AddFunction(std::move(function));
|
33
|
+
RegisterFunction(db, std::move(set));
|
34
|
+
}
|
35
|
+
|
36
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, TableFunctionSet function) {
|
37
|
+
D_ASSERT(!function.name.empty());
|
38
|
+
CreateTableFunctionInfo info(std::move(function));
|
39
|
+
auto &system_catalog = Catalog::GetSystemCatalog(db);
|
40
|
+
auto data = CatalogTransaction::GetSystemTransaction(db);
|
41
|
+
system_catalog.CreateFunction(data, info);
|
42
|
+
}
|
43
|
+
|
44
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, PragmaFunction function) {
|
45
|
+
D_ASSERT(!function.name.empty());
|
46
|
+
PragmaFunctionSet set(function.name);
|
47
|
+
set.AddFunction(std::move(function));
|
48
|
+
RegisterFunction(db, std::move(set));
|
49
|
+
}
|
50
|
+
|
51
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, PragmaFunctionSet function) {
|
52
|
+
D_ASSERT(!function.name.empty());
|
53
|
+
auto function_name = function.name;
|
54
|
+
CreatePragmaFunctionInfo info(std::move(function_name), std::move(function));
|
55
|
+
auto &system_catalog = Catalog::GetSystemCatalog(db);
|
56
|
+
auto data = CatalogTransaction::GetSystemTransaction(db);
|
57
|
+
system_catalog.CreatePragmaFunction(data, info);
|
58
|
+
}
|
59
|
+
|
60
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, CopyFunction function) {
|
61
|
+
CreateCopyFunctionInfo info(std::move(function));
|
62
|
+
auto &system_catalog = Catalog::GetSystemCatalog(db);
|
63
|
+
auto data = CatalogTransaction::GetSystemTransaction(db);
|
64
|
+
system_catalog.CreateCopyFunction(data, info);
|
65
|
+
}
|
66
|
+
|
67
|
+
void ExtensionUtil::RegisterFunction(DatabaseInstance &db, CreateMacroInfo &info) {
|
68
|
+
auto &system_catalog = Catalog::GetSystemCatalog(db);
|
69
|
+
auto data = CatalogTransaction::GetSystemTransaction(db);
|
70
|
+
system_catalog.CreateFunction(data, info);
|
71
|
+
}
|
72
|
+
|
73
|
+
void ExtensionUtil::RegisterType(DatabaseInstance &db, string type_name, LogicalType type) {
|
74
|
+
D_ASSERT(!type_name.empty());
|
75
|
+
CreateTypeInfo info(std::move(type_name), std::move(type));
|
76
|
+
info.temporary = true;
|
77
|
+
info.internal = true;
|
78
|
+
auto &system_catalog = Catalog::GetSystemCatalog(db);
|
79
|
+
auto data = CatalogTransaction::GetSystemTransaction(db);
|
80
|
+
system_catalog.CreateType(data, info);
|
81
|
+
}
|
82
|
+
|
83
|
+
void ExtensionUtil::RegisterCastFunction(DatabaseInstance &db, const LogicalType &source, const LogicalType &target,
|
84
|
+
BoundCastInfo function, int64_t implicit_cast_cost) {
|
85
|
+
auto &config = DBConfig::GetConfig(db);
|
86
|
+
auto &casts = config.GetCastFunctions();
|
87
|
+
casts.RegisterCastFunction(source, target, std::move(function), implicit_cast_cost);
|
88
|
+
}
|
89
|
+
|
90
|
+
} // namespace duckdb
|