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
@@ -0,0 +1,62 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/common/serializer/buffer_stream.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/common/serializer/write_stream.hpp"
|
12
|
+
#include "duckdb/common/serializer/read_stream.hpp"
|
13
|
+
#include "duckdb/common/typedefs.hpp"
|
14
|
+
|
15
|
+
namespace duckdb {
|
16
|
+
|
17
|
+
class MemoryStream : public WriteStream, public ReadStream {
|
18
|
+
private:
|
19
|
+
idx_t position;
|
20
|
+
idx_t capacity;
|
21
|
+
bool owns_data;
|
22
|
+
data_ptr_t data;
|
23
|
+
|
24
|
+
public:
|
25
|
+
// Create a new owning MemoryStream with an internal backing buffer with the specified capacity. The stream will
|
26
|
+
// own the backing buffer, resize it when needed and free its memory when the stream is destroyed
|
27
|
+
explicit MemoryStream(idx_t capacity = 512);
|
28
|
+
|
29
|
+
// Create a new non-owning MemoryStream over the specified external buffer and capacity. The stream will not take
|
30
|
+
// ownership of the backing buffer, will not attempt to resize it and will not free the memory when the stream
|
31
|
+
// is destroyed
|
32
|
+
explicit MemoryStream(data_ptr_t buffer, idx_t capacity);
|
33
|
+
|
34
|
+
~MemoryStream() override;
|
35
|
+
|
36
|
+
// Write data to the stream.
|
37
|
+
// Throws if the write would exceed the capacity of the stream and the backing buffer is not owned by the stream
|
38
|
+
void WriteData(const_data_ptr_t buffer, idx_t write_size) override;
|
39
|
+
|
40
|
+
// Read data from the stream.
|
41
|
+
// Throws if the read would exceed the capacity of the stream
|
42
|
+
void ReadData(data_ptr_t buffer, idx_t read_size) override;
|
43
|
+
|
44
|
+
// Rewind the stream to the start, keeping the capacity and the backing buffer intact
|
45
|
+
void Rewind();
|
46
|
+
|
47
|
+
// Release ownership of the backing buffer and turn a owning stream into a non-owning one.
|
48
|
+
// The stream will no longer be responsible for freeing the data.
|
49
|
+
// The stream will also no longer attempt to automatically resize the buffer when the capacity is reached.
|
50
|
+
void Release();
|
51
|
+
|
52
|
+
// Get a pointer to the underlying backing buffer
|
53
|
+
data_ptr_t GetData() const;
|
54
|
+
|
55
|
+
// Get the current position in the stream
|
56
|
+
idx_t GetPosition() const;
|
57
|
+
|
58
|
+
// Get the capacity of the stream
|
59
|
+
idx_t GetCapacity() const;
|
60
|
+
};
|
61
|
+
|
62
|
+
} // namespace duckdb
|
@@ -0,0 +1,38 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/common/serializer/read_stream.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/catalog/catalog.hpp"
|
12
|
+
#include "duckdb/common/common.hpp"
|
13
|
+
#include "duckdb/common/exception.hpp"
|
14
|
+
#include "duckdb/common/vector.hpp"
|
15
|
+
#include <type_traits>
|
16
|
+
|
17
|
+
namespace duckdb {
|
18
|
+
|
19
|
+
class ReadStream {
|
20
|
+
public:
|
21
|
+
// Reads a set amount of data from the stream into the specified buffer and moves the stream forward accordingly
|
22
|
+
virtual void ReadData(data_ptr_t buffer, idx_t read_size) = 0;
|
23
|
+
|
24
|
+
// Reads a type from the stream and moves the stream forward sizeof(T) bytes
|
25
|
+
// The type must be a standard layout type
|
26
|
+
template <class T>
|
27
|
+
T Read() {
|
28
|
+
static_assert(std::is_standard_layout<T>(), "Read element must be a standard layout data type");
|
29
|
+
T value;
|
30
|
+
ReadData(data_ptr_cast(&value), sizeof(T));
|
31
|
+
return value;
|
32
|
+
}
|
33
|
+
|
34
|
+
virtual ~ReadStream() {
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
} // namespace duckdb
|
@@ -7,10 +7,12 @@
|
|
7
7
|
#include "duckdb/common/unordered_set.hpp"
|
8
8
|
#include "duckdb/common/set.hpp"
|
9
9
|
#include "duckdb/common/shared_ptr.hpp"
|
10
|
+
#include "duckdb/common/unique_ptr.hpp"
|
11
|
+
|
10
12
|
namespace duckdb {
|
11
13
|
|
12
|
-
class
|
13
|
-
class
|
14
|
+
class Serializer; // Forward declare
|
15
|
+
class Deserializer; // Forward declare
|
14
16
|
|
15
17
|
typedef uint16_t field_id_t;
|
16
18
|
const field_id_t MESSAGE_TERMINATOR_FIELD_ID = 0xFFFF;
|
@@ -19,34 +21,34 @@ const field_id_t MESSAGE_TERMINATOR_FIELD_ID = 0xFFFF;
|
|
19
21
|
template <class...>
|
20
22
|
using void_t = void;
|
21
23
|
|
22
|
-
// Check for anything implementing a `void
|
24
|
+
// Check for anything implementing a `void Serialize(Serializer &Serializer)` method
|
23
25
|
template <typename T, typename = T>
|
24
26
|
struct has_serialize : std::false_type {};
|
25
27
|
template <typename T>
|
26
28
|
struct has_serialize<
|
27
29
|
T, typename std::enable_if<
|
28
|
-
std::is_same<decltype(std::declval<T>().
|
29
|
-
|
30
|
+
std::is_same<decltype(std::declval<T>().Serialize(std::declval<Serializer &>())), void>::value, T>::type>
|
31
|
+
: std::true_type {};
|
30
32
|
|
31
33
|
template <typename T, typename = T>
|
32
34
|
struct has_deserialize : std::false_type {};
|
33
35
|
|
34
|
-
// Accept `static unique_ptr<T>
|
36
|
+
// Accept `static unique_ptr<T> Deserialize(Deserializer& deserializer)`
|
35
37
|
template <typename T>
|
36
38
|
struct has_deserialize<
|
37
|
-
T, typename std::enable_if<std::is_same<decltype(T::
|
38
|
-
|
39
|
+
T, typename std::enable_if<std::is_same<decltype(T::Deserialize), unique_ptr<T>(Deserializer &)>::value, T>::type>
|
40
|
+
: std::true_type {};
|
39
41
|
|
40
|
-
// Accept `static shared_ptr<T>
|
42
|
+
// Accept `static shared_ptr<T> Deserialize(Deserializer& deserializer)`
|
41
43
|
template <typename T>
|
42
44
|
struct has_deserialize<
|
43
|
-
T, typename std::enable_if<std::is_same<decltype(T::
|
44
|
-
|
45
|
+
T, typename std::enable_if<std::is_same<decltype(T::Deserialize), shared_ptr<T>(Deserializer &)>::value, T>::type>
|
46
|
+
: std::true_type {};
|
45
47
|
|
46
|
-
// Accept `static T
|
48
|
+
// Accept `static T Deserialize(Deserializer& deserializer)`
|
47
49
|
template <typename T>
|
48
50
|
struct has_deserialize<
|
49
|
-
T, typename std::enable_if<std::is_same<decltype(T::
|
51
|
+
T, typename std::enable_if<std::is_same<decltype(T::Deserialize), T(Deserializer &)>::value, T>::type>
|
50
52
|
: std::true_type {};
|
51
53
|
|
52
54
|
// Check if T is a vector, and provide access to the inner type
|
package/src/duckdb/src/include/duckdb/common/serializer/{format_serializer.hpp → serializer.hpp}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
//===----------------------------------------------------------------------===//
|
2
2
|
// DuckDB
|
3
3
|
//
|
4
|
-
// duckdb/common/serializer/
|
4
|
+
// duckdb/common/serializer/serializer.hpp
|
5
5
|
//
|
6
6
|
//
|
7
7
|
//===----------------------------------------------------------------------===//
|
@@ -9,8 +9,6 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/common/enum_util.hpp"
|
12
|
-
#include "duckdb/common/field_writer.hpp"
|
13
|
-
#include "duckdb/common/serializer.hpp"
|
14
12
|
#include "duckdb/common/serializer/serialization_traits.hpp"
|
15
13
|
#include "duckdb/common/types/interval.hpp"
|
16
14
|
#include "duckdb/common/types/string_type.hpp"
|
@@ -19,18 +17,21 @@
|
|
19
17
|
|
20
18
|
namespace duckdb {
|
21
19
|
|
22
|
-
class
|
20
|
+
class Serializer {
|
23
21
|
protected:
|
24
22
|
bool serialize_enum_as_string = false;
|
25
23
|
bool serialize_default_values = false;
|
26
24
|
|
27
25
|
public:
|
26
|
+
virtual ~Serializer() {
|
27
|
+
}
|
28
|
+
|
28
29
|
class List {
|
29
|
-
friend
|
30
|
+
friend Serializer;
|
30
31
|
|
31
32
|
private:
|
32
|
-
|
33
|
-
explicit List(
|
33
|
+
Serializer &serializer;
|
34
|
+
explicit List(Serializer &serializer) : serializer(serializer) {
|
34
35
|
}
|
35
36
|
|
36
37
|
public:
|
@@ -223,11 +224,11 @@ protected:
|
|
223
224
|
OnListEnd();
|
224
225
|
}
|
225
226
|
|
226
|
-
// class or struct implementing `
|
227
|
+
// class or struct implementing `Serialize(Serializer& Serializer)`;
|
227
228
|
template <typename T>
|
228
229
|
typename std::enable_if<has_serialize<T>::value>::type WriteValue(const T &value) {
|
229
230
|
OnObjectBegin();
|
230
|
-
value.
|
231
|
+
value.Serialize(*this);
|
231
232
|
OnObjectEnd();
|
232
233
|
}
|
233
234
|
|
@@ -275,18 +276,18 @@ protected:
|
|
275
276
|
|
276
277
|
// We need to special case vector<bool> because elements of vector<bool> cannot be referenced
|
277
278
|
template <>
|
278
|
-
void
|
279
|
+
void Serializer::WriteValue(const vector<bool> &vec);
|
279
280
|
|
280
281
|
// List Impl
|
281
282
|
template <class FUNC>
|
282
|
-
void
|
283
|
+
void Serializer::List::WriteObject(FUNC f) {
|
283
284
|
serializer.OnObjectBegin();
|
284
285
|
f(serializer);
|
285
286
|
serializer.OnObjectEnd();
|
286
287
|
}
|
287
288
|
|
288
289
|
template <class T>
|
289
|
-
void
|
290
|
+
void Serializer::List::WriteElement(const T &value) {
|
290
291
|
serializer.WriteValue(value);
|
291
292
|
}
|
292
293
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/common/serializer/write_stream.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/catalog/catalog.hpp"
|
12
|
+
#include "duckdb/common/common.hpp"
|
13
|
+
#include "duckdb/common/exception.hpp"
|
14
|
+
#include "duckdb/common/vector.hpp"
|
15
|
+
#include <type_traits>
|
16
|
+
|
17
|
+
namespace duckdb {
|
18
|
+
|
19
|
+
class WriteStream {
|
20
|
+
public:
|
21
|
+
// Writes a set amount of data from the specified buffer into the stream and moves the stream forward accordingly
|
22
|
+
virtual void WriteData(const_data_ptr_t buffer, idx_t write_size) = 0;
|
23
|
+
|
24
|
+
// Writes a type into the stream and moves the stream forward sizeof(T) bytes
|
25
|
+
// The type must be a standard layout type
|
26
|
+
template <class T>
|
27
|
+
void Write(T element) {
|
28
|
+
static_assert(std::is_standard_layout<T>(), "Write element must be a standard layout data type");
|
29
|
+
WriteData(const_data_ptr_cast(&element), sizeof(T));
|
30
|
+
}
|
31
|
+
|
32
|
+
virtual ~WriteStream() {
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
} // namespace duckdb
|
@@ -18,7 +18,6 @@ namespace duckdb {
|
|
18
18
|
class PartitionGlobalHashGroup {
|
19
19
|
public:
|
20
20
|
using GlobalSortStatePtr = unique_ptr<GlobalSortState>;
|
21
|
-
using LocalSortStatePtr = unique_ptr<LocalSortState>;
|
22
21
|
using Orders = vector<BoundOrderByNode>;
|
23
22
|
using Types = vector<LogicalType>;
|
24
23
|
|
@@ -54,6 +53,8 @@ public:
|
|
54
53
|
const vector<BoundOrderByNode> &order_bys, const Types &payload_types,
|
55
54
|
const vector<unique_ptr<BaseStatistics>> &partitions_stats, idx_t estimated_cardinality);
|
56
55
|
|
56
|
+
bool HasMergeTasks() const;
|
57
|
+
|
57
58
|
unique_ptr<RadixPartitionedTupleData> CreatePartition(idx_t new_bits) const;
|
58
59
|
void SyncPartitioning(const PartitionGlobalSinkState &other);
|
59
60
|
|
@@ -97,21 +98,26 @@ private:
|
|
97
98
|
|
98
99
|
class PartitionLocalSinkState {
|
99
100
|
public:
|
101
|
+
using LocalSortStatePtr = unique_ptr<LocalSortState>;
|
102
|
+
|
100
103
|
PartitionLocalSinkState(ClientContext &context, PartitionGlobalSinkState &gstate_p);
|
101
104
|
|
102
105
|
// Global state
|
103
106
|
PartitionGlobalSinkState &gstate;
|
104
107
|
Allocator &allocator;
|
105
108
|
|
106
|
-
//
|
109
|
+
// Shared expression evaluation
|
107
110
|
ExpressionExecutor executor;
|
108
111
|
DataChunk group_chunk;
|
109
112
|
DataChunk payload_chunk;
|
113
|
+
size_t sort_cols;
|
114
|
+
|
115
|
+
// OVER(PARTITION BY...) (hash grouping)
|
110
116
|
unique_ptr<PartitionedTupleData> local_partition;
|
111
117
|
unique_ptr<PartitionedTupleDataAppendState> local_append;
|
112
118
|
|
113
|
-
// OVER(...) (sorting)
|
114
|
-
|
119
|
+
// OVER(ORDER BY...) (only sorting)
|
120
|
+
LocalSortStatePtr local_sort;
|
115
121
|
|
116
122
|
// OVER() (no sorting)
|
117
123
|
RowLayout payload_layout;
|
@@ -134,8 +140,12 @@ class PartitionGlobalMergeState {
|
|
134
140
|
public:
|
135
141
|
using GroupDataPtr = unique_ptr<TupleDataCollection>;
|
136
142
|
|
143
|
+
// OVER(PARTITION BY...)
|
137
144
|
PartitionGlobalMergeState(PartitionGlobalSinkState &sink, GroupDataPtr group_data, hash_t hash_bin);
|
138
145
|
|
146
|
+
// OVER(ORDER BY...)
|
147
|
+
explicit PartitionGlobalMergeState(PartitionGlobalSinkState &sink);
|
148
|
+
|
139
149
|
bool IsSorted() const {
|
140
150
|
lock_guard<mutex> guard(lock);
|
141
151
|
return stage == PartitionSortStage::SORTED;
|
@@ -154,8 +154,8 @@ public:
|
|
154
154
|
//! Get a vector of the segments in this ColumnDataCollection
|
155
155
|
const vector<unique_ptr<ColumnDataCollectionSegment>> &GetSegments() const;
|
156
156
|
|
157
|
-
void
|
158
|
-
static unique_ptr<ColumnDataCollection>
|
157
|
+
void Serialize(Serializer &serializer) const;
|
158
|
+
static unique_ptr<ColumnDataCollection> Deserialize(Deserializer &deserializer);
|
159
159
|
|
160
160
|
private:
|
161
161
|
//! Creates a new segment within the ColumnDataCollection
|
@@ -19,8 +19,8 @@ class Allocator;
|
|
19
19
|
class ClientContext;
|
20
20
|
class ExecutionContext;
|
21
21
|
class VectorCache;
|
22
|
-
class
|
23
|
-
class
|
22
|
+
class Serializer;
|
23
|
+
class Deserializer;
|
24
24
|
|
25
25
|
//! A Data Chunk represents a set of vectors.
|
26
26
|
/*!
|
@@ -138,14 +138,9 @@ public:
|
|
138
138
|
//! Vector to point back to the data owned by this DataChunk.
|
139
139
|
DUCKDB_API void Reset();
|
140
140
|
|
141
|
-
|
142
|
-
DUCKDB_API void Serialize(Serializer &serializer);
|
143
|
-
//! Deserializes a blob back into a DataChunk
|
141
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
144
142
|
DUCKDB_API void Deserialize(Deserializer &source);
|
145
143
|
|
146
|
-
DUCKDB_API void FormatSerialize(FormatSerializer &serializer) const;
|
147
|
-
DUCKDB_API void FormatDeserialize(FormatDeserializer &source);
|
148
|
-
|
149
144
|
//! Hashes the DataChunk to the target vector
|
150
145
|
DUCKDB_API void Hash(Vector &result);
|
151
146
|
//! Hashes specific vectors of the DataChunk to the target vector
|
@@ -20,11 +20,8 @@ namespace duckdb {
|
|
20
20
|
|
21
21
|
enum class HLLStorageType : uint8_t { UNCOMPRESSED = 1 };
|
22
22
|
|
23
|
-
class
|
24
|
-
class
|
25
|
-
|
26
|
-
class FormatSerializer;
|
27
|
-
class FormatDeserializer;
|
23
|
+
class Serializer;
|
24
|
+
class Deserializer;
|
28
25
|
|
29
26
|
//! The HyperLogLog class holds a HyperLogLog counter for approximate cardinality counting
|
30
27
|
class HyperLogLog {
|
@@ -49,12 +46,9 @@ public:
|
|
49
46
|
data_ptr_t GetPtr() const;
|
50
47
|
//! Get copy of the HLL
|
51
48
|
unique_ptr<HyperLogLog> Copy();
|
52
|
-
//! (De)Serialize the HLL
|
53
|
-
void Serialize(FieldWriter &writer) const;
|
54
|
-
static unique_ptr<HyperLogLog> Deserialize(FieldReader &reader);
|
55
49
|
|
56
|
-
void
|
57
|
-
static unique_ptr<HyperLogLog>
|
50
|
+
void Serialize(Serializer &serializer) const;
|
51
|
+
static unique_ptr<HyperLogLog> Deserialize(Deserializer &deserializer);
|
58
52
|
|
59
53
|
public:
|
60
54
|
//! Compute HLL hashes over vdata, and store them in 'hashes'
|
@@ -16,8 +16,8 @@ struct dtime_t;
|
|
16
16
|
struct date_t;
|
17
17
|
struct timestamp_t;
|
18
18
|
|
19
|
-
class
|
20
|
-
class
|
19
|
+
class Serializer;
|
20
|
+
class Deserializer;
|
21
21
|
|
22
22
|
struct interval_t {
|
23
23
|
int32_t months;
|
@@ -29,8 +29,8 @@ struct interval_t {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
// Serialization
|
32
|
-
void
|
33
|
-
static interval_t
|
32
|
+
void Serialize(Serializer &serializer) const;
|
33
|
+
static interval_t Deserialize(Deserializer &source);
|
34
34
|
};
|
35
35
|
|
36
36
|
//! The Interval class is a static class that holds helper functions for the Interval
|
@@ -20,8 +20,6 @@
|
|
20
20
|
namespace duckdb {
|
21
21
|
|
22
22
|
class CastFunctionSet;
|
23
|
-
class Deserializer;
|
24
|
-
class Serializer;
|
25
23
|
struct GetCastFunctionInput;
|
26
24
|
struct ExtraValueInfo;
|
27
25
|
|
@@ -225,10 +223,8 @@ public:
|
|
225
223
|
|
226
224
|
//! Serializes a Value to a stand-alone binary blob
|
227
225
|
DUCKDB_API void Serialize(Serializer &serializer) const;
|
228
|
-
DUCKDB_API void FormatSerialize(FormatSerializer &serializer) const;
|
229
|
-
DUCKDB_API static Value FormatDeserialize(FormatDeserializer &deserializer);
|
230
226
|
//! Deserializes a Value from a blob
|
231
|
-
DUCKDB_API static Value Deserialize(Deserializer &
|
227
|
+
DUCKDB_API static Value Deserialize(Deserializer &deserializer);
|
232
228
|
|
233
229
|
//===--------------------------------------------------------------------===//
|
234
230
|
// Comparison Operators
|
@@ -173,13 +173,8 @@ public:
|
|
173
173
|
//! This functions resizes the vector
|
174
174
|
DUCKDB_API void Resize(idx_t cur_size, idx_t new_size);
|
175
175
|
|
176
|
-
|
177
|
-
DUCKDB_API void
|
178
|
-
//! Deserializes a blob back into a Vector
|
179
|
-
DUCKDB_API void Deserialize(idx_t count, Deserializer &source);
|
180
|
-
|
181
|
-
DUCKDB_API void FormatSerialize(FormatSerializer &serializer, idx_t count);
|
182
|
-
DUCKDB_API void FormatDeserialize(FormatDeserializer &deserializer, idx_t count);
|
176
|
+
DUCKDB_API void Serialize(Serializer &serializer, idx_t count);
|
177
|
+
DUCKDB_API void Deserialize(Deserializer &deserializer, idx_t count);
|
183
178
|
|
184
179
|
// Getters
|
185
180
|
inline VectorType GetVectorType() const {
|
@@ -17,15 +17,12 @@
|
|
17
17
|
|
18
18
|
namespace duckdb {
|
19
19
|
|
20
|
-
class FormatSerializer;
|
21
|
-
class FormatDeserializer;
|
22
20
|
class Serializer;
|
23
21
|
class Deserializer;
|
24
22
|
class Value;
|
25
23
|
class TypeCatalogEntry;
|
26
24
|
class Vector;
|
27
25
|
class ClientContext;
|
28
|
-
class FieldWriter;
|
29
26
|
|
30
27
|
struct string_t;
|
31
28
|
|
@@ -283,14 +280,8 @@ struct LogicalType {
|
|
283
280
|
return !(*this == rhs);
|
284
281
|
}
|
285
282
|
|
286
|
-
//! Serializes a LogicalType to a stand-alone binary blob
|
287
283
|
DUCKDB_API void Serialize(Serializer &serializer) const;
|
288
|
-
|
289
|
-
//! Deserializes a blob back into an LogicalType
|
290
|
-
DUCKDB_API static LogicalType Deserialize(Deserializer &source);
|
291
|
-
|
292
|
-
DUCKDB_API void FormatSerialize(FormatSerializer &serializer) const;
|
293
|
-
DUCKDB_API static LogicalType FormatDeserialize(FormatDeserializer &deserializer);
|
284
|
+
DUCKDB_API static LogicalType Deserialize(Deserializer &deserializer);
|
294
285
|
|
295
286
|
|
296
287
|
static bool TypeIsTimestamp(LogicalTypeId id) {
|
@@ -45,6 +45,8 @@ public:
|
|
45
45
|
//! Get a new chain of leaf nodes, might cause new buffer allocations,
|
46
46
|
//! with the node parameter holding the tail of the chain
|
47
47
|
static void New(ART &art, reference<Node> &node, const row_t *row_ids, idx_t count);
|
48
|
+
//! Get a new leaf node without any data
|
49
|
+
static Leaf &New(ART &art, Node &node);
|
48
50
|
//! Free the leaf (chain)
|
49
51
|
static void Free(ART &art, Node &node);
|
50
52
|
|
@@ -29,10 +29,6 @@ public:
|
|
29
29
|
//! We can vacuum 10% or more of the total in-memory footprint
|
30
30
|
static constexpr uint8_t VACUUM_THRESHOLD = 10;
|
31
31
|
|
32
|
-
//! Constants for fast offset calculations in the bitmask
|
33
|
-
static constexpr idx_t BASE[] = {0x00000000FFFFFFFF, 0x0000FFFF, 0x00FF, 0x0F, 0x3, 0x1};
|
34
|
-
static constexpr uint8_t SHIFT[] = {32, 16, 8, 4, 2, 1};
|
35
|
-
|
36
32
|
public:
|
37
33
|
FixedSizeAllocator(const idx_t segment_size, BlockManager &block_manager);
|
38
34
|
|
@@ -80,7 +76,7 @@ public:
|
|
80
76
|
IndexPointer VacuumPointer(const IndexPointer ptr);
|
81
77
|
|
82
78
|
//! Serializes all in-memory buffers and the metadata
|
83
|
-
BlockPointer Serialize(MetadataWriter &writer);
|
79
|
+
BlockPointer Serialize(PartialBlockManager &partial_block_manager, MetadataWriter &writer);
|
84
80
|
//! Deserializes all metadata
|
85
81
|
void Deserialize(const BlockPointer &block_pointer);
|
86
82
|
|
@@ -117,8 +113,6 @@ private:
|
|
117
113
|
auto buffer_ptr = buffer.Get(dirty);
|
118
114
|
return buffer_ptr + ptr.GetOffset() * segment_size + bitmask_offset;
|
119
115
|
}
|
120
|
-
//! Returns the first free offset in a bitmask
|
121
|
-
uint32_t GetOffset(ValidityMask &mask, const idx_t segment_count);
|
122
116
|
//! Returns an available buffer id
|
123
117
|
idx_t GetAvailableBufferId() const;
|
124
118
|
};
|
@@ -8,36 +8,61 @@
|
|
8
8
|
|
9
9
|
#pragma once
|
10
10
|
|
11
|
+
#include "duckdb/storage/partial_block_manager.hpp"
|
11
12
|
#include "duckdb/common/typedefs.hpp"
|
12
13
|
#include "duckdb/storage/buffer/block_handle.hpp"
|
13
14
|
#include "duckdb/storage/buffer/buffer_handle.hpp"
|
15
|
+
#include "duckdb/storage/block_manager.hpp"
|
14
16
|
|
15
17
|
namespace duckdb {
|
16
18
|
|
17
19
|
class FixedSizeAllocator;
|
18
20
|
class MetadataWriter;
|
19
21
|
|
22
|
+
struct PartialBlockForIndex : public PartialBlock {
|
23
|
+
public:
|
24
|
+
PartialBlockForIndex(PartialBlockState state, BlockManager &block_manager,
|
25
|
+
const shared_ptr<BlockHandle> &block_handle);
|
26
|
+
~PartialBlockForIndex() override {};
|
27
|
+
|
28
|
+
public:
|
29
|
+
void Flush(const idx_t free_space_left) override;
|
30
|
+
void Clear() override;
|
31
|
+
void Merge(PartialBlock &other, idx_t offset, idx_t other_size) override;
|
32
|
+
};
|
33
|
+
|
20
34
|
//! A fixed-size buffer holds fixed-size segments of data. It lazily deserializes a buffer, if on-disk and not
|
21
35
|
//! yet in memory, and it only serializes dirty and non-written buffers to disk during
|
22
36
|
//! serialization.
|
23
37
|
class FixedSizeBuffer {
|
38
|
+
public:
|
39
|
+
//! Constants for fast offset calculations in the bitmask
|
40
|
+
static constexpr idx_t BASE[] = {0x00000000FFFFFFFF, 0x0000FFFF, 0x00FF, 0x0F, 0x3, 0x1};
|
41
|
+
static constexpr uint8_t SHIFT[] = {32, 16, 8, 4, 2, 1};
|
42
|
+
|
24
43
|
public:
|
25
44
|
//! Constructor for a new in-memory buffer
|
26
45
|
explicit FixedSizeBuffer(BlockManager &block_manager);
|
27
46
|
//! Constructor for deserializing buffer metadata from disk
|
28
|
-
FixedSizeBuffer(BlockManager &block_manager, const idx_t segment_count, const
|
47
|
+
FixedSizeBuffer(BlockManager &block_manager, const idx_t segment_count, const idx_t allocation_size,
|
48
|
+
const BlockPointer &block_pointer);
|
29
49
|
|
30
50
|
//! Block manager of the database instance
|
31
51
|
BlockManager &block_manager;
|
32
52
|
|
33
53
|
//! The number of allocated segments
|
34
54
|
idx_t segment_count;
|
55
|
+
//! The size of allocated memory in this buffer (necessary for copying while pinning)
|
56
|
+
idx_t allocation_size;
|
35
57
|
|
36
58
|
//! True: the in-memory buffer is no longer consistent with a (possibly existing) copy on disk
|
37
59
|
bool dirty;
|
38
60
|
//! True: can be vacuumed after the vacuum operation
|
39
61
|
bool vacuum;
|
40
62
|
|
63
|
+
//! Partial block id and offset
|
64
|
+
BlockPointer block_pointer;
|
65
|
+
|
41
66
|
public:
|
42
67
|
//! Returns true, if the buffer is in-memory
|
43
68
|
inline bool InMemory() const {
|
@@ -45,12 +70,7 @@ public:
|
|
45
70
|
}
|
46
71
|
//! Returns true, if the block is on-disk
|
47
72
|
inline bool OnDisk() const {
|
48
|
-
return (
|
49
|
-
}
|
50
|
-
//! Returns the block ID
|
51
|
-
inline block_id_t BlockId() const {
|
52
|
-
D_ASSERT(OnDisk());
|
53
|
-
return block_handle->BlockId();
|
73
|
+
return block_pointer.IsValid();
|
54
74
|
}
|
55
75
|
//! Returns a pointer to the buffer in memory, and calls Deserialize, if the buffer is not in memory
|
56
76
|
inline data_ptr_t Get(const bool dirty_p = true) {
|
@@ -65,15 +85,25 @@ public:
|
|
65
85
|
//! Destroys the in-memory buffer and the on-disk block
|
66
86
|
void Destroy();
|
67
87
|
//! Serializes a buffer (if dirty or not on disk)
|
68
|
-
void Serialize(
|
88
|
+
void Serialize(PartialBlockManager &partial_block_manager, const idx_t available_segments, const idx_t segment_size,
|
89
|
+
const idx_t bitmask_offset);
|
69
90
|
//! Pin a buffer (if not in-memory)
|
70
91
|
void Pin();
|
92
|
+
//! Returns the first free offset in a bitmask
|
93
|
+
uint32_t GetOffset(const idx_t bitmask_count);
|
71
94
|
|
72
95
|
private:
|
73
96
|
//! The buffer handle of the in-memory buffer
|
74
97
|
BufferHandle buffer_handle;
|
75
98
|
//! The block handle of the on-disk buffer
|
76
99
|
shared_ptr<BlockHandle> block_handle;
|
100
|
+
|
101
|
+
private:
|
102
|
+
//! Returns the maximum non-free offset in a bitmask
|
103
|
+
uint32_t GetMaxOffset(const idx_t available_segments_per_buffer);
|
104
|
+
//! Sets all uninitialized regions of a buffer in the respective partial block allocation
|
105
|
+
void SetUninitializedRegions(PartialBlockForIndex &p_block_for_index, const idx_t segment_size, const idx_t offset,
|
106
|
+
const idx_t bitmask_offset);
|
77
107
|
};
|
78
108
|
|
79
109
|
} // namespace duckdb
|