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
@@ -0,0 +1,251 @@
|
|
1
|
+
#include "duckdb/function/scalar/strftime_format.hpp"
|
2
|
+
|
3
|
+
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
4
|
+
#include "duckdb/execution/expression_executor.hpp"
|
5
|
+
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
6
|
+
#include "duckdb/planner/expression/bound_parameter_expression.hpp"
|
7
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
8
|
+
|
9
|
+
#include <cctype>
|
10
|
+
#include <utility>
|
11
|
+
|
12
|
+
namespace duckdb {
|
13
|
+
|
14
|
+
struct StrfTimeBindData : public FunctionData {
|
15
|
+
explicit StrfTimeBindData(StrfTimeFormat format_p, string format_string_p, bool is_null)
|
16
|
+
: format(std::move(format_p)), format_string(std::move(format_string_p)), is_null(is_null) {
|
17
|
+
}
|
18
|
+
|
19
|
+
StrfTimeFormat format;
|
20
|
+
string format_string;
|
21
|
+
bool is_null;
|
22
|
+
|
23
|
+
unique_ptr<FunctionData> Copy() const override {
|
24
|
+
return make_uniq<StrfTimeBindData>(format, format_string, is_null);
|
25
|
+
}
|
26
|
+
|
27
|
+
bool Equals(const FunctionData &other_p) const override {
|
28
|
+
auto &other = (const StrfTimeBindData &)other_p;
|
29
|
+
return format_string == other.format_string;
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
33
|
+
template <bool REVERSED>
|
34
|
+
static unique_ptr<FunctionData> StrfTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
|
35
|
+
vector<unique_ptr<Expression>> &arguments) {
|
36
|
+
auto format_idx = REVERSED ? 0 : 1;
|
37
|
+
auto &format_arg = arguments[format_idx];
|
38
|
+
if (format_arg->HasParameter()) {
|
39
|
+
throw ParameterNotResolvedException();
|
40
|
+
}
|
41
|
+
if (!format_arg->IsFoldable()) {
|
42
|
+
throw InvalidInputException("strftime format must be a constant");
|
43
|
+
}
|
44
|
+
Value options_str = ExpressionExecutor::EvaluateScalar(context, *format_arg);
|
45
|
+
auto format_string = options_str.GetValue<string>();
|
46
|
+
StrfTimeFormat format;
|
47
|
+
bool is_null = options_str.IsNull();
|
48
|
+
if (!is_null) {
|
49
|
+
string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
|
50
|
+
if (!error.empty()) {
|
51
|
+
throw InvalidInputException("Failed to parse format specifier %s: %s", format_string, error);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return make_uniq<StrfTimeBindData>(format, format_string, is_null);
|
55
|
+
}
|
56
|
+
|
57
|
+
template <bool REVERSED>
|
58
|
+
static void StrfTimeFunctionDate(DataChunk &args, ExpressionState &state, Vector &result) {
|
59
|
+
auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
|
60
|
+
auto &info = func_expr.bind_info->Cast<StrfTimeBindData>();
|
61
|
+
|
62
|
+
if (info.is_null) {
|
63
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
64
|
+
ConstantVector::SetNull(result, true);
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
info.format.ConvertDateVector(args.data[REVERSED ? 1 : 0], result, args.size());
|
68
|
+
}
|
69
|
+
|
70
|
+
template <bool REVERSED>
|
71
|
+
static void StrfTimeFunctionTimestamp(DataChunk &args, ExpressionState &state, Vector &result) {
|
72
|
+
auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
|
73
|
+
auto &info = func_expr.bind_info->Cast<StrfTimeBindData>();
|
74
|
+
|
75
|
+
if (info.is_null) {
|
76
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
77
|
+
ConstantVector::SetNull(result, true);
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
info.format.ConvertTimestampVector(args.data[REVERSED ? 1 : 0], result, args.size());
|
81
|
+
}
|
82
|
+
|
83
|
+
ScalarFunctionSet StrfTimeFun::GetFunctions() {
|
84
|
+
ScalarFunctionSet strftime;
|
85
|
+
|
86
|
+
strftime.AddFunction(ScalarFunction({LogicalType::DATE, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
87
|
+
StrfTimeFunctionDate<false>, StrfTimeBindFunction<false>));
|
88
|
+
strftime.AddFunction(ScalarFunction({LogicalType::TIMESTAMP, LogicalType::VARCHAR}, LogicalType::VARCHAR,
|
89
|
+
StrfTimeFunctionTimestamp<false>, StrfTimeBindFunction<false>));
|
90
|
+
strftime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::VARCHAR,
|
91
|
+
StrfTimeFunctionDate<true>, StrfTimeBindFunction<true>));
|
92
|
+
strftime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::VARCHAR,
|
93
|
+
StrfTimeFunctionTimestamp<true>, StrfTimeBindFunction<true>));
|
94
|
+
return strftime;
|
95
|
+
}
|
96
|
+
|
97
|
+
struct StrpTimeBindData : public FunctionData {
|
98
|
+
StrpTimeBindData(const StrpTimeFormat &format, const string &format_string)
|
99
|
+
: formats(1, format), format_strings(1, format_string) {
|
100
|
+
}
|
101
|
+
|
102
|
+
StrpTimeBindData(vector<StrpTimeFormat> formats_p, vector<string> format_strings_p)
|
103
|
+
: formats(std::move(formats_p)), format_strings(std::move(format_strings_p)) {
|
104
|
+
}
|
105
|
+
|
106
|
+
vector<StrpTimeFormat> formats;
|
107
|
+
vector<string> format_strings;
|
108
|
+
|
109
|
+
unique_ptr<FunctionData> Copy() const override {
|
110
|
+
return make_uniq<StrpTimeBindData>(formats, format_strings);
|
111
|
+
}
|
112
|
+
|
113
|
+
bool Equals(const FunctionData &other_p) const override {
|
114
|
+
auto &other = (const StrpTimeBindData &)other_p;
|
115
|
+
return format_strings == other.format_strings;
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
static unique_ptr<FunctionData> StrpTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
|
120
|
+
vector<unique_ptr<Expression>> &arguments) {
|
121
|
+
if (arguments[1]->HasParameter()) {
|
122
|
+
throw ParameterNotResolvedException();
|
123
|
+
}
|
124
|
+
if (!arguments[1]->IsFoldable()) {
|
125
|
+
throw InvalidInputException("strptime format must be a constant");
|
126
|
+
}
|
127
|
+
Value format_value = ExpressionExecutor::EvaluateScalar(context, *arguments[1]);
|
128
|
+
string format_string;
|
129
|
+
StrpTimeFormat format;
|
130
|
+
if (format_value.IsNull()) {
|
131
|
+
return make_uniq<StrpTimeBindData>(format, format_string);
|
132
|
+
} else if (format_value.type().id() == LogicalTypeId::VARCHAR) {
|
133
|
+
format_string = format_value.ToString();
|
134
|
+
format.format_specifier = format_string;
|
135
|
+
string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
|
136
|
+
if (!error.empty()) {
|
137
|
+
throw InvalidInputException("Failed to parse format specifier %s: %s", format_string, error);
|
138
|
+
}
|
139
|
+
if (format.HasFormatSpecifier(StrTimeSpecifier::UTC_OFFSET)) {
|
140
|
+
bound_function.return_type = LogicalType::TIMESTAMP_TZ;
|
141
|
+
}
|
142
|
+
return make_uniq<StrpTimeBindData>(format, format_string);
|
143
|
+
} else if (format_value.type() == LogicalType::LIST(LogicalType::VARCHAR)) {
|
144
|
+
const auto &children = ListValue::GetChildren(format_value);
|
145
|
+
if (children.empty()) {
|
146
|
+
throw InvalidInputException("strptime format list must not be empty");
|
147
|
+
}
|
148
|
+
vector<string> format_strings;
|
149
|
+
vector<StrpTimeFormat> formats;
|
150
|
+
for (const auto &child : children) {
|
151
|
+
format_string = child.ToString();
|
152
|
+
format.format_specifier = format_string;
|
153
|
+
string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
|
154
|
+
if (!error.empty()) {
|
155
|
+
throw InvalidInputException("Failed to parse format specifier %s: %s", format_string, error);
|
156
|
+
}
|
157
|
+
// If any format has UTC offsets, then we have to produce TSTZ
|
158
|
+
if (format.HasFormatSpecifier(StrTimeSpecifier::UTC_OFFSET)) {
|
159
|
+
bound_function.return_type = LogicalType::TIMESTAMP_TZ;
|
160
|
+
}
|
161
|
+
format_strings.emplace_back(format_string);
|
162
|
+
formats.emplace_back(format);
|
163
|
+
}
|
164
|
+
return make_uniq<StrpTimeBindData>(formats, format_strings);
|
165
|
+
} else {
|
166
|
+
throw InvalidInputException("strptime format must be a string");
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
struct StrpTimeFunction {
|
171
|
+
|
172
|
+
static void Parse(DataChunk &args, ExpressionState &state, Vector &result) {
|
173
|
+
auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
|
174
|
+
auto &info = func_expr.bind_info->Cast<StrpTimeBindData>();
|
175
|
+
|
176
|
+
if (ConstantVector::IsNull(args.data[1])) {
|
177
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
178
|
+
ConstantVector::SetNull(result, true);
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
UnaryExecutor::Execute<string_t, timestamp_t>(args.data[0], result, args.size(), [&](string_t input) {
|
182
|
+
StrpTimeFormat::ParseResult result;
|
183
|
+
for (auto &format : info.formats) {
|
184
|
+
if (format.Parse(input, result)) {
|
185
|
+
return result.ToTimestamp();
|
186
|
+
}
|
187
|
+
}
|
188
|
+
throw InvalidInputException(result.FormatError(input, info.formats[0].format_specifier));
|
189
|
+
});
|
190
|
+
}
|
191
|
+
|
192
|
+
static void TryParse(DataChunk &args, ExpressionState &state, Vector &result) {
|
193
|
+
auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
|
194
|
+
auto &info = func_expr.bind_info->Cast<StrpTimeBindData>();
|
195
|
+
|
196
|
+
if (ConstantVector::IsNull(args.data[1])) {
|
197
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
198
|
+
ConstantVector::SetNull(result, true);
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
|
202
|
+
UnaryExecutor::ExecuteWithNulls<string_t, timestamp_t>(
|
203
|
+
args.data[0], result, args.size(), [&](string_t input, ValidityMask &mask, idx_t idx) {
|
204
|
+
timestamp_t result;
|
205
|
+
string error;
|
206
|
+
for (auto &format : info.formats) {
|
207
|
+
if (format.TryParseTimestamp(input, result, error)) {
|
208
|
+
return result;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
mask.SetInvalid(idx);
|
213
|
+
return timestamp_t();
|
214
|
+
});
|
215
|
+
}
|
216
|
+
};
|
217
|
+
|
218
|
+
ScalarFunctionSet StrpTimeFun::GetFunctions() {
|
219
|
+
ScalarFunctionSet strptime;
|
220
|
+
|
221
|
+
const auto list_type = LogicalType::LIST(LogicalType::VARCHAR);
|
222
|
+
auto fun = ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::TIMESTAMP,
|
223
|
+
StrpTimeFunction::Parse, StrpTimeBindFunction);
|
224
|
+
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
225
|
+
strptime.AddFunction(fun);
|
226
|
+
|
227
|
+
fun = ScalarFunction({LogicalType::VARCHAR, list_type}, LogicalType::TIMESTAMP, StrpTimeFunction::Parse,
|
228
|
+
StrpTimeBindFunction);
|
229
|
+
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
230
|
+
strptime.AddFunction(fun);
|
231
|
+
return strptime;
|
232
|
+
}
|
233
|
+
|
234
|
+
ScalarFunctionSet TryStrpTimeFun::GetFunctions() {
|
235
|
+
ScalarFunctionSet try_strptime;
|
236
|
+
|
237
|
+
const auto list_type = LogicalType::LIST(LogicalType::VARCHAR);
|
238
|
+
auto fun = ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::TIMESTAMP,
|
239
|
+
StrpTimeFunction::TryParse, StrpTimeBindFunction);
|
240
|
+
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
241
|
+
try_strptime.AddFunction(fun);
|
242
|
+
|
243
|
+
fun = ScalarFunction({LogicalType::VARCHAR, list_type}, LogicalType::TIMESTAMP, StrpTimeFunction::TryParse,
|
244
|
+
StrpTimeBindFunction);
|
245
|
+
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
246
|
+
try_strptime.AddFunction(fun);
|
247
|
+
|
248
|
+
return try_strptime;
|
249
|
+
}
|
250
|
+
|
251
|
+
} // namespace duckdb
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#include "duckdb/common/vector_operations/binary_executor.hpp"
|
10
10
|
#include "duckdb/common/vector_operations/ternary_executor.hpp"
|
11
11
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
12
|
-
#include "duckdb/
|
12
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
13
13
|
|
14
14
|
namespace duckdb {
|
15
15
|
|
@@ -350,8 +350,8 @@ static void TimeBucketOriginFunction(DataChunk &args, ExpressionState &state, Ve
|
|
350
350
|
}
|
351
351
|
}
|
352
352
|
|
353
|
-
|
354
|
-
ScalarFunctionSet time_bucket
|
353
|
+
ScalarFunctionSet TimeBucketFun::GetFunctions() {
|
354
|
+
ScalarFunctionSet time_bucket;
|
355
355
|
time_bucket.AddFunction(
|
356
356
|
ScalarFunction({LogicalType::INTERVAL, LogicalType::DATE}, LogicalType::DATE, TimeBucketFunction<date_t>));
|
357
357
|
time_bucket.AddFunction(ScalarFunction({LogicalType::INTERVAL, LogicalType::TIMESTAMP}, LogicalType::TIMESTAMP,
|
@@ -364,8 +364,7 @@ void TimeBucketFun::RegisterFunction(BuiltinFunctions &set) {
|
|
364
364
|
LogicalType::DATE, TimeBucketOriginFunction<date_t>));
|
365
365
|
time_bucket.AddFunction(ScalarFunction({LogicalType::INTERVAL, LogicalType::TIMESTAMP, LogicalType::TIMESTAMP},
|
366
366
|
LogicalType::TIMESTAMP, TimeBucketOriginFunction<timestamp_t>));
|
367
|
-
|
368
|
-
set.AddFunction(time_bucket);
|
367
|
+
return time_bucket;
|
369
368
|
}
|
370
369
|
|
371
370
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
2
2
|
#include "duckdb/common/types/interval.hpp"
|
3
3
|
#include "duckdb/common/operator/multiply.hpp"
|
4
4
|
|
@@ -107,24 +107,44 @@ struct ToMicroSecondsOperator {
|
|
107
107
|
}
|
108
108
|
};
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
110
|
+
ScalarFunction ToYearsFun::GetFunction() {
|
111
|
+
return ScalarFunction({LogicalType::INTEGER}, LogicalType::INTERVAL,
|
112
|
+
ScalarFunction::UnaryFunction<int32_t, interval_t, ToYearsOperator>);
|
113
|
+
}
|
114
|
+
|
115
|
+
ScalarFunction ToMonthsFun::GetFunction() {
|
116
|
+
return ScalarFunction({LogicalType::INTEGER}, LogicalType::INTERVAL,
|
117
|
+
ScalarFunction::UnaryFunction<int32_t, interval_t, ToMonthsOperator>);
|
118
|
+
}
|
119
|
+
|
120
|
+
ScalarFunction ToDaysFun::GetFunction() {
|
121
|
+
return ScalarFunction({LogicalType::INTEGER}, LogicalType::INTERVAL,
|
122
|
+
ScalarFunction::UnaryFunction<int32_t, interval_t, ToDaysOperator>);
|
123
|
+
}
|
124
|
+
|
125
|
+
ScalarFunction ToHoursFun::GetFunction() {
|
126
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::INTERVAL,
|
127
|
+
ScalarFunction::UnaryFunction<int64_t, interval_t, ToHoursOperator>);
|
128
|
+
}
|
129
|
+
|
130
|
+
ScalarFunction ToMinutesFun::GetFunction() {
|
131
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::INTERVAL,
|
132
|
+
ScalarFunction::UnaryFunction<int64_t, interval_t, ToMinutesOperator>);
|
133
|
+
}
|
134
|
+
|
135
|
+
ScalarFunction ToSecondsFun::GetFunction() {
|
136
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::INTERVAL,
|
137
|
+
ScalarFunction::UnaryFunction<int64_t, interval_t, ToSecondsOperator>);
|
138
|
+
}
|
139
|
+
|
140
|
+
ScalarFunction ToMillisecondsFun::GetFunction() {
|
141
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::INTERVAL,
|
142
|
+
ScalarFunction::UnaryFunction<int64_t, interval_t, ToMilliSecondsOperator>);
|
143
|
+
}
|
144
|
+
|
145
|
+
ScalarFunction ToMicrosecondsFun::GetFunction() {
|
146
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::INTERVAL,
|
147
|
+
ScalarFunction::UnaryFunction<int64_t, interval_t, ToMicroSecondsOperator>);
|
128
148
|
}
|
129
149
|
|
130
150
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/enum_functions.hpp"
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
@@ -130,40 +130,36 @@ unique_ptr<FunctionData> BindEnumRangeBoundaryFunction(ClientContext &context, S
|
|
130
130
|
return nullptr;
|
131
131
|
}
|
132
132
|
|
133
|
-
|
134
|
-
auto fun =
|
135
|
-
ScalarFunction("enum_first", {LogicalType::ANY}, LogicalType::VARCHAR, EnumFirstFunction, BindEnumFunction);
|
133
|
+
ScalarFunction EnumFirstFun::GetFunction() {
|
134
|
+
auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::VARCHAR, EnumFirstFunction, BindEnumFunction);
|
136
135
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
137
|
-
|
136
|
+
return fun;
|
138
137
|
}
|
139
138
|
|
140
|
-
|
141
|
-
auto fun =
|
142
|
-
ScalarFunction("enum_last", {LogicalType::ANY}, LogicalType::VARCHAR, EnumLastFunction, BindEnumFunction);
|
139
|
+
ScalarFunction EnumLastFun::GetFunction() {
|
140
|
+
auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::VARCHAR, EnumLastFunction, BindEnumFunction);
|
143
141
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
144
|
-
|
142
|
+
return fun;
|
145
143
|
}
|
146
144
|
|
147
|
-
|
148
|
-
auto fun =
|
149
|
-
ScalarFunction("enum_code", {LogicalType::ANY}, LogicalType::ANY, EnumCodeFunction, BindEnumCodeFunction);
|
145
|
+
ScalarFunction EnumCodeFun::GetFunction() {
|
146
|
+
auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::ANY, EnumCodeFunction, BindEnumCodeFunction);
|
150
147
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
151
|
-
|
148
|
+
return fun;
|
152
149
|
}
|
153
150
|
|
154
|
-
|
155
|
-
auto fun = ScalarFunction(
|
156
|
-
|
151
|
+
ScalarFunction EnumRangeFun::GetFunction() {
|
152
|
+
auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::LIST(LogicalType::VARCHAR), EnumRangeFunction,
|
153
|
+
BindEnumFunction);
|
157
154
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
158
|
-
|
155
|
+
return fun;
|
159
156
|
}
|
160
157
|
|
161
|
-
|
162
|
-
auto fun = ScalarFunction(
|
163
|
-
|
164
|
-
BindEnumRangeBoundaryFunction);
|
158
|
+
ScalarFunction EnumRangeBoundaryFun::GetFunction() {
|
159
|
+
auto fun = ScalarFunction({LogicalType::ANY, LogicalType::ANY}, LogicalType::LIST(LogicalType::VARCHAR),
|
160
|
+
EnumRangeBoundaryFunction, BindEnumRangeBoundaryFunction);
|
165
161
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
166
|
-
|
162
|
+
return fun;
|
167
163
|
}
|
168
164
|
|
169
165
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
2
2
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
3
3
|
|
4
4
|
namespace duckdb {
|
@@ -9,10 +9,10 @@ static void AliasFunction(DataChunk &args, ExpressionState &state, Vector &resul
|
|
9
9
|
result.Reference(v);
|
10
10
|
}
|
11
11
|
|
12
|
-
|
13
|
-
auto fun = ScalarFunction(
|
12
|
+
ScalarFunction AliasFun::GetFunction() {
|
13
|
+
auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::VARCHAR, AliasFunction);
|
14
14
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
15
|
-
|
15
|
+
return fun;
|
16
16
|
}
|
17
17
|
|
18
18
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/main/database.hpp"
|
4
4
|
#include "duckdb/main/client_context.hpp"
|
@@ -58,11 +58,10 @@ unique_ptr<FunctionData> CurrentSettingBind(ClientContext &context, ScalarFuncti
|
|
58
58
|
return make_uniq<CurrentSettingBindData>(val);
|
59
59
|
}
|
60
60
|
|
61
|
-
|
62
|
-
auto fun = ScalarFunction(
|
63
|
-
CurrentSettingBind);
|
61
|
+
ScalarFunction CurrentSettingFun::GetFunction() {
|
62
|
+
auto fun = ScalarFunction({LogicalType::VARCHAR}, LogicalType::ANY, CurrentSettingFunction, CurrentSettingBind);
|
64
63
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
65
|
-
|
64
|
+
return fun;
|
66
65
|
}
|
67
66
|
|
68
67
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
2
2
|
#include <iostream>
|
3
3
|
|
4
4
|
namespace duckdb {
|
@@ -10,12 +10,12 @@ struct ErrorOperator {
|
|
10
10
|
}
|
11
11
|
};
|
12
12
|
|
13
|
-
|
14
|
-
auto fun = ScalarFunction(
|
13
|
+
ScalarFunction ErrorFun::GetFunction() {
|
14
|
+
auto fun = ScalarFunction({LogicalType::VARCHAR}, LogicalType::BOOLEAN,
|
15
15
|
ScalarFunction::UnaryFunction<string_t, bool, ErrorOperator>);
|
16
16
|
// Set the function with side effects to avoid the optimization.
|
17
17
|
fun.side_effects = FunctionSideEffects::HAS_SIDE_EFFECTS;
|
18
|
-
|
18
|
+
return fun;
|
19
19
|
}
|
20
20
|
|
21
21
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
@@ -6,11 +6,11 @@ static void HashFunction(DataChunk &args, ExpressionState &state, Vector &result
|
|
6
6
|
args.Hash(result);
|
7
7
|
}
|
8
8
|
|
9
|
-
|
10
|
-
auto hash_fun = ScalarFunction(
|
9
|
+
ScalarFunction HashFun::GetFunction() {
|
10
|
+
auto hash_fun = ScalarFunction({LogicalType::ANY}, LogicalType::HASH, HashFunction);
|
11
11
|
hash_fun.varargs = LogicalType::ANY;
|
12
12
|
hash_fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
13
|
-
|
13
|
+
return hash_fun;
|
14
14
|
}
|
15
15
|
|
16
16
|
} // namespace duckdb
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#include "duckdb/common/operator/comparison_operators.hpp"
|
2
|
-
#include "duckdb/
|
2
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
3
3
|
|
4
4
|
namespace duckdb {
|
5
5
|
|
@@ -101,8 +101,8 @@ ScalarFunction GetLeastGreatestFunction(const LogicalType &type) {
|
|
101
101
|
}
|
102
102
|
|
103
103
|
template <class OP>
|
104
|
-
static
|
105
|
-
ScalarFunctionSet fun_set
|
104
|
+
static ScalarFunctionSet GetLeastGreatestFunctions() {
|
105
|
+
ScalarFunctionSet fun_set;
|
106
106
|
fun_set.AddFunction(ScalarFunction({LogicalType::BIGINT}, LogicalType::BIGINT, LeastGreatestFunction<int64_t, OP>,
|
107
107
|
nullptr, nullptr, nullptr, nullptr, LogicalType::BIGINT,
|
108
108
|
FunctionSideEffects::NO_SIDE_EFFECTS, FunctionNullHandling::SPECIAL_HANDLING));
|
@@ -123,16 +123,15 @@ static void RegisterLeastGreatest(BuiltinFunctions &set, const string &fun_name)
|
|
123
123
|
|
124
124
|
fun_set.AddFunction(GetLeastGreatestFunction<timestamp_t, OP>(LogicalType::TIMESTAMP_TZ));
|
125
125
|
fun_set.AddFunction(GetLeastGreatestFunction<time_t, OP>(LogicalType::TIME_TZ));
|
126
|
-
|
127
|
-
set.AddFunction(fun_set);
|
126
|
+
return fun_set;
|
128
127
|
}
|
129
128
|
|
130
|
-
|
131
|
-
|
129
|
+
ScalarFunctionSet LeastFun::GetFunctions() {
|
130
|
+
return GetLeastGreatestFunctions<duckdb::LessThan>();
|
132
131
|
}
|
133
132
|
|
134
|
-
|
135
|
-
|
133
|
+
ScalarFunctionSet GreatestFun::GetFunctions() {
|
134
|
+
return GetLeastGreatestFunctions<duckdb::GreaterThan>();
|
136
135
|
}
|
137
136
|
|
138
137
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
2
2
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
3
3
|
|
4
4
|
namespace duckdb {
|
@@ -43,12 +43,12 @@ static unique_ptr<BaseStatistics> StatsPropagateStats(ClientContext &context, Fu
|
|
43
43
|
return nullptr;
|
44
44
|
}
|
45
45
|
|
46
|
-
|
47
|
-
ScalarFunction stats(
|
46
|
+
ScalarFunction StatsFun::GetFunction() {
|
47
|
+
ScalarFunction stats({LogicalType::ANY}, LogicalType::VARCHAR, StatsFunction, StatsBind, nullptr,
|
48
48
|
StatsPropagateStats);
|
49
49
|
stats.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
50
50
|
stats.side_effects = FunctionSideEffects::HAS_SIDE_EFFECTS;
|
51
|
-
|
51
|
+
return stats;
|
52
52
|
}
|
53
53
|
|
54
54
|
} // namespace duckdb
|
package/src/duckdb/src/{function/scalar/system → core_functions/scalar/generic}/system_functions.cpp
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
#include "duckdb/catalog/catalog_search_path.hpp"
|
2
|
-
#include "duckdb/
|
2
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
3
3
|
#include "duckdb/main/database.hpp"
|
4
4
|
#include "duckdb/main/client_context.hpp"
|
5
5
|
#include "duckdb/main/client_data.hpp"
|
@@ -64,20 +64,31 @@ static void VersionFunction(DataChunk &input, ExpressionState &state, Vector &re
|
|
64
64
|
result.Reference(val);
|
65
65
|
}
|
66
66
|
|
67
|
-
|
67
|
+
ScalarFunction CurrentQueryFun::GetFunction() {
|
68
|
+
ScalarFunction current_query({}, LogicalType::VARCHAR, CurrentQueryFunction);
|
69
|
+
current_query.side_effects = FunctionSideEffects::HAS_SIDE_EFFECTS;
|
70
|
+
return current_query;
|
71
|
+
}
|
72
|
+
|
73
|
+
ScalarFunction CurrentSchemaFun::GetFunction() {
|
74
|
+
return ScalarFunction({}, LogicalType::VARCHAR, CurrentSchemaFunction);
|
75
|
+
}
|
76
|
+
|
77
|
+
ScalarFunction CurrentDatabaseFun::GetFunction() {
|
78
|
+
return ScalarFunction({}, LogicalType::VARCHAR, CurrentDatabaseFunction);
|
79
|
+
}
|
80
|
+
|
81
|
+
ScalarFunction CurrentSchemasFun::GetFunction() {
|
68
82
|
auto varchar_list_type = LogicalType::LIST(LogicalType::VARCHAR);
|
83
|
+
return ScalarFunction({LogicalType::BOOLEAN}, varchar_list_type, CurrentSchemasFunction);
|
84
|
+
}
|
69
85
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
ScalarFunction("current_schemas", {LogicalType::BOOLEAN}, varchar_list_type, CurrentSchemasFunction));
|
77
|
-
set.AddFunction(ScalarFunction("txid_current", {}, LogicalType::BIGINT, TransactionIdCurrent));
|
78
|
-
set.AddFunction(ScalarFunction("version", {}, LogicalType::VARCHAR, VersionFunction));
|
79
|
-
set.AddFunction(ExportAggregateFunction::GetCombine());
|
80
|
-
set.AddFunction(ExportAggregateFunction::GetFinalize());
|
86
|
+
ScalarFunction CurrentTransactionIdFun::GetFunction() {
|
87
|
+
return ScalarFunction({}, LogicalType::BIGINT, TransactionIdCurrent);
|
88
|
+
}
|
89
|
+
|
90
|
+
ScalarFunction VersionFun::GetFunction() {
|
91
|
+
return ScalarFunction({}, LogicalType::VARCHAR, VersionFunction);
|
81
92
|
}
|
82
93
|
|
83
94
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/generic_functions.hpp"
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
@@ -7,10 +7,10 @@ static void TypeOfFunction(DataChunk &args, ExpressionState &state, Vector &resu
|
|
7
7
|
result.Reference(v);
|
8
8
|
}
|
9
9
|
|
10
|
-
|
11
|
-
auto fun = ScalarFunction(
|
10
|
+
ScalarFunction TypeOfFun::GetFunction() {
|
11
|
+
auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::VARCHAR, TypeOfFunction);
|
12
12
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
13
|
-
|
13
|
+
return fun;
|
14
14
|
}
|
15
15
|
|
16
16
|
} // namespace duckdb
|