duckdb 0.8.1-dev31.0 → 0.8.1-dev341.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 +8 -8
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +1 -1
- package/src/duckdb/extension/icu/icu-makedate.cpp +5 -4
- 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 +3 -1
- 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 +40 -25
- 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 +25 -1
- 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 +113 -0
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +7 -0
- package/src/duckdb/src/catalog/catalog_entry.cpp +4 -4
- 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/catalog/duck_catalog.cpp +1 -0
- package/src/duckdb/src/common/adbc/adbc.cpp +301 -106
- package/src/duckdb/src/common/adbc/driver_manager.cpp +10 -22
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +12 -12
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +7 -7
- 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 +19 -14
- package/src/duckdb/src/common/field_writer.cpp +1 -1
- package/src/duckdb/src/common/file_system.cpp +15 -2
- 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/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/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 +44 -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 +32 -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 +36 -37
- package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +22 -22
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +48 -84
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +49 -51
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +115 -133
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +62 -99
- 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 +45 -45
- 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 +3 -3
- package/src/duckdb/src/core_functions/scalar/list/flatten.cpp +2 -4
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +3 -3
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +6 -7
- 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 +3 -3
- 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 +10 -11
- package/src/duckdb/src/execution/index/art/leaf_segment.cpp +10 -0
- package/src/duckdb/src/execution/index/art/node.cpp +47 -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 +4 -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_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_unnest.cpp +3 -3
- 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_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 +2 -2
- package/src/duckdb/src/execution/window_segment_tree.cpp +8 -6
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +158 -20
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +66 -74
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +13 -13
- 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 +3 -3
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -3
- 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 +25 -23
- 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 +1 -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 +17 -20
- 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/test_vector_types.cpp +82 -26
- package/src/duckdb/src/function/table/table_scan.cpp +2 -2
- 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 +6 -0
- 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/adbc/adbc.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +15 -4
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_buffer.hpp +7 -2
- 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/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 +8 -29
- 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 +3 -1
- 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_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +8 -7
- package/src/duckdb/src/include/duckdb/main/capi/cast/utils.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
- 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 +17 -0
- package/src/duckdb/src/include/duckdb/main/relation.hpp +12 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +9 -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/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 +1 -1
- 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 +34 -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/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/scan_state.hpp +22 -0
- 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/capi/appender-c.cpp +5 -5
- package/src/duckdb/src/main/capi/arrow-c.cpp +10 -10
- 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 +3 -3
- package/src/duckdb/src/main/config.cpp +1 -0
- package/src/duckdb/src/main/database_manager.cpp +1 -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/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 +22 -6
- package/src/duckdb/src/optimizer/deliminator.cpp +12 -12
- package/src/duckdb/src/optimizer/expression_heuristics.cpp +1 -0
- 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 +1 -1
- 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 +4 -4
- 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 +28 -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 -1
- 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 +8 -8
- 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 +4 -2
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +5 -2
- package/src/duckdb/src/planner/binder.cpp +1 -1
- package/src/duckdb/src/planner/bound_result_modifier.cpp +16 -11
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +5 -5
- 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_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 +15 -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_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 +8 -7
- package/src/duckdb/src/storage/index.cpp +14 -3
- package/src/duckdb/src/storage/local_storage.cpp +2 -1
- package/src/duckdb/src/storage/magic_bytes.cpp +1 -1
- 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/table/chunk_info.cpp +2 -2
- package/src/duckdb/src/storage/table/column_segment.cpp +3 -3
- package/src/duckdb/src/storage/table/list_column_data.cpp +3 -3
- package/src/duckdb/src/storage/table/row_group.cpp +4 -4
- package/src/duckdb/src/storage/table/standard_column_data.cpp +1 -1
- 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/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
@@ -16,13 +16,13 @@
|
|
16
16
|
namespace duckdb {
|
17
17
|
|
18
18
|
// Hugeint arithmetic
|
19
|
-
static hugeint_t
|
19
|
+
static hugeint_t MultiplyByDouble(const hugeint_t &h, const double &d) {
|
20
20
|
D_ASSERT(d >= 0 && d <= 1);
|
21
21
|
return Hugeint::Convert(Hugeint::Cast<double>(h) * d);
|
22
22
|
}
|
23
23
|
|
24
24
|
// Interval arithmetic
|
25
|
-
static interval_t
|
25
|
+
static interval_t MultiplyByDouble(const interval_t &i, const double &d) { // NOLINT
|
26
26
|
D_ASSERT(d >= 0 && d <= 1);
|
27
27
|
return Interval::FromMicro(std::llround(Interval::GetMicro(i) * d));
|
28
28
|
}
|
@@ -207,6 +207,18 @@ timestamp_t CastInterpolation::Interpolate(const timestamp_t &lo, const double d
|
|
207
207
|
return timestamp_t(std::llround(lo.value * (1.0 - d) + hi.value * d));
|
208
208
|
}
|
209
209
|
|
210
|
+
template <>
|
211
|
+
hugeint_t CastInterpolation::Interpolate(const hugeint_t &lo, const double d, const hugeint_t &hi) {
|
212
|
+
const hugeint_t delta = hi - lo;
|
213
|
+
return lo + MultiplyByDouble(delta, d);
|
214
|
+
}
|
215
|
+
|
216
|
+
template <>
|
217
|
+
interval_t CastInterpolation::Interpolate(const interval_t &lo, const double d, const interval_t &hi) {
|
218
|
+
const interval_t delta = hi - lo;
|
219
|
+
return lo + MultiplyByDouble(delta, d);
|
220
|
+
}
|
221
|
+
|
210
222
|
template <>
|
211
223
|
string_t CastInterpolation::Cast(const std::string &src, Vector &result) {
|
212
224
|
return StringVector::AddString(result, src);
|
@@ -451,34 +463,34 @@ struct QuantileBindData : public FunctionData {
|
|
451
463
|
|
452
464
|
struct QuantileOperation {
|
453
465
|
template <class STATE>
|
454
|
-
static void Initialize(STATE
|
455
|
-
new (state) STATE;
|
466
|
+
static void Initialize(STATE &state) {
|
467
|
+
new (&state) STATE();
|
456
468
|
}
|
457
469
|
|
458
470
|
template <class INPUT_TYPE, class STATE, class OP>
|
459
|
-
static void ConstantOperation(STATE
|
460
|
-
|
471
|
+
static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
|
472
|
+
idx_t count) {
|
461
473
|
for (idx_t i = 0; i < count; i++) {
|
462
|
-
Operation<INPUT_TYPE, STATE, OP>(state,
|
474
|
+
Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
|
463
475
|
}
|
464
476
|
}
|
465
477
|
|
466
478
|
template <class INPUT_TYPE, class STATE, class OP>
|
467
|
-
static void Operation(STATE
|
468
|
-
state
|
479
|
+
static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &) {
|
480
|
+
state.v.emplace_back(input);
|
469
481
|
}
|
470
482
|
|
471
483
|
template <class STATE, class OP>
|
472
|
-
static void Combine(const STATE &source, STATE
|
484
|
+
static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
|
473
485
|
if (source.v.empty()) {
|
474
486
|
return;
|
475
487
|
}
|
476
|
-
target
|
488
|
+
target.v.insert(target.v.end(), source.v.begin(), source.v.end());
|
477
489
|
}
|
478
490
|
|
479
491
|
template <class STATE>
|
480
|
-
static void Destroy(
|
481
|
-
state
|
492
|
+
static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
|
493
|
+
state.~STATE();
|
482
494
|
}
|
483
495
|
|
484
496
|
static bool IgnoreNull() {
|
@@ -486,69 +498,35 @@ struct QuantileOperation {
|
|
486
498
|
}
|
487
499
|
};
|
488
500
|
|
489
|
-
template <class STATE_TYPE, class RESULT_TYPE, class OP>
|
490
|
-
static void ExecuteListFinalize(Vector &states, AggregateInputData &aggr_input_data, Vector &result,
|
491
|
-
idx_t count, // NOLINT
|
492
|
-
idx_t offset) {
|
493
|
-
D_ASSERT(result.GetType().id() == LogicalTypeId::LIST);
|
494
|
-
|
495
|
-
D_ASSERT(aggr_input_data.bind_data);
|
496
|
-
auto bind_data = (QuantileBindData *)aggr_input_data.bind_data;
|
497
|
-
|
498
|
-
if (states.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
499
|
-
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
500
|
-
ListVector::Reserve(result, bind_data->quantiles.size());
|
501
|
-
|
502
|
-
auto sdata = ConstantVector::GetData<STATE_TYPE *>(states);
|
503
|
-
auto rdata = ConstantVector::GetData<RESULT_TYPE>(result);
|
504
|
-
auto &mask = ConstantVector::Validity(result);
|
505
|
-
OP::template Finalize<RESULT_TYPE, STATE_TYPE>(result, aggr_input_data, sdata[0], rdata, mask, 0);
|
506
|
-
} else {
|
507
|
-
D_ASSERT(states.GetVectorType() == VectorType::FLAT_VECTOR);
|
508
|
-
result.SetVectorType(VectorType::FLAT_VECTOR);
|
509
|
-
ListVector::Reserve(result, (offset + count) * bind_data->quantiles.size());
|
510
|
-
|
511
|
-
auto sdata = FlatVector::GetData<STATE_TYPE *>(states);
|
512
|
-
auto rdata = FlatVector::GetData<RESULT_TYPE>(result);
|
513
|
-
auto &mask = FlatVector::Validity(result);
|
514
|
-
for (idx_t i = 0; i < count; i++) {
|
515
|
-
OP::template Finalize<RESULT_TYPE, STATE_TYPE>(result, aggr_input_data, sdata[i], rdata, mask, i + offset);
|
516
|
-
}
|
517
|
-
}
|
518
|
-
|
519
|
-
result.Verify(count);
|
520
|
-
}
|
521
|
-
|
522
501
|
template <class STATE, class INPUT_TYPE, class RESULT_TYPE, class OP>
|
523
502
|
static AggregateFunction QuantileListAggregate(const LogicalType &input_type, const LogicalType &child_type) { // NOLINT
|
524
503
|
LogicalType result_type = LogicalType::LIST(child_type);
|
525
504
|
return AggregateFunction(
|
526
505
|
{input_type}, result_type, AggregateFunction::StateSize<STATE>, AggregateFunction::StateInitialize<STATE, OP>,
|
527
506
|
AggregateFunction::UnaryScatterUpdate<STATE, INPUT_TYPE, OP>, AggregateFunction::StateCombine<STATE, OP>,
|
528
|
-
|
529
|
-
AggregateFunction::StateDestroy<STATE, OP>);
|
507
|
+
AggregateFunction::StateFinalize<STATE, RESULT_TYPE, OP>, AggregateFunction::UnaryUpdate<STATE, INPUT_TYPE, OP>,
|
508
|
+
nullptr, AggregateFunction::StateDestroy<STATE, OP>);
|
530
509
|
}
|
531
510
|
|
532
511
|
template <bool DISCRETE>
|
533
512
|
struct QuantileScalarOperation : public QuantileOperation {
|
534
513
|
|
535
|
-
template <class
|
536
|
-
static void Finalize(
|
537
|
-
|
538
|
-
|
539
|
-
mask.SetInvalid(idx);
|
514
|
+
template <class T, class STATE>
|
515
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
516
|
+
if (state.v.empty()) {
|
517
|
+
finalize_data.ReturnNull();
|
540
518
|
return;
|
541
519
|
}
|
542
|
-
D_ASSERT(
|
543
|
-
auto bind_data = (
|
544
|
-
D_ASSERT(bind_data
|
545
|
-
Interpolator<DISCRETE> interp(bind_data
|
546
|
-
target
|
520
|
+
D_ASSERT(finalize_data.input.bind_data);
|
521
|
+
auto &bind_data = finalize_data.input.bind_data->Cast<QuantileBindData>();
|
522
|
+
D_ASSERT(bind_data.quantiles.size() == 1);
|
523
|
+
Interpolator<DISCRETE> interp(bind_data.quantiles[0], state.v.size(), bind_data.desc);
|
524
|
+
target = interp.template Operation<typename STATE::SaveType, T>(state.v.data(), finalize_data.result);
|
547
525
|
}
|
548
526
|
|
549
527
|
template <class STATE, class INPUT_TYPE, class RESULT_TYPE>
|
550
528
|
static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
|
551
|
-
AggregateInputData &aggr_input_data, STATE
|
529
|
+
AggregateInputData &aggr_input_data, STATE &state, const FrameBounds &frame,
|
552
530
|
const FrameBounds &prev, Vector &result, idx_t ridx, idx_t bias) {
|
553
531
|
auto rdata = FlatVector::GetData<RESULT_TYPE>(result);
|
554
532
|
auto &rmask = FlatVector::Validity(result);
|
@@ -556,17 +534,17 @@ struct QuantileScalarOperation : public QuantileOperation {
|
|
556
534
|
QuantileIncluded included(fmask, dmask, bias);
|
557
535
|
|
558
536
|
// Lazily initialise frame state
|
559
|
-
auto prev_pos = state
|
560
|
-
state
|
537
|
+
auto prev_pos = state.pos;
|
538
|
+
state.SetPos(frame.second - frame.first);
|
561
539
|
|
562
|
-
auto index = state
|
540
|
+
auto index = state.w.data();
|
563
541
|
D_ASSERT(index);
|
564
542
|
|
565
543
|
D_ASSERT(aggr_input_data.bind_data);
|
566
|
-
auto bind_data =
|
544
|
+
auto &bind_data = aggr_input_data.bind_data->Cast<QuantileBindData>();
|
567
545
|
|
568
546
|
// Find the two positions needed
|
569
|
-
const auto q = bind_data
|
547
|
+
const auto q = bind_data.quantiles[0];
|
570
548
|
|
571
549
|
bool replace = false;
|
572
550
|
if (frame.first == prev.first + 1 && frame.second == prev.second + 1) {
|
@@ -577,7 +555,7 @@ struct QuantileScalarOperation : public QuantileOperation {
|
|
577
555
|
Interpolator<DISCRETE> interp(q, prev_pos, false);
|
578
556
|
replace = CanReplace(index, data, j, interp.FRN, interp.CRN, included);
|
579
557
|
if (replace) {
|
580
|
-
state
|
558
|
+
state.pos = prev_pos;
|
581
559
|
}
|
582
560
|
}
|
583
561
|
} else {
|
@@ -586,10 +564,10 @@ struct QuantileScalarOperation : public QuantileOperation {
|
|
586
564
|
|
587
565
|
if (!replace && !included.AllValid()) {
|
588
566
|
// Remove the NULLs
|
589
|
-
state
|
567
|
+
state.pos = std::partition(index, index + state.pos, included) - index;
|
590
568
|
}
|
591
|
-
if (state
|
592
|
-
Interpolator<DISCRETE> interp(q, state
|
569
|
+
if (state.pos) {
|
570
|
+
Interpolator<DISCRETE> interp(q, state.pos, false);
|
593
571
|
|
594
572
|
using ID = QuantileIndirect<INPUT_TYPE>;
|
595
573
|
ID indirect(data);
|
@@ -661,46 +639,45 @@ AggregateFunction GetDiscreteQuantileAggregateFunction(const LogicalType &type)
|
|
661
639
|
template <class CHILD_TYPE, bool DISCRETE>
|
662
640
|
struct QuantileListOperation : public QuantileOperation {
|
663
641
|
|
664
|
-
template <class
|
665
|
-
static void Finalize(
|
666
|
-
|
667
|
-
|
668
|
-
mask.SetInvalid(idx);
|
642
|
+
template <class T, class STATE>
|
643
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
644
|
+
if (state.v.empty()) {
|
645
|
+
finalize_data.ReturnNull();
|
669
646
|
return;
|
670
647
|
}
|
671
648
|
|
672
|
-
D_ASSERT(
|
673
|
-
auto bind_data = (
|
649
|
+
D_ASSERT(finalize_data.input.bind_data);
|
650
|
+
auto &bind_data = finalize_data.input.bind_data->Cast<QuantileBindData>();
|
674
651
|
|
675
|
-
auto &result = ListVector::GetEntry(
|
676
|
-
auto ridx = ListVector::GetListSize(
|
677
|
-
ListVector::Reserve(
|
652
|
+
auto &result = ListVector::GetEntry(finalize_data.result);
|
653
|
+
auto ridx = ListVector::GetListSize(finalize_data.result);
|
654
|
+
ListVector::Reserve(finalize_data.result, ridx + bind_data.quantiles.size());
|
678
655
|
auto rdata = FlatVector::GetData<CHILD_TYPE>(result);
|
679
656
|
|
680
|
-
auto v_t = state
|
657
|
+
auto v_t = state.v.data();
|
681
658
|
D_ASSERT(v_t);
|
682
659
|
|
683
|
-
auto &entry = target
|
660
|
+
auto &entry = target;
|
684
661
|
entry.offset = ridx;
|
685
662
|
idx_t lower = 0;
|
686
|
-
for (const auto &q : bind_data
|
687
|
-
const auto &quantile = bind_data
|
688
|
-
Interpolator<DISCRETE> interp(quantile, state
|
663
|
+
for (const auto &q : bind_data.order) {
|
664
|
+
const auto &quantile = bind_data.quantiles[q];
|
665
|
+
Interpolator<DISCRETE> interp(quantile, state.v.size(), bind_data.desc);
|
689
666
|
interp.begin = lower;
|
690
667
|
rdata[ridx + q] = interp.template Operation<typename STATE::SaveType, CHILD_TYPE>(v_t, result);
|
691
668
|
lower = interp.FRN;
|
692
669
|
}
|
693
|
-
entry.length = bind_data
|
670
|
+
entry.length = bind_data.quantiles.size();
|
694
671
|
|
695
|
-
ListVector::SetListSize(
|
672
|
+
ListVector::SetListSize(finalize_data.result, entry.offset + entry.length);
|
696
673
|
}
|
697
674
|
|
698
675
|
template <class STATE, class INPUT_TYPE, class RESULT_TYPE>
|
699
676
|
static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
|
700
|
-
AggregateInputData &aggr_input_data, STATE
|
677
|
+
AggregateInputData &aggr_input_data, STATE &state, const FrameBounds &frame,
|
701
678
|
const FrameBounds &prev, Vector &list, idx_t lidx, idx_t bias) {
|
702
679
|
D_ASSERT(aggr_input_data.bind_data);
|
703
|
-
auto bind_data =
|
680
|
+
auto &bind_data = aggr_input_data.bind_data->Cast<QuantileBindData>();
|
704
681
|
|
705
682
|
QuantileIncluded included(fmask, dmask, bias);
|
706
683
|
|
@@ -709,7 +686,7 @@ struct QuantileListOperation : public QuantileOperation {
|
|
709
686
|
auto &lmask = FlatVector::Validity(list);
|
710
687
|
auto &lentry = ldata[lidx];
|
711
688
|
lentry.offset = ListVector::GetListSize(list);
|
712
|
-
lentry.length = bind_data
|
689
|
+
lentry.length = bind_data.quantiles.size();
|
713
690
|
|
714
691
|
ListVector::Reserve(list, lentry.offset + lentry.length);
|
715
692
|
ListVector::SetListSize(list, lentry.offset + lentry.length);
|
@@ -717,10 +694,10 @@ struct QuantileListOperation : public QuantileOperation {
|
|
717
694
|
auto rdata = FlatVector::GetData<CHILD_TYPE>(result);
|
718
695
|
|
719
696
|
// Lazily initialise frame state
|
720
|
-
auto prev_pos = state
|
721
|
-
state
|
697
|
+
auto prev_pos = state.pos;
|
698
|
+
state.SetPos(frame.second - frame.first);
|
722
699
|
|
723
|
-
auto index = state
|
700
|
+
auto index = state.w.data();
|
724
701
|
|
725
702
|
// We can generalise replacement for quantile lists by observing that when a replacement is
|
726
703
|
// valid for a single quantile, it is valid for all quantiles greater/less than that quantile
|
@@ -728,14 +705,14 @@ struct QuantileListOperation : public QuantileOperation {
|
|
728
705
|
// So if a replaced index in an IQR is located between Q25 and Q50, but has a value below Q25,
|
729
706
|
// then Q25 must be recomputed, but Q50 and Q75 are unaffected.
|
730
707
|
// For a single element list, this reduces to the scalar case.
|
731
|
-
std::pair<idx_t, idx_t> replaceable {state
|
708
|
+
std::pair<idx_t, idx_t> replaceable {state.pos, 0};
|
732
709
|
if (frame.first == prev.first + 1 && frame.second == prev.second + 1) {
|
733
710
|
// Fixed frame size
|
734
711
|
const auto j = ReplaceIndex(index, frame, prev);
|
735
712
|
// We can only replace if the number of NULLs has not changed
|
736
713
|
if (included.AllValid() || included(prev.first) == included(prev.second)) {
|
737
|
-
for (const auto &q : bind_data
|
738
|
-
const auto &quantile = bind_data
|
714
|
+
for (const auto &q : bind_data.order) {
|
715
|
+
const auto &quantile = bind_data.quantiles[q];
|
739
716
|
Interpolator<DISCRETE> interp(quantile, prev_pos, false);
|
740
717
|
const auto replace = CanReplace(index, data, j, interp.FRN, interp.CRN, included);
|
741
718
|
if (replace < 0) {
|
@@ -750,7 +727,7 @@ struct QuantileListOperation : public QuantileOperation {
|
|
750
727
|
}
|
751
728
|
}
|
752
729
|
if (replaceable.first < replaceable.second) {
|
753
|
-
state
|
730
|
+
state.pos = prev_pos;
|
754
731
|
}
|
755
732
|
}
|
756
733
|
} else {
|
@@ -759,15 +736,15 @@ struct QuantileListOperation : public QuantileOperation {
|
|
759
736
|
|
760
737
|
if (replaceable.first >= replaceable.second && !included.AllValid()) {
|
761
738
|
// Remove the NULLs
|
762
|
-
state
|
739
|
+
state.pos = std::partition(index, index + state.pos, included) - index;
|
763
740
|
}
|
764
741
|
|
765
|
-
if (state
|
742
|
+
if (state.pos) {
|
766
743
|
using ID = QuantileIndirect<INPUT_TYPE>;
|
767
744
|
ID indirect(data);
|
768
|
-
for (const auto &q : bind_data
|
769
|
-
const auto &quantile = bind_data
|
770
|
-
Interpolator<DISCRETE> interp(quantile, state
|
745
|
+
for (const auto &q : bind_data.order) {
|
746
|
+
const auto &quantile = bind_data.quantiles[q];
|
747
|
+
Interpolator<DISCRETE> interp(quantile, state.pos, false);
|
771
748
|
if (replaceable.first <= interp.FRN && interp.CRN <= replaceable.second) {
|
772
749
|
rdata[lentry.offset + q] = interp.template Replace<idx_t, CHILD_TYPE, ID>(index, result, indirect);
|
773
750
|
} else {
|
@@ -1035,24 +1012,23 @@ struct MadAccessor<dtime_t, interval_t, dtime_t> {
|
|
1035
1012
|
template <typename MEDIAN_TYPE>
|
1036
1013
|
struct MedianAbsoluteDeviationOperation : public QuantileOperation {
|
1037
1014
|
|
1038
|
-
template <class
|
1039
|
-
static void Finalize(
|
1040
|
-
|
1041
|
-
|
1042
|
-
mask.SetInvalid(idx);
|
1015
|
+
template <class T, class STATE>
|
1016
|
+
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
|
1017
|
+
if (state.v.empty()) {
|
1018
|
+
finalize_data.ReturnNull();
|
1043
1019
|
return;
|
1044
1020
|
}
|
1045
1021
|
using SAVE_TYPE = typename STATE::SaveType;
|
1046
|
-
Interpolator<false> interp(0.5, state
|
1047
|
-
const auto med = interp.template Operation<SAVE_TYPE, MEDIAN_TYPE>(state
|
1022
|
+
Interpolator<false> interp(0.5, state.v.size(), false);
|
1023
|
+
const auto med = interp.template Operation<SAVE_TYPE, MEDIAN_TYPE>(state.v.data(), finalize_data.result);
|
1048
1024
|
|
1049
|
-
MadAccessor<SAVE_TYPE,
|
1050
|
-
target
|
1025
|
+
MadAccessor<SAVE_TYPE, T, MEDIAN_TYPE> accessor(med);
|
1026
|
+
target = interp.template Operation<SAVE_TYPE, T>(state.v.data(), finalize_data.result, accessor);
|
1051
1027
|
}
|
1052
1028
|
|
1053
1029
|
template <class STATE, class INPUT_TYPE, class RESULT_TYPE>
|
1054
1030
|
static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
|
1055
|
-
AggregateInputData &, STATE
|
1031
|
+
AggregateInputData &, STATE &state, const FrameBounds &frame, const FrameBounds &prev,
|
1056
1032
|
Vector &result, idx_t ridx, idx_t bias) {
|
1057
1033
|
auto rdata = FlatVector::GetData<RESULT_TYPE>(result);
|
1058
1034
|
auto &rmask = FlatVector::Validity(result);
|
@@ -1060,25 +1036,25 @@ struct MedianAbsoluteDeviationOperation : public QuantileOperation {
|
|
1060
1036
|
QuantileIncluded included(fmask, dmask, bias);
|
1061
1037
|
|
1062
1038
|
// Lazily initialise frame state
|
1063
|
-
auto prev_pos = state
|
1064
|
-
state
|
1039
|
+
auto prev_pos = state.pos;
|
1040
|
+
state.SetPos(frame.second - frame.first);
|
1065
1041
|
|
1066
|
-
auto index = state
|
1042
|
+
auto index = state.w.data();
|
1067
1043
|
D_ASSERT(index);
|
1068
1044
|
|
1069
1045
|
// We need a second index for the second pass.
|
1070
|
-
if (state
|
1071
|
-
state
|
1046
|
+
if (state.pos > state.m.size()) {
|
1047
|
+
state.m.resize(state.pos);
|
1072
1048
|
}
|
1073
1049
|
|
1074
|
-
auto index2 = state
|
1050
|
+
auto index2 = state.m.data();
|
1075
1051
|
D_ASSERT(index2);
|
1076
1052
|
|
1077
1053
|
// The replacement trick does not work on the second index because if
|
1078
1054
|
// the median has changed, the previous order is not correct.
|
1079
1055
|
// It is probably close, however, and so reuse is helpful.
|
1080
1056
|
ReuseIndexes(index2, frame, prev);
|
1081
|
-
std::partition(index2, index2 + state
|
1057
|
+
std::partition(index2, index2 + state.pos, included);
|
1082
1058
|
|
1083
1059
|
// Find the two positions needed for the median
|
1084
1060
|
const float q = 0.5;
|
@@ -1092,7 +1068,7 @@ struct MedianAbsoluteDeviationOperation : public QuantileOperation {
|
|
1092
1068
|
Interpolator<false> interp(q, prev_pos, false);
|
1093
1069
|
replace = CanReplace(index, data, j, interp.FRN, interp.CRN, included);
|
1094
1070
|
if (replace) {
|
1095
|
-
state
|
1071
|
+
state.pos = prev_pos;
|
1096
1072
|
}
|
1097
1073
|
}
|
1098
1074
|
} else {
|
@@ -1101,11 +1077,11 @@ struct MedianAbsoluteDeviationOperation : public QuantileOperation {
|
|
1101
1077
|
|
1102
1078
|
if (!replace && !included.AllValid()) {
|
1103
1079
|
// Remove the NULLs
|
1104
|
-
state
|
1080
|
+
state.pos = std::partition(index, index + state.pos, included) - index;
|
1105
1081
|
}
|
1106
1082
|
|
1107
|
-
if (state
|
1108
|
-
Interpolator<false> interp(q, state
|
1083
|
+
if (state.pos) {
|
1084
|
+
Interpolator<false> interp(q, state.pos, false);
|
1109
1085
|
|
1110
1086
|
// Compute or replace median from the first index
|
1111
1087
|
using ID = QuantileIndirect<INPUT_TYPE>;
|
@@ -1177,16 +1153,27 @@ AggregateFunction GetMedianAbsoluteDeviationAggregateFunction(const LogicalType
|
|
1177
1153
|
|
1178
1154
|
static void QuantileSerialize(FieldWriter &writer, const FunctionData *bind_data_p, const AggregateFunction &function) {
|
1179
1155
|
D_ASSERT(bind_data_p);
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1156
|
+
auto bind_data = dynamic_cast<const QuantileBindData *>(bind_data_p);
|
1157
|
+
D_ASSERT(bind_data);
|
1158
|
+
writer.WriteRegularSerializableList<Value>(bind_data->quantiles);
|
1159
|
+
writer.WriteList<idx_t>(bind_data->order);
|
1160
|
+
writer.WriteField<bool>(bind_data->desc);
|
1184
1161
|
}
|
1185
1162
|
|
1186
1163
|
unique_ptr<FunctionData> QuantileDeserialize(ClientContext &context, FieldReader &reader,
|
1187
1164
|
AggregateFunction &bound_function) {
|
1188
|
-
auto quantiles = reader.
|
1189
|
-
|
1165
|
+
auto quantiles = reader.ReadRequiredSerializableList<Value, Value>();
|
1166
|
+
auto bind_data = make_uniq<QuantileBindData>(quantiles);
|
1167
|
+
bind_data->quantiles = quantiles;
|
1168
|
+
bind_data->order = reader.ReadRequiredList<idx_t>();
|
1169
|
+
bind_data->desc = reader.ReadRequired<bool>();
|
1170
|
+
|
1171
|
+
return std::move(bind_data);
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
static void QuantileDecimalSerialize(FieldWriter &writer, const FunctionData *bind_data_p,
|
1175
|
+
const AggregateFunction &function) {
|
1176
|
+
throw NotImplementedException("FIXME: serializing quantiles with decimals is not supported right now");
|
1190
1177
|
}
|
1191
1178
|
|
1192
1179
|
unique_ptr<FunctionData> BindMedian(ClientContext &context, AggregateFunction &function,
|
@@ -1200,7 +1187,7 @@ unique_ptr<FunctionData> BindMedianDecimal(ClientContext &context, AggregateFunc
|
|
1200
1187
|
|
1201
1188
|
function = GetDiscreteQuantileAggregateFunction(arguments[0]->return_type);
|
1202
1189
|
function.name = "median";
|
1203
|
-
function.serialize =
|
1190
|
+
function.serialize = QuantileDecimalSerialize;
|
1204
1191
|
function.deserialize = QuantileDeserialize;
|
1205
1192
|
function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
|
1206
1193
|
return bind_data;
|
@@ -1251,11 +1238,6 @@ unique_ptr<FunctionData> BindQuantile(ClientContext &context, AggregateFunction
|
|
1251
1238
|
return make_uniq<QuantileBindData>(quantiles);
|
1252
1239
|
}
|
1253
1240
|
|
1254
|
-
static void QuantileDecimalSerialize(FieldWriter &writer, const FunctionData *bind_data_p,
|
1255
|
-
const AggregateFunction &function) {
|
1256
|
-
throw NotImplementedException("FIXME: serializing quantiles with decimals is not supported right now");
|
1257
|
-
}
|
1258
|
-
|
1259
1241
|
unique_ptr<FunctionData> BindDiscreteQuantileDecimal(ClientContext &context, AggregateFunction &function,
|
1260
1242
|
vector<unique_ptr<Expression>> &arguments) {
|
1261
1243
|
auto bind_data = BindQuantile(context, function, arguments);
|