duckdb 0.8.2-dev4142.0 → 0.8.2-dev4314.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 +0 -2
- package/lib/duckdb.js +3 -3
- package/package.json +1 -1
- package/src/connection.cpp +9 -8
- package/src/database.cpp +5 -8
- package/src/duckdb/extension/icu/icu-datepart.cpp +2 -2
- package/src/duckdb/extension/icu/icu-strptime.cpp +0 -9
- package/src/duckdb/extension/icu/icu_extension.cpp +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/gregocal.h +1 -1
- package/src/duckdb/extension/json/buffered_json_reader.cpp +3 -17
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +2 -5
- package/src/duckdb/extension/json/include/json_deserializer.hpp +2 -2
- package/src/duckdb/extension/json/include/json_scan.hpp +5 -12
- package/src/duckdb/extension/json/include/json_serializer.hpp +3 -3
- package/src/duckdb/extension/json/include/json_transform.hpp +2 -5
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +2 -18
- package/src/duckdb/extension/json/json_scan.cpp +7 -76
- package/src/duckdb/extension/json/serialize_json.cpp +8 -8
- package/src/duckdb/extension/parquet/column_writer.cpp +46 -45
- package/src/duckdb/extension/parquet/include/column_writer.hpp +2 -2
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +2 -5
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_encoder.hpp +4 -4
- package/src/duckdb/extension/parquet/parquet_extension.cpp +74 -55
- package/src/duckdb/extension/parquet/parquet_writer.cpp +3 -2
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +0 -1
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +0 -1
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +0 -1
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +0 -1
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +0 -2
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +1 -3
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +0 -1
- package/src/duckdb/src/catalog/catalog_entry.cpp +2 -11
- package/src/duckdb/src/catalog/catalog_set.cpp +16 -14
- package/src/duckdb/src/catalog/default/default_functions.cpp +2 -2
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +0 -1
- package/src/duckdb/src/common/constants.cpp +0 -1
- package/src/duckdb/src/common/enum_util.cpp +0 -10
- package/src/duckdb/src/common/exception.cpp +1 -1
- package/src/duckdb/src/common/extra_type_info.cpp +20 -192
- package/src/duckdb/src/common/multi_file_reader.cpp +0 -68
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +9 -4
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +3 -11
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +1 -1
- package/src/duckdb/src/common/serializer/memory_stream.cpp +61 -0
- package/src/duckdb/src/common/serializer/{format_serializer.cpp → serializer.cpp} +2 -2
- package/src/duckdb/src/common/sort/partition_state.cpp +107 -29
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +4 -4
- package/src/duckdb/src/common/types/data_chunk.cpp +11 -43
- package/src/duckdb/src/common/types/hyperloglog.cpp +4 -23
- package/src/duckdb/src/common/types/interval.cpp +2 -2
- package/src/duckdb/src/common/types/value.cpp +10 -135
- package/src/duckdb/src/common/types/vector.cpp +17 -149
- package/src/duckdb/src/common/types.cpp +2 -20
- package/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp +0 -1
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +6 -7
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +5 -28
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +30 -78
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +5 -30
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +6 -9
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +21 -16
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +15 -23
- package/src/duckdb/src/execution/index/art/art.cpp +5 -1
- package/src/duckdb/src/execution/index/art/leaf.cpp +13 -10
- package/src/duckdb/src/execution/index/art/node48.cpp +0 -2
- package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +38 -73
- package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +245 -27
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +2 -3
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +35 -20
- package/src/duckdb/src/function/macro_function.cpp +0 -42
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +10 -8
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +13 -12
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +9 -11
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +7 -33
- package/src/duckdb/src/function/scalar_function.cpp +1 -2
- package/src/duckdb/src/function/scalar_macro_function.cpp +0 -10
- package/src/duckdb/src/function/table/copy_csv.cpp +38 -38
- package/src/duckdb/src/function/table/read_csv.cpp +5 -174
- package/src/duckdb/src/function/table/table_scan.cpp +5 -42
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_function.cpp +3 -4
- package/src/duckdb/src/function/table_macro_function.cpp +0 -10
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +0 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +0 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +0 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +3 -8
- package/src/duckdb/src/include/duckdb/common/constants.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +16 -46
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +2 -6
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +44 -23
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +31 -23
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +4 -6
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/serializer/{format_deserializer.hpp → deserializer.hpp} +13 -13
- package/src/duckdb/src/include/duckdb/common/serializer/memory_stream.hpp +62 -0
- package/src/duckdb/src/include/duckdb/common/serializer/read_stream.hpp +38 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +15 -13
- package/src/duckdb/src/include/duckdb/common/serializer/{format_serializer.hpp → serializer.hpp} +13 -12
- package/src/duckdb/src/include/duckdb/common/serializer/write_stream.hpp +36 -0
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +14 -4
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +3 -8
- package/src/duckdb/src/include/duckdb/common/types/hyperloglog.hpp +4 -10
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +1 -5
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +2 -7
- package/src/duckdb/src/include/duckdb/common/types.hpp +1 -10
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +1 -7
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +38 -8
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_reader_options.hpp +2 -11
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +4 -14
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +15 -98
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +1 -7
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +9 -10
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -12
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +2 -7
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +4 -16
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +2 -11
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +2 -7
- package/src/duckdb/src/include/duckdb/main/relation.hpp +9 -2
- package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +1 -4
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/constraint.hpp +2 -12
- package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +1 -4
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +4 -6
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_scalar_function_info.hpp +0 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_function_info.hpp +0 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +24 -51
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +1 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_collation_info.hpp +0 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_copy_function_info.hpp +0 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +0 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +1 -13
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +2 -8
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +2 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +2 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +2 -21
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +1 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +5 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_expression.hpp +3 -16
- package/src/duckdb/src/include/duckdb/parser/query_node/cte_node.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/query_node/recursive_cte_node.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/query_node/select_node.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/query_node/set_operation_node.hpp +2 -4
- package/src/duckdb/src/include/duckdb/parser/query_node.hpp +7 -14
- package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +14 -32
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +4 -9
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +6 -14
- package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +2 -6
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +2 -10
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +0 -1
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +2 -8
- package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +4 -4
- package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +3 -9
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +2 -8
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +2 -8
- package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +2 -19
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +0 -3
- package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +2 -14
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +4 -8
- package/src/duckdb/src/include/duckdb/planner/filter/constant_filter.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/filter/null_filter.hpp +4 -8
- package/src/duckdb/src/include/duckdb/planner/joinside.hpp +1 -6
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +2 -17
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +2 -6
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dependent_join.hpp +0 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +0 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +2 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +1 -3
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +0 -5
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +3 -12
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/block.hpp +7 -4
- package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +6 -6
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +18 -18
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +6 -0
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +4 -5
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_reader.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_writer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +35 -19
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +2 -11
- package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +3 -5
- package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +3 -11
- package/src/duckdb/src/include/duckdb/storage/statistics/list_stats.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/statistics/node_statistics.hpp +0 -26
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/statistics/struct_stats.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +4 -6
- package/src/duckdb/src/include/duckdb/storage/table/chunk_info.hpp +8 -17
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +5 -20
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +4 -7
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +27 -29
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +0 -2
- package/src/duckdb/src/main/client_context.cpp +0 -6
- package/src/duckdb/src/main/client_verify.cpp +0 -2
- package/src/duckdb/src/main/extension/extension_helper.cpp +1 -0
- package/src/duckdb/src/main/relation.cpp +15 -2
- package/src/duckdb/src/parser/column_definition.cpp +0 -25
- package/src/duckdb/src/parser/column_list.cpp +0 -13
- package/src/duckdb/src/parser/constraint.cpp +0 -33
- package/src/duckdb/src/parser/constraints/check_constraint.cpp +0 -11
- package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +0 -27
- package/src/duckdb/src/parser/constraints/not_null_constraint.cpp +0 -11
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +0 -24
- package/src/duckdb/src/parser/expression/between_expression.cpp +2 -16
- package/src/duckdb/src/parser/expression/case_expression.cpp +2 -29
- package/src/duckdb/src/parser/expression/cast_expression.cpp +2 -16
- package/src/duckdb/src/parser/expression/collate_expression.cpp +2 -14
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +2 -13
- package/src/duckdb/src/parser/expression/comparison_expression.cpp +2 -14
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +2 -13
- package/src/duckdb/src/parser/expression/constant_expression.cpp +2 -12
- package/src/duckdb/src/parser/expression/default_expression.cpp +2 -9
- package/src/duckdb/src/parser/expression/function_expression.cpp +2 -32
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +2 -14
- package/src/duckdb/src/parser/expression/operator_expression.cpp +2 -13
- package/src/duckdb/src/parser/expression/parameter_expression.cpp +2 -13
- package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +2 -12
- package/src/duckdb/src/parser/expression/star_expression.cpp +2 -43
- package/src/duckdb/src/parser/expression/subquery_expression.cpp +2 -28
- package/src/duckdb/src/parser/expression/window_expression.cpp +2 -53
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +0 -35
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +0 -18
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +0 -13
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +1 -189
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +0 -29
- package/src/duckdb/src/parser/parsed_data/create_collation_info.cpp +0 -4
- package/src/duckdb/src/parser/parsed_data/create_copy_function_info.cpp +0 -4
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +0 -48
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +0 -47
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +1 -28
- package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +0 -31
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +0 -23
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +0 -22
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +0 -23
- package/src/duckdb/src/parser/parsed_data/detach_info.cpp +0 -19
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +0 -26
- package/src/duckdb/src/parser/parsed_data/sample_options.cpp +2 -25
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +0 -16
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +0 -20
- package/src/duckdb/src/parser/parsed_expression.cpp +2 -79
- package/src/duckdb/src/parser/query_node/cte_node.cpp +2 -19
- package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +2 -21
- package/src/duckdb/src/parser/query_node/select_node.cpp +2 -47
- package/src/duckdb/src/parser/query_node/set_operation_node.cpp +2 -17
- package/src/duckdb/src/parser/query_node.cpp +2 -62
- package/src/duckdb/src/parser/result_modifier.cpp +2 -96
- package/src/duckdb/src/parser/statement/select_statement.cpp +2 -13
- package/src/duckdb/src/parser/tableref/basetableref.cpp +2 -21
- package/src/duckdb/src/parser/tableref/emptytableref.cpp +0 -9
- package/src/duckdb/src/parser/tableref/expressionlistref.cpp +2 -28
- package/src/duckdb/src/parser/tableref/joinref.cpp +2 -23
- package/src/duckdb/src/parser/tableref/pivotref.cpp +0 -61
- package/src/duckdb/src/parser/tableref/subqueryref.cpp +2 -15
- package/src/duckdb/src/parser/tableref/table_function.cpp +2 -17
- package/src/duckdb/src/parser/tableref.cpp +2 -52
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +1 -4
- package/src/duckdb/src/planner/bound_result_modifier.cpp +0 -33
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +6 -30
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +0 -19
- package/src/duckdb/src/planner/expression/bound_case_expression.cpp +0 -36
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +0 -15
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +0 -20
- package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +0 -13
- package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +0 -13
- package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +0 -11
- package/src/duckdb/src/planner/expression/bound_expression.cpp +1 -5
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -28
- package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +0 -4
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +0 -23
- package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +0 -16
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +0 -18
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +0 -16
- package/src/duckdb/src/planner/expression/bound_subquery_expression.cpp +0 -4
- package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +0 -15
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +7 -60
- package/src/duckdb/src/planner/expression.cpp +0 -74
- package/src/duckdb/src/planner/filter/conjunction_filter.cpp +0 -21
- package/src/duckdb/src/planner/filter/constant_filter.cpp +0 -12
- package/src/duckdb/src/planner/filter/null_filter.cpp +0 -14
- package/src/duckdb/src/planner/joinside.cpp +0 -24
- package/src/duckdb/src/planner/logical_operator.cpp +15 -215
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +0 -46
- package/src/duckdb/src/planner/operator/logical_any_join.cpp +0 -14
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +0 -23
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +0 -23
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -56
- package/src/duckdb/src/planner/operator/logical_create.cpp +0 -12
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +0 -25
- package/src/duckdb/src/planner/operator/logical_create_table.cpp +0 -10
- package/src/duckdb/src/planner/operator/logical_cross_product.cpp +0 -9
- package/src/duckdb/src/planner/operator/logical_cteref.cpp +0 -18
- package/src/duckdb/src/planner/operator/logical_delete.cpp +0 -22
- package/src/duckdb/src/planner/operator/logical_delim_get.cpp +0 -12
- package/src/duckdb/src/planner/operator/logical_dependent_join.cpp +0 -4
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +0 -16
- package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +0 -10
- package/src/duckdb/src/planner/operator/logical_empty_result.cpp +0 -15
- package/src/duckdb/src/planner/operator/logical_expression_get.cpp +0 -24
- package/src/duckdb/src/planner/operator/logical_extension_operator.cpp +6 -19
- package/src/duckdb/src/planner/operator/logical_filter.cpp +0 -15
- package/src/duckdb/src/planner/operator/logical_get.cpp +12 -97
- package/src/duckdb/src/planner/operator/logical_insert.cpp +0 -77
- package/src/duckdb/src/planner/operator/logical_join.cpp +0 -17
- package/src/duckdb/src/planner/operator/logical_limit.cpp +0 -16
- package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +0 -16
- package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +0 -13
- package/src/duckdb/src/planner/operator/logical_order.cpp +0 -15
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +0 -20
- package/src/duckdb/src/planner/operator/logical_positional_join.cpp +0 -10
- package/src/duckdb/src/planner/operator/logical_pragma.cpp +0 -8
- package/src/duckdb/src/planner/operator/logical_prepare.cpp +0 -8
- package/src/duckdb/src/planner/operator/logical_projection.cpp +0 -12
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +0 -15
- package/src/duckdb/src/planner/operator/logical_reset.cpp +0 -12
- package/src/duckdb/src/planner/operator/logical_sample.cpp +0 -11
- package/src/duckdb/src/planner/operator/logical_set.cpp +0 -14
- package/src/duckdb/src/planner/operator/logical_set_operation.cpp +0 -13
- package/src/duckdb/src/planner/operator/logical_simple.cpp +0 -60
- package/src/duckdb/src/planner/operator/logical_top_n.cpp +0 -14
- package/src/duckdb/src/planner/operator/logical_unnest.cpp +0 -14
- package/src/duckdb/src/planner/operator/logical_update.cpp +0 -28
- package/src/duckdb/src/planner/operator/logical_window.cpp +0 -13
- package/src/duckdb/src/planner/planner.cpp +13 -22
- package/src/duckdb/src/planner/table_filter.cpp +0 -59
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +7 -17
- package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +7 -4
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +24 -22
- package/src/duckdb/src/storage/checkpoint_manager.cpp +203 -180
- package/src/duckdb/src/storage/data_table.cpp +2 -2
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +11 -9
- package/src/duckdb/src/storage/partial_block_manager.cpp +42 -15
- package/src/duckdb/src/storage/serialization/serialize_constraint.cpp +20 -20
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +46 -42
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +63 -63
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +167 -165
- package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +12 -12
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +54 -54
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +88 -88
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +72 -72
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +20 -20
- package/src/duckdb/src/storage/serialization/serialize_result_modifier.cpp +22 -22
- package/src/duckdb/src/storage/serialization/serialize_statement.cpp +4 -4
- package/src/duckdb/src/storage/serialization/serialize_storage.cpp +41 -6
- package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +24 -24
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +32 -32
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +29 -29
- package/src/duckdb/src/storage/single_file_block_manager.cpp +17 -22
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +31 -85
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +6 -19
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +0 -26
- package/src/duckdb/src/storage/statistics/list_stats.cpp +6 -22
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +20 -135
- package/src/duckdb/src/storage/statistics/string_stats.cpp +5 -28
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +8 -30
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/table/chunk_info.cpp +9 -88
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +28 -34
- package/src/duckdb/src/storage/table/column_data.cpp +20 -25
- package/src/duckdb/src/storage/table/list_column_data.cpp +16 -9
- package/src/duckdb/src/storage/table/row_group.cpp +16 -92
- package/src/duckdb/src/storage/table/row_group_collection.cpp +5 -1
- package/src/duckdb/src/storage/table/standard_column_data.cpp +10 -7
- package/src/duckdb/src/storage/table/struct_column_data.cpp +17 -11
- package/src/duckdb/src/storage/table/table_statistics.cpp +13 -22
- package/src/duckdb/src/storage/wal_replay.cpp +108 -106
- package/src/duckdb/src/storage/write_ahead_log.cpp +135 -64
- package/src/duckdb/src/transaction/commit_state.cpp +22 -8
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +11 -6
- package/src/duckdb/src/verification/statement_verifier.cpp +0 -5
- package/src/duckdb/third_party/parquet/parquet_types.h +1 -1
- package/src/duckdb/ub_src_common.cpp +0 -4
- package/src/duckdb/ub_src_common_serializer.cpp +2 -4
- package/src/duckdb/ub_src_planner.cpp +0 -2
- package/src/duckdb/ub_src_planner_expression.cpp +0 -2
- package/src/duckdb/ub_src_planner_operator.cpp +0 -8
- package/src/duckdb_node.cpp +6 -12
- package/src/duckdb_node.hpp +23 -13
- package/src/statement.cpp +15 -16
- package/test/database_fail.test.ts +20 -0
- package/test/worker.js +7 -0
- package/src/duckdb/src/common/field_writer.cpp +0 -97
- package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +0 -27
- package/src/duckdb/src/common/serializer/buffered_serializer.cpp +0 -36
- package/src/duckdb/src/common/serializer.cpp +0 -24
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +0 -379
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_deserializer.hpp +0 -41
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_serializer.hpp +0 -50
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +0 -151
- package/src/duckdb/src/include/duckdb/planner/plan_serialization.hpp +0 -44
- package/src/duckdb/src/include/duckdb/verification/deserialized_statement_verifier_v2.hpp +0 -32
- package/src/duckdb/src/planner/expression/bound_default_expression.cpp +0 -16
- package/src/duckdb/src/planner/operator/logical_execute.cpp +0 -12
- package/src/duckdb/src/planner/operator/logical_explain.cpp +0 -22
- package/src/duckdb/src/planner/operator/logical_export.cpp +0 -13
- package/src/duckdb/src/planner/operator/logical_show.cpp +0 -21
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +0 -22
- package/src/duckdb/src/planner/plan_serialization.cpp +0 -20
- package/src/duckdb/src/verification/deserialized_statement_verifier_v2.cpp +0 -34
- package/src/duckdb/ub_src_planner_parsed_data.cpp +0 -2
@@ -5,70 +5,288 @@
|
|
5
5
|
|
6
6
|
namespace duckdb {
|
7
7
|
|
8
|
+
//===--------------------------------------------------------------------===//
|
9
|
+
// PartialBlockForIndex
|
10
|
+
//===--------------------------------------------------------------------===//
|
11
|
+
|
12
|
+
PartialBlockForIndex::PartialBlockForIndex(PartialBlockState state, BlockManager &block_manager,
|
13
|
+
const shared_ptr<BlockHandle> &block_handle)
|
14
|
+
: PartialBlock(state, block_manager, block_handle) {
|
15
|
+
}
|
16
|
+
|
17
|
+
void PartialBlockForIndex::Flush(const idx_t free_space_left) {
|
18
|
+
FlushInternal(free_space_left);
|
19
|
+
block_handle = block_manager.ConvertToPersistent(state.block_id, std::move(block_handle));
|
20
|
+
Clear();
|
21
|
+
}
|
22
|
+
|
23
|
+
void PartialBlockForIndex::Merge(PartialBlock &other, idx_t offset, idx_t other_size) {
|
24
|
+
throw InternalException("no merge for PartialBlockForIndex");
|
25
|
+
}
|
26
|
+
|
27
|
+
void PartialBlockForIndex::Clear() {
|
28
|
+
block_handle.reset();
|
29
|
+
}
|
30
|
+
|
31
|
+
//===--------------------------------------------------------------------===//
|
32
|
+
// FixedSizeBuffer
|
33
|
+
//===--------------------------------------------------------------------===//
|
34
|
+
|
35
|
+
constexpr idx_t FixedSizeBuffer::BASE[];
|
36
|
+
constexpr uint8_t FixedSizeBuffer::SHIFT[];
|
37
|
+
|
8
38
|
FixedSizeBuffer::FixedSizeBuffer(BlockManager &block_manager)
|
9
|
-
: block_manager(block_manager), segment_count(0), dirty(false), vacuum(false),
|
39
|
+
: block_manager(block_manager), segment_count(0), allocation_size(0), dirty(false), vacuum(false), block_pointer(),
|
40
|
+
block_handle(nullptr) {
|
10
41
|
|
11
42
|
auto &buffer_manager = block_manager.buffer_manager;
|
12
43
|
buffer_handle = buffer_manager.Allocate(Storage::BLOCK_SIZE, false, &block_handle);
|
13
44
|
}
|
14
45
|
|
15
|
-
FixedSizeBuffer::FixedSizeBuffer(BlockManager &block_manager, const idx_t segment_count, const
|
16
|
-
|
46
|
+
FixedSizeBuffer::FixedSizeBuffer(BlockManager &block_manager, const idx_t segment_count, const idx_t allocation_size,
|
47
|
+
const BlockPointer &block_pointer)
|
48
|
+
: block_manager(block_manager), segment_count(segment_count), allocation_size(allocation_size), dirty(false),
|
49
|
+
vacuum(false), block_pointer(block_pointer) {
|
17
50
|
|
18
|
-
D_ASSERT(
|
19
|
-
block_handle = block_manager.RegisterBlock(block_id);
|
20
|
-
D_ASSERT(BlockId() < MAXIMUM_BLOCK);
|
51
|
+
D_ASSERT(block_pointer.IsValid());
|
52
|
+
block_handle = block_manager.RegisterBlock(block_pointer.block_id);
|
53
|
+
D_ASSERT(block_handle->BlockId() < MAXIMUM_BLOCK);
|
21
54
|
}
|
22
55
|
|
23
56
|
void FixedSizeBuffer::Destroy() {
|
24
57
|
if (InMemory()) {
|
58
|
+
// we can have multiple readers on a pinned block, and unpinning the buffer handle
|
59
|
+
// decrements the reader count on the underlying block handle (Destroy() unpins)
|
25
60
|
buffer_handle.Destroy();
|
26
61
|
}
|
27
62
|
if (OnDisk()) {
|
28
|
-
|
63
|
+
// marking a block as modified decreases the reference count of multi-use blocks
|
64
|
+
block_manager.MarkBlockAsModified(block_pointer.block_id);
|
29
65
|
}
|
30
66
|
}
|
31
67
|
|
32
|
-
void FixedSizeBuffer::Serialize(
|
68
|
+
void FixedSizeBuffer::Serialize(PartialBlockManager &partial_block_manager, const idx_t available_segments,
|
69
|
+
const idx_t segment_size, const idx_t bitmask_offset) {
|
33
70
|
|
71
|
+
// we do not serialize a block that is already on disk and not in memory
|
34
72
|
if (!InMemory()) {
|
35
73
|
if (!OnDisk() || dirty) {
|
36
|
-
throw InternalException("invalid
|
74
|
+
throw InternalException("invalid or missing buffer in FixedSizeAllocator");
|
37
75
|
}
|
38
76
|
return;
|
39
77
|
}
|
78
|
+
|
79
|
+
// we do not serialize a block that is already on disk and not dirty
|
40
80
|
if (!dirty && OnDisk()) {
|
41
81
|
return;
|
42
82
|
}
|
43
83
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
84
|
+
if (dirty) {
|
85
|
+
// the allocation possibly changed
|
86
|
+
auto max_offset = GetMaxOffset(available_segments);
|
87
|
+
allocation_size = max_offset * segment_size + bitmask_offset;
|
88
|
+
}
|
48
89
|
|
49
|
-
//
|
50
|
-
|
90
|
+
// the buffer is in memory, so we copied it onto a new buffer when pinning
|
91
|
+
D_ASSERT(InMemory() && !OnDisk());
|
51
92
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
93
|
+
// now we write the changes, first get a partial block allocation
|
94
|
+
PartialBlockAllocation allocation = partial_block_manager.GetBlockAllocation(allocation_size);
|
95
|
+
block_pointer.block_id = allocation.state.block_id;
|
96
|
+
block_pointer.offset = allocation.state.offset;
|
97
|
+
|
98
|
+
auto &buffer_manager = block_manager.buffer_manager;
|
99
|
+
|
100
|
+
if (allocation.partial_block) {
|
101
|
+
// copy to an existing partial block
|
102
|
+
D_ASSERT(block_pointer.offset > 0);
|
103
|
+
auto &p_block_for_index = allocation.partial_block->Cast<PartialBlockForIndex>();
|
104
|
+
auto dst_handle = buffer_manager.Pin(p_block_for_index.block_handle);
|
105
|
+
memcpy(dst_handle.Ptr() + block_pointer.offset, buffer_handle.Ptr(), allocation_size);
|
106
|
+
SetUninitializedRegions(p_block_for_index, segment_size, block_pointer.offset, bitmask_offset);
|
58
107
|
|
59
108
|
} else {
|
60
|
-
//
|
61
|
-
|
62
|
-
D_ASSERT(
|
63
|
-
|
109
|
+
// create a new block that can potentially be used as a partial block
|
110
|
+
D_ASSERT(block_handle);
|
111
|
+
D_ASSERT(!block_pointer.offset);
|
112
|
+
auto p_block_for_index = make_uniq<PartialBlockForIndex>(allocation.state, block_manager, block_handle);
|
113
|
+
SetUninitializedRegions(*p_block_for_index, segment_size, block_pointer.offset, bitmask_offset);
|
114
|
+
allocation.partial_block = std::move(p_block_for_index);
|
64
115
|
}
|
116
|
+
|
117
|
+
partial_block_manager.RegisterPartialBlock(std::move(allocation));
|
118
|
+
|
119
|
+
// resetting this buffer
|
120
|
+
buffer_handle.Destroy();
|
121
|
+
block_handle = block_manager.RegisterBlock(block_pointer.block_id);
|
122
|
+
D_ASSERT(block_handle->BlockId() < MAXIMUM_BLOCK);
|
123
|
+
|
124
|
+
// we persist any changes, so the buffer is no longer dirty
|
125
|
+
dirty = false;
|
65
126
|
}
|
66
127
|
|
67
128
|
void FixedSizeBuffer::Pin() {
|
68
129
|
|
69
130
|
auto &buffer_manager = block_manager.buffer_manager;
|
70
|
-
D_ASSERT(
|
71
|
-
|
131
|
+
D_ASSERT(block_pointer.IsValid());
|
132
|
+
D_ASSERT(block_handle && block_handle->BlockId() < MAXIMUM_BLOCK);
|
133
|
+
D_ASSERT(!dirty);
|
134
|
+
|
135
|
+
buffer_handle = buffer_manager.Pin(block_handle);
|
136
|
+
|
137
|
+
// we need to copy the (partial) data into a new (not yet disk-backed) buffer handle
|
138
|
+
shared_ptr<BlockHandle> new_block_handle;
|
139
|
+
auto new_buffer_handle = buffer_manager.Allocate(Storage::BLOCK_SIZE, false, &new_block_handle);
|
140
|
+
|
141
|
+
memcpy(new_buffer_handle.Ptr(), buffer_handle.Ptr() + block_pointer.offset, allocation_size);
|
142
|
+
|
143
|
+
Destroy();
|
144
|
+
buffer_handle = std::move(new_buffer_handle);
|
145
|
+
block_handle = new_block_handle;
|
146
|
+
block_pointer = BlockPointer();
|
147
|
+
}
|
148
|
+
|
149
|
+
uint32_t FixedSizeBuffer::GetOffset(const idx_t bitmask_count) {
|
150
|
+
|
151
|
+
// this function calls Get() on the buffer, so the buffer must already be in memory
|
152
|
+
D_ASSERT(InMemory());
|
153
|
+
|
154
|
+
// get the bitmask data
|
155
|
+
auto bitmask_ptr = reinterpret_cast<validity_t *>(Get());
|
156
|
+
ValidityMask mask(bitmask_ptr);
|
157
|
+
auto data = mask.GetData();
|
158
|
+
|
159
|
+
// fills up a buffer sequentially before searching for free bits
|
160
|
+
if (mask.RowIsValid(segment_count)) {
|
161
|
+
mask.SetInvalid(segment_count);
|
162
|
+
return segment_count;
|
163
|
+
}
|
164
|
+
|
165
|
+
for (idx_t entry_idx = 0; entry_idx < bitmask_count; entry_idx++) {
|
166
|
+
// get an entry with free bits
|
167
|
+
if (data[entry_idx] == 0) {
|
168
|
+
continue;
|
169
|
+
}
|
170
|
+
|
171
|
+
// find the position of the free bit
|
172
|
+
auto entry = data[entry_idx];
|
173
|
+
idx_t first_valid_bit = 0;
|
174
|
+
|
175
|
+
// this loop finds the position of the rightmost set bit in entry and stores it
|
176
|
+
// in first_valid_bit
|
177
|
+
for (idx_t i = 0; i < 6; i++) {
|
178
|
+
// set the left half of the bits of this level to zero and test if the entry is still not zero
|
179
|
+
if (entry & BASE[i]) {
|
180
|
+
// first valid bit is in the rightmost s[i] bits
|
181
|
+
// permanently set the left half of the bits to zero
|
182
|
+
entry &= BASE[i];
|
183
|
+
} else {
|
184
|
+
// first valid bit is in the leftmost s[i] bits
|
185
|
+
// shift by s[i] for the next iteration and add s[i] to the position of the rightmost set bit
|
186
|
+
entry >>= SHIFT[i];
|
187
|
+
first_valid_bit += SHIFT[i];
|
188
|
+
}
|
189
|
+
}
|
190
|
+
D_ASSERT(entry);
|
191
|
+
|
192
|
+
auto prev_bits = entry_idx * sizeof(validity_t) * 8;
|
193
|
+
D_ASSERT(mask.RowIsValid(prev_bits + first_valid_bit));
|
194
|
+
mask.SetInvalid(prev_bits + first_valid_bit);
|
195
|
+
return (prev_bits + first_valid_bit);
|
196
|
+
}
|
197
|
+
|
198
|
+
throw InternalException("Invalid bitmask for FixedSizeAllocator");
|
199
|
+
}
|
200
|
+
|
201
|
+
uint32_t FixedSizeBuffer::GetMaxOffset(const idx_t available_segments) {
|
202
|
+
|
203
|
+
// this function calls Get() on the buffer, so the buffer must already be in memory
|
204
|
+
D_ASSERT(InMemory());
|
205
|
+
|
206
|
+
// finds the maximum zero bit in a bitmask, and adds one to it,
|
207
|
+
// so that max_offset * segment_size = allocated_size of this bitmask's buffer
|
208
|
+
idx_t entry_size = sizeof(validity_t) * 8;
|
209
|
+
idx_t bitmask_count = available_segments / entry_size;
|
210
|
+
if (available_segments % entry_size != 0) {
|
211
|
+
bitmask_count++;
|
212
|
+
}
|
213
|
+
uint32_t max_offset = bitmask_count * sizeof(validity_t) * 8;
|
214
|
+
auto bits_in_last_entry = available_segments % (sizeof(validity_t) * 8);
|
215
|
+
|
216
|
+
// get the bitmask data
|
217
|
+
auto bitmask_ptr = reinterpret_cast<validity_t *>(Get());
|
218
|
+
const ValidityMask mask(bitmask_ptr);
|
219
|
+
const auto data = mask.GetData();
|
220
|
+
|
221
|
+
D_ASSERT(bitmask_count > 0);
|
222
|
+
for (idx_t i = bitmask_count; i > 0; i--) {
|
223
|
+
|
224
|
+
auto entry = data[i - 1];
|
225
|
+
|
226
|
+
// set all bits after bits_in_last_entry
|
227
|
+
if (i == bitmask_count) {
|
228
|
+
entry |= ~idx_t(0) << bits_in_last_entry;
|
229
|
+
}
|
230
|
+
|
231
|
+
if (entry == ~idx_t(0)) {
|
232
|
+
max_offset -= sizeof(validity_t) * 8;
|
233
|
+
continue;
|
234
|
+
}
|
235
|
+
|
236
|
+
// invert data[entry_idx]
|
237
|
+
auto entry_inv = ~entry;
|
238
|
+
idx_t first_valid_bit = 0;
|
239
|
+
|
240
|
+
// then find the position of the LEFTMOST set bit
|
241
|
+
for (idx_t level = 0; level < 6; level++) {
|
242
|
+
|
243
|
+
// set the right half of the bits of this level to zero and test if the entry is still not zero
|
244
|
+
if (entry_inv & ~BASE[level]) {
|
245
|
+
// first valid bit is in the leftmost s[level] bits
|
246
|
+
// shift by s[level] for the next iteration and add s[level] to the position of the leftmost set bit
|
247
|
+
entry_inv >>= SHIFT[level];
|
248
|
+
first_valid_bit += SHIFT[level];
|
249
|
+
} else {
|
250
|
+
// first valid bit is in the rightmost s[level] bits
|
251
|
+
// permanently set the left half of the bits to zero
|
252
|
+
entry_inv &= BASE[level];
|
253
|
+
}
|
254
|
+
}
|
255
|
+
D_ASSERT(entry_inv);
|
256
|
+
max_offset -= sizeof(validity_t) * 8 - first_valid_bit;
|
257
|
+
D_ASSERT(!mask.RowIsValid(max_offset));
|
258
|
+
return max_offset + 1;
|
259
|
+
}
|
260
|
+
|
261
|
+
// there are no allocations in this buffer
|
262
|
+
// FIXME: put this line back in and then fix the missing vacuum bug in
|
263
|
+
// FIXME: test_index_large_aborted_append.test with force_restart
|
264
|
+
// FIXME: test if we still have non-dirty buffer to serialize after fixing this
|
265
|
+
// throw InternalException("tried to serialize empty buffer");
|
266
|
+
return 0;
|
267
|
+
}
|
268
|
+
|
269
|
+
void FixedSizeBuffer::SetUninitializedRegions(PartialBlockForIndex &p_block_for_index, const idx_t segment_size,
|
270
|
+
const idx_t offset, const idx_t bitmask_offset) {
|
271
|
+
|
272
|
+
// this function calls Get() on the buffer, so the buffer must already be in memory
|
273
|
+
D_ASSERT(InMemory());
|
274
|
+
|
275
|
+
auto bitmask_ptr = reinterpret_cast<validity_t *>(Get());
|
276
|
+
ValidityMask mask(bitmask_ptr);
|
277
|
+
|
278
|
+
idx_t i = 0;
|
279
|
+
idx_t max_offset = offset + allocation_size;
|
280
|
+
idx_t current_offset = offset + bitmask_offset;
|
281
|
+
while (current_offset < max_offset) {
|
282
|
+
|
283
|
+
if (mask.RowIsValid(i)) {
|
284
|
+
D_ASSERT(current_offset + segment_size <= max_offset);
|
285
|
+
p_block_for_index.AddUninitializedRegion(current_offset, current_offset + segment_size);
|
286
|
+
}
|
287
|
+
current_offset += segment_size;
|
288
|
+
i++;
|
289
|
+
}
|
72
290
|
}
|
73
291
|
|
74
292
|
} // namespace duckdb
|
@@ -156,8 +156,7 @@ SinkFinalizeType PhysicalWindow::Finalize(Pipeline &pipeline, Event &event, Clie
|
|
156
156
|
}
|
157
157
|
|
158
158
|
// Find the first group to sort
|
159
|
-
|
160
|
-
if (groups.empty()) {
|
159
|
+
if (!state.global_partition->HasMergeTasks()) {
|
161
160
|
// Empty input!
|
162
161
|
return SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
163
162
|
}
|
@@ -538,7 +537,7 @@ WindowGlobalSourceState::Task WindowGlobalSourceState::NextTask(idx_t hash_bin)
|
|
538
537
|
if (hash_bin < bin_count) {
|
539
538
|
// Find a non-empty hash group.
|
540
539
|
for (; hash_bin < hash_groups.size(); hash_bin = next_build++) {
|
541
|
-
if (hash_groups[hash_bin]) {
|
540
|
+
if (hash_groups[hash_bin] && hash_groups[hash_bin]->count) {
|
542
541
|
auto result = CreateTask(hash_bin);
|
543
542
|
if (result.second) {
|
544
543
|
return result;
|
@@ -163,8 +163,7 @@ SinkFinalizeType PhysicalAsOfJoin::Finalize(Pipeline &pipeline, Event &event, Cl
|
|
163
163
|
gstate.lhs_sink->SyncPartitioning(gstate.rhs_sink);
|
164
164
|
|
165
165
|
// Find the first group to sort
|
166
|
-
|
167
|
-
if (groups.empty() && EmptyResultIfRHSIsEmpty()) {
|
166
|
+
if (!gstate.rhs_sink.HasMergeTasks() && EmptyResultIfRHSIsEmpty()) {
|
168
167
|
// Empty input!
|
169
168
|
return SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
170
169
|
}
|
@@ -433,6 +432,9 @@ void AsOfProbeBuffer::BeginLeftScan(hash_t scan_bin) {
|
|
433
432
|
|
434
433
|
left_hash = lhs_sink.hash_groups[left_group].get();
|
435
434
|
auto &left_sort = *(left_hash->global_sort);
|
435
|
+
if (left_sort.sorted_blocks.empty()) {
|
436
|
+
return;
|
437
|
+
}
|
436
438
|
lhs_scanner = make_uniq<PayloadScanner>(left_sort, false);
|
437
439
|
left_itr = make_uniq<SBIterator>(left_sort, iterator_comp);
|
438
440
|
|
@@ -681,14 +683,16 @@ class AsOfLocalSourceState : public LocalSourceState {
|
|
681
683
|
public:
|
682
684
|
using HashGroupPtr = unique_ptr<PartitionGlobalHashGroup>;
|
683
685
|
|
684
|
-
AsOfLocalSourceState(AsOfGlobalSourceState &gsource, const PhysicalAsOfJoin &op);
|
686
|
+
AsOfLocalSourceState(AsOfGlobalSourceState &gsource, const PhysicalAsOfJoin &op, ClientContext &client_p);
|
685
687
|
|
686
|
-
|
687
|
-
|
688
|
+
// Return true if we were not interrupted (another thread died)
|
689
|
+
bool CombineLeftPartitions();
|
690
|
+
bool MergeLeftPartitions();
|
688
691
|
|
689
692
|
idx_t BeginRightScan(const idx_t hash_bin);
|
690
693
|
|
691
694
|
AsOfGlobalSourceState &gsource;
|
695
|
+
ClientContext &client;
|
692
696
|
|
693
697
|
//! The left side partition being probed
|
694
698
|
AsOfProbeBuffer probe_buffer;
|
@@ -702,38 +706,45 @@ public:
|
|
702
706
|
const bool *found_match = {};
|
703
707
|
};
|
704
708
|
|
705
|
-
AsOfLocalSourceState::AsOfLocalSourceState(AsOfGlobalSourceState &gsource, const PhysicalAsOfJoin &op
|
706
|
-
|
709
|
+
AsOfLocalSourceState::AsOfLocalSourceState(AsOfGlobalSourceState &gsource, const PhysicalAsOfJoin &op,
|
710
|
+
ClientContext &client_p)
|
711
|
+
: gsource(gsource), client(client_p), probe_buffer(gsource.gsink.lhs_sink->context, op) {
|
707
712
|
gsource.mergers++;
|
708
713
|
}
|
709
714
|
|
710
|
-
|
715
|
+
bool AsOfLocalSourceState::CombineLeftPartitions() {
|
711
716
|
const auto buffer_count = gsource.gsink.lhs_buffers.size();
|
712
|
-
while (gsource.combined < buffer_count) {
|
717
|
+
while (gsource.combined < buffer_count && !client.interrupted) {
|
713
718
|
const auto next_combine = gsource.next_combine++;
|
714
719
|
if (next_combine < buffer_count) {
|
715
720
|
gsource.gsink.lhs_buffers[next_combine]->Combine();
|
716
721
|
++gsource.combined;
|
717
722
|
} else {
|
718
|
-
|
723
|
+
TaskScheduler::GetScheduler(client).YieldThread();
|
719
724
|
}
|
720
725
|
}
|
726
|
+
|
727
|
+
return !client.interrupted;
|
721
728
|
}
|
722
729
|
|
723
|
-
|
730
|
+
bool AsOfLocalSourceState::MergeLeftPartitions() {
|
724
731
|
PartitionGlobalMergeStates::Callback local_callback;
|
725
732
|
PartitionLocalMergeState local_merge(*gsource.gsink.lhs_sink);
|
726
733
|
gsource.GetMergeStates().ExecuteTask(local_merge, local_callback);
|
727
734
|
gsource.merged++;
|
728
|
-
while (gsource.merged < gsource.mergers) {
|
729
|
-
|
735
|
+
while (gsource.merged < gsource.mergers && !client.interrupted) {
|
736
|
+
TaskScheduler::GetScheduler(client).YieldThread();
|
730
737
|
}
|
738
|
+
return !client.interrupted;
|
731
739
|
}
|
732
740
|
|
733
741
|
idx_t AsOfLocalSourceState::BeginRightScan(const idx_t hash_bin_p) {
|
734
742
|
hash_bin = hash_bin_p;
|
735
743
|
|
736
744
|
hash_group = std::move(gsource.gsink.rhs_sink.hash_groups[hash_bin]);
|
745
|
+
if (hash_group->global_sort->sorted_blocks.empty()) {
|
746
|
+
return 0;
|
747
|
+
}
|
737
748
|
scanner = make_uniq<PayloadScanner>(*hash_group->global_sort);
|
738
749
|
found_match = gsource.gsink.right_outers[hash_bin].GetMatches();
|
739
750
|
|
@@ -743,7 +754,7 @@ idx_t AsOfLocalSourceState::BeginRightScan(const idx_t hash_bin_p) {
|
|
743
754
|
unique_ptr<LocalSourceState> PhysicalAsOfJoin::GetLocalSourceState(ExecutionContext &context,
|
744
755
|
GlobalSourceState &gstate) const {
|
745
756
|
auto &gsource = gstate.Cast<AsOfGlobalSourceState>();
|
746
|
-
return make_uniq<AsOfLocalSourceState>(gsource, *this);
|
757
|
+
return make_uniq<AsOfLocalSourceState>(gsource, *this, context.client);
|
747
758
|
}
|
748
759
|
|
749
760
|
SourceResultType PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk &chunk,
|
@@ -751,17 +762,21 @@ SourceResultType PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk
|
|
751
762
|
auto &gsource = input.global_state.Cast<AsOfGlobalSourceState>();
|
752
763
|
auto &lsource = input.local_state.Cast<AsOfLocalSourceState>();
|
753
764
|
auto &rhs_sink = gsource.gsink.rhs_sink;
|
765
|
+
auto &client = context.client;
|
754
766
|
|
755
767
|
// Step 1: Combine the partitions
|
756
|
-
lsource.CombineLeftPartitions()
|
768
|
+
if (!lsource.CombineLeftPartitions()) {
|
769
|
+
return SourceResultType::FINISHED;
|
770
|
+
}
|
757
771
|
|
758
772
|
// Step 2: Sort on all threads
|
759
|
-
lsource.MergeLeftPartitions()
|
773
|
+
if (!lsource.MergeLeftPartitions()) {
|
774
|
+
return SourceResultType::FINISHED;
|
775
|
+
}
|
760
776
|
|
761
777
|
// Step 3: Join the partitions
|
762
778
|
auto &lhs_sink = *gsource.gsink.lhs_sink;
|
763
|
-
auto
|
764
|
-
const auto left_bins = partitions.size();
|
779
|
+
const auto left_bins = lhs_sink.grouping_data ? lhs_sink.grouping_data->GetPartitions().size() : 1;
|
765
780
|
while (gsource.flushed < left_bins) {
|
766
781
|
// Make sure we have something to flush
|
767
782
|
if (!lsource.probe_buffer.Scanning()) {
|
@@ -769,13 +784,13 @@ SourceResultType PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk
|
|
769
784
|
if (left_bin < left_bins) {
|
770
785
|
// More to flush
|
771
786
|
lsource.probe_buffer.BeginLeftScan(left_bin);
|
772
|
-
} else if (!IsRightOuterJoin(join_type)) {
|
787
|
+
} else if (!IsRightOuterJoin(join_type) || client.interrupted) {
|
773
788
|
return SourceResultType::FINISHED;
|
774
789
|
} else {
|
775
790
|
// Wait for all threads to finish
|
776
791
|
// TODO: How to implement a spin wait correctly?
|
777
792
|
// Returning BLOCKED seems to hang the system.
|
778
|
-
|
793
|
+
TaskScheduler::GetScheduler(client).YieldThread();
|
779
794
|
continue;
|
780
795
|
}
|
781
796
|
}
|
@@ -92,46 +92,4 @@ string MacroFunction::ToSQL(const string &schema, const string &name) const {
|
|
92
92
|
return StringUtil::Format("CREATE MACRO %s.%s(%s) AS ", schema, name, StringUtil::Join(param_strings, ", "));
|
93
93
|
}
|
94
94
|
|
95
|
-
void MacroFunction::Serialize(Serializer &main_serializer) const {
|
96
|
-
FieldWriter writer(main_serializer);
|
97
|
-
writer.WriteField(type);
|
98
|
-
writer.WriteSerializableList(parameters);
|
99
|
-
writer.WriteField<uint32_t>((uint32_t)default_parameters.size());
|
100
|
-
auto &serializer = writer.GetSerializer();
|
101
|
-
for (auto &kv : default_parameters) {
|
102
|
-
serializer.WriteString(kv.first);
|
103
|
-
kv.second->Serialize(serializer);
|
104
|
-
}
|
105
|
-
SerializeInternal(writer);
|
106
|
-
writer.Finalize();
|
107
|
-
}
|
108
|
-
|
109
|
-
unique_ptr<MacroFunction> MacroFunction::Deserialize(Deserializer &main_source) {
|
110
|
-
FieldReader reader(main_source);
|
111
|
-
auto type = reader.ReadRequired<MacroType>();
|
112
|
-
auto parameters = reader.ReadRequiredSerializableList<ParsedExpression>();
|
113
|
-
auto default_param_count = reader.ReadRequired<uint32_t>();
|
114
|
-
unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
|
115
|
-
auto &source = reader.GetSource();
|
116
|
-
for (idx_t i = 0; i < default_param_count; i++) {
|
117
|
-
auto name = source.Read<string>();
|
118
|
-
default_parameters[name] = ParsedExpression::Deserialize(source);
|
119
|
-
}
|
120
|
-
unique_ptr<MacroFunction> result;
|
121
|
-
switch (type) {
|
122
|
-
case MacroType::SCALAR_MACRO:
|
123
|
-
result = ScalarMacroFunction::Deserialize(reader);
|
124
|
-
break;
|
125
|
-
case MacroType::TABLE_MACRO:
|
126
|
-
result = TableMacroFunction::Deserialize(reader);
|
127
|
-
break;
|
128
|
-
default:
|
129
|
-
throw InternalException("Cannot deserialize macro type");
|
130
|
-
}
|
131
|
-
result->parameters = std::move(parameters);
|
132
|
-
result->default_parameters = std::move(default_parameters);
|
133
|
-
reader.Finalize();
|
134
|
-
return result;
|
135
|
-
}
|
136
|
-
|
137
95
|
} // namespace duckdb
|
@@ -1,5 +1,7 @@
|
|
1
1
|
#include "duckdb/function/function_set.hpp"
|
2
2
|
#include "duckdb/function/scalar/compressed_materialization_functions.hpp"
|
3
|
+
#include "duckdb/common/serializer/serializer.hpp"
|
4
|
+
#include "duckdb/common/serializer/deserializer.hpp"
|
3
5
|
|
4
6
|
namespace duckdb {
|
5
7
|
|
@@ -143,17 +145,17 @@ static scalar_function_t GetIntegralDecompressFunctionInputSwitch(const LogicalT
|
|
143
145
|
}
|
144
146
|
}
|
145
147
|
|
146
|
-
static void CMIntegralSerialize(
|
147
|
-
|
148
|
-
|
148
|
+
static void CMIntegralSerialize(Serializer &serializer, const optional_ptr<FunctionData> bind_data,
|
149
|
+
const ScalarFunction &function) {
|
150
|
+
serializer.WriteProperty(100, "arguments", function.arguments);
|
151
|
+
serializer.WriteProperty(101, "return_type", function.return_type);
|
149
152
|
}
|
150
153
|
|
151
154
|
template <scalar_function_t (*GET_FUNCTION)(const LogicalType &, const LogicalType &)>
|
152
|
-
unique_ptr<FunctionData> CMIntegralDeserialize(
|
153
|
-
|
154
|
-
|
155
|
-
function.function =
|
156
|
-
GET_FUNCTION(function.arguments[0], reader.ReadRequiredSerializable<LogicalType, LogicalType>());
|
155
|
+
unique_ptr<FunctionData> CMIntegralDeserialize(Deserializer &deserializer, ScalarFunction &function) {
|
156
|
+
function.arguments = deserializer.ReadProperty<vector<LogicalType>>(100, "arguments");
|
157
|
+
auto return_type = deserializer.ReadProperty<LogicalType>(101, "return_type");
|
158
|
+
function.function = GET_FUNCTION(function.arguments[0], return_type);
|
157
159
|
return nullptr;
|
158
160
|
}
|
159
161
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
#include "duckdb/common/bswap.hpp"
|
2
2
|
#include "duckdb/function/scalar/compressed_materialization_functions.hpp"
|
3
|
+
#include "duckdb/common/serializer/serializer.hpp"
|
4
|
+
#include "duckdb/common/serializer/deserializer.hpp"
|
3
5
|
|
4
6
|
namespace duckdb {
|
5
7
|
|
@@ -186,16 +188,16 @@ static scalar_function_t GetStringDecompressFunctionSwitch(const LogicalType &in
|
|
186
188
|
}
|
187
189
|
}
|
188
190
|
|
189
|
-
static void CMStringCompressSerialize(
|
191
|
+
static void CMStringCompressSerialize(Serializer &serializer, const optional_ptr<FunctionData> bind_data,
|
190
192
|
const ScalarFunction &function) {
|
191
|
-
|
192
|
-
|
193
|
+
serializer.WriteProperty(100, "arguments", function.arguments);
|
194
|
+
serializer.WriteProperty(101, "return_type", function.return_type);
|
193
195
|
}
|
194
196
|
|
195
|
-
unique_ptr<FunctionData> CMStringCompressDeserialize(
|
196
|
-
|
197
|
-
|
198
|
-
function.function = GetStringCompressFunctionSwitch(
|
197
|
+
unique_ptr<FunctionData> CMStringCompressDeserialize(Deserializer &deserializer, ScalarFunction &function) {
|
198
|
+
function.arguments = deserializer.ReadProperty<vector<LogicalType>>(100, "arguments");
|
199
|
+
auto return_type = deserializer.ReadProperty<LogicalType>(101, "return_type");
|
200
|
+
function.function = GetStringCompressFunctionSwitch(return_type);
|
199
201
|
return nullptr;
|
200
202
|
}
|
201
203
|
|
@@ -213,14 +215,13 @@ void CMStringCompressFun::RegisterFunction(BuiltinFunctions &set) {
|
|
213
215
|
}
|
214
216
|
}
|
215
217
|
|
216
|
-
static void CMStringDecompressSerialize(
|
218
|
+
static void CMStringDecompressSerialize(Serializer &serializer, const optional_ptr<FunctionData> bind_data,
|
217
219
|
const ScalarFunction &function) {
|
218
|
-
|
220
|
+
serializer.WriteProperty(100, "arguments", function.arguments);
|
219
221
|
}
|
220
222
|
|
221
|
-
unique_ptr<FunctionData> CMStringDecompressDeserialize(
|
222
|
-
|
223
|
-
function.arguments = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
223
|
+
unique_ptr<FunctionData> CMStringDecompressDeserialize(Deserializer &deserializer, ScalarFunction &function) {
|
224
|
+
function.arguments = deserializer.ReadProperty<vector<LogicalType>>(100, "arguments");
|
224
225
|
function.function = GetStringDecompressFunctionSwitch(function.arguments[0]);
|
225
226
|
return nullptr;
|
226
227
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#include "duckdb/common/field_writer.hpp"
|
2
1
|
#include "duckdb/common/operator/add.hpp"
|
3
2
|
#include "duckdb/common/operator/multiply.hpp"
|
4
3
|
#include "duckdb/common/operator/numeric_binary_operators.hpp"
|
@@ -250,23 +249,22 @@ unique_ptr<FunctionData> BindDecimalAddSubtract(ClientContext &context, ScalarFu
|
|
250
249
|
return std::move(bind_data);
|
251
250
|
}
|
252
251
|
|
253
|
-
static void SerializeDecimalArithmetic(
|
252
|
+
static void SerializeDecimalArithmetic(Serializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
254
253
|
const ScalarFunction &function) {
|
255
254
|
auto &bind_data = bind_data_p->Cast<DecimalArithmeticBindData>();
|
256
|
-
|
257
|
-
|
258
|
-
|
255
|
+
serializer.WriteProperty(100, "check_overflow", bind_data.check_overflow);
|
256
|
+
serializer.WriteProperty(101, "return_type", function.return_type);
|
257
|
+
serializer.WriteProperty(102, "arguments", function.arguments);
|
259
258
|
}
|
260
259
|
|
261
260
|
// TODO this is partially duplicated from the bind
|
262
261
|
template <class OP, class OPOVERFLOWCHECK, bool IS_SUBTRACT = false>
|
263
|
-
unique_ptr<FunctionData> DeserializeDecimalArithmetic(
|
264
|
-
ScalarFunction &bound_function) {
|
265
|
-
// re-change the function pointers
|
266
|
-
auto check_overflow = reader.ReadRequired<bool>();
|
267
|
-
auto return_type = reader.ReadRequiredSerializable<LogicalType, LogicalType>();
|
268
|
-
auto arguments = reader.template ReadRequiredSerializableList<LogicalType, LogicalType>();
|
262
|
+
unique_ptr<FunctionData> DeserializeDecimalArithmetic(Deserializer &deserializer, ScalarFunction &bound_function) {
|
269
263
|
|
264
|
+
// // re-change the function pointers
|
265
|
+
auto check_overflow = deserializer.ReadProperty<bool>(100, "check_overflow");
|
266
|
+
auto return_type = deserializer.ReadProperty<LogicalType>(101, "return_type");
|
267
|
+
auto arguments = deserializer.ReadProperty<vector<LogicalType>>(102, "arguments");
|
270
268
|
if (check_overflow) {
|
271
269
|
bound_function.function = GetScalarBinaryFunction<OPOVERFLOWCHECK>(return_type.InternalType());
|
272
270
|
} else {
|