duckdb 0.10.2-dev0.0 → 0.10.2-dev5.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 +22 -18
- package/binding.gyp.in +3 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +3 -1
- package/src/duckdb/extension/icu/icu_extension.cpp +6 -2
- package/src/duckdb/extension/json/buffered_json_reader.cpp +10 -3
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +2 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +13 -7
- package/src/duckdb/extension/json/include/json_serializer.hpp +5 -4
- package/src/duckdb/extension/json/include/json_structure.hpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +15 -5
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +15 -6
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +21 -20
- package/src/duckdb/extension/json/json_functions/read_json.cpp +37 -3
- package/src/duckdb/extension/json/json_functions.cpp +7 -2
- package/src/duckdb/extension/json/json_scan.cpp +57 -33
- package/src/duckdb/extension/parquet/column_reader.cpp +12 -3
- package/src/duckdb/extension/parquet/column_writer.cpp +44 -7
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +5 -1
- package/src/duckdb/extension/parquet/parquet_extension.cpp +30 -3
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +1 -1
- package/src/duckdb/extension/parquet/parquet_writer.cpp +4 -2
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +1 -1
- package/src/duckdb/src/catalog/catalog.cpp +5 -1
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +21 -5
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +8 -9
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -7
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +6 -7
- package/src/duckdb/src/catalog/catalog_entry.cpp +8 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +2 -2
- package/src/duckdb/src/catalog/default/default_functions.cpp +6 -6
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +7 -7
- package/src/duckdb/src/catalog/dependency_catalog_set.cpp +2 -1
- package/src/duckdb/src/catalog/dependency_list.cpp +92 -8
- package/src/duckdb/src/catalog/dependency_manager.cpp +53 -68
- package/src/duckdb/src/catalog/duck_catalog.cpp +1 -1
- package/src/duckdb/src/common/adbc/adbc.cpp +287 -45
- package/src/duckdb/src/common/arrow/appender/union_data.cpp +2 -2
- package/src/duckdb/src/common/box_renderer.cpp +12 -12
- package/src/duckdb/src/common/crypto/md5.cpp +2 -1
- package/src/duckdb/src/common/enum_util.cpp +307 -1
- package/src/duckdb/src/common/enums/expression_type.cpp +4 -0
- package/src/duckdb/src/common/enums/optimizer_type.cpp +1 -1
- package/src/duckdb/src/common/file_system.cpp +60 -13
- package/src/duckdb/src/common/filename_pattern.cpp +13 -13
- package/src/duckdb/src/common/gzip_file_system.cpp +1 -1
- package/src/duckdb/src/common/http_state.cpp +1 -1
- package/src/duckdb/src/common/local_file_system.cpp +72 -71
- package/src/duckdb/src/common/multi_file_reader.cpp +48 -28
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +2 -2
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +13 -1
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +32 -13
- package/src/duckdb/src/common/string_util.cpp +2 -3
- package/src/duckdb/src/common/tree_renderer.cpp +32 -67
- package/src/duckdb/src/common/types/bit.cpp +6 -6
- package/src/duckdb/src/common/types/data_chunk.cpp +2 -2
- package/src/duckdb/src/common/types/hash.cpp +6 -6
- package/src/duckdb/src/common/types/hyperloglog.cpp +2 -0
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +13 -0
- package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +5 -7
- package/src/duckdb/src/common/types/uuid.cpp +1 -1
- package/src/duckdb/src/common/types/vector.cpp +22 -14
- package/src/duckdb/src/common/types.cpp +8 -1
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +20 -18
- package/src/duckdb/src/common/vector_operations/generators.cpp +1 -1
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +267 -110
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +52 -23
- package/src/duckdb/src/common/virtual_file_system.cpp +33 -20
- package/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +3 -3
- package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +31 -16
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +3 -0
- package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +2 -0
- package/src/duckdb/src/core_functions/core_functions.cpp +1 -1
- package/src/duckdb/src/core_functions/function_list.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/time_bucket.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/system_functions.cpp +46 -17
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/list/flatten.cpp +82 -45
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +3 -2
- package/src/duckdb/src/core_functions/scalar/string/hex.cpp +2 -4
- package/src/duckdb/src/core_functions/scalar/string/repeat.cpp +12 -21
- package/src/duckdb/src/execution/column_binding_resolver.cpp +2 -10
- package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +133 -66
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +0 -2
- package/src/duckdb/src/execution/expression_executor.cpp +0 -4
- package/src/duckdb/src/execution/expression_executor_state.cpp +1 -1
- package/src/duckdb/src/execution/index/art/art.cpp +2 -2
- package/src/duckdb/src/execution/index/unknown_index.cpp +13 -13
- package/src/duckdb/src/execution/join_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +0 -1
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +10 -7
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +32 -1
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +16 -2
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +7 -7
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +354 -159
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +11 -2
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +22 -7
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +10 -10
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +9 -18
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +180 -47
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +100 -58
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +88 -21
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +12 -13
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +2 -0
- package/src/duckdb/src/execution/operator/persistent/csv_rejects_table.cpp +118 -23
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +14 -5
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +5 -5
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +0 -9
- package/src/duckdb/src/execution/physical_plan/plan_vacuum.cpp +18 -0
- package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -3
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +81 -106
- package/src/duckdb/src/execution/reservoir_sample.cpp +1 -1
- package/src/duckdb/src/execution/window_executor.cpp +48 -28
- package/src/duckdb/src/execution/window_segment_tree.cpp +20 -23
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +1 -1
- package/src/duckdb/src/function/cast/enum_casts.cpp +20 -55
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +10 -9
- package/src/duckdb/src/function/cast_rules.cpp +9 -1
- package/src/duckdb/src/function/compression_config.cpp +1 -1
- package/src/duckdb/src/function/function_binder.cpp +45 -44
- package/src/duckdb/src/function/function_set.cpp +9 -9
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -2
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +21 -5
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +2 -2
- package/src/duckdb/src/function/scalar/list/list_select.cpp +5 -2
- package/src/duckdb/src/function/scalar/list/list_zip.cpp +5 -4
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +60 -32
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +1 -1
- package/src/duckdb/src/function/scalar/strftime_format.cpp +31 -25
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +6 -6
- package/src/duckdb/src/function/scalar/string/length.cpp +23 -2
- package/src/duckdb/src/function/scalar/string/like.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +1 -1
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +3 -3
- package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +1 -1
- package/src/duckdb/src/function/table/arrow.cpp +7 -1
- package/src/duckdb/src/function/table/copy_csv.cpp +17 -13
- package/src/duckdb/src/function/table/read_csv.cpp +52 -39
- package/src/duckdb/src/function/table/sniff_csv.cpp +7 -13
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +7 -1
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +12 -2
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -2
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_metadata_info.cpp +9 -2
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +10 -6
- package/src/duckdb/src/function/table/table_scan.cpp +1 -4
- package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +6 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +6 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +26 -4
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +39 -6
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +19 -14
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +16 -16
- package/src/duckdb/src/include/duckdb/common/crypto/md5.hpp +0 -1
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/exception/binder_exception.hpp +14 -10
- package/src/duckdb/src/include/duckdb/common/exception/catalog_exception.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/exception/conversion_exception.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/exception/http_exception.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/exception/transaction_exception.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/exception.hpp +57 -58
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/file_open_flags.hpp +134 -0
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +9 -6
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +35 -36
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +4 -6
- package/src/duckdb/src/include/duckdb/common/fixed_size_map.hpp +13 -13
- package/src/duckdb/src/include/duckdb/common/helper.hpp +42 -47
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +13 -10
- package/src/duckdb/src/include/duckdb/common/memory_safety.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +50 -24
- package/src/duckdb/src/include/duckdb/common/operator/abs.hpp +12 -4
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/pipe_file_system.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/platform.h +1 -1
- package/src/duckdb/src/include/duckdb/common/printer.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/profiler.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/random_engine.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +7 -7
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +17 -6
- package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +14 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serializer.hpp +16 -0
- package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +24 -25
- package/src/duckdb/src/include/duckdb/common/typedefs.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types/cast_helpers.hpp +1 -2
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_iterators.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types/column/partitioned_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/constraint_conflict_info.hpp +1 -2
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/date.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/hash.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types/hyperloglog.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +10 -3
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +12 -12
- package/src/duckdb/src/include/duckdb/common/types/string_heap.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +21 -20
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +15 -7
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +14 -10
- package/src/duckdb/src/include/duckdb/common/uhugeint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +15 -14
- package/src/duckdb/src/include/duckdb/common/vector.hpp +21 -21
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/general_cast.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +50 -32
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +10 -11
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/sum_helpers.hpp +13 -1
- package/src/duckdb/src/include/duckdb/core_functions/function_list.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/lambda_functions.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/column_binding_resolver.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/aggregate_object.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/distinct_aggregate_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/column_count_scanner.hpp +0 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer.hpp +9 -6
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +40 -22
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +5 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +6 -4
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +24 -10
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/skip_scanner.hpp +0 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +58 -17
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_rejects_table.hpp +16 -5
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +6 -6
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +5 -5
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +10 -13
- package/src/duckdb/src/include/duckdb/function/function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +24 -23
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/function_set.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/pragma_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +7 -7
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -3
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +12 -11
- package/src/duckdb/src/include/duckdb/function/udf_function.hpp +66 -60
- package/src/duckdb/src/include/duckdb/main/appender.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/buffered_data/buffered_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/buffered_data/simple_buffered_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/chunk_scan_state/query_result.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/client_context_file_opener.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/client_properties.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +14 -5
- package/src/duckdb/src/include/duckdb/main/connection.hpp +27 -26
- package/src/duckdb/src/include/duckdb/main/database.hpp +19 -3
- package/src/duckdb/src/include/duckdb/main/database_file_opener.hpp +58 -0
- package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/error_manager.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +8 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/external_dependencies.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +8 -8
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +2 -59
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/relation/query_relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +11 -7
- package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/secret/secret_storage.hpp +4 -4
- package/src/duckdb/src/include/duckdb/main/settings.hpp +78 -70
- package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_analyzer.hpp +45 -0
- package/src/duckdb/src/include/duckdb/optimizer/compressed_materialization.hpp +11 -13
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cost_model.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +7 -7
- package/src/duckdb/src/include/duckdb/optimizer/matcher/function_matcher.hpp +7 -7
- package/src/duckdb/src/include/duckdb/optimizer/matcher/type_matcher.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/optimizer.hpp +3 -0
- package/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +32 -30
- package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/executor_task.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/pipeline_event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -4
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +49 -8
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_scalar_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_database_info.hpp +40 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_pragma_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_secret_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/extra_drop_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +3 -5
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +16 -9
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_expanded_expression.hpp +34 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +5 -8
- package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +3 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder/group_binder.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +3 -5
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +6 -14
- package/src/duckdb/src/include/duckdb/planner/expression_binder/qualify_binder.hpp +3 -6
- package/src/duckdb/src/include/duckdb/planner/expression_binder/select_bind_state.hpp +52 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/select_binder.hpp +4 -10
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression_iterator.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +3 -6
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_database.hpp +4 -12
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_secret.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_vacuum.hpp +52 -0
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +5 -4
- package/src/duckdb/src/include/duckdb/planner/subquery/flatten_dependent_join.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +4 -1
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +2 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +5 -5
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/algorithm/alprd.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/flag_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/leading_zero_buffer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_analyze.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/index.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/magic_bytes.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +4 -1
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +24 -24
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats_union.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +9 -6
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/chunk_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +10 -1
- package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_version_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/segment_lock.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/delete_info.hpp +20 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/update_info.hpp +1 -1
- package/src/duckdb/src/main/appender.cpp +1 -1
- package/src/duckdb/src/main/attached_database.cpp +11 -3
- package/src/duckdb/src/main/capi/arrow-c.cpp +6 -2
- package/src/duckdb/src/main/capi/cast/utils-c.cpp +1 -1
- package/src/duckdb/src/main/capi/duckdb-c.cpp +1 -1
- package/src/duckdb/src/main/capi/pending-c.cpp +1 -1
- package/src/duckdb/src/main/capi/prepared-c.cpp +2 -2
- package/src/duckdb/src/main/capi/result-c.cpp +4 -4
- package/src/duckdb/src/main/client_context.cpp +4 -12
- package/src/duckdb/src/main/client_context_file_opener.cpp +15 -3
- package/src/duckdb/src/main/client_data.cpp +5 -0
- package/src/duckdb/src/main/config.cpp +82 -82
- package/src/duckdb/src/main/database.cpp +31 -7
- package/src/duckdb/src/main/database_manager.cpp +3 -2
- package/src/duckdb/src/main/database_path_and_type.cpp +4 -4
- package/src/duckdb/src/main/error_manager.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_alias.cpp +9 -9
- package/src/duckdb/src/main/extension/extension_helper.cpp +10 -5
- package/src/duckdb/src/main/extension/extension_install.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_load.cpp +111 -37
- package/src/duckdb/src/main/query_profiler.cpp +1 -118
- package/src/duckdb/src/main/secret/secret_manager.cpp +1 -2
- package/src/duckdb/src/main/secret/secret_storage.cpp +1 -1
- package/src/duckdb/src/main/settings/settings.cpp +81 -65
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +8 -1
- package/src/duckdb/src/optimizer/compressed_materialization/compress_aggregate.cpp +3 -0
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +26 -28
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +5 -5
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +10 -6
- package/src/duckdb/src/optimizer/optimizer.cpp +14 -17
- package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +16 -5
- package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +7 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +2 -2
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_between.cpp +8 -8
- package/src/duckdb/src/optimizer/statistics/expression/propagate_case.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +7 -7
- package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +6 -6
- package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +10 -10
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_cross_product.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +14 -7
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +9 -9
- package/src/duckdb/src/optimizer/statistics/operator/propagate_limit.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_order.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_projection.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics_propagator.cpp +39 -18
- package/src/duckdb/src/parallel/pipeline_finish_event.cpp +1 -1
- package/src/duckdb/src/parallel/task_scheduler.cpp +8 -1
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +4 -2
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +64 -0
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -0
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +13 -5
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +24 -0
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -8
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +2 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +3 -0
- package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +2 -6
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +2 -6
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -6
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +5 -2
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +2 -8
- package/src/duckdb/src/parser/transform/statement/transform_update.cpp +1 -6
- package/src/duckdb/src/parser/transform/statement/transform_use.cpp +3 -2
- package/src/duckdb/src/parser/transformer.cpp +14 -2
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +40 -17
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +8 -3
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +32 -30
- package/src/duckdb/src/planner/binder/query_node/bind_cte_node.cpp +28 -17
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +146 -101
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +28 -26
- package/src/duckdb/src/planner/binder/query_node/plan_cte_node.cpp +29 -0
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_copy_database.cpp +23 -28
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +11 -12
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +9 -11
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +10 -13
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_set.cpp +3 -0
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +66 -65
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +54 -46
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +3 -0
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +5 -5
- package/src/duckdb/src/planner/binder.cpp +78 -6
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +11 -3
- package/src/duckdb/src/planner/expression/bound_expanded_expression.cpp +22 -0
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +11 -58
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +5 -8
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +5 -4
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +5 -19
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +8 -8
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +42 -26
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +3 -22
- package/src/duckdb/src/planner/expression_binder/select_bind_state.cpp +52 -0
- package/src/duckdb/src/planner/expression_binder/select_binder.cpp +43 -5
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +19 -7
- package/src/duckdb/src/planner/logical_operator.cpp +20 -3
- package/src/duckdb/src/planner/operator/logical_copy_database.cpp +4 -14
- package/src/duckdb/src/planner/operator/logical_delete.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_vacuum.cpp +65 -0
- package/src/duckdb/src/planner/planner.cpp +4 -4
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +26 -27
- package/src/duckdb/src/storage/arena_allocator.cpp +9 -0
- package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +1 -1
- package/src/duckdb/src/storage/buffer_manager.cpp +2 -10
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +2 -3
- package/src/duckdb/src/storage/checkpoint_manager.cpp +15 -8
- package/src/duckdb/src/storage/compression/bitpacking.cpp +6 -1
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +1 -1
- package/src/duckdb/src/storage/data_pointer.cpp +1 -1
- package/src/duckdb/src/storage/data_table.cpp +18 -7
- package/src/duckdb/src/storage/local_storage.cpp +8 -5
- package/src/duckdb/src/storage/magic_bytes.cpp +6 -5
- package/src/duckdb/src/storage/partial_block_manager.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +20 -9
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +12 -10
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +23 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +46 -19
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +21 -5
- package/src/duckdb/src/storage/statistics/array_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +2 -3
- package/src/duckdb/src/storage/statistics/list_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +1 -1
- package/src/duckdb/src/storage/storage_info.cpp +19 -19
- package/src/duckdb/src/storage/storage_manager.cpp +18 -13
- package/src/duckdb/src/storage/table/chunk_info.cpp +11 -3
- package/src/duckdb/src/storage/table/column_data.cpp +88 -66
- package/src/duckdb/src/storage/table/row_group.cpp +7 -7
- package/src/duckdb/src/storage/table/row_version_manager.cpp +2 -2
- package/src/duckdb/src/storage/table/standard_column_data.cpp +4 -0
- package/src/duckdb/src/storage/table/update_segment.cpp +3 -1
- package/src/duckdb/src/storage/table_index_list.cpp +6 -1
- package/src/duckdb/src/storage/temporary_file_manager.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +8 -7
- package/src/duckdb/src/storage/write_ahead_log.cpp +3 -4
- package/src/duckdb/src/transaction/cleanup_state.cpp +10 -3
- package/src/duckdb/src/transaction/commit_state.cpp +11 -4
- package/src/duckdb/src/transaction/duck_transaction.cpp +23 -3
- package/src/duckdb/src/transaction/rollback_state.cpp +1 -1
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
- package/src/duckdb/src/transaction/undo_buffer.cpp +3 -1
- package/src/duckdb/third_party/fmt/include/fmt/core.h +0 -5
- package/src/duckdb/third_party/fsst/fsst.h +1 -1
- package/src/duckdb/third_party/fsst/libfsst.cpp +1 -140
- package/src/duckdb/third_party/fsst/libfsst.hpp +0 -13
- package/src/duckdb/third_party/hyperloglog/hyperloglog.hpp +4 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +8 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +2 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +15401 -15354
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +299 -538
- package/src/duckdb/third_party/lz4/lz4.cpp +2605 -0
- package/src/duckdb/third_party/lz4/lz4.hpp +843 -0
- package/src/duckdb/third_party/parquet/parquet_types.cpp +3 -0
- package/src/duckdb/third_party/parquet/parquet_types.h +2 -1
- package/src/duckdb/third_party/re2/re2/bitmap256.cc +44 -0
- package/src/duckdb/third_party/re2/re2/bitmap256.h +3 -35
- package/src/duckdb/third_party/re2/re2/bitstate.cc +31 -24
- package/src/duckdb/third_party/re2/re2/compile.cc +146 -164
- package/src/duckdb/third_party/re2/re2/dfa.cc +174 -181
- package/src/duckdb/third_party/re2/re2/filtered_re2.cc +19 -3
- package/src/duckdb/third_party/re2/re2/filtered_re2.h +27 -23
- package/src/duckdb/third_party/re2/re2/mimics_pcre.cc +21 -11
- package/src/duckdb/third_party/re2/re2/nfa.cc +91 -131
- package/src/duckdb/third_party/re2/re2/onepass.cc +11 -10
- package/src/duckdb/third_party/re2/re2/parse.cc +171 -154
- package/src/duckdb/third_party/re2/re2/perl_groups.cc +35 -35
- package/src/duckdb/third_party/re2/re2/pod_array.h +55 -0
- package/src/duckdb/third_party/re2/re2/prefilter.cc +40 -40
- package/src/duckdb/third_party/re2/re2/prefilter.h +24 -2
- package/src/duckdb/third_party/re2/re2/prefilter_tree.cc +70 -84
- package/src/duckdb/third_party/re2/re2/prefilter_tree.h +5 -4
- package/src/duckdb/third_party/re2/re2/prog.cc +315 -58
- package/src/duckdb/third_party/re2/re2/prog.h +77 -44
- package/src/duckdb/third_party/re2/re2/re2.cc +333 -221
- package/src/duckdb/third_party/re2/re2/re2.h +277 -201
- package/src/duckdb/third_party/re2/re2/regexp.cc +137 -105
- package/src/duckdb/third_party/re2/re2/regexp.h +45 -40
- package/src/duckdb/third_party/re2/re2/set.cc +40 -17
- package/src/duckdb/third_party/re2/re2/set.h +11 -6
- package/src/duckdb/third_party/re2/re2/simplify.cc +50 -41
- package/src/duckdb/third_party/re2/re2/sparse_array.h +392 -0
- package/src/duckdb/third_party/re2/re2/sparse_set.h +264 -0
- package/src/duckdb/third_party/re2/re2/stringpiece.cc +1 -1
- package/src/duckdb/third_party/re2/re2/stringpiece.h +11 -8
- package/src/duckdb/third_party/re2/re2/tostring.cc +8 -6
- package/src/duckdb/third_party/re2/re2/unicode_casefold.cc +39 -10
- package/src/duckdb/third_party/re2/re2/unicode_casefold.h +1 -1
- package/src/duckdb/third_party/re2/re2/unicode_groups.cc +5019 -4566
- package/src/duckdb/third_party/re2/re2/unicode_groups.h +1 -1
- package/src/duckdb/third_party/re2/re2/walker-inl.h +21 -20
- package/src/duckdb/third_party/re2/util/logging.h +14 -18
- package/src/duckdb/third_party/re2/util/mix.h +4 -4
- package/src/duckdb/third_party/re2/util/mutex.h +48 -15
- package/src/duckdb/third_party/re2/util/rune.cc +5 -5
- package/src/duckdb/third_party/re2/util/strutil.cc +1 -16
- package/src/duckdb/third_party/re2/util/strutil.h +1 -3
- package/src/duckdb/third_party/re2/util/utf.h +1 -1
- package/src/duckdb/third_party/re2/util/util.h +9 -1
- package/src/duckdb/third_party/utf8proc/include/utf8proc_wrapper.hpp +2 -0
- package/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp +36 -1
- package/src/duckdb/ub_src_common.cpp +0 -2
- package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
- package/src/duckdb/ub_src_planner_expression.cpp +2 -0
- package/src/duckdb/ub_src_planner_expression_binder.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +2 -0
- package/test/jsdoc.test.ts +3 -0
|
@@ -40,43 +40,23 @@ extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory(PULONGLONG)
|
|
|
40
40
|
#endif
|
|
41
41
|
|
|
42
42
|
#if defined(__linux__)
|
|
43
|
+
#include <linux/falloc.h>
|
|
43
44
|
#include <libgen.h>
|
|
44
45
|
// See e.g.:
|
|
45
46
|
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
|
|
46
47
|
#elif defined(__APPLE__)
|
|
47
|
-
#include <TargetConditionals.h>
|
|
48
|
-
#if not(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1)
|
|
49
|
-
#include <libproc.h>
|
|
50
|
-
#endif
|
|
48
|
+
#include <TargetConditionals.h>
|
|
49
|
+
#if not(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1)
|
|
50
|
+
#include <libproc.h>
|
|
51
|
+
#endif
|
|
51
52
|
#elif defined(_WIN32)
|
|
52
53
|
#include <restartmanager.h>
|
|
53
54
|
#endif
|
|
54
55
|
|
|
55
56
|
namespace duckdb {
|
|
56
57
|
|
|
57
|
-
static void AssertValidFileFlags(uint8_t flags) {
|
|
58
|
-
#ifdef DEBUG
|
|
59
|
-
bool is_read = flags & FileFlags::FILE_FLAGS_READ;
|
|
60
|
-
bool is_write = flags & FileFlags::FILE_FLAGS_WRITE;
|
|
61
|
-
bool is_create = (flags & FileFlags::FILE_FLAGS_FILE_CREATE) || (flags & FileFlags::FILE_FLAGS_FILE_CREATE_NEW);
|
|
62
|
-
bool is_private = (flags & FileFlags::FILE_FLAGS_PRIVATE);
|
|
63
|
-
|
|
64
|
-
// require either READ or WRITE (or both)
|
|
65
|
-
D_ASSERT(is_read || is_write);
|
|
66
|
-
// CREATE/Append flags require writing
|
|
67
|
-
D_ASSERT(is_write || !(flags & FileFlags::FILE_FLAGS_APPEND));
|
|
68
|
-
D_ASSERT(is_write || !(flags & FileFlags::FILE_FLAGS_FILE_CREATE));
|
|
69
|
-
D_ASSERT(is_write || !(flags & FileFlags::FILE_FLAGS_FILE_CREATE_NEW));
|
|
70
|
-
// cannot combine CREATE and CREATE_NEW flags
|
|
71
|
-
D_ASSERT(!(flags & FileFlags::FILE_FLAGS_FILE_CREATE && flags & FileFlags::FILE_FLAGS_FILE_CREATE_NEW));
|
|
72
|
-
|
|
73
|
-
// For is_private can only be set along with a create flag
|
|
74
|
-
D_ASSERT(!is_private || is_create);
|
|
75
|
-
#endif
|
|
76
|
-
}
|
|
77
|
-
|
|
78
58
|
#ifndef _WIN32
|
|
79
|
-
bool LocalFileSystem::FileExists(const string &filename) {
|
|
59
|
+
bool LocalFileSystem::FileExists(const string &filename, optional_ptr<FileOpener> opener) {
|
|
80
60
|
if (!filename.empty()) {
|
|
81
61
|
if (access(filename.c_str(), 0) == 0) {
|
|
82
62
|
struct stat status;
|
|
@@ -90,7 +70,7 @@ bool LocalFileSystem::FileExists(const string &filename) {
|
|
|
90
70
|
return false;
|
|
91
71
|
}
|
|
92
72
|
|
|
93
|
-
bool LocalFileSystem::IsPipe(const string &filename) {
|
|
73
|
+
bool LocalFileSystem::IsPipe(const string &filename, optional_ptr<FileOpener> opener) {
|
|
94
74
|
if (!filename.empty()) {
|
|
95
75
|
if (access(filename.c_str(), 0) == 0) {
|
|
96
76
|
struct stat status;
|
|
@@ -105,7 +85,7 @@ bool LocalFileSystem::IsPipe(const string &filename) {
|
|
|
105
85
|
}
|
|
106
86
|
|
|
107
87
|
#else
|
|
108
|
-
bool LocalFileSystem::FileExists(const string &filename) {
|
|
88
|
+
bool LocalFileSystem::FileExists(const string &filename, optional_ptr<FileOpener> opener) {
|
|
109
89
|
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
110
90
|
const wchar_t *wpath = unicode_path.c_str();
|
|
111
91
|
if (_waccess(wpath, 0) == 0) {
|
|
@@ -117,7 +97,7 @@ bool LocalFileSystem::FileExists(const string &filename) {
|
|
|
117
97
|
}
|
|
118
98
|
return false;
|
|
119
99
|
}
|
|
120
|
-
bool LocalFileSystem::IsPipe(const string &filename) {
|
|
100
|
+
bool LocalFileSystem::IsPipe(const string &filename, optional_ptr<FileOpener> opener) {
|
|
121
101
|
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
122
102
|
const wchar_t *wpath = unicode_path.c_str();
|
|
123
103
|
if (_waccess(wpath, 0) == 0) {
|
|
@@ -233,7 +213,7 @@ static string AdditionalProcessInfo(FileSystem &fs, pid_t pid) {
|
|
|
233
213
|
try {
|
|
234
214
|
auto cmdline_file = fs.OpenFile(StringUtil::Format("/proc/%d/cmdline", pid), FileFlags::FILE_FLAGS_READ);
|
|
235
215
|
auto cmdline = cmdline_file->ReadLine();
|
|
236
|
-
process_name = basename(const_cast<char *>(cmdline.c_str()));
|
|
216
|
+
process_name = basename(const_cast<char *>(cmdline.c_str())); // NOLINT: old C API does not take const
|
|
237
217
|
} catch (std::exception &) {
|
|
238
218
|
// ignore
|
|
239
219
|
}
|
|
@@ -292,19 +272,19 @@ bool LocalFileSystem::IsPrivateFile(const string &path_p, FileOpener *opener) {
|
|
|
292
272
|
return true;
|
|
293
273
|
}
|
|
294
274
|
|
|
295
|
-
unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p,
|
|
296
|
-
|
|
275
|
+
unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, FileOpenFlags flags,
|
|
276
|
+
optional_ptr<FileOpener> opener) {
|
|
297
277
|
auto path = FileSystem::ExpandPath(path_p, opener);
|
|
298
|
-
if (
|
|
278
|
+
if (flags.Compression() != FileCompressionType::UNCOMPRESSED) {
|
|
299
279
|
throw NotImplementedException("Unsupported compression type for default file system");
|
|
300
280
|
}
|
|
301
281
|
|
|
302
|
-
|
|
282
|
+
flags.Verify();
|
|
303
283
|
|
|
304
284
|
int open_flags = 0;
|
|
305
285
|
int rc;
|
|
306
|
-
bool open_read = flags
|
|
307
|
-
bool open_write = flags
|
|
286
|
+
bool open_read = flags.OpenForReading();
|
|
287
|
+
bool open_write = flags.OpenForWriting();
|
|
308
288
|
if (open_read && open_write) {
|
|
309
289
|
open_flags = O_RDWR;
|
|
310
290
|
} else if (open_read) {
|
|
@@ -316,18 +296,18 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, uint8_t f
|
|
|
316
296
|
}
|
|
317
297
|
if (open_write) {
|
|
318
298
|
// need Read or Write
|
|
319
|
-
D_ASSERT(flags
|
|
299
|
+
D_ASSERT(flags.OpenForWriting());
|
|
320
300
|
open_flags |= O_CLOEXEC;
|
|
321
|
-
if (flags
|
|
301
|
+
if (flags.CreateFileIfNotExists()) {
|
|
322
302
|
open_flags |= O_CREAT;
|
|
323
|
-
} else if (flags
|
|
303
|
+
} else if (flags.OverwriteExistingFile()) {
|
|
324
304
|
open_flags |= O_CREAT | O_TRUNC;
|
|
325
305
|
}
|
|
326
|
-
if (flags
|
|
306
|
+
if (flags.OpenForAppending()) {
|
|
327
307
|
open_flags |= O_APPEND;
|
|
328
308
|
}
|
|
329
309
|
}
|
|
330
|
-
if (flags
|
|
310
|
+
if (flags.DirectIO()) {
|
|
331
311
|
#if defined(__sun) && defined(__SVR4)
|
|
332
312
|
throw InvalidInputException("DIRECT_IO not supported on Solaris");
|
|
333
313
|
#endif
|
|
@@ -341,7 +321,7 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, uint8_t f
|
|
|
341
321
|
|
|
342
322
|
// Determine permissions
|
|
343
323
|
mode_t filesec;
|
|
344
|
-
if (flags
|
|
324
|
+
if (flags.CreatePrivateFile()) {
|
|
345
325
|
open_flags |= O_EXCL; // Ensure we error on existing files or the permissions may not set
|
|
346
326
|
filesec = 0600;
|
|
347
327
|
} else {
|
|
@@ -352,6 +332,9 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, uint8_t f
|
|
|
352
332
|
int fd = open(path.c_str(), open_flags, filesec);
|
|
353
333
|
|
|
354
334
|
if (fd == -1) {
|
|
335
|
+
if (flags.ReturnNullIfNotExists() && errno == ENOENT) {
|
|
336
|
+
return nullptr;
|
|
337
|
+
}
|
|
355
338
|
throw IOException("Cannot open file \"%s\": %s", {{"errno", std::to_string(errno)}}, path, strerror(errno));
|
|
356
339
|
}
|
|
357
340
|
// #if defined(__DARWIN__) || defined(__APPLE__)
|
|
@@ -363,14 +346,14 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, uint8_t f
|
|
|
363
346
|
// }
|
|
364
347
|
// }
|
|
365
348
|
// #endif
|
|
366
|
-
if (
|
|
349
|
+
if (flags.Lock() != FileLockType::NO_LOCK) {
|
|
367
350
|
// set lock on file
|
|
368
351
|
// but only if it is not an input/output stream
|
|
369
352
|
auto file_type = GetFileTypeInternal(fd);
|
|
370
353
|
if (file_type != FileType::FILE_TYPE_FIFO && file_type != FileType::FILE_TYPE_SOCKET) {
|
|
371
354
|
struct flock fl;
|
|
372
355
|
memset(&fl, 0, sizeof fl);
|
|
373
|
-
fl.l_type =
|
|
356
|
+
fl.l_type = flags.Lock() == FileLockType::READ_LOCK ? F_RDLCK : F_WRLCK;
|
|
374
357
|
fl.l_whence = SEEK_SET;
|
|
375
358
|
fl.l_start = 0;
|
|
376
359
|
fl.l_len = 0;
|
|
@@ -387,7 +370,7 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, uint8_t f
|
|
|
387
370
|
message = AdditionalProcessInfo(*this, fl.l_pid);
|
|
388
371
|
}
|
|
389
372
|
|
|
390
|
-
if (
|
|
373
|
+
if (flags.Lock() == FileLockType::WRITE_LOCK) {
|
|
391
374
|
// maybe we can get a read lock instead and tell this to the user.
|
|
392
375
|
fl.l_type = F_RDLCK;
|
|
393
376
|
rc = fcntl(fd, F_SETLK, &fl);
|
|
@@ -490,6 +473,16 @@ int64_t LocalFileSystem::Write(FileHandle &handle, void *buffer, int64_t nr_byte
|
|
|
490
473
|
return bytes_written;
|
|
491
474
|
}
|
|
492
475
|
|
|
476
|
+
bool LocalFileSystem::Trim(FileHandle &handle, idx_t offset_bytes, idx_t length_bytes) {
|
|
477
|
+
#if defined(__linux__)
|
|
478
|
+
int fd = handle.Cast<UnixFileHandle>().fd;
|
|
479
|
+
int res = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset_bytes, length_bytes);
|
|
480
|
+
return res == 0;
|
|
481
|
+
#else
|
|
482
|
+
return false;
|
|
483
|
+
#endif
|
|
484
|
+
}
|
|
485
|
+
|
|
493
486
|
int64_t LocalFileSystem::GetFileSize(FileHandle &handle) {
|
|
494
487
|
int fd = handle.Cast<UnixFileHandle>().fd;
|
|
495
488
|
struct stat s;
|
|
@@ -521,7 +514,7 @@ void LocalFileSystem::Truncate(FileHandle &handle, int64_t new_size) {
|
|
|
521
514
|
}
|
|
522
515
|
}
|
|
523
516
|
|
|
524
|
-
bool LocalFileSystem::DirectoryExists(const string &directory) {
|
|
517
|
+
bool LocalFileSystem::DirectoryExists(const string &directory, optional_ptr<FileOpener> opener) {
|
|
525
518
|
if (!directory.empty()) {
|
|
526
519
|
if (access(directory.c_str(), 0) == 0) {
|
|
527
520
|
struct stat status;
|
|
@@ -535,7 +528,7 @@ bool LocalFileSystem::DirectoryExists(const string &directory) {
|
|
|
535
528
|
return false;
|
|
536
529
|
}
|
|
537
530
|
|
|
538
|
-
void LocalFileSystem::CreateDirectory(const string &directory) {
|
|
531
|
+
void LocalFileSystem::CreateDirectory(const string &directory, optional_ptr<FileOpener> opener) {
|
|
539
532
|
struct stat st;
|
|
540
533
|
|
|
541
534
|
if (stat(directory.c_str(), &st) != 0) {
|
|
@@ -589,11 +582,11 @@ int RemoveDirectoryRecursive(const char *path) {
|
|
|
589
582
|
return r;
|
|
590
583
|
}
|
|
591
584
|
|
|
592
|
-
void LocalFileSystem::RemoveDirectory(const string &directory) {
|
|
585
|
+
void LocalFileSystem::RemoveDirectory(const string &directory, optional_ptr<FileOpener> opener) {
|
|
593
586
|
RemoveDirectoryRecursive(directory.c_str());
|
|
594
587
|
}
|
|
595
588
|
|
|
596
|
-
void LocalFileSystem::RemoveFile(const string &filename) {
|
|
589
|
+
void LocalFileSystem::RemoveFile(const string &filename, optional_ptr<FileOpener> opener) {
|
|
597
590
|
if (std::remove(filename.c_str()) != 0) {
|
|
598
591
|
throw IOException("Could not remove file \"%s\": %s", {{"errno", std::to_string(errno)}}, filename,
|
|
599
592
|
strerror(errno));
|
|
@@ -602,7 +595,7 @@ void LocalFileSystem::RemoveFile(const string &filename) {
|
|
|
602
595
|
|
|
603
596
|
bool LocalFileSystem::ListFiles(const string &directory, const std::function<void(const string &, bool)> &callback,
|
|
604
597
|
FileOpener *opener) {
|
|
605
|
-
if (!DirectoryExists(directory)) {
|
|
598
|
+
if (!DirectoryExists(directory, opener)) {
|
|
606
599
|
return false;
|
|
607
600
|
}
|
|
608
601
|
DIR *dir = opendir(directory.c_str());
|
|
@@ -642,7 +635,7 @@ void LocalFileSystem::FileSync(FileHandle &handle) {
|
|
|
642
635
|
}
|
|
643
636
|
}
|
|
644
637
|
|
|
645
|
-
void LocalFileSystem::MoveFile(const string &source, const string &target) {
|
|
638
|
+
void LocalFileSystem::MoveFile(const string &source, const string &target, optional_ptr<FileOpener> opener) {
|
|
646
639
|
//! FIXME: rename does not guarantee atomicity or overwriting target file if it exists
|
|
647
640
|
if (rename(source.c_str(), target.c_str()) != 0) {
|
|
648
641
|
throw IOException("Could not rename file!", {{"errno", std::to_string(errno)}});
|
|
@@ -766,20 +759,20 @@ bool LocalFileSystem::IsPrivateFile(const string &path_p, FileOpener *opener) {
|
|
|
766
759
|
return true;
|
|
767
760
|
}
|
|
768
761
|
|
|
769
|
-
unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p,
|
|
770
|
-
|
|
762
|
+
unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, FileOpenFlags flags,
|
|
763
|
+
optional_ptr<FileOpener> opener) {
|
|
771
764
|
auto path = FileSystem::ExpandPath(path_p, opener);
|
|
772
|
-
if (
|
|
765
|
+
if (flags.Compression() != FileCompressionType::UNCOMPRESSED) {
|
|
773
766
|
throw NotImplementedException("Unsupported compression type for default file system");
|
|
774
767
|
}
|
|
775
|
-
|
|
768
|
+
flags.Verify();
|
|
776
769
|
|
|
777
770
|
DWORD desired_access;
|
|
778
771
|
DWORD share_mode;
|
|
779
772
|
DWORD creation_disposition = OPEN_EXISTING;
|
|
780
773
|
DWORD flags_and_attributes = FILE_ATTRIBUTE_NORMAL;
|
|
781
|
-
bool open_read = flags
|
|
782
|
-
bool open_write = flags
|
|
774
|
+
bool open_read = flags.OpenForReading();
|
|
775
|
+
bool open_write = flags.OpenForWriting();
|
|
783
776
|
if (open_read && open_write) {
|
|
784
777
|
desired_access = GENERIC_READ | GENERIC_WRITE;
|
|
785
778
|
share_mode = 0;
|
|
@@ -793,30 +786,33 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path_p, uint8_t f
|
|
|
793
786
|
throw InternalException("READ, WRITE or both should be specified when opening a file");
|
|
794
787
|
}
|
|
795
788
|
if (open_write) {
|
|
796
|
-
if (flags
|
|
789
|
+
if (flags.CreateFileIfNotExists()) {
|
|
797
790
|
creation_disposition = OPEN_ALWAYS;
|
|
798
|
-
} else if (flags
|
|
791
|
+
} else if (flags.OverwriteExistingFile()) {
|
|
799
792
|
creation_disposition = CREATE_ALWAYS;
|
|
800
793
|
}
|
|
801
794
|
}
|
|
802
|
-
if (flags
|
|
795
|
+
if (flags.DirectIO()) {
|
|
803
796
|
flags_and_attributes |= FILE_FLAG_NO_BUFFERING;
|
|
804
797
|
}
|
|
805
798
|
auto unicode_path = WindowsUtil::UTF8ToUnicode(path.c_str());
|
|
806
799
|
HANDLE hFile = CreateFileW(unicode_path.c_str(), desired_access, share_mode, NULL, creation_disposition,
|
|
807
800
|
flags_and_attributes, NULL);
|
|
808
801
|
if (hFile == INVALID_HANDLE_VALUE) {
|
|
802
|
+
if (flags.ReturnNullIfNotExists() && GetLastError() == ERROR_FILE_NOT_FOUND) {
|
|
803
|
+
return nullptr;
|
|
804
|
+
}
|
|
809
805
|
auto error = LocalFileSystem::GetLastErrorAsString();
|
|
810
806
|
|
|
811
807
|
auto better_error = AdditionalLockInfo(unicode_path);
|
|
812
808
|
if (!better_error.empty()) {
|
|
813
809
|
throw IOException(better_error);
|
|
810
|
+
} else {
|
|
811
|
+
throw IOException("Cannot open file \"%s\": %s", path.c_str(), error);
|
|
814
812
|
}
|
|
815
|
-
|
|
816
|
-
throw IOException("Cannot open file \"%s\": %s", path.c_str(), error);
|
|
817
813
|
}
|
|
818
814
|
auto handle = make_uniq<WindowsFileHandle>(*this, path.c_str(), hFile);
|
|
819
|
-
if (flags
|
|
815
|
+
if (flags.OpenForAppending()) {
|
|
820
816
|
auto file_size = GetFileSize(*handle);
|
|
821
817
|
SetFilePointer(*handle, file_size);
|
|
822
818
|
}
|
|
@@ -920,6 +916,11 @@ int64_t LocalFileSystem::Write(FileHandle &handle, void *buffer, int64_t nr_byte
|
|
|
920
916
|
return bytes_written;
|
|
921
917
|
}
|
|
922
918
|
|
|
919
|
+
bool LocalFileSystem::Trim(FileHandle &handle, idx_t offset_bytes, idx_t length_bytes) {
|
|
920
|
+
// TODO: Not yet implemented on windows.
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
|
|
923
924
|
int64_t LocalFileSystem::GetFileSize(FileHandle &handle) {
|
|
924
925
|
HANDLE hFile = handle.Cast<WindowsFileHandle>().fd;
|
|
925
926
|
LARGE_INTEGER result;
|
|
@@ -971,12 +972,12 @@ static DWORD WindowsGetFileAttributes(const string &filename) {
|
|
|
971
972
|
return GetFileAttributesW(unicode_path.c_str());
|
|
972
973
|
}
|
|
973
974
|
|
|
974
|
-
bool LocalFileSystem::DirectoryExists(const string &directory) {
|
|
975
|
+
bool LocalFileSystem::DirectoryExists(const string &directory, optional_ptr<FileOpener> opener) {
|
|
975
976
|
DWORD attrs = WindowsGetFileAttributes(directory);
|
|
976
977
|
return (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY));
|
|
977
978
|
}
|
|
978
979
|
|
|
979
|
-
void LocalFileSystem::CreateDirectory(const string &directory) {
|
|
980
|
+
void LocalFileSystem::CreateDirectory(const string &directory, optional_ptr<FileOpener> opener) {
|
|
980
981
|
if (DirectoryExists(directory)) {
|
|
981
982
|
return;
|
|
982
983
|
}
|
|
@@ -1001,7 +1002,7 @@ static void DeleteDirectoryRecursive(FileSystem &fs, string directory) {
|
|
|
1001
1002
|
}
|
|
1002
1003
|
}
|
|
1003
1004
|
|
|
1004
|
-
void LocalFileSystem::RemoveDirectory(const string &directory) {
|
|
1005
|
+
void LocalFileSystem::RemoveDirectory(const string &directory, optional_ptr<FileOpener> opener) {
|
|
1005
1006
|
if (FileExists(directory)) {
|
|
1006
1007
|
throw IOException("Attempting to delete directory \"%s\", but it is a file and not a directory!", directory);
|
|
1007
1008
|
}
|
|
@@ -1011,7 +1012,7 @@ void LocalFileSystem::RemoveDirectory(const string &directory) {
|
|
|
1011
1012
|
DeleteDirectoryRecursive(*this, directory.c_str());
|
|
1012
1013
|
}
|
|
1013
1014
|
|
|
1014
|
-
void LocalFileSystem::RemoveFile(const string &filename) {
|
|
1015
|
+
void LocalFileSystem::RemoveFile(const string &filename, optional_ptr<FileOpener> opener) {
|
|
1015
1016
|
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
1016
1017
|
if (!DeleteFileW(unicode_path.c_str())) {
|
|
1017
1018
|
auto error = LocalFileSystem::GetLastErrorAsString();
|
|
@@ -1055,7 +1056,7 @@ void LocalFileSystem::FileSync(FileHandle &handle) {
|
|
|
1055
1056
|
}
|
|
1056
1057
|
}
|
|
1057
1058
|
|
|
1058
|
-
void LocalFileSystem::MoveFile(const string &source, const string &target) {
|
|
1059
|
+
void LocalFileSystem::MoveFile(const string &source, const string &target, optional_ptr<FileOpener> opener) {
|
|
1059
1060
|
auto source_unicode = WindowsUtil::UTF8ToUnicode(source.c_str());
|
|
1060
1061
|
auto target_unicode = WindowsUtil::UTF8ToUnicode(target.c_str());
|
|
1061
1062
|
if (!MoveFileW(source_unicode.c_str(), target_unicode.c_str())) {
|
|
@@ -1162,7 +1163,7 @@ static void GlobFilesInternal(FileSystem &fs, const string &path, const string &
|
|
|
1162
1163
|
|
|
1163
1164
|
vector<string> LocalFileSystem::FetchFileWithoutGlob(const string &path, FileOpener *opener, bool absolute_path) {
|
|
1164
1165
|
vector<string> result;
|
|
1165
|
-
if (FileExists(path) || IsPipe(path)) {
|
|
1166
|
+
if (FileExists(path, opener) || IsPipe(path, opener)) {
|
|
1166
1167
|
result.push_back(path);
|
|
1167
1168
|
} else if (!absolute_path) {
|
|
1168
1169
|
Value value;
|
|
@@ -1171,7 +1172,7 @@ vector<string> LocalFileSystem::FetchFileWithoutGlob(const string &path, FileOpe
|
|
|
1171
1172
|
vector<std::string> search_paths = StringUtil::Split(search_paths_str, ',');
|
|
1172
1173
|
for (const auto &search_path : search_paths) {
|
|
1173
1174
|
auto joined_path = JoinPath(search_path, path);
|
|
1174
|
-
if (FileExists(joined_path) || IsPipe(joined_path)) {
|
|
1175
|
+
if (FileExists(joined_path, opener) || IsPipe(joined_path, opener)) {
|
|
1175
1176
|
result.push_back(joined_path);
|
|
1176
1177
|
}
|
|
1177
1178
|
}
|
|
@@ -1262,7 +1263,7 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
|
|
|
1262
1263
|
if (is_last_chunk) {
|
|
1263
1264
|
for (auto &prev_directory : previous_directories) {
|
|
1264
1265
|
const string filename = JoinPath(prev_directory, splits[i]);
|
|
1265
|
-
if (FileExists(filename) || DirectoryExists(filename)) {
|
|
1266
|
+
if (FileExists(filename, opener) || DirectoryExists(filename, opener)) {
|
|
1266
1267
|
result.push_back(filename);
|
|
1267
1268
|
}
|
|
1268
1269
|
}
|
|
@@ -172,7 +172,7 @@ MultiFileReaderBindData MultiFileReader::BindOptions(MultiFileReaderOptions &opt
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
for (auto &part : partitions) {
|
|
175
|
-
idx_t hive_partitioning_index
|
|
175
|
+
idx_t hive_partitioning_index;
|
|
176
176
|
auto lookup = std::find(names.begin(), names.end(), part.first);
|
|
177
177
|
if (lookup != names.end()) {
|
|
178
178
|
// hive partitioning column also exists in file - override
|
|
@@ -421,39 +421,59 @@ bool MultiFileReaderOptions::AutoDetectHivePartitioningInternal(const vector<str
|
|
|
421
421
|
}
|
|
422
422
|
return true;
|
|
423
423
|
}
|
|
424
|
-
void MultiFileReaderOptions::AutoDetectHiveTypesInternal(const string &
|
|
424
|
+
void MultiFileReaderOptions::AutoDetectHiveTypesInternal(const vector<string> &files, ClientContext &context) {
|
|
425
|
+
const LogicalType candidates[] = {LogicalType::DATE, LogicalType::TIMESTAMP, LogicalType::BIGINT};
|
|
426
|
+
|
|
425
427
|
auto &fs = FileSystem::GetFileSystem(context);
|
|
426
428
|
|
|
427
|
-
|
|
428
|
-
auto
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
auto part = StringUtil::Split(*it, "=");
|
|
434
|
-
if (part.size() == 2) {
|
|
435
|
-
partitions[part.front()] = part.back();
|
|
429
|
+
unordered_map<string, LogicalType> detected_types;
|
|
430
|
+
for (auto &file : files) {
|
|
431
|
+
unordered_map<string, string> partitions;
|
|
432
|
+
auto splits = StringUtil::Split(file, fs.PathSeparator(file));
|
|
433
|
+
if (splits.size() < 2) {
|
|
434
|
+
return;
|
|
436
435
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
const LogicalType candidates[] = {LogicalType::DATE, LogicalType::TIMESTAMP, LogicalType::BIGINT};
|
|
443
|
-
for (auto &part : partitions) {
|
|
444
|
-
const string &name = part.first;
|
|
445
|
-
if (hive_types_schema.find(name) != hive_types_schema.end()) {
|
|
446
|
-
continue;
|
|
436
|
+
for (auto it = splits.begin(); it != std::prev(splits.end()); it++) {
|
|
437
|
+
auto part = StringUtil::Split(*it, "=");
|
|
438
|
+
if (part.size() == 2) {
|
|
439
|
+
partitions[part.front()] = part.back();
|
|
440
|
+
}
|
|
447
441
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
442
|
+
if (partitions.empty()) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
for (auto &part : partitions) {
|
|
447
|
+
const string &name = part.first;
|
|
448
|
+
if (hive_types_schema.find(name) != hive_types_schema.end()) {
|
|
449
|
+
// type was explicitly provided by the user
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
LogicalType detected_type = LogicalType::VARCHAR;
|
|
453
|
+
Value value(part.second);
|
|
454
|
+
for (auto &candidate : candidates) {
|
|
455
|
+
const bool success = value.TryCastAs(context, candidate, true);
|
|
456
|
+
if (success) {
|
|
457
|
+
detected_type = candidate;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
auto entry = detected_types.find(name);
|
|
462
|
+
if (entry == detected_types.end()) {
|
|
463
|
+
// type was not yet detected - insert it
|
|
464
|
+
detected_types.insert(make_pair(name, std::move(detected_type)));
|
|
465
|
+
} else {
|
|
466
|
+
// type was already detected - check if the type matches
|
|
467
|
+
// if not promote to VARCHAR
|
|
468
|
+
if (entry->second != detected_type) {
|
|
469
|
+
entry->second = LogicalType::VARCHAR;
|
|
470
|
+
}
|
|
454
471
|
}
|
|
455
472
|
}
|
|
456
473
|
}
|
|
474
|
+
for (auto &entry : detected_types) {
|
|
475
|
+
hive_types_schema.insert(make_pair(entry.first, std::move(entry.second)));
|
|
476
|
+
}
|
|
457
477
|
}
|
|
458
478
|
void MultiFileReaderOptions::AutoDetectHivePartitioning(const vector<string> &files, ClientContext &context) {
|
|
459
479
|
D_ASSERT(!files.empty());
|
|
@@ -471,7 +491,7 @@ void MultiFileReaderOptions::AutoDetectHivePartitioning(const vector<string> &fi
|
|
|
471
491
|
hive_partitioning = AutoDetectHivePartitioningInternal(files, context);
|
|
472
492
|
}
|
|
473
493
|
if (hive_partitioning && hive_types_autocast) {
|
|
474
|
-
AutoDetectHiveTypesInternal(files
|
|
494
|
+
AutoDetectHiveTypesInternal(files, context);
|
|
475
495
|
}
|
|
476
496
|
}
|
|
477
497
|
void MultiFileReaderOptions::VerifyHiveTypesArePartitions(const std::map<string, string> &partitions) const {
|
|
@@ -120,13 +120,13 @@ static idx_t SelectComparison(Vector &, Vector &, const SelectionVector &, idx_t
|
|
|
120
120
|
template <>
|
|
121
121
|
idx_t SelectComparison<Equals>(Vector &left, Vector &right, const SelectionVector &sel, idx_t count,
|
|
122
122
|
SelectionVector *true_sel, SelectionVector *false_sel) {
|
|
123
|
-
return VectorOperations::NestedEquals(left, right, sel, count, true_sel, false_sel);
|
|
123
|
+
return VectorOperations::NestedEquals(left, right, &sel, count, true_sel, false_sel);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
template <>
|
|
127
127
|
idx_t SelectComparison<NotEquals>(Vector &left, Vector &right, const SelectionVector &sel, idx_t count,
|
|
128
128
|
SelectionVector *true_sel, SelectionVector *false_sel) {
|
|
129
|
-
return VectorOperations::NestedNotEquals(left, right, sel, count, true_sel, false_sel);
|
|
129
|
+
return VectorOperations::NestedNotEquals(left, right, &sel, count, true_sel, false_sel);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
template <>
|
|
@@ -10,7 +10,13 @@ namespace duckdb {
|
|
|
10
10
|
BufferedFileReader::BufferedFileReader(FileSystem &fs, const char *path, FileLockType lock_type,
|
|
11
11
|
optional_ptr<FileOpener> opener)
|
|
12
12
|
: fs(fs), data(make_unsafe_uniq_array<data_t>(FILE_BUFFER_SIZE)), offset(0), read_data(0), total_read(0) {
|
|
13
|
-
handle = fs.OpenFile(path, FileFlags::FILE_FLAGS_READ
|
|
13
|
+
handle = fs.OpenFile(path, FileFlags::FILE_FLAGS_READ | lock_type, opener.get());
|
|
14
|
+
file_size = fs.GetFileSize(*handle);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
BufferedFileReader::BufferedFileReader(FileSystem &fs, unique_ptr<FileHandle> handle_p)
|
|
18
|
+
: fs(fs), data(make_unsafe_uniq_array<data_t>(FILE_BUFFER_SIZE)), offset(0), read_data(0),
|
|
19
|
+
handle(std::move(handle_p)), total_read(0) {
|
|
14
20
|
file_size = fs.GetFileSize(*handle);
|
|
15
21
|
}
|
|
16
22
|
|
|
@@ -51,6 +57,12 @@ void BufferedFileReader::Seek(uint64_t location) {
|
|
|
51
57
|
read_data = offset = 0;
|
|
52
58
|
}
|
|
53
59
|
|
|
60
|
+
void BufferedFileReader::Reset() {
|
|
61
|
+
handle->Reset();
|
|
62
|
+
total_read = 0;
|
|
63
|
+
read_data = offset = 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
uint64_t BufferedFileReader::CurrentOffset() {
|
|
55
67
|
return total_read + offset;
|
|
56
68
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#include "duckdb/common/serializer/buffered_file_writer.hpp"
|
|
2
2
|
#include "duckdb/common/exception.hpp"
|
|
3
3
|
#include "duckdb/common/algorithm.hpp"
|
|
4
|
+
#include "duckdb/common/typedefs.hpp"
|
|
4
5
|
#include <cstring>
|
|
5
6
|
|
|
6
7
|
namespace duckdb {
|
|
7
8
|
|
|
8
9
|
// Remove this when we switch C++17: https://stackoverflow.com/a/53350948
|
|
9
|
-
constexpr
|
|
10
|
+
constexpr FileOpenFlags BufferedFileWriter::DEFAULT_OPEN_FLAGS;
|
|
10
11
|
|
|
11
|
-
BufferedFileWriter::BufferedFileWriter(FileSystem &fs, const string &path_p,
|
|
12
|
+
BufferedFileWriter::BufferedFileWriter(FileSystem &fs, const string &path_p, FileOpenFlags open_flags)
|
|
12
13
|
: fs(fs), path(path_p), data(make_unsafe_uniq_array<data_t>(FILE_BUFFER_SIZE)), offset(0), total_written(0) {
|
|
13
|
-
handle = fs.OpenFile(path, open_flags
|
|
14
|
+
handle = fs.OpenFile(path, open_flags | FileLockType::WRITE_LOCK);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
int64_t BufferedFileWriter::GetFileSize() {
|
|
@@ -22,16 +23,34 @@ idx_t BufferedFileWriter::GetTotalWritten() {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
void BufferedFileWriter::WriteData(const_data_ptr_t buffer, idx_t write_size) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
offset
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
if (write_size >= (2ULL * FILE_BUFFER_SIZE - offset)) {
|
|
27
|
+
idx_t to_copy = 0;
|
|
28
|
+
// Check before performing direct IO if there is some data in the current internal buffer.
|
|
29
|
+
// If so, then fill the buffer (to avoid to small write operation), flush it and then write
|
|
30
|
+
// all the remain data directly.
|
|
31
|
+
// This is to avoid to split a large buffer into N*FILE_BUFFER_SIZE buffers
|
|
32
|
+
if (offset != 0) {
|
|
33
|
+
// Some data are still present in the buffer let write them before
|
|
34
|
+
to_copy = FILE_BUFFER_SIZE - offset;
|
|
35
|
+
memcpy(data.get() + offset, buffer, to_copy);
|
|
36
|
+
offset += to_copy;
|
|
37
|
+
Flush(); // Flush buffer before writing every things else
|
|
38
|
+
}
|
|
39
|
+
idx_t remaining_to_write = write_size - to_copy;
|
|
40
|
+
fs.Write(*handle, const_cast<data_ptr_t>(buffer + to_copy), remaining_to_write); // NOLINT: wrong API in Write
|
|
41
|
+
total_written += remaining_to_write;
|
|
42
|
+
} else {
|
|
43
|
+
// first copy anything we can from the buffer
|
|
44
|
+
const_data_ptr_t end_ptr = buffer + write_size;
|
|
45
|
+
while (buffer < end_ptr) {
|
|
46
|
+
idx_t to_write = MinValue<idx_t>((end_ptr - buffer), FILE_BUFFER_SIZE - offset);
|
|
47
|
+
D_ASSERT(to_write > 0);
|
|
48
|
+
memcpy(data.get() + offset, buffer, to_write);
|
|
49
|
+
offset += to_write;
|
|
50
|
+
buffer += to_write;
|
|
51
|
+
if (offset == FILE_BUFFER_SIZE) {
|
|
52
|
+
Flush();
|
|
53
|
+
}
|
|
35
54
|
}
|
|
36
55
|
}
|
|
37
56
|
}
|
|
@@ -173,7 +173,6 @@ string StringUtil::Join(const set<string> &input, const string &separator) {
|
|
|
173
173
|
|
|
174
174
|
string StringUtil::BytesToHumanReadableString(idx_t bytes, idx_t multiplier) {
|
|
175
175
|
D_ASSERT(multiplier == 1000 || multiplier == 1024);
|
|
176
|
-
string db_size;
|
|
177
176
|
idx_t array[6] = {};
|
|
178
177
|
const char *unit[2][6] = {{"bytes", "KiB", "MiB", "GiB", "TiB", "PiB"}, {"bytes", "kB", "MB", "GB", "TB", "PB"}};
|
|
179
178
|
|
|
@@ -230,7 +229,7 @@ bool StringUtil::CIEquals(const string &l1, const string &l2) {
|
|
|
230
229
|
if (l1.size() != l2.size()) {
|
|
231
230
|
return false;
|
|
232
231
|
}
|
|
233
|
-
const auto charmap = LowerFun::
|
|
232
|
+
const auto charmap = LowerFun::ASCII_TO_LOWER_MAP;
|
|
234
233
|
for (idx_t c = 0; c < l1.size(); c++) {
|
|
235
234
|
if (charmap[(uint8_t)l1[c]] != charmap[(uint8_t)l2[c]]) {
|
|
236
235
|
return false;
|
|
@@ -240,7 +239,7 @@ bool StringUtil::CIEquals(const string &l1, const string &l2) {
|
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
bool StringUtil::CILessThan(const string &s1, const string &s2) {
|
|
243
|
-
const auto charmap = UpperFun::
|
|
242
|
+
const auto charmap = UpperFun::ASCII_TO_UPPER_MAP;
|
|
244
243
|
|
|
245
244
|
unsigned char u1, u2;
|
|
246
245
|
|