duckdb 0.7.2-dev2740.0 → 0.7.2-dev2867.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-datepart.cpp +51 -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 +16 -28
- 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/local_file_system.cpp +1 -3
- package/src/duckdb/src/common/multi_file_reader.cpp +11 -8
- 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/schema/physical_create_type.cpp +11 -2
- 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/read_csv.cpp +7 -4
- 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/multi_file_reader.hpp +5 -4
- 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/schema/physical_create_type.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +0 -85
- package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +0 -8
- package/src/duckdb/src/include/duckdb/function/function_set.hpp +7 -2
- package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +1 -36
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +0 -120
- package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +0 -24
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +1 -97
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +0 -2
- 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/include/duckdb/parser/tableref/pivotref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +5 -1
- package/src/duckdb/src/main/attached_database.cpp +5 -3
- package/src/duckdb/src/main/database.cpp +34 -37
- package/src/duckdb/src/main/extension/extension_helper.cpp +1 -0
- package/src/duckdb/src/main/extension/extension_load.cpp +61 -38
- package/src/duckdb/src/main/extension/extension_util.cpp +90 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +1 -4
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -4
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +43 -24
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +17 -28
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +6 -7
- package/src/duckdb/third_party/fmt/format.cc +0 -5
- package/src/duckdb/third_party/fmt/include/fmt/core.h +10 -12
- package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +2 -33
- package/src/duckdb/third_party/fmt/include/fmt/format.h +61 -24
- package/src/duckdb/third_party/fmt/include/fmt/printf.h +15 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +10735 -10674
- package/src/duckdb/ub_src_common_enums.cpp +2 -0
- package/src/duckdb/ub_src_core_functions.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp +8 -0
- package/src/duckdb/ub_src_core_functions_aggregate_distributive.cpp +24 -0
- package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +8 -0
- package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_aggregate_regression.cpp +14 -0
- package/src/duckdb/ub_src_core_functions_scalar_bit.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_date.cpp +22 -0
- package/src/duckdb/ub_src_core_functions_scalar_enum.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +16 -0
- package/src/duckdb/ub_src_core_functions_scalar_list.cpp +14 -0
- package/src/duckdb/ub_src_core_functions_scalar_map.cpp +12 -0
- package/src/duckdb/ub_src_core_functions_scalar_math.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_operators.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_random.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +44 -0
- package/src/duckdb/ub_src_core_functions_scalar_struct.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_union.cpp +6 -0
- package/src/duckdb/ub_src_function_aggregate.cpp +0 -8
- package/src/duckdb/ub_src_function_aggregate_distributive.cpp +0 -24
- package/src/duckdb/ub_src_function_scalar.cpp +2 -8
- package/src/duckdb/ub_src_function_scalar_generic.cpp +0 -14
- package/src/duckdb/ub_src_function_scalar_list.cpp +0 -14
- package/src/duckdb/ub_src_function_scalar_operators.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_string.cpp +0 -42
- package/src/duckdb/ub_src_function_scalar_struct.cpp +0 -4
- package/src/duckdb/ub_src_function_scalar_system.cpp +0 -2
- package/src/duckdb/ub_src_main_extension.cpp +2 -0
- package/src/duckdb/src/function/aggregate/algebraic/corr.cpp +0 -14
- package/src/duckdb/src/function/aggregate/algebraic/covar.cpp +0 -25
- package/src/duckdb/src/function/aggregate/algebraic/stddev.cpp +0 -54
- package/src/duckdb/src/function/aggregate/algebraic_functions.cpp +0 -21
- package/src/duckdb/src/function/aggregate/holistic_functions.cpp +0 -12
- package/src/duckdb/src/function/aggregate/nested_functions.cpp +0 -10
- package/src/duckdb/src/function/aggregate/regression_functions.cpp +0 -21
- package/src/duckdb/src/function/scalar/date_functions.cpp +0 -22
- package/src/duckdb/src/function/scalar/enum_functions.cpp +0 -13
- package/src/duckdb/src/function/scalar/math_functions.cpp +0 -50
- package/src/duckdb/src/function/scalar/trigonometrics_functions.cpp +0 -18
- package/src/duckdb/src/include/duckdb/function/aggregate/algebraic_functions.hpp +0 -56
- package/src/duckdb/src/include/duckdb/function/aggregate/holistic_functions.hpp +0 -33
- package/src/duckdb/src/include/duckdb/function/aggregate/nested_functions.hpp +0 -26
- package/src/duckdb/src/include/duckdb/function/aggregate/regression_functions.hpp +0 -53
- package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +0 -32
- package/src/duckdb/src/include/duckdb/function/scalar/blob_functions.hpp +0 -24
- package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +0 -73
- package/src/duckdb/src/include/duckdb/function/scalar/enum_functions.hpp +0 -37
- package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +0 -137
- package/src/duckdb/src/include/duckdb/function/scalar/trigonometric_functions.hpp +0 -49
- package/src/duckdb/ub_src_function_aggregate_algebraic.cpp +0 -8
- package/src/duckdb/ub_src_function_aggregate_holistic.cpp +0 -8
- package/src/duckdb/ub_src_function_aggregate_nested.cpp +0 -4
- package/src/duckdb/ub_src_function_aggregate_regression.cpp +0 -14
- package/src/duckdb/ub_src_function_scalar_bit.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_blob.cpp +0 -4
- package/src/duckdb/ub_src_function_scalar_date.cpp +0 -22
- package/src/duckdb/ub_src_function_scalar_enum.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_map.cpp +0 -12
- package/src/duckdb/ub_src_function_scalar_math.cpp +0 -6
- package/src/duckdb/ub_src_function_scalar_union.cpp +0 -6
- /package/src/duckdb/src/include/duckdb/function/scalar/{strftime.hpp → strftime_format.hpp} +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
1
2
|
#include "duckdb/common/case_insensitive_map.hpp"
|
2
3
|
#include "duckdb/common/enums/date_part_specifier.hpp"
|
3
4
|
#include "duckdb/common/exception.hpp"
|
@@ -6,7 +7,6 @@
|
|
6
7
|
#include "duckdb/common/types/timestamp.hpp"
|
7
8
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
8
9
|
#include "duckdb/execution/expression_executor.hpp"
|
9
|
-
#include "duckdb/function/scalar/date_functions.hpp"
|
10
10
|
#include "duckdb/function/scalar/nested_functions.hpp"
|
11
11
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
12
12
|
|
@@ -14,82 +14,6 @@
|
|
14
14
|
|
15
15
|
namespace duckdb {
|
16
16
|
|
17
|
-
bool TryGetDatePartSpecifier(const string &specifier_p, DatePartSpecifier &result) {
|
18
|
-
auto specifier = StringUtil::Lower(specifier_p);
|
19
|
-
if (specifier == "year" || specifier == "yr" || specifier == "y" || specifier == "years" || specifier == "yrs") {
|
20
|
-
result = DatePartSpecifier::YEAR;
|
21
|
-
} else if (specifier == "month" || specifier == "mon" || specifier == "months" || specifier == "mons") {
|
22
|
-
result = DatePartSpecifier::MONTH;
|
23
|
-
} else if (specifier == "day" || specifier == "days" || specifier == "d" || specifier == "dayofmonth") {
|
24
|
-
result = DatePartSpecifier::DAY;
|
25
|
-
} else if (specifier == "decade" || specifier == "dec" || specifier == "decades" || specifier == "decs") {
|
26
|
-
result = DatePartSpecifier::DECADE;
|
27
|
-
} else if (specifier == "century" || specifier == "cent" || specifier == "centuries" || specifier == "c") {
|
28
|
-
result = DatePartSpecifier::CENTURY;
|
29
|
-
} else if (specifier == "millennium" || specifier == "mil" || specifier == "millenniums" ||
|
30
|
-
specifier == "millennia" || specifier == "mils" || specifier == "millenium") {
|
31
|
-
result = DatePartSpecifier::MILLENNIUM;
|
32
|
-
} else if (specifier == "microseconds" || specifier == "microsecond" || specifier == "us" || specifier == "usec" ||
|
33
|
-
specifier == "usecs" || specifier == "usecond" || specifier == "useconds") {
|
34
|
-
result = DatePartSpecifier::MICROSECONDS;
|
35
|
-
} else if (specifier == "milliseconds" || specifier == "millisecond" || specifier == "ms" || specifier == "msec" ||
|
36
|
-
specifier == "msecs" || specifier == "msecond" || specifier == "mseconds") {
|
37
|
-
result = DatePartSpecifier::MILLISECONDS;
|
38
|
-
} else if (specifier == "second" || specifier == "sec" || specifier == "seconds" || specifier == "secs" ||
|
39
|
-
specifier == "s") {
|
40
|
-
result = DatePartSpecifier::SECOND;
|
41
|
-
} else if (specifier == "minute" || specifier == "min" || specifier == "minutes" || specifier == "mins" ||
|
42
|
-
specifier == "m") {
|
43
|
-
result = DatePartSpecifier::MINUTE;
|
44
|
-
} else if (specifier == "hour" || specifier == "hr" || specifier == "hours" || specifier == "hrs" ||
|
45
|
-
specifier == "h") {
|
46
|
-
result = DatePartSpecifier::HOUR;
|
47
|
-
} else if (specifier == "epoch") {
|
48
|
-
// seconds since 1970-01-01
|
49
|
-
result = DatePartSpecifier::EPOCH;
|
50
|
-
} else if (specifier == "dow" || specifier == "dayofweek" || specifier == "weekday") {
|
51
|
-
// day of the week (Sunday = 0, Saturday = 6)
|
52
|
-
result = DatePartSpecifier::DOW;
|
53
|
-
} else if (specifier == "isodow") {
|
54
|
-
// isodow (Monday = 1, Sunday = 7)
|
55
|
-
result = DatePartSpecifier::ISODOW;
|
56
|
-
} else if (specifier == "week" || specifier == "weeks" || specifier == "w" || specifier == "weekofyear") {
|
57
|
-
// ISO week number
|
58
|
-
result = DatePartSpecifier::WEEK;
|
59
|
-
} else if (specifier == "doy" || specifier == "dayofyear") {
|
60
|
-
// day of the year (1-365/366)
|
61
|
-
result = DatePartSpecifier::DOY;
|
62
|
-
} else if (specifier == "quarter" || specifier == "quarters") {
|
63
|
-
// quarter of the year (1-4)
|
64
|
-
result = DatePartSpecifier::QUARTER;
|
65
|
-
} else if (specifier == "yearweek") {
|
66
|
-
// Combined isoyear and isoweek YYYYWW
|
67
|
-
result = DatePartSpecifier::YEARWEEK;
|
68
|
-
} else if (specifier == "isoyear") {
|
69
|
-
// ISO year (first week of the year may be in previous year)
|
70
|
-
result = DatePartSpecifier::ISOYEAR;
|
71
|
-
} else if (specifier == "era") {
|
72
|
-
result = DatePartSpecifier::ERA;
|
73
|
-
} else if (specifier == "timezone") {
|
74
|
-
result = DatePartSpecifier::TIMEZONE;
|
75
|
-
} else if (specifier == "timezone_hour") {
|
76
|
-
result = DatePartSpecifier::TIMEZONE_HOUR;
|
77
|
-
} else if (specifier == "timezone_minute") {
|
78
|
-
result = DatePartSpecifier::TIMEZONE_MINUTE;
|
79
|
-
} else {
|
80
|
-
return false;
|
81
|
-
}
|
82
|
-
return true;
|
83
|
-
}
|
84
|
-
|
85
|
-
DatePartSpecifier GetDatePartSpecifier(const string &specifier) {
|
86
|
-
DatePartSpecifier result;
|
87
|
-
if (!TryGetDatePartSpecifier(specifier, result)) {
|
88
|
-
throw ConversionException("extract specifier \"%s\" not recognized", specifier);
|
89
|
-
}
|
90
|
-
return result;
|
91
|
-
}
|
92
|
-
|
93
17
|
DatePartSpecifier GetDateTypePartSpecifier(const string &specifier, LogicalType &type) {
|
94
18
|
const auto part = GetDatePartSpecifier(specifier);
|
95
19
|
switch (type.id()) {
|
@@ -1204,31 +1128,31 @@ static void DatePartFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
1204
1128
|
});
|
1205
1129
|
}
|
1206
1130
|
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
ScalarFunctionSet operator_set
|
1131
|
+
ScalarFunctionSet GetGenericDatePartFunction(scalar_function_t date_func, scalar_function_t ts_func,
|
1132
|
+
scalar_function_t interval_func, function_statistics_t date_stats,
|
1133
|
+
function_statistics_t ts_stats) {
|
1134
|
+
ScalarFunctionSet operator_set;
|
1211
1135
|
operator_set.AddFunction(
|
1212
1136
|
ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, std::move(date_func), nullptr, nullptr, date_stats));
|
1213
1137
|
operator_set.AddFunction(
|
1214
1138
|
ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::BIGINT, std::move(ts_func), nullptr, nullptr, ts_stats));
|
1215
1139
|
operator_set.AddFunction(ScalarFunction({LogicalType::INTERVAL}, LogicalType::BIGINT, std::move(interval_func)));
|
1216
|
-
|
1140
|
+
return operator_set;
|
1217
1141
|
}
|
1218
1142
|
|
1219
1143
|
template <class OP>
|
1220
|
-
static
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
}
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
ScalarFunctionSet operator_set
|
1144
|
+
static ScalarFunctionSet GetDatePartFunction() {
|
1145
|
+
return GetGenericDatePartFunction(
|
1146
|
+
DatePart::UnaryFunction<date_t, int64_t, OP>, DatePart::UnaryFunction<timestamp_t, int64_t, OP>,
|
1147
|
+
ScalarFunction::UnaryFunction<interval_t, int64_t, OP>, OP::template PropagateStatistics<date_t>,
|
1148
|
+
OP::template PropagateStatistics<timestamp_t>);
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
ScalarFunctionSet GetGenericTimePartFunction(scalar_function_t date_func, scalar_function_t ts_func,
|
1152
|
+
scalar_function_t interval_func, scalar_function_t time_func,
|
1153
|
+
function_statistics_t date_stats, function_statistics_t ts_stats,
|
1154
|
+
function_statistics_t time_stats) {
|
1155
|
+
ScalarFunctionSet operator_set;
|
1232
1156
|
operator_set.AddFunction(
|
1233
1157
|
ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, std::move(date_func), nullptr, nullptr, date_stats));
|
1234
1158
|
operator_set.AddFunction(
|
@@ -1236,13 +1160,13 @@ void AddGenericTimePartOperator(BuiltinFunctions &set, const string &name, scala
|
|
1236
1160
|
operator_set.AddFunction(ScalarFunction({LogicalType::INTERVAL}, LogicalType::BIGINT, std::move(interval_func)));
|
1237
1161
|
operator_set.AddFunction(
|
1238
1162
|
ScalarFunction({LogicalType::TIME}, LogicalType::BIGINT, std::move(time_func), nullptr, nullptr, time_stats));
|
1239
|
-
|
1163
|
+
return operator_set;
|
1240
1164
|
}
|
1241
1165
|
|
1242
1166
|
template <class OP>
|
1243
|
-
static
|
1244
|
-
|
1245
|
-
|
1167
|
+
static ScalarFunctionSet GetTimePartFunction() {
|
1168
|
+
return GetGenericTimePartFunction(
|
1169
|
+
DatePart::UnaryFunction<date_t, int64_t, OP>, DatePart::UnaryFunction<timestamp_t, int64_t, OP>,
|
1246
1170
|
ScalarFunction::UnaryFunction<interval_t, int64_t, OP>, ScalarFunction::UnaryFunction<dtime_t, int64_t, OP>,
|
1247
1171
|
OP::template PropagateStatistics<date_t>, OP::template PropagateStatistics<timestamp_t>,
|
1248
1172
|
OP::template PropagateStatistics<dtime_t>);
|
@@ -1470,68 +1394,142 @@ struct StructDatePart {
|
|
1470
1394
|
}
|
1471
1395
|
};
|
1472
1396
|
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1397
|
+
ScalarFunctionSet YearFun::GetFunctions() {
|
1398
|
+
return GetGenericDatePartFunction(LastYearFunction<date_t>, LastYearFunction<timestamp_t>,
|
1399
|
+
ScalarFunction::UnaryFunction<interval_t, int64_t, DatePart::YearOperator>,
|
1400
|
+
DatePart::YearOperator::PropagateStatistics<date_t>,
|
1401
|
+
DatePart::YearOperator::PropagateStatistics<timestamp_t>);
|
1402
|
+
}
|
1403
|
+
|
1404
|
+
ScalarFunctionSet MonthFun::GetFunctions() {
|
1405
|
+
return GetDatePartFunction<DatePart::MonthOperator>();
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
ScalarFunctionSet DayFun::GetFunctions() {
|
1409
|
+
return GetDatePartFunction<DatePart::DayOperator>();
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
ScalarFunctionSet DecadeFun::GetFunctions() {
|
1413
|
+
return GetDatePartFunction<DatePart::DecadeOperator>();
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
ScalarFunctionSet CenturyFun::GetFunctions() {
|
1417
|
+
return GetDatePartFunction<DatePart::CenturyOperator>();
|
1418
|
+
}
|
1419
|
+
|
1420
|
+
ScalarFunctionSet MillenniumFun::GetFunctions() {
|
1421
|
+
return GetDatePartFunction<DatePart::MillenniumOperator>();
|
1422
|
+
}
|
1423
|
+
|
1424
|
+
ScalarFunctionSet QuarterFun::GetFunctions() {
|
1425
|
+
return GetDatePartFunction<DatePart::QuarterOperator>();
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
ScalarFunctionSet DayOfWeekFun::GetFunctions() {
|
1429
|
+
return GetDatePartFunction<DatePart::DayOfWeekOperator>();
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
ScalarFunctionSet ISODayOfWeekFun::GetFunctions() {
|
1433
|
+
return GetDatePartFunction<DatePart::ISODayOfWeekOperator>();
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
ScalarFunctionSet DayOfYearFun::GetFunctions() {
|
1437
|
+
return GetDatePartFunction<DatePart::DayOfYearOperator>();
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
ScalarFunctionSet WeekFun::GetFunctions() {
|
1441
|
+
return GetDatePartFunction<DatePart::WeekOperator>();
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
ScalarFunctionSet ISOYearFun::GetFunctions() {
|
1445
|
+
return GetDatePartFunction<DatePart::ISOYearOperator>();
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
ScalarFunctionSet EraFun::GetFunctions() {
|
1449
|
+
return GetDatePartFunction<DatePart::EraOperator>();
|
1450
|
+
}
|
1451
|
+
|
1452
|
+
ScalarFunctionSet TimezoneFun::GetFunctions() {
|
1453
|
+
return GetDatePartFunction<DatePart::TimezoneOperator>();
|
1454
|
+
}
|
1455
|
+
|
1456
|
+
ScalarFunctionSet TimezoneHourFun::GetFunctions() {
|
1457
|
+
return GetDatePartFunction<DatePart::TimezoneHourOperator>();
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
ScalarFunctionSet TimezoneMinuteFun::GetFunctions() {
|
1461
|
+
return GetDatePartFunction<DatePart::TimezoneMinuteOperator>();
|
1462
|
+
}
|
1463
|
+
|
1464
|
+
ScalarFunctionSet EpochFun::GetFunctions() {
|
1465
|
+
return GetTimePartFunction<DatePart::EpochOperator>();
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
ScalarFunctionSet MicrosecondsFun::GetFunctions() {
|
1469
|
+
return GetTimePartFunction<DatePart::MicrosecondsOperator>();
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
ScalarFunctionSet MillisecondsFun::GetFunctions() {
|
1473
|
+
return GetTimePartFunction<DatePart::MillisecondsOperator>();
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
ScalarFunctionSet SecondsFun::GetFunctions() {
|
1477
|
+
return GetTimePartFunction<DatePart::SecondsOperator>();
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
ScalarFunctionSet MinutesFun::GetFunctions() {
|
1481
|
+
return GetTimePartFunction<DatePart::MinutesOperator>();
|
1482
|
+
}
|
1483
|
+
|
1484
|
+
ScalarFunctionSet HoursFun::GetFunctions() {
|
1485
|
+
return GetTimePartFunction<DatePart::HoursOperator>();
|
1486
|
+
}
|
1487
|
+
|
1488
|
+
ScalarFunctionSet YearWeekFun::GetFunctions() {
|
1489
|
+
return GetDatePartFunction<DatePart::YearWeekOperator>();
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
ScalarFunctionSet DayOfMonthFun::GetFunctions() {
|
1493
|
+
return GetDatePartFunction<DatePart::DayOperator>();
|
1494
|
+
}
|
1495
|
+
|
1496
|
+
ScalarFunctionSet WeekDayFun::GetFunctions() {
|
1497
|
+
return GetDatePartFunction<DatePart::DayOfWeekOperator>();
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
ScalarFunctionSet WeekOfYearFun::GetFunctions() {
|
1501
|
+
return GetDatePartFunction<DatePart::WeekOperator>();
|
1502
|
+
}
|
1503
|
+
|
1504
|
+
ScalarFunctionSet LastDayFun::GetFunctions() {
|
1505
|
+
ScalarFunctionSet last_day;
|
1511
1506
|
last_day.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::DATE,
|
1512
1507
|
DatePart::UnaryFunction<date_t, date_t, LastDayOperator>));
|
1513
1508
|
last_day.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::DATE,
|
1514
1509
|
DatePart::UnaryFunction<timestamp_t, date_t, LastDayOperator>));
|
1515
|
-
|
1510
|
+
return last_day;
|
1511
|
+
}
|
1516
1512
|
|
1517
|
-
|
1518
|
-
ScalarFunctionSet monthname
|
1513
|
+
ScalarFunctionSet MonthNameFun::GetFunctions() {
|
1514
|
+
ScalarFunctionSet monthname;
|
1519
1515
|
monthname.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::VARCHAR,
|
1520
1516
|
DatePart::UnaryFunction<date_t, string_t, MonthNameOperator>));
|
1521
1517
|
monthname.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::VARCHAR,
|
1522
1518
|
DatePart::UnaryFunction<timestamp_t, string_t, MonthNameOperator>));
|
1523
|
-
|
1519
|
+
return monthname;
|
1520
|
+
}
|
1524
1521
|
|
1525
|
-
|
1526
|
-
ScalarFunctionSet dayname
|
1522
|
+
ScalarFunctionSet DayNameFun::GetFunctions() {
|
1523
|
+
ScalarFunctionSet dayname;
|
1527
1524
|
dayname.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::VARCHAR,
|
1528
1525
|
DatePart::UnaryFunction<date_t, string_t, DayNameOperator>));
|
1529
1526
|
dayname.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::VARCHAR,
|
1530
1527
|
DatePart::UnaryFunction<timestamp_t, string_t, DayNameOperator>));
|
1531
|
-
|
1528
|
+
return dayname;
|
1529
|
+
}
|
1532
1530
|
|
1533
|
-
|
1534
|
-
ScalarFunctionSet date_part
|
1531
|
+
ScalarFunctionSet DatePartFun::GetFunctions() {
|
1532
|
+
ScalarFunctionSet date_part;
|
1535
1533
|
date_part.AddFunction(
|
1536
1534
|
ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::BIGINT, DatePartFunction<date_t>));
|
1537
1535
|
date_part.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::BIGINT,
|
@@ -1547,9 +1545,7 @@ void DatePartFun::RegisterFunction(BuiltinFunctions &set) {
|
|
1547
1545
|
date_part.AddFunction(StructDatePart::GetFunction<dtime_t>(LogicalType::TIME));
|
1548
1546
|
date_part.AddFunction(StructDatePart::GetFunction<interval_t>(LogicalType::INTERVAL));
|
1549
1547
|
|
1550
|
-
|
1551
|
-
date_part.name = "datepart";
|
1552
|
-
set.AddFunction(date_part);
|
1548
|
+
return date_part;
|
1553
1549
|
}
|
1554
1550
|
|
1555
1551
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
2
2
|
#include "duckdb/common/enums/date_part_specifier.hpp"
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/operator/subtract.hpp"
|
@@ -438,7 +438,7 @@ static void DateSubFunction(DataChunk &args, ExpressionState &state, Vector &res
|
|
438
438
|
}
|
439
439
|
}
|
440
440
|
|
441
|
-
|
441
|
+
ScalarFunctionSet DateSubFun::GetFunctions() {
|
442
442
|
ScalarFunctionSet date_sub("date_sub");
|
443
443
|
date_sub.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE, LogicalType::DATE},
|
444
444
|
LogicalType::BIGINT, DateSubFunction<date_t>));
|
@@ -446,10 +446,7 @@ void DateSubFun::RegisterFunction(BuiltinFunctions &set) {
|
|
446
446
|
LogicalType::BIGINT, DateSubFunction<timestamp_t>));
|
447
447
|
date_sub.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIME, LogicalType::TIME},
|
448
448
|
LogicalType::BIGINT, DateSubFunction<dtime_t>));
|
449
|
-
|
450
|
-
|
451
|
-
date_sub.name = "datesub";
|
452
|
-
set.AddFunction(date_sub);
|
449
|
+
return date_sub;
|
453
450
|
}
|
454
451
|
|
455
452
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
2
2
|
#include "duckdb/common/enums/date_part_specifier.hpp"
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/operator/cast_operators.hpp"
|
@@ -6,7 +6,6 @@
|
|
6
6
|
#include "duckdb/common/types/time.hpp"
|
7
7
|
#include "duckdb/common/types/timestamp.hpp"
|
8
8
|
#include "duckdb/common/types/value.hpp"
|
9
|
-
#include "duckdb/common/string_util.hpp"
|
10
9
|
#include "duckdb/execution/expression_executor.hpp"
|
11
10
|
|
12
11
|
namespace duckdb {
|
@@ -717,7 +716,7 @@ static unique_ptr<FunctionData> DateTruncBind(ClientContext &context, ScalarFunc
|
|
717
716
|
return nullptr;
|
718
717
|
}
|
719
718
|
|
720
|
-
|
719
|
+
ScalarFunctionSet DateTruncFun::GetFunctions() {
|
721
720
|
ScalarFunctionSet date_trunc("date_trunc");
|
722
721
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::TIMESTAMP,
|
723
722
|
DateTruncFunction<timestamp_t, timestamp_t>, DateTruncBind));
|
@@ -725,9 +724,7 @@ void DateTruncFun::RegisterFunction(BuiltinFunctions &set) {
|
|
725
724
|
DateTruncFunction<date_t, timestamp_t>, DateTruncBind));
|
726
725
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::INTERVAL}, LogicalType::INTERVAL,
|
727
726
|
DateTruncFunction<interval_t, interval_t>));
|
728
|
-
|
729
|
-
date_trunc.name = "datetrunc";
|
730
|
-
set.AddFunction(date_trunc);
|
727
|
+
return date_trunc;
|
731
728
|
}
|
732
729
|
|
733
730
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
2
2
|
#include "duckdb/common/types/time.hpp"
|
3
3
|
#include "duckdb/common/types/date.hpp"
|
4
4
|
#include "duckdb/common/types/timestamp.hpp"
|
@@ -33,14 +33,13 @@ static void EpochMillisFunction(DataChunk &input, ExpressionState &state, Vector
|
|
33
33
|
UnaryExecutor::Execute<int64_t, timestamp_t, EpochMillisOperator>(input.data[0], result, input.size());
|
34
34
|
}
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
ScalarFunction EpochMsFun::GetFunction() {
|
37
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochMillisFunction);
|
38
|
+
}
|
39
|
+
|
40
|
+
ScalarFunction ToTimestampFun::GetFunction() {
|
40
41
|
// to_timestamp is an alias from Postgres that converts the time in seconds to a timestamp
|
41
|
-
|
42
|
-
to_timestamp.AddFunction(ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochSecFunction));
|
43
|
-
set.AddFunction(to_timestamp);
|
42
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochSecFunction);
|
44
43
|
}
|
45
44
|
|
46
45
|
} // namespace duckdb
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/core_functions/scalar/date_functions.hpp"
|
2
2
|
#include "duckdb/common/types/date.hpp"
|
3
3
|
#include "duckdb/common/types/time.hpp"
|
4
4
|
#include "duckdb/common/types/timestamp.hpp"
|
@@ -79,7 +79,7 @@ static void ExecuteMakeTimestamp(DataChunk &input, ExpressionState &state, Vecto
|
|
79
79
|
SenaryExecutor::Execute<T, T, T, T, T, double, timestamp_t>(input, result, func);
|
80
80
|
}
|
81
81
|
|
82
|
-
|
82
|
+
ScalarFunctionSet MakeDateFun::GetFunctions() {
|
83
83
|
ScalarFunctionSet make_date("make_date");
|
84
84
|
make_date.AddFunction(ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT},
|
85
85
|
LogicalType::DATE, ExecuteMakeDate<int64_t>));
|
@@ -88,18 +88,18 @@ void MakeDateFun::RegisterFunction(BuiltinFunctions &set) {
|
|
88
88
|
{"year", LogicalType::BIGINT}, {"month", LogicalType::BIGINT}, {"day", LogicalType::BIGINT}};
|
89
89
|
make_date.AddFunction(
|
90
90
|
ScalarFunction({LogicalType::STRUCT(make_date_children)}, LogicalType::DATE, ExecuteStructMakeDate<int64_t>));
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
91
|
+
return make_date;
|
92
|
+
}
|
93
|
+
|
94
|
+
ScalarFunction MakeTimeFun::GetFunction() {
|
95
|
+
return ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::DOUBLE}, LogicalType::TIME,
|
96
|
+
ExecuteMakeTime<int64_t>);
|
97
|
+
}
|
98
|
+
|
99
|
+
ScalarFunction MakeTimestampFun::GetFunction() {
|
100
|
+
return ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT,
|
101
|
+
LogicalType::BIGINT, LogicalType::DOUBLE},
|
102
|
+
LogicalType::TIMESTAMP, ExecuteMakeTimestamp<int64_t>);
|
103
103
|
}
|
104
104
|
|
105
105
|
} // namespace duckdb
|