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
@@ -46,22 +46,22 @@ TableFunction GetReadJSONObjectsTableFunction(bool list_parameter, shared_ptr<JS
|
|
46
46
|
return table_function;
|
47
47
|
}
|
48
48
|
|
49
|
-
|
49
|
+
TableFunctionSet JSONFunctions::GetReadJSONObjectsFunction() {
|
50
50
|
TableFunctionSet function_set("read_json_objects");
|
51
51
|
auto function_info =
|
52
52
|
make_shared<JSONScanInfo>(JSONScanType::READ_JSON_OBJECTS, JSONFormat::UNSTRUCTURED, JSONRecordType::JSON);
|
53
53
|
function_set.AddFunction(GetReadJSONObjectsTableFunction(false, function_info));
|
54
54
|
function_set.AddFunction(GetReadJSONObjectsTableFunction(true, function_info));
|
55
|
-
return
|
55
|
+
return function_set;
|
56
56
|
}
|
57
57
|
|
58
|
-
|
58
|
+
TableFunctionSet JSONFunctions::GetReadNDJSONObjectsFunction() {
|
59
59
|
TableFunctionSet function_set("read_ndjson_objects");
|
60
60
|
auto function_info =
|
61
61
|
make_shared<JSONScanInfo>(JSONScanType::READ_JSON_OBJECTS, JSONFormat::NEWLINE_DELIMITED, JSONRecordType::JSON);
|
62
62
|
function_set.AddFunction(GetReadJSONObjectsTableFunction(false, function_info));
|
63
63
|
function_set.AddFunction(GetReadJSONObjectsTableFunction(true, function_info));
|
64
|
-
return
|
64
|
+
return function_set;
|
65
65
|
}
|
66
66
|
|
67
67
|
} // namespace duckdb
|
@@ -121,8 +121,8 @@ JSONFunctionLocalState &JSONFunctionLocalState::ResetAndGet(ExpressionState &sta
|
|
121
121
|
return lstate;
|
122
122
|
}
|
123
123
|
|
124
|
-
vector<
|
125
|
-
vector<
|
124
|
+
vector<ScalarFunctionSet> JSONFunctions::GetScalarFunctions() {
|
125
|
+
vector<ScalarFunctionSet> functions;
|
126
126
|
|
127
127
|
// Extract functions
|
128
128
|
AddAliases({"json_extract", "json_extract_path"}, GetExtractFunction(), functions);
|
@@ -153,14 +153,14 @@ vector<CreateScalarFunctionInfo> JSONFunctions::GetScalarFunctions() {
|
|
153
153
|
return functions;
|
154
154
|
}
|
155
155
|
|
156
|
-
vector<
|
157
|
-
vector<
|
156
|
+
vector<PragmaFunctionSet> JSONFunctions::GetPragmaFunctions() {
|
157
|
+
vector<PragmaFunctionSet> functions;
|
158
158
|
functions.push_back(GetExecuteJsonSerializedSqlPragmaFunction());
|
159
159
|
return functions;
|
160
160
|
}
|
161
161
|
|
162
|
-
vector<
|
163
|
-
vector<
|
162
|
+
vector<TableFunctionSet> JSONFunctions::GetTableFunctions() {
|
163
|
+
vector<TableFunctionSet> functions;
|
164
164
|
|
165
165
|
// Reads JSON as string
|
166
166
|
functions.push_back(GetReadJSONObjectsFunction());
|
@@ -34,6 +34,7 @@
|
|
34
34
|
#include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
|
35
35
|
#include "duckdb/common/multi_file_reader.hpp"
|
36
36
|
#include "duckdb/storage/table/row_group.hpp"
|
37
|
+
#include "duckdb/main/extension_util.hpp"
|
37
38
|
#endif
|
38
39
|
|
39
40
|
namespace duckdb {
|
@@ -687,20 +688,23 @@ unique_ptr<TableRef> ParquetScanReplacement(ClientContext &context, const string
|
|
687
688
|
}
|
688
689
|
|
689
690
|
void ParquetExtension::Load(DuckDB &db) {
|
691
|
+
auto &db_instance = *db.instance;
|
690
692
|
auto &fs = db.GetFileSystem();
|
691
693
|
fs.RegisterSubSystem(FileCompressionType::ZSTD, make_uniq<ZStdFileSystem>());
|
692
694
|
|
693
695
|
auto scan_fun = ParquetScanFunction::GetFunctionSet();
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
696
|
+
scan_fun.name = "read_parquet";
|
697
|
+
ExtensionUtil::RegisterFunction(db_instance, scan_fun);
|
698
|
+
scan_fun.name = "parquet_scan";
|
699
|
+
ExtensionUtil::RegisterFunction(db_instance, scan_fun);
|
698
700
|
|
701
|
+
// parquet_metadata
|
699
702
|
ParquetMetaDataFunction meta_fun;
|
700
|
-
|
703
|
+
ExtensionUtil::RegisterFunction(db_instance, MultiFileReader::CreateFunctionSet(meta_fun));
|
701
704
|
|
705
|
+
// parquet_schema
|
702
706
|
ParquetSchemaFunction schema_fun;
|
703
|
-
|
707
|
+
ExtensionUtil::RegisterFunction(db_instance, MultiFileReader::CreateFunctionSet(schema_fun));
|
704
708
|
|
705
709
|
CopyFunction function("parquet");
|
706
710
|
function.copy_to_bind = ParquetWriteBind;
|
@@ -714,24 +718,7 @@ void ParquetExtension::Load(DuckDB &db) {
|
|
714
718
|
function.copy_from_function = scan_fun.functions[0];
|
715
719
|
|
716
720
|
function.extension = "parquet";
|
717
|
-
|
718
|
-
|
719
|
-
Connection con(db);
|
720
|
-
con.BeginTransaction();
|
721
|
-
auto &context = *con.context;
|
722
|
-
auto &catalog = Catalog::GetSystemCatalog(context);
|
723
|
-
|
724
|
-
if (catalog.GetEntry<TableFunctionCatalogEntry>(context, DEFAULT_SCHEMA, "parquet_scan",
|
725
|
-
OnEntryNotFound::RETURN_NULL)) {
|
726
|
-
throw InvalidInputException("Parquet extension is either already loaded or built-in");
|
727
|
-
}
|
728
|
-
|
729
|
-
catalog.CreateCopyFunction(context, info);
|
730
|
-
catalog.CreateTableFunction(context, cinfo);
|
731
|
-
catalog.CreateTableFunction(context, pq_scan);
|
732
|
-
catalog.CreateTableFunction(context, meta_cinfo);
|
733
|
-
catalog.CreateTableFunction(context, schema_cinfo);
|
734
|
-
con.Commit();
|
721
|
+
ExtensionUtil::RegisterFunction(db_instance, function);
|
735
722
|
|
736
723
|
auto &config = DBConfig::GetConfig(*db.instance);
|
737
724
|
config.replacement_scans.emplace_back(ParquetScanReplacement);
|
@@ -55,6 +55,30 @@ string PrintParquetElementToString(T &&entry) {
|
|
55
55
|
return ss.str();
|
56
56
|
}
|
57
57
|
|
58
|
+
template <class T>
|
59
|
+
Value ParquetElementString(T &&value, bool is_set) {
|
60
|
+
if (!is_set) {
|
61
|
+
return Value();
|
62
|
+
}
|
63
|
+
return Value(ConvertParquetElementToString(value));
|
64
|
+
}
|
65
|
+
|
66
|
+
template <class T>
|
67
|
+
Value ParquetElementInteger(T &&value, bool is_iset) {
|
68
|
+
if (!is_iset) {
|
69
|
+
return Value();
|
70
|
+
}
|
71
|
+
return Value::INTEGER(value);
|
72
|
+
}
|
73
|
+
|
74
|
+
template <class T>
|
75
|
+
Value ParquetElementBigint(T &&value, bool is_iset) {
|
76
|
+
if (!is_iset) {
|
77
|
+
return Value();
|
78
|
+
}
|
79
|
+
return Value::BIGINT(value);
|
80
|
+
}
|
81
|
+
|
58
82
|
void ParquetMetaDataOperatorData::BindMetaData(vector<LogicalType> &return_types, vector<string> &names) {
|
59
83
|
names.emplace_back("file_name");
|
60
84
|
return_types.emplace_back(LogicalType::VARCHAR);
|
@@ -186,7 +210,7 @@ void ParquetMetaDataOperatorData::LoadFileMetaData(ClientContext &context, const
|
|
186
210
|
current_chunk.SetValue(5, count, Value::BIGINT(col_idx));
|
187
211
|
|
188
212
|
// file_offset, LogicalType::BIGINT
|
189
|
-
current_chunk.SetValue(6, count,
|
213
|
+
current_chunk.SetValue(6, count, ParquetElementBigint(column.file_offset, row_group.__isset.file_offset));
|
190
214
|
|
191
215
|
// num_values, LogicalType::BIGINT
|
192
216
|
current_chunk.SetValue(7, count, Value::BIGINT(col_meta.num_values));
|
@@ -206,13 +230,10 @@ void ParquetMetaDataOperatorData::LoadFileMetaData(ClientContext &context, const
|
|
206
230
|
ConvertParquetStats(column_type, schema_element, stats.__isset.max, stats.max));
|
207
231
|
|
208
232
|
// stats_null_count, LogicalType::BIGINT
|
209
|
-
current_chunk.SetValue(
|
210
|
-
12, count, stats.__isset.null_count ? Value::BIGINT(stats.null_count) : Value(LogicalType::BIGINT));
|
233
|
+
current_chunk.SetValue(12, count, ParquetElementBigint(stats.null_count, stats.__isset.null_count));
|
211
234
|
|
212
235
|
// stats_distinct_count, LogicalType::BIGINT
|
213
|
-
current_chunk.SetValue(13, count,
|
214
|
-
stats.__isset.distinct_count ? Value::BIGINT(stats.distinct_count)
|
215
|
-
: Value(LogicalType::BIGINT));
|
236
|
+
current_chunk.SetValue(13, count, ParquetElementBigint(stats.distinct_count, stats.__isset.distinct_count));
|
216
237
|
|
217
238
|
// stats_min_value, LogicalType::VARCHAR
|
218
239
|
current_chunk.SetValue(
|
@@ -234,10 +255,13 @@ void ParquetMetaDataOperatorData::LoadFileMetaData(ClientContext &context, const
|
|
234
255
|
current_chunk.SetValue(17, count, Value(StringUtil::Join(encoding_string, ", ")));
|
235
256
|
|
236
257
|
// index_page_offset, LogicalType::BIGINT
|
237
|
-
current_chunk.SetValue(
|
258
|
+
current_chunk.SetValue(
|
259
|
+
18, count, ParquetElementBigint(col_meta.index_page_offset, col_meta.__isset.index_page_offset));
|
238
260
|
|
239
261
|
// dictionary_page_offset, LogicalType::BIGINT
|
240
|
-
current_chunk.SetValue(
|
262
|
+
current_chunk.SetValue(
|
263
|
+
19, count,
|
264
|
+
ParquetElementBigint(col_meta.dictionary_page_offset, col_meta.__isset.dictionary_page_offset));
|
241
265
|
|
242
266
|
// data_page_offset, LogicalType::BIGINT
|
243
267
|
current_chunk.SetValue(20, count, Value::BIGINT(col_meta.data_page_offset));
|
@@ -299,8 +323,10 @@ void ParquetMetaDataOperatorData::BindSchema(vector<LogicalType> &return_types,
|
|
299
323
|
return_types.emplace_back(LogicalType::VARCHAR);
|
300
324
|
}
|
301
325
|
|
302
|
-
Value ParquetLogicalTypeToString(const duckdb_parquet::format::LogicalType &type) {
|
303
|
-
|
326
|
+
Value ParquetLogicalTypeToString(const duckdb_parquet::format::LogicalType &type, bool is_set) {
|
327
|
+
if (!is_set) {
|
328
|
+
return Value();
|
329
|
+
}
|
304
330
|
if (type.__isset.STRING) {
|
305
331
|
return Value(PrintParquetElementToString(type.STRING));
|
306
332
|
}
|
@@ -362,31 +388,31 @@ void ParquetMetaDataOperatorData::LoadSchemaData(ClientContext &context, const v
|
|
362
388
|
current_chunk.SetValue(1, count, column.name);
|
363
389
|
|
364
390
|
// type, LogicalType::VARCHAR
|
365
|
-
current_chunk.SetValue(2, count,
|
391
|
+
current_chunk.SetValue(2, count, ParquetElementString(column.type, column.__isset.type));
|
366
392
|
|
367
|
-
// type_length, LogicalType::
|
368
|
-
current_chunk.SetValue(3, count,
|
393
|
+
// type_length, LogicalType::INTEGER
|
394
|
+
current_chunk.SetValue(3, count, ParquetElementInteger(column.type_length, column.__isset.type_length));
|
369
395
|
|
370
396
|
// repetition_type, LogicalType::VARCHAR
|
371
|
-
current_chunk.SetValue(4, count,
|
397
|
+
current_chunk.SetValue(4, count, ParquetElementString(column.repetition_type, column.__isset.repetition_type));
|
372
398
|
|
373
399
|
// num_children, LogicalType::BIGINT
|
374
|
-
current_chunk.SetValue(5, count,
|
400
|
+
current_chunk.SetValue(5, count, ParquetElementBigint(column.num_children, column.__isset.num_children));
|
375
401
|
|
376
402
|
// converted_type, LogicalType::VARCHAR
|
377
|
-
current_chunk.SetValue(6, count,
|
403
|
+
current_chunk.SetValue(6, count, ParquetElementString(column.converted_type, column.__isset.converted_type));
|
378
404
|
|
379
405
|
// scale, LogicalType::BIGINT
|
380
|
-
current_chunk.SetValue(7, count,
|
406
|
+
current_chunk.SetValue(7, count, ParquetElementBigint(column.scale, column.__isset.scale));
|
381
407
|
|
382
408
|
// precision, LogicalType::BIGINT
|
383
|
-
current_chunk.SetValue(8, count,
|
409
|
+
current_chunk.SetValue(8, count, ParquetElementBigint(column.precision, column.__isset.precision));
|
384
410
|
|
385
411
|
// field_id, LogicalType::BIGINT
|
386
|
-
current_chunk.SetValue(9, count,
|
412
|
+
current_chunk.SetValue(9, count, ParquetElementBigint(column.field_id, column.__isset.field_id));
|
387
413
|
|
388
414
|
// logical_type, LogicalType::VARCHAR
|
389
|
-
current_chunk.SetValue(10, count, ParquetLogicalTypeToString(column.logicalType));
|
415
|
+
current_chunk.SetValue(10, count, ParquetLogicalTypeToString(column.logicalType, column.__isset.logicalType));
|
390
416
|
|
391
417
|
count++;
|
392
418
|
if (count >= STANDARD_VECTOR_SIZE) {
|
@@ -5,8 +5,7 @@ namespace duckdb {
|
|
5
5
|
|
6
6
|
PragmaFunctionCatalogEntry::PragmaFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema,
|
7
7
|
CreatePragmaFunctionInfo &info)
|
8
|
-
:
|
9
|
-
functions(std::move(info.functions)) {
|
8
|
+
: FunctionEntry(CatalogType::PRAGMA_FUNCTION_ENTRY, catalog, schema, info), functions(std::move(info.functions)) {
|
10
9
|
}
|
11
10
|
|
12
11
|
} // namespace duckdb
|
@@ -5,7 +5,7 @@ namespace duckdb {
|
|
5
5
|
|
6
6
|
ScalarFunctionCatalogEntry::ScalarFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema,
|
7
7
|
CreateScalarFunctionInfo &info)
|
8
|
-
:
|
8
|
+
: FunctionEntry(CatalogType::SCALAR_FUNCTION_ENTRY, catalog, schema, info), functions(info.functions) {
|
9
9
|
}
|
10
10
|
|
11
11
|
unique_ptr<CatalogEntry> ScalarFunctionCatalogEntry::AlterEntry(ClientContext &context, AlterInfo &info) {
|
@@ -7,9 +7,9 @@
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
9
|
MacroCatalogEntry::MacroCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateMacroInfo &info)
|
10
|
-
:
|
10
|
+
: FunctionEntry(
|
11
11
|
(info.function->type == MacroType::SCALAR_MACRO ? CatalogType::MACRO_ENTRY : CatalogType::TABLE_MACRO_ENTRY),
|
12
|
-
|
12
|
+
catalog, schema, info),
|
13
13
|
function(std::move(info.function)) {
|
14
14
|
this->temporary = info.temporary;
|
15
15
|
this->internal = info.internal;
|
@@ -5,8 +5,7 @@ namespace duckdb {
|
|
5
5
|
|
6
6
|
TableFunctionCatalogEntry::TableFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema,
|
7
7
|
CreateTableFunctionInfo &info)
|
8
|
-
:
|
9
|
-
functions(std::move(info.functions)) {
|
8
|
+
: FunctionEntry(CatalogType::TABLE_FUNCTION_ENTRY, catalog, schema, info), functions(std::move(info.functions)) {
|
10
9
|
D_ASSERT(this->functions.Size() > 0);
|
11
10
|
}
|
12
11
|
|
@@ -7,6 +7,9 @@
|
|
7
7
|
#include "duckdb/catalog/default/default_schemas.hpp"
|
8
8
|
#include "duckdb/function/built_in_functions.hpp"
|
9
9
|
#include "duckdb/main/attached_database.hpp"
|
10
|
+
#ifndef DISABLE_CORE_FUNCTIONS_EXTENSION
|
11
|
+
#include "duckdb/core_functions/core_functions.hpp"
|
12
|
+
#endif
|
10
13
|
|
11
14
|
namespace duckdb {
|
12
15
|
|
@@ -22,7 +25,7 @@ void DuckCatalog::Initialize(bool load_builtin) {
|
|
22
25
|
// first initialize the base system catalogs
|
23
26
|
// these are never written to the WAL
|
24
27
|
// we start these at 1 because deleted entries default to 0
|
25
|
-
|
28
|
+
auto data = CatalogTransaction::GetSystemTransaction(GetDatabase());
|
26
29
|
|
27
30
|
// create the default schema
|
28
31
|
CreateSchemaInfo info;
|
@@ -34,6 +37,10 @@ void DuckCatalog::Initialize(bool load_builtin) {
|
|
34
37
|
// initialize default functions
|
35
38
|
BuiltinFunctions builtin(data, *this);
|
36
39
|
builtin.Initialize();
|
40
|
+
|
41
|
+
#ifndef DISABLE_CORE_FUNCTIONS_EXTENSION
|
42
|
+
CoreFunctions::RegisterFunctions(*this, data);
|
43
|
+
#endif
|
37
44
|
}
|
38
45
|
|
39
46
|
Verify();
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#include "duckdb/common/enums/date_part_specifier.hpp"
|
2
|
+
#include "duckdb/common/string_util.hpp"
|
3
|
+
|
4
|
+
namespace duckdb {
|
5
|
+
|
6
|
+
bool TryGetDatePartSpecifier(const string &specifier_p, DatePartSpecifier &result) {
|
7
|
+
auto specifier = StringUtil::Lower(specifier_p);
|
8
|
+
if (specifier == "year" || specifier == "yr" || specifier == "y" || specifier == "years" || specifier == "yrs") {
|
9
|
+
result = DatePartSpecifier::YEAR;
|
10
|
+
} else if (specifier == "month" || specifier == "mon" || specifier == "months" || specifier == "mons") {
|
11
|
+
result = DatePartSpecifier::MONTH;
|
12
|
+
} else if (specifier == "day" || specifier == "days" || specifier == "d" || specifier == "dayofmonth") {
|
13
|
+
result = DatePartSpecifier::DAY;
|
14
|
+
} else if (specifier == "decade" || specifier == "dec" || specifier == "decades" || specifier == "decs") {
|
15
|
+
result = DatePartSpecifier::DECADE;
|
16
|
+
} else if (specifier == "century" || specifier == "cent" || specifier == "centuries" || specifier == "c") {
|
17
|
+
result = DatePartSpecifier::CENTURY;
|
18
|
+
} else if (specifier == "millennium" || specifier == "mil" || specifier == "millenniums" ||
|
19
|
+
specifier == "millennia" || specifier == "mils" || specifier == "millenium") {
|
20
|
+
result = DatePartSpecifier::MILLENNIUM;
|
21
|
+
} else if (specifier == "microseconds" || specifier == "microsecond" || specifier == "us" || specifier == "usec" ||
|
22
|
+
specifier == "usecs" || specifier == "usecond" || specifier == "useconds") {
|
23
|
+
result = DatePartSpecifier::MICROSECONDS;
|
24
|
+
} else if (specifier == "milliseconds" || specifier == "millisecond" || specifier == "ms" || specifier == "msec" ||
|
25
|
+
specifier == "msecs" || specifier == "msecond" || specifier == "mseconds") {
|
26
|
+
result = DatePartSpecifier::MILLISECONDS;
|
27
|
+
} else if (specifier == "second" || specifier == "sec" || specifier == "seconds" || specifier == "secs" ||
|
28
|
+
specifier == "s") {
|
29
|
+
result = DatePartSpecifier::SECOND;
|
30
|
+
} else if (specifier == "minute" || specifier == "min" || specifier == "minutes" || specifier == "mins" ||
|
31
|
+
specifier == "m") {
|
32
|
+
result = DatePartSpecifier::MINUTE;
|
33
|
+
} else if (specifier == "hour" || specifier == "hr" || specifier == "hours" || specifier == "hrs" ||
|
34
|
+
specifier == "h") {
|
35
|
+
result = DatePartSpecifier::HOUR;
|
36
|
+
} else if (specifier == "epoch") {
|
37
|
+
// seconds since 1970-01-01
|
38
|
+
result = DatePartSpecifier::EPOCH;
|
39
|
+
} else if (specifier == "dow" || specifier == "dayofweek" || specifier == "weekday") {
|
40
|
+
// day of the week (Sunday = 0, Saturday = 6)
|
41
|
+
result = DatePartSpecifier::DOW;
|
42
|
+
} else if (specifier == "isodow") {
|
43
|
+
// isodow (Monday = 1, Sunday = 7)
|
44
|
+
result = DatePartSpecifier::ISODOW;
|
45
|
+
} else if (specifier == "week" || specifier == "weeks" || specifier == "w" || specifier == "weekofyear") {
|
46
|
+
// ISO week number
|
47
|
+
result = DatePartSpecifier::WEEK;
|
48
|
+
} else if (specifier == "doy" || specifier == "dayofyear") {
|
49
|
+
// day of the year (1-365/366)
|
50
|
+
result = DatePartSpecifier::DOY;
|
51
|
+
} else if (specifier == "quarter" || specifier == "quarters") {
|
52
|
+
// quarter of the year (1-4)
|
53
|
+
result = DatePartSpecifier::QUARTER;
|
54
|
+
} else if (specifier == "yearweek") {
|
55
|
+
// Combined isoyear and isoweek YYYYWW
|
56
|
+
result = DatePartSpecifier::YEARWEEK;
|
57
|
+
} else if (specifier == "isoyear") {
|
58
|
+
// ISO year (first week of the year may be in previous year)
|
59
|
+
result = DatePartSpecifier::ISOYEAR;
|
60
|
+
} else if (specifier == "era") {
|
61
|
+
result = DatePartSpecifier::ERA;
|
62
|
+
} else if (specifier == "timezone") {
|
63
|
+
result = DatePartSpecifier::TIMEZONE;
|
64
|
+
} else if (specifier == "timezone_hour") {
|
65
|
+
result = DatePartSpecifier::TIMEZONE_HOUR;
|
66
|
+
} else if (specifier == "timezone_minute") {
|
67
|
+
result = DatePartSpecifier::TIMEZONE_MINUTE;
|
68
|
+
} else {
|
69
|
+
return false;
|
70
|
+
}
|
71
|
+
return true;
|
72
|
+
}
|
73
|
+
|
74
|
+
DatePartSpecifier GetDatePartSpecifier(const string &specifier) {
|
75
|
+
DatePartSpecifier result;
|
76
|
+
if (!TryGetDatePartSpecifier(specifier, result)) {
|
77
|
+
throw ConversionException("extract specifier \"%s\" not recognized", specifier);
|
78
|
+
}
|
79
|
+
return result;
|
80
|
+
}
|
81
|
+
|
82
|
+
} // namespace duckdb
|
@@ -18,6 +18,7 @@
|
|
18
18
|
#include "duckdb/common/fsst.hpp"
|
19
19
|
#include "fsst.h"
|
20
20
|
#include "duckdb/common/types/bit.hpp"
|
21
|
+
#include "duckdb/common/types/value_map.hpp"
|
21
22
|
|
22
23
|
#include "duckdb/common/serializer/format_serializer.hpp"
|
23
24
|
#include "duckdb/common/serializer/format_deserializer.hpp"
|
@@ -1256,7 +1257,7 @@ void Vector::UTFVerify(idx_t count) {
|
|
1256
1257
|
void Vector::VerifyMap(Vector &vector_p, const SelectionVector &sel_p, idx_t count) {
|
1257
1258
|
#ifdef DEBUG
|
1258
1259
|
D_ASSERT(vector_p.GetType().id() == LogicalTypeId::MAP);
|
1259
|
-
auto valid_check = CheckMapValidity(vector_p, count, sel_p);
|
1260
|
+
auto valid_check = MapVector::CheckMapValidity(vector_p, count, sel_p);
|
1260
1261
|
D_ASSERT(valid_check == MapInvalidReason::VALID);
|
1261
1262
|
#endif // DEBUG
|
1262
1263
|
}
|
@@ -1264,7 +1265,7 @@ void Vector::VerifyMap(Vector &vector_p, const SelectionVector &sel_p, idx_t cou
|
|
1264
1265
|
void Vector::VerifyUnion(Vector &vector_p, const SelectionVector &sel_p, idx_t count) {
|
1265
1266
|
#ifdef DEBUG
|
1266
1267
|
D_ASSERT(vector_p.GetType().id() == LogicalTypeId::UNION);
|
1267
|
-
auto valid_check = CheckUnionValidity(vector_p, count, sel_p);
|
1268
|
+
auto valid_check = UnionVector::CheckUnionValidity(vector_p, count, sel_p);
|
1268
1269
|
D_ASSERT(valid_check == UnionInvalidReason::VALID);
|
1269
1270
|
#endif // DEBUG
|
1270
1271
|
}
|
@@ -1439,6 +1440,9 @@ void Vector::Verify(idx_t count) {
|
|
1439
1440
|
Verify(*this, *flat_sel, count);
|
1440
1441
|
}
|
1441
1442
|
|
1443
|
+
//===--------------------------------------------------------------------===//
|
1444
|
+
// FlatVector
|
1445
|
+
//===--------------------------------------------------------------------===//
|
1442
1446
|
void FlatVector::SetNull(Vector &vector, idx_t idx, bool is_null) {
|
1443
1447
|
D_ASSERT(vector.GetVectorType() == VectorType::FLAT_VECTOR);
|
1444
1448
|
vector.validity.Set(idx, !is_null);
|
@@ -1451,6 +1455,9 @@ void FlatVector::SetNull(Vector &vector, idx_t idx, bool is_null) {
|
|
1451
1455
|
}
|
1452
1456
|
}
|
1453
1457
|
|
1458
|
+
//===--------------------------------------------------------------------===//
|
1459
|
+
// ConstantVector
|
1460
|
+
//===--------------------------------------------------------------------===//
|
1454
1461
|
void ConstantVector::SetNull(Vector &vector, bool is_null) {
|
1455
1462
|
D_ASSERT(vector.GetVectorType() == VectorType::CONSTANT_VECTOR);
|
1456
1463
|
vector.validity.Set(0, !is_null);
|
@@ -1539,6 +1546,9 @@ void ConstantVector::Reference(Vector &vector, Vector &source, idx_t position, i
|
|
1539
1546
|
}
|
1540
1547
|
}
|
1541
1548
|
|
1549
|
+
//===--------------------------------------------------------------------===//
|
1550
|
+
// StringVector
|
1551
|
+
//===--------------------------------------------------------------------===//
|
1542
1552
|
string_t StringVector::AddString(Vector &vector, const char *data, idx_t len) {
|
1543
1553
|
return StringVector::AddString(vector, string_t(data, len));
|
1544
1554
|
}
|
@@ -1629,6 +1639,9 @@ void StringVector::AddHeapReference(Vector &vector, Vector &other) {
|
|
1629
1639
|
StringVector::AddBuffer(vector, other.auxiliary);
|
1630
1640
|
}
|
1631
1641
|
|
1642
|
+
//===--------------------------------------------------------------------===//
|
1643
|
+
// FSSTVector
|
1644
|
+
//===--------------------------------------------------------------------===//
|
1632
1645
|
string_t FSSTVector::AddCompressedString(Vector &vector, const char *data, idx_t len) {
|
1633
1646
|
return FSSTVector::AddCompressedString(vector, string_t(data, len));
|
1634
1647
|
}
|
@@ -1714,6 +1727,9 @@ void FSSTVector::DecompressVector(const Vector &src, Vector &dst, idx_t src_offs
|
|
1714
1727
|
}
|
1715
1728
|
}
|
1716
1729
|
|
1730
|
+
//===--------------------------------------------------------------------===//
|
1731
|
+
// MapVector
|
1732
|
+
//===--------------------------------------------------------------------===//
|
1717
1733
|
Vector &MapVector::GetKeys(Vector &vector) {
|
1718
1734
|
auto &entries = StructVector::GetEntries(ListVector::GetEntry(vector));
|
1719
1735
|
D_ASSERT(entries.size() == 2);
|
@@ -1732,6 +1748,67 @@ const Vector &MapVector::GetValues(const Vector &vector) {
|
|
1732
1748
|
return GetValues((Vector &)vector);
|
1733
1749
|
}
|
1734
1750
|
|
1751
|
+
MapInvalidReason MapVector::CheckMapValidity(Vector &map, idx_t count, const SelectionVector &sel) {
|
1752
|
+
D_ASSERT(map.GetType().id() == LogicalTypeId::MAP);
|
1753
|
+
UnifiedVectorFormat map_vdata;
|
1754
|
+
|
1755
|
+
map.ToUnifiedFormat(count, map_vdata);
|
1756
|
+
auto &map_validity = map_vdata.validity;
|
1757
|
+
|
1758
|
+
auto list_data = ListVector::GetData(map);
|
1759
|
+
auto &keys = MapVector::GetKeys(map);
|
1760
|
+
UnifiedVectorFormat key_vdata;
|
1761
|
+
keys.ToUnifiedFormat(count, key_vdata);
|
1762
|
+
auto &key_validity = key_vdata.validity;
|
1763
|
+
|
1764
|
+
for (idx_t row = 0; row < count; row++) {
|
1765
|
+
auto mapped_row = sel.get_index(row);
|
1766
|
+
auto row_idx = map_vdata.sel->get_index(mapped_row);
|
1767
|
+
// map is allowed to be NULL
|
1768
|
+
if (!map_validity.RowIsValid(row_idx)) {
|
1769
|
+
continue;
|
1770
|
+
}
|
1771
|
+
row_idx = key_vdata.sel->get_index(row);
|
1772
|
+
value_set_t unique_keys;
|
1773
|
+
for (idx_t i = 0; i < list_data[row_idx].length; i++) {
|
1774
|
+
auto index = list_data[row_idx].offset + i;
|
1775
|
+
index = key_vdata.sel->get_index(index);
|
1776
|
+
if (!key_validity.RowIsValid(index)) {
|
1777
|
+
return MapInvalidReason::NULL_KEY;
|
1778
|
+
}
|
1779
|
+
auto value = keys.GetValue(index);
|
1780
|
+
auto result = unique_keys.insert(value);
|
1781
|
+
if (!result.second) {
|
1782
|
+
return MapInvalidReason::DUPLICATE_KEY;
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
return MapInvalidReason::VALID;
|
1787
|
+
}
|
1788
|
+
|
1789
|
+
void MapVector::MapConversionVerify(Vector &vector, idx_t count) {
|
1790
|
+
auto valid_check = MapVector::CheckMapValidity(vector, count);
|
1791
|
+
switch (valid_check) {
|
1792
|
+
case MapInvalidReason::VALID:
|
1793
|
+
break;
|
1794
|
+
case MapInvalidReason::DUPLICATE_KEY: {
|
1795
|
+
throw InvalidInputException("Map keys have to be unique");
|
1796
|
+
}
|
1797
|
+
case MapInvalidReason::NULL_KEY: {
|
1798
|
+
throw InvalidInputException("Map keys can not be NULL");
|
1799
|
+
}
|
1800
|
+
case MapInvalidReason::NULL_KEY_LIST: {
|
1801
|
+
throw InvalidInputException("The list of map keys is not allowed to be NULL");
|
1802
|
+
}
|
1803
|
+
default: {
|
1804
|
+
throw InternalException("MapInvalidReason not implemented");
|
1805
|
+
}
|
1806
|
+
}
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
//===--------------------------------------------------------------------===//
|
1810
|
+
// StructVector
|
1811
|
+
//===--------------------------------------------------------------------===//
|
1735
1812
|
vector<unique_ptr<Vector>> &StructVector::GetEntries(Vector &vector) {
|
1736
1813
|
D_ASSERT(vector.GetType().id() == LogicalTypeId::STRUCT || vector.GetType().id() == LogicalTypeId::UNION);
|
1737
1814
|
|
@@ -1750,6 +1827,9 @@ const vector<unique_ptr<Vector>> &StructVector::GetEntries(const Vector &vector)
|
|
1750
1827
|
return GetEntries((Vector &)vector);
|
1751
1828
|
}
|
1752
1829
|
|
1830
|
+
//===--------------------------------------------------------------------===//
|
1831
|
+
// ListVector
|
1832
|
+
//===--------------------------------------------------------------------===//
|
1753
1833
|
const Vector &ListVector::GetEntry(const Vector &vector) {
|
1754
1834
|
D_ASSERT(vector.GetType().id() == LogicalTypeId::LIST || vector.GetType().id() == LogicalTypeId::MAP);
|
1755
1835
|
if (vector.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
|
@@ -1928,7 +2008,9 @@ void ListVector::GetConsecutiveChildSelVector(Vector &list, SelectionVector &sel
|
|
1928
2008
|
// info.second.offset = 0;
|
1929
2009
|
}
|
1930
2010
|
|
1931
|
-
|
2011
|
+
//===--------------------------------------------------------------------===//
|
2012
|
+
// UnionVector
|
2013
|
+
//===--------------------------------------------------------------------===//
|
1932
2014
|
const Vector &UnionVector::GetMember(const Vector &vector, idx_t member_index) {
|
1933
2015
|
D_ASSERT(member_index < UnionType::GetMemberCount(vector.GetType()));
|
1934
2016
|
auto &entries = StructVector::GetEntries(vector);
|
@@ -2015,4 +2097,55 @@ union_tag_t UnionVector::GetTag(const Vector &vector, idx_t index) {
|
|
2015
2097
|
return FlatVector::GetData<union_tag_t>(tag_vector)[index];
|
2016
2098
|
}
|
2017
2099
|
|
2100
|
+
UnionInvalidReason UnionVector::CheckUnionValidity(Vector &vector, idx_t count, const SelectionVector &sel) {
|
2101
|
+
D_ASSERT(vector.GetType().id() == LogicalTypeId::UNION);
|
2102
|
+
auto member_count = UnionType::GetMemberCount(vector.GetType());
|
2103
|
+
if (member_count == 0) {
|
2104
|
+
return UnionInvalidReason::NO_MEMBERS;
|
2105
|
+
}
|
2106
|
+
|
2107
|
+
UnifiedVectorFormat union_vdata;
|
2108
|
+
vector.ToUnifiedFormat(count, union_vdata);
|
2109
|
+
|
2110
|
+
UnifiedVectorFormat tags_vdata;
|
2111
|
+
auto &tag_vector = UnionVector::GetTags(vector);
|
2112
|
+
tag_vector.ToUnifiedFormat(count, tags_vdata);
|
2113
|
+
|
2114
|
+
// check that only one member is valid at a time
|
2115
|
+
for (idx_t row_idx = 0; row_idx < count; row_idx++) {
|
2116
|
+
auto union_mapped_row_idx = sel.get_index(row_idx);
|
2117
|
+
if (!union_vdata.validity.RowIsValid(union_mapped_row_idx)) {
|
2118
|
+
continue;
|
2119
|
+
}
|
2120
|
+
|
2121
|
+
auto tag_mapped_row_idx = tags_vdata.sel->get_index(row_idx);
|
2122
|
+
if (!tags_vdata.validity.RowIsValid(tag_mapped_row_idx)) {
|
2123
|
+
continue;
|
2124
|
+
}
|
2125
|
+
|
2126
|
+
auto tag = ((union_tag_t *)tags_vdata.data)[tag_mapped_row_idx];
|
2127
|
+
if (tag >= member_count) {
|
2128
|
+
return UnionInvalidReason::TAG_OUT_OF_RANGE;
|
2129
|
+
}
|
2130
|
+
|
2131
|
+
bool found_valid = false;
|
2132
|
+
for (idx_t member_idx = 0; member_idx < member_count; member_idx++) {
|
2133
|
+
|
2134
|
+
UnifiedVectorFormat member_vdata;
|
2135
|
+
auto &member = UnionVector::GetMember(vector, member_idx);
|
2136
|
+
member.ToUnifiedFormat(count, member_vdata);
|
2137
|
+
|
2138
|
+
auto mapped_row_idx = member_vdata.sel->get_index(row_idx);
|
2139
|
+
if (member_vdata.validity.RowIsValid(mapped_row_idx)) {
|
2140
|
+
if (found_valid) {
|
2141
|
+
return UnionInvalidReason::VALIDITY_OVERLAP;
|
2142
|
+
}
|
2143
|
+
found_valid = true;
|
2144
|
+
}
|
2145
|
+
}
|
2146
|
+
}
|
2147
|
+
|
2148
|
+
return UnionInvalidReason::VALID;
|
2149
|
+
}
|
2150
|
+
|
2018
2151
|
} // namespace duckdb
|