duckdb 0.8.1-dev65.0 → 0.8.1
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 +8 -8
- package/package.json +3 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +2 -2
- package/src/duckdb/extension/icu/icu-extension.cpp +1 -1
- package/src/duckdb/extension/icu/icu-makedate.cpp +5 -4
- package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp +0 -2
- package/src/duckdb/extension/json/buffered_json_reader.cpp +23 -14
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +6 -6
- package/src/duckdb/extension/json/include/json_common.hpp +13 -3
- package/src/duckdb/extension/json/include/json_executors.hpp +1 -1
- package/src/duckdb/extension/json/include/json_scan.hpp +5 -2
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +5 -0
- package/src/duckdb/extension/json/json_functions/json_create.cpp +16 -16
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +5 -3
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +12 -12
- package/src/duckdb/extension/json/json_functions/read_json.cpp +2 -1
- package/src/duckdb/extension/json/json_functions.cpp +6 -3
- package/src/duckdb/extension/json/json_scan.cpp +43 -27
- package/src/duckdb/extension/parquet/column_reader.cpp +57 -52
- package/src/duckdb/extension/parquet/column_writer.cpp +57 -45
- package/src/duckdb/extension/parquet/include/cast_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/include/column_reader.hpp +5 -4
- package/src/duckdb/extension/parquet/include/column_writer.hpp +24 -0
- package/src/duckdb/extension/parquet/include/decode_utils.hpp +6 -0
- package/src/duckdb/extension/parquet/include/list_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/include/parquet_dbp_decoder.hpp +4 -4
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +4 -5
- package/src/duckdb/extension/parquet/include/resizable_buffer.hpp +4 -4
- package/src/duckdb/extension/parquet/include/row_number_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/include/struct_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/parquet-extension.cpp +27 -2
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +1 -1
- package/src/duckdb/extension/parquet/parquet_reader.cpp +18 -18
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +23 -26
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +2 -2
- package/src/duckdb/extension/parquet/parquet_writer.cpp +3 -3
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +3 -3
- package/src/duckdb/src/catalog/catalog.cpp +5 -17
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +7 -1
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +121 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +49 -12
- package/src/duckdb/src/catalog/catalog_set.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_types.cpp +9 -84
- package/src/duckdb/src/catalog/dependency_manager.cpp +2 -2
- package/src/duckdb/src/common/adbc/adbc.cpp +118 -12
- package/src/duckdb/src/common/adbc/driver_manager.cpp +0 -20
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +12 -12
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +11 -12
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +11 -10
- package/src/duckdb/src/common/checksum.cpp +1 -1
- package/src/duckdb/src/common/compressed_file_system.cpp +6 -6
- package/src/duckdb/src/common/crypto/md5.cpp +9 -9
- package/src/duckdb/src/common/exception.cpp +4 -1
- package/src/duckdb/src/common/exception_format_value.cpp +24 -15
- package/src/duckdb/src/common/field_writer.cpp +1 -1
- package/src/duckdb/src/common/fsst.cpp +11 -6
- package/src/duckdb/src/common/gzip_file_system.cpp +8 -8
- package/src/duckdb/src/common/hive_partitioning.cpp +1 -1
- package/src/duckdb/src/common/local_file_system.cpp +11 -11
- package/src/duckdb/src/common/multi_file_reader.cpp +3 -0
- package/src/duckdb/src/common/operator/cast_operators.cpp +1 -1
- package/src/duckdb/src/common/pipe_file_system.cpp +2 -2
- package/src/duckdb/src/common/radix_partitioning.cpp +2 -2
- package/src/duckdb/src/common/random_engine.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_heap_gather.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_heap_scatter.cpp +5 -5
- package/src/duckdb/src/common/row_operations/row_match.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_radix_scatter.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +4 -4
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +1 -1
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +3 -3
- package/src/duckdb/src/common/serializer.cpp +1 -1
- package/src/duckdb/src/common/sort/comparators.cpp +1 -1
- package/src/duckdb/src/common/sort/merge_sorter.cpp +7 -2
- package/src/duckdb/src/common/sort/partition_state.cpp +2 -2
- package/src/duckdb/src/common/types/bit.cpp +5 -5
- package/src/duckdb/src/common/types/blob.cpp +8 -8
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +4 -4
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +3 -3
- package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +1 -1
- package/src/duckdb/src/common/types/column/partitioned_column_data.cpp +2 -2
- package/src/duckdb/src/common/types/hash.cpp +2 -2
- package/src/duckdb/src/common/types/hyperloglog.cpp +22 -21
- package/src/duckdb/src/common/types/list_segment.cpp +77 -49
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +1 -1
- package/src/duckdb/src/common/types/row/row_data_collection_scanner.cpp +5 -4
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +5 -3
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +61 -24
- package/src/duckdb/src/common/types/string_heap.cpp +1 -1
- package/src/duckdb/src/common/types/time.cpp +2 -8
- package/src/duckdb/src/common/types/timestamp.cpp +37 -1
- package/src/duckdb/src/common/types/value.cpp +3 -2
- package/src/duckdb/src/common/types/vector.cpp +98 -101
- package/src/duckdb/src/common/types/vector_cache.cpp +6 -6
- package/src/duckdb/src/common/types/vector_constants.cpp +2 -1
- package/src/duckdb/src/common/types.cpp +48 -33
- package/src/duckdb/src/common/vector_operations/boolean_operators.cpp +2 -2
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +12 -12
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +13 -11
- package/src/duckdb/src/common/vector_operations/vector_storage.cpp +1 -1
- package/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp +30 -33
- package/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp +0 -4
- package/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp +33 -36
- package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +53 -66
- package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +48 -48
- package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +44 -44
- package/src/duckdb/src/core_functions/aggregate/distributive/bool.cpp +32 -32
- package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +34 -34
- package/src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp +30 -31
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +91 -103
- package/src/duckdb/src/core_functions/aggregate/distributive/product.cpp +17 -17
- package/src/duckdb/src/core_functions/aggregate/distributive/skew.cpp +25 -27
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +37 -38
- package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +22 -22
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +49 -85
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +49 -51
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +116 -134
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +63 -100
- package/src/duckdb/src/core_functions/aggregate/nested/histogram.cpp +24 -26
- package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +22 -23
- package/src/duckdb/src/core_functions/aggregate/regression/regr_avg.cpp +16 -18
- package/src/duckdb/src/core_functions/aggregate/regression/regr_intercept.cpp +22 -25
- package/src/duckdb/src/core_functions/aggregate/regression/regr_r2.cpp +19 -24
- package/src/duckdb/src/core_functions/aggregate/regression/regr_sxx_syy.cpp +18 -23
- package/src/duckdb/src/core_functions/aggregate/regression/regr_sxy.cpp +14 -18
- package/src/duckdb/src/core_functions/function_list.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/blob/base64.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +46 -46
- package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/generic/current_setting.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/least.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/generic/stats.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/system_functions.cpp +14 -0
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +4 -4
- package/src/duckdb/src/core_functions/scalar/list/flatten.cpp +2 -4
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +26 -9
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +7 -9
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/map/cardinality.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/map/map.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/map/map_concat.cpp +4 -1
- package/src/duckdb/src/core_functions/scalar/map/map_extract.cpp +5 -9
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +6 -6
- package/src/duckdb/src/core_functions/scalar/string/starts_with.cpp +3 -2
- package/src/duckdb/src/core_functions/scalar/string/string_split.cpp +4 -4
- package/src/duckdb/src/core_functions/scalar/string/trim.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/union/union_extract.cpp +1 -1
- package/src/duckdb/src/execution/adaptive_filter.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_case.cpp +10 -10
- package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +7 -7
- package/src/duckdb/src/execution/expression_executor.cpp +28 -28
- package/src/duckdb/src/execution/index/art/art.cpp +110 -39
- package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +23 -5
- package/src/duckdb/src/execution/index/art/leaf.cpp +11 -11
- package/src/duckdb/src/execution/index/art/leaf_segment.cpp +10 -0
- package/src/duckdb/src/execution/index/art/node.cpp +48 -35
- package/src/duckdb/src/execution/index/art/node16.cpp +3 -0
- package/src/duckdb/src/execution/index/art/node256.cpp +1 -0
- package/src/duckdb/src/execution/index/art/node4.cpp +3 -0
- package/src/duckdb/src/execution/index/art/node48.cpp +2 -0
- package/src/duckdb/src/execution/index/art/prefix.cpp +2 -0
- package/src/duckdb/src/execution/join_hashtable.cpp +6 -4
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +4 -4
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +2 -2
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +2 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +4 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +26 -9
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +5 -2
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +5 -1
- package/src/duckdb/src/execution/operator/join/outer_join_marker.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +4 -4
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +3 -6
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +2 -3
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -1
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +2 -2
- package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +1 -1
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +1 -0
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +10 -5
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +2 -1
- package/src/duckdb/src/execution/operator/scan/physical_expression_scan.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +0 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +29 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +1 -1
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan_generator.cpp +2 -2
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/reservoir_sample.cpp +20 -6
- package/src/duckdb/src/execution/window_segment_tree.cpp +8 -6
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +159 -21
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +68 -75
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +14 -14
- package/src/duckdb/src/function/cast/cast_function_set.cpp +1 -1
- package/src/duckdb/src/function/cast/decimal_cast.cpp +1 -1
- package/src/duckdb/src/function/cast/enum_casts.cpp +2 -2
- package/src/duckdb/src/function/cast/list_casts.cpp +2 -4
- package/src/duckdb/src/function/cast/string_cast.cpp +11 -11
- package/src/duckdb/src/function/cast/union_casts.cpp +2 -2
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +3 -2
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +33 -23
- package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +2 -2
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +4 -4
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +3 -4
- package/src/duckdb/src/function/scalar/string/concat.cpp +8 -7
- package/src/duckdb/src/function/scalar/string/contains.cpp +4 -4
- package/src/duckdb/src/function/scalar/string/like.cpp +5 -5
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +4 -4
- package/src/duckdb/src/function/scalar/string/regexp/regexp_util.cpp +6 -2
- package/src/duckdb/src/function/scalar/string/regexp.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/strip_accents.cpp +1 -1
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +1 -1
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +27 -25
- package/src/duckdb/src/function/scalar_function.cpp +3 -3
- package/src/duckdb/src/function/table/arrow.cpp +6 -6
- package/src/duckdb/src/function/table/arrow_conversion.cpp +67 -61
- package/src/duckdb/src/function/table/checkpoint.cpp +4 -1
- package/src/duckdb/src/function/table/copy_csv.cpp +11 -7
- package/src/duckdb/src/function/table/glob.cpp +1 -1
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +1 -1
- package/src/duckdb/src/function/table/range.cpp +4 -4
- package/src/duckdb/src/function/table/read_csv.cpp +19 -21
- package/src/duckdb/src/function/table/repeat.cpp +5 -2
- package/src/duckdb/src/function/table/repeat_row.cpp +10 -3
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +4 -4
- package/src/duckdb/src/function/table/system/test_vector_types.cpp +82 -26
- package/src/duckdb/src/function/table/table_scan.cpp +4 -4
- package/src/duckdb/src/function/table/unnest.cpp +1 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +2 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +11 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +8 -2
- package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +97 -0
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +15 -4
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_buffer.hpp +7 -2
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_options.hpp +8 -1
- package/src/duckdb/src/include/duckdb/common/arrow/result_arrow_wrapper.hpp +0 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +16 -22
- package/src/duckdb/src/include/duckdb/common/crypto/md5.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/exception.hpp +5 -2
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +11 -0
- package/src/duckdb/src/include/duckdb/common/fsst.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/radix.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/typedefs.hpp +30 -0
- package/src/duckdb/src/include/duckdb/common/types/column/partitioned_column_data.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/types/hyperloglog.hpp +6 -2
- package/src/duckdb/src/include/duckdb/common/types/null_value.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +4 -14
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +9 -0
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +18 -6
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +112 -76
- package/src/duckdb/src/include/duckdb/common/vector_operations/binary_executor.hpp +16 -15
- package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +11 -11
- package/src/duckdb/src/include/duckdb/common/vector_operations/ternary_executor.hpp +23 -19
- package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +3 -3
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/corr.hpp +20 -24
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/covar.hpp +36 -39
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/stddev.hpp +57 -53
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_count.hpp +8 -9
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_slope.hpp +16 -18
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/sum_helpers.hpp +7 -8
- package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +9 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +2 -6
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +16 -36
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +14 -2
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +13 -7
- package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +13 -3
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +12 -12
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +9 -30
- package/src/duckdb/src/include/duckdb/function/aggregate_state.hpp +95 -0
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +13 -2
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +44 -0
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -2
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +4 -3
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +9 -8
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/capi/cast/utils.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +142 -136
- package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/pending_query_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +23 -0
- package/src/duckdb/src/include/duckdb/main/relation.hpp +12 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +19 -0
- package/src/duckdb/src/include/duckdb/main/stream_query_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +12 -3
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +6 -12
- package/src/duckdb/src/include/duckdb/parser/constraint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression_map.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_expression.hpp +5 -1
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/query_node.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +36 -5
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +7 -4
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +4 -3
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +106 -92
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/bound_query_node.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +37 -1
- package/src/duckdb/src/include/duckdb/planner/bound_tableref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +5 -7
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/filter/constant_filter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/filter/null_filter.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +7 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +6 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +6 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +26 -0
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/byte_reader.hpp +4 -0
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/in_memory_block_manager.hpp +13 -13
- package/src/duckdb/src/include/duckdb/storage/index.hpp +6 -4
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +0 -6
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +12 -0
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/chunk_info.hpp +25 -2
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +12 -0
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +22 -0
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +0 -2
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +2 -2
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +2 -2
- package/src/duckdb/src/main/attached_database.cpp +8 -0
- package/src/duckdb/src/main/capi/appender-c.cpp +5 -5
- package/src/duckdb/src/main/capi/arrow-c.cpp +13 -13
- package/src/duckdb/src/main/capi/cast/from_decimal-c.cpp +1 -1
- package/src/duckdb/src/main/capi/cast/utils-c.cpp +1 -1
- package/src/duckdb/src/main/capi/config-c.cpp +3 -6
- package/src/duckdb/src/main/capi/data_chunk-c.cpp +17 -17
- package/src/duckdb/src/main/capi/duckdb-c.cpp +4 -4
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +4 -4
- package/src/duckdb/src/main/capi/logical_types-c.cpp +22 -21
- package/src/duckdb/src/main/capi/pending-c.cpp +6 -6
- package/src/duckdb/src/main/capi/prepared-c.cpp +10 -10
- package/src/duckdb/src/main/capi/replacement_scan-c.cpp +6 -6
- package/src/duckdb/src/main/capi/result-c.cpp +23 -23
- package/src/duckdb/src/main/capi/table_function-c.cpp +1 -1
- package/src/duckdb/src/main/client_context.cpp +7 -6
- package/src/duckdb/src/main/config.cpp +2 -0
- package/src/duckdb/src/main/database.cpp +1 -0
- package/src/duckdb/src/main/database_manager.cpp +22 -1
- package/src/duckdb/src/main/error_manager.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_load.cpp +1 -1
- package/src/duckdb/src/main/query_result.cpp +6 -2
- package/src/duckdb/src/main/relation/create_table_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/create_view_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/delete_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/explain_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/insert_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/update_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/write_csv_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/write_parquet_relation.cpp +1 -1
- package/src/duckdb/src/main/relation.cpp +1 -1
- package/src/duckdb/src/main/settings/settings.cpp +41 -6
- package/src/duckdb/src/optimizer/deliminator.cpp +12 -12
- package/src/duckdb/src/optimizer/filter_combiner.cpp +3 -3
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +10 -10
- package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +1 -1
- package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +2 -2
- package/src/duckdb/src/optimizer/regex_range_filter.cpp +2 -4
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +6 -6
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +2 -2
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +27 -16
- package/src/duckdb/src/parallel/executor.cpp +39 -15
- package/src/duckdb/src/parallel/meta_pipeline.cpp +17 -3
- package/src/duckdb/src/parser/base_expression.cpp +2 -5
- package/src/duckdb/src/parser/column_definition.cpp +5 -8
- package/src/duckdb/src/parser/expression/between_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/case_expression.cpp +6 -6
- package/src/duckdb/src/parser/expression/cast_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/collate_expression.cpp +3 -3
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/comparison_expression.cpp +3 -3
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +2 -2
- package/src/duckdb/src/parser/expression/constant_expression.cpp +2 -2
- package/src/duckdb/src/parser/expression/function_expression.cpp +10 -14
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +2 -2
- package/src/duckdb/src/parser/expression/operator_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/parameter_expression.cpp +2 -2
- package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +3 -3
- package/src/duckdb/src/parser/expression/star_expression.cpp +9 -9
- package/src/duckdb/src/parser/expression/subquery_expression.cpp +5 -5
- package/src/duckdb/src/parser/expression/window_expression.cpp +13 -24
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +0 -3
- package/src/duckdb/src/parser/parsed_expression.cpp +34 -18
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +4 -4
- package/src/duckdb/src/parser/parser.cpp +98 -38
- package/src/duckdb/src/parser/query_node/select_node.cpp +6 -13
- package/src/duckdb/src/parser/query_node.cpp +7 -6
- package/src/duckdb/src/parser/result_modifier.cpp +25 -18
- package/src/duckdb/src/parser/statement/select_statement.cpp +3 -3
- package/src/duckdb/src/parser/tableref/basetableref.cpp +4 -4
- package/src/duckdb/src/parser/tableref/emptytableref.cpp +1 -1
- package/src/duckdb/src/parser/tableref/expressionlistref.cpp +5 -5
- package/src/duckdb/src/parser/tableref/joinref.cpp +6 -6
- package/src/duckdb/src/parser/tableref/pivotref.cpp +10 -15
- package/src/duckdb/src/parser/tableref/subqueryref.cpp +3 -3
- package/src/duckdb/src/parser/tableref/table_function.cpp +3 -3
- package/src/duckdb/src/parser/tableref.cpp +12 -3
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +7 -7
- package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +4 -4
- package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +4 -4
- package/src/duckdb/src/parser/transform/expression/transform_case.cpp +8 -10
- package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +7 -9
- package/src/duckdb/src/parser/transform/expression/transform_coalesce.cpp +3 -5
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +22 -22
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +42 -44
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +70 -75
- package/src/duckdb/src/parser/transform/expression/transform_grouping_function.cpp +4 -4
- package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +7 -7
- package/src/duckdb/src/parser/transform/expression/transform_is_null.cpp +4 -5
- package/src/duckdb/src/parser/transform/expression/transform_lambda.cpp +5 -6
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +31 -29
- package/src/duckdb/src/parser/transform/expression/transform_param_ref.cpp +13 -14
- package/src/duckdb/src/parser/transform/expression/transform_positional_reference.cpp +4 -4
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +9 -10
- package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +0 -2
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +28 -32
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +18 -18
- package/src/duckdb/src/parser/transform/helpers/transform_sample.cpp +3 -3
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +27 -26
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +11 -14
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +14 -16
- package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +8 -9
- package/src/duckdb/src/parser/transform/statement/transform_call.cpp +2 -5
- package/src/duckdb/src/parser/transform/statement/transform_checkpoint.cpp +4 -6
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +22 -23
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +14 -18
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +13 -15
- package/src/duckdb/src/parser/transform/statement/transform_create_schema.cpp +8 -10
- package/src/duckdb/src/parser/transform/statement/transform_create_sequence.cpp +8 -10
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +26 -28
- package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +8 -10
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +12 -15
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +13 -18
- package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +11 -13
- package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +3 -4
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +20 -25
- package/src/duckdb/src/parser/transform/statement/transform_explain.cpp +5 -7
- package/src/duckdb/src/parser/transform/statement/transform_export.cpp +5 -6
- package/src/duckdb/src/parser/transform/statement/transform_import.cpp +2 -3
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +21 -24
- package/src/duckdb/src/parser/transform/statement/transform_load.cpp +4 -5
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +7 -7
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +7 -9
- package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +11 -19
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +12 -14
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +12 -9
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +34 -34
- package/src/duckdb/src/parser/transform/statement/transform_set.cpp +18 -19
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +5 -7
- package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +4 -5
- package/src/duckdb/src/parser/transform/statement/transform_transaction.cpp +3 -5
- package/src/duckdb/src/parser/transform/statement/transform_update.cpp +10 -13
- package/src/duckdb/src/parser/transform/statement/transform_upsert.cpp +4 -4
- package/src/duckdb/src/parser/transform/statement/transform_use.cpp +2 -3
- package/src/duckdb/src/parser/transform/statement/transform_vacuum.cpp +6 -10
- package/src/duckdb/src/parser/transform/tableref/transform_base_tableref.cpp +18 -18
- package/src/duckdb/src/parser/transform/tableref/transform_from.cpp +5 -5
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +11 -11
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +30 -27
- package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +5 -5
- package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +13 -12
- package/src/duckdb/src/parser/transform/tableref/transform_tableref.cpp +8 -8
- package/src/duckdb/src/parser/transformer.cpp +45 -47
- package/src/duckdb/src/planner/bind_context.cpp +9 -10
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +1 -3
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_positional_reference_expression.cpp +8 -3
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +6 -3
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +39 -23
- package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +1 -28
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +18 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +0 -25
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +2 -114
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +7 -2
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +7 -2
- package/src/duckdb/src/planner/binder.cpp +1 -1
- package/src/duckdb/src/planner/bound_result_modifier.cpp +30 -11
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +11 -10
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_case_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_default_expression.cpp +7 -1
- package/src/duckdb/src/planner/expression/bound_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +3 -4
- package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +4 -5
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +3 -4
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_subquery_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +8 -21
- package/src/duckdb/src/planner/expression.cpp +18 -0
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder.cpp +3 -2
- package/src/duckdb/src/planner/expression_iterator.cpp +2 -2
- package/src/duckdb/src/planner/filter/conjunction_filter.cpp +2 -2
- package/src/duckdb/src/planner/filter/constant_filter.cpp +1 -1
- package/src/duckdb/src/planner/logical_operator.cpp +3 -4
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +5 -4
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +14 -2
- package/src/duckdb/src/planner/planner.cpp +5 -15
- package/src/duckdb/src/planner/table_filter.cpp +1 -1
- package/src/duckdb/src/storage/arena_allocator.cpp +2 -2
- package/src/duckdb/src/storage/buffer/block_handle.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +2 -2
- package/src/duckdb/src/storage/checkpoint_manager.cpp +3 -3
- package/src/duckdb/src/storage/compression/bitpacking.cpp +8 -8
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +36 -36
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +11 -11
- package/src/duckdb/src/storage/compression/fsst.cpp +34 -34
- package/src/duckdb/src/storage/compression/rle.cpp +8 -8
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +13 -13
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +11 -11
- package/src/duckdb/src/storage/data_table.cpp +12 -10
- package/src/duckdb/src/storage/index.cpp +13 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -3
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +3 -3
- package/src/duckdb/src/storage/statistics/list_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/string_stats.cpp +15 -14
- package/src/duckdb/src/storage/storage_manager.cpp +6 -0
- package/src/duckdb/src/storage/table/chunk_info.cpp +2 -2
- package/src/duckdb/src/storage/table/column_data.cpp +7 -3
- package/src/duckdb/src/storage/table/column_segment.cpp +3 -3
- package/src/duckdb/src/storage/table/list_column_data.cpp +8 -7
- package/src/duckdb/src/storage/table/row_group.cpp +8 -7
- package/src/duckdb/src/storage/table/row_group_collection.cpp +6 -3
- package/src/duckdb/src/storage/table/standard_column_data.cpp +5 -4
- package/src/duckdb/src/storage/table/struct_column_data.cpp +4 -3
- package/src/duckdb/src/storage/table/update_segment.cpp +12 -12
- package/src/duckdb/src/storage/wal_replay.cpp +5 -6
- package/src/duckdb/src/transaction/cleanup_state.cpp +3 -3
- package/src/duckdb/src/transaction/commit_state.cpp +8 -8
- package/src/duckdb/src/transaction/duck_transaction.cpp +9 -7
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +16 -16
- package/src/duckdb/src/transaction/rollback_state.cpp +3 -3
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/statement_verifier.cpp +3 -4
- package/src/duckdb/third_party/hyperloglog/hyperloglog.hpp +2 -2
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +0 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +0 -14
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +12828 -12956
- package/src/duckdb/third_party/pcg/pcg_extras.hpp +1 -1
- package/src/duckdb/third_party/zstd/compress/zstd_compress.cpp +3 -0
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_cwksp.h +4 -0
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +5 -5
- package/src/duckdb/ub_src_parser_transform_statement.cpp +0 -2
- package/test/extension.test.ts +11 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +0 -46
- package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +0 -28
@@ -13,66 +13,60 @@
|
|
13
13
|
|
14
14
|
namespace duckdb {
|
15
15
|
|
16
|
-
void Transformer::TransformWindowDef(duckdb_libpgquery::PGWindowDef
|
16
|
+
void Transformer::TransformWindowDef(duckdb_libpgquery::PGWindowDef &window_spec, WindowExpression &expr,
|
17
17
|
const char *window_name) {
|
18
|
-
D_ASSERT(window_spec);
|
19
|
-
D_ASSERT(expr);
|
20
|
-
|
21
18
|
// next: partitioning/ordering expressions
|
22
|
-
if (window_spec
|
23
|
-
if (window_name && !expr
|
19
|
+
if (window_spec.partitionClause) {
|
20
|
+
if (window_name && !expr.partitions.empty()) {
|
24
21
|
throw ParserException("Cannot override PARTITION BY clause of window \"%s\"", window_name);
|
25
22
|
}
|
26
|
-
TransformExpressionList(*window_spec
|
23
|
+
TransformExpressionList(*window_spec.partitionClause, expr.partitions);
|
27
24
|
}
|
28
|
-
if (window_spec
|
29
|
-
if (window_name && !expr
|
25
|
+
if (window_spec.orderClause) {
|
26
|
+
if (window_name && !expr.orders.empty()) {
|
30
27
|
throw ParserException("Cannot override ORDER BY clause of window \"%s\"", window_name);
|
31
28
|
}
|
32
|
-
TransformOrderBy(window_spec
|
29
|
+
TransformOrderBy(window_spec.orderClause, expr.orders);
|
33
30
|
}
|
34
31
|
}
|
35
32
|
|
36
|
-
void Transformer::TransformWindowFrame(duckdb_libpgquery::PGWindowDef
|
37
|
-
D_ASSERT(window_spec);
|
38
|
-
D_ASSERT(expr);
|
39
|
-
|
33
|
+
void Transformer::TransformWindowFrame(duckdb_libpgquery::PGWindowDef &window_spec, WindowExpression &expr) {
|
40
34
|
// finally: specifics of bounds
|
41
|
-
expr
|
42
|
-
expr
|
35
|
+
expr.start_expr = TransformExpression(window_spec.startOffset);
|
36
|
+
expr.end_expr = TransformExpression(window_spec.endOffset);
|
43
37
|
|
44
|
-
if ((window_spec
|
45
|
-
(window_spec
|
38
|
+
if ((window_spec.frameOptions & FRAMEOPTION_END_UNBOUNDED_PRECEDING) ||
|
39
|
+
(window_spec.frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING)) {
|
46
40
|
throw InternalException(
|
47
41
|
"Window frames starting with unbounded following or ending in unbounded preceding make no sense");
|
48
42
|
}
|
49
43
|
|
50
|
-
const bool rangeMode = (window_spec
|
51
|
-
if (window_spec
|
52
|
-
expr
|
53
|
-
} else if (window_spec
|
54
|
-
expr
|
55
|
-
} else if (window_spec
|
56
|
-
expr
|
57
|
-
} else if (window_spec
|
58
|
-
expr
|
44
|
+
const bool rangeMode = (window_spec.frameOptions & FRAMEOPTION_RANGE) != 0;
|
45
|
+
if (window_spec.frameOptions & FRAMEOPTION_START_UNBOUNDED_PRECEDING) {
|
46
|
+
expr.start = WindowBoundary::UNBOUNDED_PRECEDING;
|
47
|
+
} else if (window_spec.frameOptions & FRAMEOPTION_START_VALUE_PRECEDING) {
|
48
|
+
expr.start = rangeMode ? WindowBoundary::EXPR_PRECEDING_RANGE : WindowBoundary::EXPR_PRECEDING_ROWS;
|
49
|
+
} else if (window_spec.frameOptions & FRAMEOPTION_START_VALUE_FOLLOWING) {
|
50
|
+
expr.start = rangeMode ? WindowBoundary::EXPR_FOLLOWING_RANGE : WindowBoundary::EXPR_FOLLOWING_ROWS;
|
51
|
+
} else if (window_spec.frameOptions & FRAMEOPTION_START_CURRENT_ROW) {
|
52
|
+
expr.start = rangeMode ? WindowBoundary::CURRENT_ROW_RANGE : WindowBoundary::CURRENT_ROW_ROWS;
|
59
53
|
}
|
60
54
|
|
61
|
-
if (window_spec
|
62
|
-
expr
|
63
|
-
} else if (window_spec
|
64
|
-
expr
|
65
|
-
} else if (window_spec
|
66
|
-
expr
|
67
|
-
} else if (window_spec
|
68
|
-
expr
|
55
|
+
if (window_spec.frameOptions & FRAMEOPTION_END_UNBOUNDED_FOLLOWING) {
|
56
|
+
expr.end = WindowBoundary::UNBOUNDED_FOLLOWING;
|
57
|
+
} else if (window_spec.frameOptions & FRAMEOPTION_END_VALUE_PRECEDING) {
|
58
|
+
expr.end = rangeMode ? WindowBoundary::EXPR_PRECEDING_RANGE : WindowBoundary::EXPR_PRECEDING_ROWS;
|
59
|
+
} else if (window_spec.frameOptions & FRAMEOPTION_END_VALUE_FOLLOWING) {
|
60
|
+
expr.end = rangeMode ? WindowBoundary::EXPR_FOLLOWING_RANGE : WindowBoundary::EXPR_FOLLOWING_ROWS;
|
61
|
+
} else if (window_spec.frameOptions & FRAMEOPTION_END_CURRENT_ROW) {
|
62
|
+
expr.end = rangeMode ? WindowBoundary::CURRENT_ROW_RANGE : WindowBoundary::CURRENT_ROW_ROWS;
|
69
63
|
}
|
70
64
|
|
71
|
-
D_ASSERT(expr
|
72
|
-
if (((window_spec
|
73
|
-
!expr
|
74
|
-
((window_spec
|
75
|
-
!expr
|
65
|
+
D_ASSERT(expr.start != WindowBoundary::INVALID && expr.end != WindowBoundary::INVALID);
|
66
|
+
if (((window_spec.frameOptions & (FRAMEOPTION_START_VALUE_PRECEDING | FRAMEOPTION_START_VALUE_FOLLOWING)) &&
|
67
|
+
!expr.start_expr) ||
|
68
|
+
((window_spec.frameOptions & (FRAMEOPTION_END_VALUE_PRECEDING | FRAMEOPTION_END_VALUE_FOLLOWING)) &&
|
69
|
+
!expr.end_expr)) {
|
76
70
|
throw InternalException("Failed to transform window boundary expression");
|
77
71
|
}
|
78
72
|
}
|
@@ -98,40 +92,40 @@ bool Transformer::InWindowDefinition() {
|
|
98
92
|
return false;
|
99
93
|
}
|
100
94
|
|
101
|
-
unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::PGFuncCall
|
102
|
-
auto name = root
|
95
|
+
unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::PGFuncCall &root) {
|
96
|
+
auto name = root.funcname;
|
103
97
|
string catalog, schema, function_name;
|
104
98
|
if (name->length == 3) {
|
105
99
|
// catalog + schema + name
|
106
|
-
catalog =
|
107
|
-
schema =
|
108
|
-
function_name =
|
100
|
+
catalog = PGPointerCast<duckdb_libpgquery::PGValue>(name->head->data.ptr_value)->val.str;
|
101
|
+
schema = PGPointerCast<duckdb_libpgquery::PGValue>(name->head->next->data.ptr_value)->val.str;
|
102
|
+
function_name = PGPointerCast<duckdb_libpgquery::PGValue>(name->head->next->next->data.ptr_value)->val.str;
|
109
103
|
} else if (name->length == 2) {
|
110
104
|
// schema + name
|
111
105
|
catalog = INVALID_CATALOG;
|
112
|
-
schema =
|
113
|
-
function_name =
|
106
|
+
schema = PGPointerCast<duckdb_libpgquery::PGValue>(name->head->data.ptr_value)->val.str;
|
107
|
+
function_name = PGPointerCast<duckdb_libpgquery::PGValue>(name->head->next->data.ptr_value)->val.str;
|
114
108
|
} else if (name->length == 1) {
|
115
109
|
// unqualified name
|
116
110
|
catalog = INVALID_CATALOG;
|
117
111
|
schema = INVALID_SCHEMA;
|
118
|
-
function_name =
|
112
|
+
function_name = PGPointerCast<duckdb_libpgquery::PGValue>(name->head->data.ptr_value)->val.str;
|
119
113
|
} else {
|
120
114
|
throw ParserException("TransformFuncCall - Expected 1, 2 or 3 qualifications");
|
121
115
|
}
|
122
116
|
|
123
117
|
// transform children
|
124
118
|
vector<unique_ptr<ParsedExpression>> children;
|
125
|
-
if (root
|
126
|
-
TransformExpressionList(*root
|
119
|
+
if (root.args) {
|
120
|
+
TransformExpressionList(*root.args, children);
|
127
121
|
}
|
128
|
-
if (children.size() == 1 && ExpressionIsEmptyStar(*children[0]) && !root
|
122
|
+
if (children.size() == 1 && ExpressionIsEmptyStar(*children[0]) && !root.agg_distinct && !root.agg_order) {
|
129
123
|
// COUNT(*) gets translated into COUNT()
|
130
124
|
children.clear();
|
131
125
|
}
|
132
126
|
|
133
127
|
auto lowercase_name = StringUtil::Lower(function_name);
|
134
|
-
if (root
|
128
|
+
if (root.over) {
|
135
129
|
if (InWindowDefinition()) {
|
136
130
|
throw ParserException("window functions are not allowed in window definitions");
|
137
131
|
}
|
@@ -141,30 +135,30 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
|
|
141
135
|
throw InternalException("Unknown/unsupported window function");
|
142
136
|
}
|
143
137
|
|
144
|
-
if (root
|
138
|
+
if (root.agg_distinct) {
|
145
139
|
throw ParserException("DISTINCT is not implemented for window functions!");
|
146
140
|
}
|
147
141
|
|
148
|
-
if (root
|
142
|
+
if (root.agg_order) {
|
149
143
|
throw ParserException("ORDER BY is not implemented for window functions!");
|
150
144
|
}
|
151
145
|
|
152
|
-
if (win_fun_type != ExpressionType::WINDOW_AGGREGATE && root
|
146
|
+
if (win_fun_type != ExpressionType::WINDOW_AGGREGATE && root.agg_filter) {
|
153
147
|
throw ParserException("FILTER is not implemented for non-aggregate window functions!");
|
154
148
|
}
|
155
|
-
if (root
|
149
|
+
if (root.export_state) {
|
156
150
|
throw ParserException("EXPORT_STATE is not supported for window functions!");
|
157
151
|
}
|
158
152
|
|
159
|
-
if (win_fun_type == ExpressionType::WINDOW_AGGREGATE && root
|
153
|
+
if (win_fun_type == ExpressionType::WINDOW_AGGREGATE && root.agg_ignore_nulls) {
|
160
154
|
throw ParserException("IGNORE NULLS is not supported for windowed aggregates");
|
161
155
|
}
|
162
156
|
|
163
157
|
auto expr = make_uniq<WindowExpression>(win_fun_type, std::move(catalog), std::move(schema), lowercase_name);
|
164
|
-
expr->ignore_nulls = root
|
158
|
+
expr->ignore_nulls = root.agg_ignore_nulls;
|
165
159
|
|
166
|
-
if (root
|
167
|
-
auto filter_expr = TransformExpression(root
|
160
|
+
if (root.agg_filter) {
|
161
|
+
auto filter_expr = TransformExpression(root.agg_filter);
|
168
162
|
expr->filter_expr = std::move(filter_expr);
|
169
163
|
}
|
170
164
|
|
@@ -197,7 +191,7 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
|
|
197
191
|
}
|
198
192
|
}
|
199
193
|
}
|
200
|
-
auto window_spec =
|
194
|
+
auto window_spec = PGPointerCast<duckdb_libpgquery::PGWindowDef>(root.over);
|
201
195
|
if (window_spec->name) {
|
202
196
|
auto it = window_clauses.find(StringUtil::Lower(string(window_spec->name)));
|
203
197
|
if (it == window_clauses.end()) {
|
@@ -217,30 +211,30 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
|
|
217
211
|
D_ASSERT(window_ref);
|
218
212
|
}
|
219
213
|
in_window_definition = true;
|
220
|
-
TransformWindowDef(window_ref, expr
|
214
|
+
TransformWindowDef(*window_ref, *expr);
|
221
215
|
if (window_ref != window_spec) {
|
222
|
-
TransformWindowDef(window_spec, expr
|
216
|
+
TransformWindowDef(*window_spec, *expr, window_name);
|
223
217
|
}
|
224
|
-
TransformWindowFrame(window_spec, expr
|
218
|
+
TransformWindowFrame(*window_spec, *expr);
|
225
219
|
in_window_definition = false;
|
226
|
-
expr->query_location = root
|
220
|
+
expr->query_location = root.location;
|
227
221
|
return std::move(expr);
|
228
222
|
}
|
229
223
|
|
230
|
-
if (root
|
224
|
+
if (root.agg_ignore_nulls) {
|
231
225
|
throw ParserException("IGNORE NULLS is not supported for non-window functions");
|
232
226
|
}
|
233
227
|
|
234
228
|
unique_ptr<ParsedExpression> filter_expr;
|
235
|
-
if (root
|
236
|
-
filter_expr = TransformExpression(root
|
229
|
+
if (root.agg_filter) {
|
230
|
+
filter_expr = TransformExpression(root.agg_filter);
|
237
231
|
}
|
238
232
|
|
239
233
|
auto order_bys = make_uniq<OrderModifier>();
|
240
|
-
TransformOrderBy(root
|
234
|
+
TransformOrderBy(root.agg_order, order_bys->orders);
|
241
235
|
|
242
236
|
// Ordered aggregates can be either WITHIN GROUP or after the function arguments
|
243
|
-
if (root
|
237
|
+
if (root.agg_within_group) {
|
244
238
|
// https://www.postgresql.org/docs/current/functions-aggregate.html#FUNCTIONS-ORDEREDSET-TABLE
|
245
239
|
// Since we implement "ordered aggregates" without sorting,
|
246
240
|
// we map all the ones we support to the corresponding aggregate function.
|
@@ -304,17 +298,18 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
|
|
304
298
|
}
|
305
299
|
auto arg_expr = children[0].get();
|
306
300
|
auto &order_by = order_bys->orders[0];
|
307
|
-
if (arg_expr->Equals(order_by.expression
|
301
|
+
if (arg_expr->Equals(*order_by.expression)) {
|
308
302
|
auto sense = make_uniq<ConstantExpression>(EnumUtil::ToChars(order_by.type));
|
309
303
|
auto nulls = make_uniq<ConstantExpression>(EnumUtil::ToChars(order_by.null_order));
|
310
304
|
order_bys = nullptr;
|
311
305
|
auto unordered = make_uniq<FunctionExpression>(catalog, schema, lowercase_name.c_str(), std::move(children),
|
312
306
|
std::move(filter_expr), std::move(order_bys),
|
313
|
-
root
|
307
|
+
root.agg_distinct, false, root.export_state);
|
314
308
|
lowercase_name = "list_sort";
|
315
309
|
order_bys.reset(); // NOLINT
|
316
310
|
filter_expr.reset(); // NOLINT
|
317
311
|
children.clear(); // NOLINT
|
312
|
+
root.agg_distinct = false;
|
318
313
|
children.emplace_back(std::move(unordered));
|
319
314
|
children.emplace_back(std::move(sense));
|
320
315
|
children.emplace_back(std::move(nulls));
|
@@ -323,13 +318,13 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
|
|
323
318
|
|
324
319
|
auto function = make_uniq<FunctionExpression>(std::move(catalog), std::move(schema), lowercase_name.c_str(),
|
325
320
|
std::move(children), std::move(filter_expr), std::move(order_bys),
|
326
|
-
root
|
327
|
-
function->query_location = root
|
321
|
+
root.agg_distinct, false, root.export_state);
|
322
|
+
function->query_location = root.location;
|
328
323
|
|
329
324
|
return std::move(function);
|
330
325
|
}
|
331
326
|
|
332
|
-
unique_ptr<ParsedExpression> Transformer::TransformSQLValueFunction(duckdb_libpgquery::PGSQLValueFunction
|
327
|
+
unique_ptr<ParsedExpression> Transformer::TransformSQLValueFunction(duckdb_libpgquery::PGSQLValueFunction &node) {
|
333
328
|
throw InternalException("SQL value functions should not be emitted by the parser");
|
334
329
|
}
|
335
330
|
|
@@ -3,13 +3,13 @@
|
|
3
3
|
|
4
4
|
namespace duckdb {
|
5
5
|
|
6
|
-
unique_ptr<ParsedExpression> Transformer::TransformGroupingFunction(duckdb_libpgquery::PGGroupingFunc
|
6
|
+
unique_ptr<ParsedExpression> Transformer::TransformGroupingFunction(duckdb_libpgquery::PGGroupingFunc &grouping) {
|
7
7
|
auto op = make_uniq<OperatorExpression>(ExpressionType::GROUPING_FUNCTION);
|
8
|
-
for (auto node =
|
9
|
-
auto n =
|
8
|
+
for (auto node = grouping.args->head; node; node = node->next) {
|
9
|
+
auto n = PGPointerCast<duckdb_libpgquery::PGNode>(node->data.ptr_value);
|
10
10
|
op->children.push_back(TransformExpression(n));
|
11
11
|
}
|
12
|
-
op->query_location =
|
12
|
+
op->query_location = grouping.location;
|
13
13
|
return std::move(op);
|
14
14
|
}
|
15
15
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
|
-
unique_ptr<ParsedExpression> Transformer::TransformInterval(duckdb_libpgquery::PGIntervalConstant
|
9
|
+
unique_ptr<ParsedExpression> Transformer::TransformInterval(duckdb_libpgquery::PGIntervalConstant &node) {
|
10
10
|
// handle post-fix notation of INTERVAL
|
11
11
|
|
12
12
|
// three scenarios
|
@@ -14,25 +14,25 @@ unique_ptr<ParsedExpression> Transformer::TransformInterval(duckdb_libpgquery::P
|
|
14
14
|
// interval 'string' year
|
15
15
|
// interval int year
|
16
16
|
unique_ptr<ParsedExpression> expr;
|
17
|
-
switch (node
|
17
|
+
switch (node.val_type) {
|
18
18
|
case duckdb_libpgquery::T_PGAExpr:
|
19
|
-
expr = TransformExpression(node
|
19
|
+
expr = TransformExpression(node.eval);
|
20
20
|
break;
|
21
21
|
case duckdb_libpgquery::T_PGString:
|
22
|
-
expr = make_uniq<ConstantExpression>(Value(node
|
22
|
+
expr = make_uniq<ConstantExpression>(Value(node.sval));
|
23
23
|
break;
|
24
24
|
case duckdb_libpgquery::T_PGInteger:
|
25
|
-
expr = make_uniq<ConstantExpression>(Value(node
|
25
|
+
expr = make_uniq<ConstantExpression>(Value(node.ival));
|
26
26
|
break;
|
27
27
|
default:
|
28
28
|
throw InternalException("Unsupported interval transformation");
|
29
29
|
}
|
30
30
|
|
31
|
-
if (!node
|
31
|
+
if (!node.typmods) {
|
32
32
|
return make_uniq<CastExpression>(LogicalType::INTERVAL, std::move(expr));
|
33
33
|
}
|
34
34
|
|
35
|
-
int32_t mask =
|
35
|
+
int32_t mask = PGPointerCast<duckdb_libpgquery::PGAConst>(node.typmods->head->data.ptr_value)->val.val.ival;
|
36
36
|
// these seemingly random constants are from datetime.hpp
|
37
37
|
// they are copied here to avoid having to include this header
|
38
38
|
// the bitshift is from the function INTERVAL_MASK in the parser
|
@@ -4,13 +4,12 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
-
unique_ptr<ParsedExpression> Transformer::TransformNullTest(duckdb_libpgquery::PGNullTest
|
8
|
-
|
9
|
-
|
10
|
-
if (root->argisrow) {
|
7
|
+
unique_ptr<ParsedExpression> Transformer::TransformNullTest(duckdb_libpgquery::PGNullTest &root) {
|
8
|
+
auto arg = TransformExpression(PGPointerCast<duckdb_libpgquery::PGNode>(root.arg));
|
9
|
+
if (root.argisrow) {
|
11
10
|
throw NotImplementedException("IS NULL argisrow");
|
12
11
|
}
|
13
|
-
ExpressionType expr_type = (root
|
12
|
+
ExpressionType expr_type = (root.nulltesttype == duckdb_libpgquery::PG_IS_NULL)
|
14
13
|
? ExpressionType::OPERATOR_IS_NULL
|
15
14
|
: ExpressionType::OPERATOR_IS_NOT_NULL;
|
16
15
|
|
@@ -4,13 +4,12 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
-
unique_ptr<ParsedExpression> Transformer::TransformLambda(duckdb_libpgquery::PGLambdaFunction
|
7
|
+
unique_ptr<ParsedExpression> Transformer::TransformLambda(duckdb_libpgquery::PGLambdaFunction &node) {
|
8
|
+
D_ASSERT(node.lhs);
|
9
|
+
D_ASSERT(node.rhs);
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
auto lhs = TransformExpression(node->lhs);
|
13
|
-
auto rhs = TransformExpression(node->rhs);
|
11
|
+
auto lhs = TransformExpression(node.lhs);
|
12
|
+
auto rhs = TransformExpression(node.rhs);
|
14
13
|
D_ASSERT(lhs);
|
15
14
|
D_ASSERT(rhs);
|
16
15
|
return make_uniq<LambdaExpression>(std::move(lhs), std::move(rhs));
|
@@ -57,17 +57,16 @@ unique_ptr<ParsedExpression> Transformer::TransformBinaryOperator(string op, uni
|
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
60
|
-
unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgquery::PGAExpr
|
61
|
-
|
62
|
-
auto name = string((reinterpret_cast<duckdb_libpgquery::PGValue *>(root->name->head->data.ptr_value))->val.str);
|
60
|
+
unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgquery::PGAExpr &root) {
|
61
|
+
auto name = string(PGPointerCast<duckdb_libpgquery::PGValue>(root.name->head->data.ptr_value)->val.str);
|
63
62
|
|
64
|
-
switch (root
|
63
|
+
switch (root.kind) {
|
65
64
|
case duckdb_libpgquery::PG_AEXPR_OP_ALL:
|
66
65
|
case duckdb_libpgquery::PG_AEXPR_OP_ANY: {
|
67
66
|
// left=ANY(right)
|
68
67
|
// we turn this into left=ANY((SELECT UNNEST(right)))
|
69
|
-
auto left_expr = TransformExpression(root
|
70
|
-
auto right_expr = TransformExpression(root
|
68
|
+
auto left_expr = TransformExpression(root.lexpr);
|
69
|
+
auto right_expr = TransformExpression(root.rexpr);
|
71
70
|
|
72
71
|
auto subquery_expr = make_uniq<SubqueryExpression>();
|
73
72
|
auto select_statement = make_uniq<SelectStatement>();
|
@@ -82,9 +81,12 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
82
81
|
subquery_expr->subquery_type = SubqueryType::ANY;
|
83
82
|
subquery_expr->child = std::move(left_expr);
|
84
83
|
subquery_expr->comparison_type = OperatorToExpressionType(name);
|
85
|
-
subquery_expr->query_location = root
|
84
|
+
subquery_expr->query_location = root.location;
|
85
|
+
if (subquery_expr->comparison_type == ExpressionType::INVALID) {
|
86
|
+
throw ParserException("Unsupported comparison \"%s\" for ANY/ALL subquery", name);
|
87
|
+
}
|
86
88
|
|
87
|
-
if (root
|
89
|
+
if (root.kind == duckdb_libpgquery::PG_AEXPR_OP_ALL) {
|
88
90
|
// ALL sublink is equivalent to NOT(ANY) with inverted comparison
|
89
91
|
// e.g. [= ALL()] is equivalent to [NOT(<> ANY())]
|
90
92
|
// first invert the comparison type
|
@@ -94,7 +96,7 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
94
96
|
return std::move(subquery_expr);
|
95
97
|
}
|
96
98
|
case duckdb_libpgquery::PG_AEXPR_IN: {
|
97
|
-
auto left_expr = TransformExpression(root
|
99
|
+
auto left_expr = TransformExpression(root.lexpr);
|
98
100
|
ExpressionType operator_type;
|
99
101
|
// this looks very odd, but seems to be the way to find out its NOT IN
|
100
102
|
if (name == "<>") {
|
@@ -105,35 +107,35 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
105
107
|
operator_type = ExpressionType::COMPARE_IN;
|
106
108
|
}
|
107
109
|
auto result = make_uniq<OperatorExpression>(operator_type, std::move(left_expr));
|
108
|
-
result->query_location = root
|
109
|
-
TransformExpressionList(*
|
110
|
+
result->query_location = root.location;
|
111
|
+
TransformExpressionList(*PGPointerCast<duckdb_libpgquery::PGList>(root.rexpr), result->children);
|
110
112
|
return std::move(result);
|
111
113
|
}
|
112
114
|
// rewrite NULLIF(a, b) into CASE WHEN a=b THEN NULL ELSE a END
|
113
115
|
case duckdb_libpgquery::PG_AEXPR_NULLIF: {
|
114
116
|
vector<unique_ptr<ParsedExpression>> children;
|
115
|
-
children.push_back(TransformExpression(root
|
116
|
-
children.push_back(TransformExpression(root
|
117
|
+
children.push_back(TransformExpression(root.lexpr));
|
118
|
+
children.push_back(TransformExpression(root.rexpr));
|
117
119
|
return make_uniq<FunctionExpression>("nullif", std::move(children));
|
118
120
|
}
|
119
121
|
// rewrite (NOT) X BETWEEN A AND B into (NOT) AND(GREATERTHANOREQUALTO(X,
|
120
122
|
// A), LESSTHANOREQUALTO(X, B))
|
121
123
|
case duckdb_libpgquery::PG_AEXPR_BETWEEN:
|
122
124
|
case duckdb_libpgquery::PG_AEXPR_NOT_BETWEEN: {
|
123
|
-
auto between_args =
|
125
|
+
auto between_args = PGPointerCast<duckdb_libpgquery::PGList>(root.rexpr);
|
124
126
|
if (between_args->length != 2 || !between_args->head->data.ptr_value || !between_args->tail->data.ptr_value) {
|
125
127
|
throw InternalException("(NOT) BETWEEN needs two args");
|
126
128
|
}
|
127
129
|
|
128
|
-
auto input = TransformExpression(root
|
130
|
+
auto input = TransformExpression(root.lexpr);
|
129
131
|
auto between_left =
|
130
|
-
TransformExpression(
|
132
|
+
TransformExpression(PGPointerCast<duckdb_libpgquery::PGNode>(between_args->head->data.ptr_value));
|
131
133
|
auto between_right =
|
132
|
-
TransformExpression(
|
134
|
+
TransformExpression(PGPointerCast<duckdb_libpgquery::PGNode>(between_args->tail->data.ptr_value));
|
133
135
|
|
134
136
|
auto compare_between =
|
135
137
|
make_uniq<BetweenExpression>(std::move(input), std::move(between_left), std::move(between_right));
|
136
|
-
if (root
|
138
|
+
if (root.kind == duckdb_libpgquery::PG_AEXPR_BETWEEN) {
|
137
139
|
return std::move(compare_between);
|
138
140
|
} else {
|
139
141
|
return make_uniq<OperatorExpression>(ExpressionType::OPERATOR_NOT, std::move(compare_between));
|
@@ -141,13 +143,13 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
141
143
|
}
|
142
144
|
// rewrite SIMILAR TO into regexp_full_match('asdf', '.*sd.*')
|
143
145
|
case duckdb_libpgquery::PG_AEXPR_SIMILAR: {
|
144
|
-
auto left_expr = TransformExpression(root
|
145
|
-
auto right_expr = TransformExpression(root
|
146
|
+
auto left_expr = TransformExpression(root.lexpr);
|
147
|
+
auto right_expr = TransformExpression(root.rexpr);
|
146
148
|
|
147
149
|
vector<unique_ptr<ParsedExpression>> children;
|
148
150
|
children.push_back(std::move(left_expr));
|
149
151
|
|
150
|
-
auto &similar_func =
|
152
|
+
auto &similar_func = right_expr->Cast<FunctionExpression>();
|
151
153
|
D_ASSERT(similar_func.function_name == "similar_escape");
|
152
154
|
D_ASSERT(similar_func.children.size() == 2);
|
153
155
|
if (similar_func.children[1]->type != ExpressionType::VALUE_CONSTANT) {
|
@@ -176,14 +178,14 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
176
178
|
}
|
177
179
|
}
|
178
180
|
case duckdb_libpgquery::PG_AEXPR_NOT_DISTINCT: {
|
179
|
-
auto left_expr = TransformExpression(root
|
180
|
-
auto right_expr = TransformExpression(root
|
181
|
+
auto left_expr = TransformExpression(root.lexpr);
|
182
|
+
auto right_expr = TransformExpression(root.rexpr);
|
181
183
|
return make_uniq<ComparisonExpression>(ExpressionType::COMPARE_NOT_DISTINCT_FROM, std::move(left_expr),
|
182
184
|
std::move(right_expr));
|
183
185
|
}
|
184
186
|
case duckdb_libpgquery::PG_AEXPR_DISTINCT: {
|
185
|
-
auto left_expr = TransformExpression(root
|
186
|
-
auto right_expr = TransformExpression(root
|
187
|
+
auto left_expr = TransformExpression(root.lexpr);
|
188
|
+
auto right_expr = TransformExpression(root.rexpr);
|
187
189
|
return make_uniq<ComparisonExpression>(ExpressionType::COMPARE_DISTINCT_FROM, std::move(left_expr),
|
188
190
|
std::move(right_expr));
|
189
191
|
}
|
@@ -191,8 +193,8 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
191
193
|
default:
|
192
194
|
break;
|
193
195
|
}
|
194
|
-
auto left_expr = TransformExpression(root
|
195
|
-
auto right_expr = TransformExpression(root
|
196
|
+
auto left_expr = TransformExpression(root.lexpr);
|
197
|
+
auto right_expr = TransformExpression(root.rexpr);
|
196
198
|
|
197
199
|
if (!left_expr) {
|
198
200
|
// prefix operator
|
@@ -205,10 +207,10 @@ unique_ptr<ParsedExpression> Transformer::TransformAExprInternal(duckdb_libpgque
|
|
205
207
|
}
|
206
208
|
}
|
207
209
|
|
208
|
-
unique_ptr<ParsedExpression> Transformer::TransformAExpr(duckdb_libpgquery::PGAExpr
|
210
|
+
unique_ptr<ParsedExpression> Transformer::TransformAExpr(duckdb_libpgquery::PGAExpr &root) {
|
209
211
|
auto result = TransformAExprInternal(root);
|
210
212
|
if (result) {
|
211
|
-
result->query_location = root
|
213
|
+
result->query_location = root.location;
|
212
214
|
}
|
213
215
|
return result;
|
214
216
|
}
|
@@ -4,39 +4,38 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
-
unique_ptr<ParsedExpression> Transformer::TransformParamRef(duckdb_libpgquery::PGParamRef
|
8
|
-
D_ASSERT(node);
|
7
|
+
unique_ptr<ParsedExpression> Transformer::TransformParamRef(duckdb_libpgquery::PGParamRef &node) {
|
9
8
|
auto expr = make_uniq<ParameterExpression>();
|
10
|
-
if (node
|
9
|
+
if (node.number < 0) {
|
11
10
|
throw ParserException("Parameter numbers cannot be negative");
|
12
11
|
}
|
13
12
|
|
14
|
-
if (node
|
13
|
+
if (node.name) {
|
15
14
|
// This is a named parameter, try to find an entry for it
|
16
|
-
D_ASSERT(node
|
15
|
+
D_ASSERT(node.number == 0);
|
17
16
|
int32_t index;
|
18
|
-
if (GetNamedParam(node
|
17
|
+
if (GetNamedParam(node.name, index)) {
|
19
18
|
// We've seen this named parameter before and assigned it an index!
|
20
|
-
node
|
19
|
+
node.number = index;
|
21
20
|
}
|
22
21
|
}
|
23
|
-
if (node
|
22
|
+
if (node.number == 0) {
|
24
23
|
expr->parameter_nr = ParamCount() + 1;
|
25
|
-
if (node
|
24
|
+
if (node.name && !HasNamedParameters() && ParamCount() != 0) {
|
26
25
|
// This parameter is named, but there were other parameter before it, and they were not named
|
27
26
|
throw NotImplementedException("Mixing positional and named parameters is not supported yet");
|
28
27
|
}
|
29
|
-
if (node
|
30
|
-
D_ASSERT(!named_param_map.count(node
|
28
|
+
if (node.name) {
|
29
|
+
D_ASSERT(!named_param_map.count(node.name));
|
31
30
|
// Add it to the named parameter map so we can find it next time it's referenced
|
32
|
-
SetNamedParam(node
|
31
|
+
SetNamedParam(node.name, expr->parameter_nr);
|
33
32
|
}
|
34
33
|
} else {
|
35
|
-
if (!node
|
34
|
+
if (!node.name && HasNamedParameters()) {
|
36
35
|
// This parameter does not have a name, but the named param map is not empty
|
37
36
|
throw NotImplementedException("Mixing positional and named parameters is not supported yet");
|
38
37
|
}
|
39
|
-
expr->parameter_nr = node
|
38
|
+
expr->parameter_nr = node.number;
|
40
39
|
}
|
41
40
|
SetParamCount(MaxValue<idx_t>(ParamCount(), expr->parameter_nr));
|
42
41
|
return std::move(expr);
|
@@ -4,12 +4,12 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
-
unique_ptr<ParsedExpression> Transformer::TransformPositionalReference(duckdb_libpgquery::PGPositionalReference
|
8
|
-
if (node
|
7
|
+
unique_ptr<ParsedExpression> Transformer::TransformPositionalReference(duckdb_libpgquery::PGPositionalReference &node) {
|
8
|
+
if (node.position <= 0) {
|
9
9
|
throw ParserException("Positional reference node needs to be >= 1");
|
10
10
|
}
|
11
|
-
auto result = make_uniq<PositionalReferenceExpression>(node
|
12
|
-
result->query_location = node
|
11
|
+
auto result = make_uniq<PositionalReferenceExpression>(node.position);
|
12
|
+
result->query_location = node.location;
|
13
13
|
return std::move(result);
|
14
14
|
}
|
15
15
|
|