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
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
#include <assert.h>
|
|
13
13
|
#include <ctype.h>
|
|
14
14
|
#include <errno.h>
|
|
15
|
+
#ifdef _MSC_VER
|
|
16
|
+
#include <intrin.h>
|
|
17
|
+
#endif
|
|
15
18
|
#include <stdint.h>
|
|
16
19
|
#include <stdlib.h>
|
|
17
20
|
#include <string.h>
|
|
18
21
|
#include <algorithm>
|
|
22
|
+
#include <atomic>
|
|
19
23
|
#include <iterator>
|
|
20
24
|
#include <mutex>
|
|
21
25
|
#include <string>
|
|
@@ -24,14 +28,21 @@
|
|
|
24
28
|
|
|
25
29
|
#include "util/util.h"
|
|
26
30
|
#include "util/logging.h"
|
|
27
|
-
#include "util/sparse_array.h"
|
|
28
31
|
#include "util/strutil.h"
|
|
29
32
|
#include "util/utf.h"
|
|
30
33
|
#include "re2/prog.h"
|
|
31
34
|
#include "re2/regexp.h"
|
|
35
|
+
#include "re2/sparse_array.h"
|
|
32
36
|
|
|
33
37
|
namespace duckdb_re2 {
|
|
34
38
|
|
|
39
|
+
// Controls the maximum count permitted by GlobalReplace(); -1 is unlimited.
|
|
40
|
+
static int maximum_global_replace_count = -1;
|
|
41
|
+
|
|
42
|
+
void RE2::FUZZING_ONLY_set_maximum_global_replace_count(int i) {
|
|
43
|
+
maximum_global_replace_count = i;
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
// Maximum number of args we can set
|
|
36
47
|
static const int kMaxArgs = 16;
|
|
37
48
|
static const int kVecSize = 1+kMaxArgs;
|
|
@@ -39,11 +50,11 @@ static const int kVecSize = 1+kMaxArgs;
|
|
|
39
50
|
const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
|
|
40
51
|
|
|
41
52
|
RE2::Options::Options(RE2::CannedOptions opt)
|
|
42
|
-
:
|
|
53
|
+
: max_mem_(kDefaultMaxMem),
|
|
54
|
+
encoding_(opt == RE2::Latin1 ? EncodingLatin1 : EncodingUTF8),
|
|
43
55
|
posix_syntax_(opt == RE2::POSIX),
|
|
44
56
|
longest_match_(opt == RE2::POSIX),
|
|
45
57
|
log_errors_(opt != RE2::Quiet),
|
|
46
|
-
max_mem_(kDefaultMaxMem),
|
|
47
58
|
literal_(false),
|
|
48
59
|
never_nl_(false),
|
|
49
60
|
dot_nl_(false),
|
|
@@ -54,11 +65,30 @@ RE2::Options::Options(RE2::CannedOptions opt)
|
|
|
54
65
|
one_line_(false) {
|
|
55
66
|
}
|
|
56
67
|
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
// Empty objects for use as const references.
|
|
69
|
+
// Statically allocating the storage and then
|
|
70
|
+
// lazily constructing the objects (in a once
|
|
71
|
+
// in RE2::Init()) avoids global constructors
|
|
72
|
+
// and the false positives (thanks, Valgrind)
|
|
73
|
+
// about memory leaks at program termination.
|
|
74
|
+
struct EmptyStorage {
|
|
75
|
+
std::string empty_string;
|
|
76
|
+
std::map<std::string, int> empty_named_groups;
|
|
77
|
+
std::map<int, std::string> empty_group_names;
|
|
78
|
+
};
|
|
79
|
+
alignas(EmptyStorage) static char empty_storage[sizeof(EmptyStorage)];
|
|
80
|
+
|
|
81
|
+
static inline std::string* empty_string() {
|
|
82
|
+
return &reinterpret_cast<EmptyStorage*>(empty_storage)->empty_string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static inline std::map<std::string, int>* empty_named_groups() {
|
|
86
|
+
return &reinterpret_cast<EmptyStorage*>(empty_storage)->empty_named_groups;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static inline std::map<int, std::string>* empty_group_names() {
|
|
90
|
+
return &reinterpret_cast<EmptyStorage*>(empty_storage)->empty_group_names;
|
|
91
|
+
}
|
|
62
92
|
|
|
63
93
|
// Converts from Regexp error code to RE2 error code.
|
|
64
94
|
// Maybe some day they will diverge. In any event, this
|
|
@@ -79,6 +109,8 @@ static RE2::ErrorCode RegexpErrorToRE2(duckdb_re2::RegexpStatusCode code) {
|
|
|
79
109
|
return RE2::ErrorMissingBracket;
|
|
80
110
|
case duckdb_re2::kRegexpMissingParen:
|
|
81
111
|
return RE2::ErrorMissingParen;
|
|
112
|
+
case duckdb_re2::kRegexpUnexpectedParen:
|
|
113
|
+
return RE2::ErrorUnexpectedParen;
|
|
82
114
|
case duckdb_re2::kRegexpTrailingBackslash:
|
|
83
115
|
return RE2::ErrorTrailingBackslash;
|
|
84
116
|
case duckdb_re2::kRegexpRepeatArgument:
|
|
@@ -167,44 +199,53 @@ int RE2::Options::ParseFlags() const {
|
|
|
167
199
|
void RE2::Init(const StringPiece& pattern, const Options& options) {
|
|
168
200
|
static std::once_flag empty_once;
|
|
169
201
|
std::call_once(empty_once, []() {
|
|
170
|
-
|
|
171
|
-
empty_named_groups = new std::map<std::string, int>;
|
|
172
|
-
empty_group_names = new std::map<int, std::string>;
|
|
202
|
+
(void) new (empty_storage) EmptyStorage;
|
|
173
203
|
});
|
|
174
204
|
|
|
175
|
-
pattern_ = std::string(pattern);
|
|
205
|
+
pattern_ = new std::string(pattern);
|
|
176
206
|
options_.Copy(options);
|
|
177
207
|
entire_regexp_ = NULL;
|
|
178
208
|
suffix_regexp_ = NULL;
|
|
179
|
-
|
|
209
|
+
error_ = empty_string();
|
|
210
|
+
error_arg_ = empty_string();
|
|
211
|
+
|
|
180
212
|
num_captures_ = -1;
|
|
181
|
-
rprog_ = NULL;
|
|
182
|
-
error_ = empty_string;
|
|
183
213
|
error_code_ = NoError;
|
|
214
|
+
longest_match_ = options_.longest_match();
|
|
215
|
+
is_one_pass_ = false;
|
|
216
|
+
prefix_foldcase_ = false;
|
|
217
|
+
prefix_.clear();
|
|
218
|
+
prog_ = NULL;
|
|
219
|
+
|
|
220
|
+
rprog_ = NULL;
|
|
184
221
|
named_groups_ = NULL;
|
|
185
222
|
group_names_ = NULL;
|
|
186
223
|
|
|
187
224
|
RegexpStatus status;
|
|
188
225
|
entire_regexp_ = Regexp::Parse(
|
|
189
|
-
pattern_,
|
|
226
|
+
*pattern_,
|
|
190
227
|
static_cast<Regexp::ParseFlags>(options_.ParseFlags()),
|
|
191
228
|
&status);
|
|
192
229
|
if (entire_regexp_ == NULL) {
|
|
193
230
|
if (options_.log_errors()) {
|
|
194
|
-
LOG(ERROR) << "Error parsing '" << trunc(pattern_) << "': "
|
|
231
|
+
LOG(ERROR) << "Error parsing '" << trunc(*pattern_) << "': "
|
|
195
232
|
<< status.Text();
|
|
196
233
|
}
|
|
197
234
|
error_ = new std::string(status.Text());
|
|
198
235
|
error_code_ = RegexpErrorToRE2(status.code());
|
|
199
|
-
error_arg_ = std::string(status.error_arg());
|
|
236
|
+
error_arg_ = new std::string(status.error_arg());
|
|
200
237
|
return;
|
|
201
238
|
}
|
|
202
239
|
|
|
240
|
+
bool foldcase;
|
|
203
241
|
duckdb_re2::Regexp* suffix;
|
|
204
|
-
if (entire_regexp_->RequiredPrefix(&prefix_, &
|
|
242
|
+
if (entire_regexp_->RequiredPrefix(&prefix_, &foldcase, &suffix)) {
|
|
243
|
+
prefix_foldcase_ = foldcase;
|
|
205
244
|
suffix_regexp_ = suffix;
|
|
206
|
-
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
207
247
|
suffix_regexp_ = entire_regexp_->Incref();
|
|
248
|
+
}
|
|
208
249
|
|
|
209
250
|
// Two thirds of the memory goes to the forward Prog,
|
|
210
251
|
// one third to the reverse prog, because the forward
|
|
@@ -212,7 +253,7 @@ void RE2::Init(const StringPiece& pattern, const Options& options) {
|
|
|
212
253
|
prog_ = suffix_regexp_->CompileToProg(options_.max_mem()*2/3);
|
|
213
254
|
if (prog_ == NULL) {
|
|
214
255
|
if (options_.log_errors())
|
|
215
|
-
LOG(ERROR) << "Error compiling '" << trunc(pattern_) << "'";
|
|
256
|
+
LOG(ERROR) << "Error compiling '" << trunc(*pattern_) << "'";
|
|
216
257
|
error_ = new std::string("pattern too large - compile failed");
|
|
217
258
|
error_code_ = RE2::ErrorPatternTooLarge;
|
|
218
259
|
return;
|
|
@@ -238,28 +279,34 @@ duckdb_re2::Prog* RE2::ReverseProg() const {
|
|
|
238
279
|
re->suffix_regexp_->CompileToReverseProg(re->options_.max_mem() / 3);
|
|
239
280
|
if (re->rprog_ == NULL) {
|
|
240
281
|
if (re->options_.log_errors())
|
|
241
|
-
LOG(ERROR) << "Error reverse compiling '" << trunc(re->pattern_)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
282
|
+
LOG(ERROR) << "Error reverse compiling '" << trunc(*re->pattern_)
|
|
283
|
+
<< "'";
|
|
284
|
+
// We no longer touch error_ and error_code_ because failing to compile
|
|
285
|
+
// the reverse Prog is not a showstopper: falling back to NFA execution
|
|
286
|
+
// is fine. More importantly, an RE2 object is supposed to be logically
|
|
287
|
+
// immutable: whatever ok() would have returned after Init() completed,
|
|
288
|
+
// it should continue to return that no matter what ReverseProg() does.
|
|
245
289
|
}
|
|
246
290
|
}, this);
|
|
247
291
|
return rprog_;
|
|
248
292
|
}
|
|
249
293
|
|
|
250
294
|
RE2::~RE2() {
|
|
295
|
+
if (group_names_ != empty_group_names())
|
|
296
|
+
delete group_names_;
|
|
297
|
+
if (named_groups_ != empty_named_groups())
|
|
298
|
+
delete named_groups_;
|
|
299
|
+
delete rprog_;
|
|
300
|
+
delete prog_;
|
|
301
|
+
if (error_arg_ != empty_string())
|
|
302
|
+
delete error_arg_;
|
|
303
|
+
if (error_ != empty_string())
|
|
304
|
+
delete error_;
|
|
251
305
|
if (suffix_regexp_)
|
|
252
306
|
suffix_regexp_->Decref();
|
|
253
307
|
if (entire_regexp_)
|
|
254
308
|
entire_regexp_->Decref();
|
|
255
|
-
delete
|
|
256
|
-
delete rprog_;
|
|
257
|
-
if (error_ != empty_string)
|
|
258
|
-
delete error_;
|
|
259
|
-
if (named_groups_ != NULL && named_groups_ != empty_named_groups)
|
|
260
|
-
delete named_groups_;
|
|
261
|
-
if (group_names_ != NULL && group_names_ != empty_group_names)
|
|
262
|
-
delete group_names_;
|
|
309
|
+
delete pattern_;
|
|
263
310
|
}
|
|
264
311
|
|
|
265
312
|
int RE2::ProgramSize() const {
|
|
@@ -277,28 +324,54 @@ int RE2::ReverseProgramSize() const {
|
|
|
277
324
|
return prog->size();
|
|
278
325
|
}
|
|
279
326
|
|
|
280
|
-
|
|
327
|
+
// Finds the most significant non-zero bit in n.
|
|
328
|
+
static int FindMSBSet(uint32_t n) {
|
|
329
|
+
DCHECK_NE(n, 0);
|
|
330
|
+
#if defined(__GNUC__)
|
|
331
|
+
return 31 ^ __builtin_clz(n);
|
|
332
|
+
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
|
|
333
|
+
unsigned long c;
|
|
334
|
+
_BitScanReverse(&c, n);
|
|
335
|
+
return static_cast<int>(c);
|
|
336
|
+
#else
|
|
337
|
+
int c = 0;
|
|
338
|
+
for (int shift = 1 << 4; shift != 0; shift >>= 1) {
|
|
339
|
+
uint32_t word = n >> shift;
|
|
340
|
+
if (word != 0) {
|
|
341
|
+
n = word;
|
|
342
|
+
c += shift;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return c;
|
|
346
|
+
#endif
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
static int Fanout(Prog* prog, std::vector<int>* histogram) {
|
|
281
350
|
SparseArray<int> fanout(prog->size());
|
|
282
351
|
prog->Fanout(&fanout);
|
|
283
|
-
|
|
352
|
+
int data[32] = {};
|
|
353
|
+
int size = 0;
|
|
284
354
|
for (SparseArray<int>::iterator i = fanout.begin(); i != fanout.end(); ++i) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
355
|
+
if (i->value() == 0)
|
|
356
|
+
continue;
|
|
357
|
+
uint32_t value = i->value();
|
|
358
|
+
int bucket = FindMSBSet(value);
|
|
359
|
+
bucket += value & (value-1) ? 1 : 0;
|
|
360
|
+
++data[bucket];
|
|
361
|
+
size = std::max(size, bucket+1);
|
|
291
362
|
}
|
|
292
|
-
|
|
363
|
+
if (histogram != NULL)
|
|
364
|
+
histogram->assign(data, data+size);
|
|
365
|
+
return size-1;
|
|
293
366
|
}
|
|
294
367
|
|
|
295
|
-
int RE2::ProgramFanout(std::
|
|
368
|
+
int RE2::ProgramFanout(std::vector<int>* histogram) const {
|
|
296
369
|
if (prog_ == NULL)
|
|
297
370
|
return -1;
|
|
298
371
|
return Fanout(prog_, histogram);
|
|
299
372
|
}
|
|
300
373
|
|
|
301
|
-
int RE2::ReverseProgramFanout(std::
|
|
374
|
+
int RE2::ReverseProgramFanout(std::vector<int>* histogram) const {
|
|
302
375
|
if (prog_ == NULL)
|
|
303
376
|
return -1;
|
|
304
377
|
Prog* prog = ReverseProg();
|
|
@@ -313,7 +386,7 @@ const std::map<std::string, int>& RE2::NamedCapturingGroups() const {
|
|
|
313
386
|
if (re->suffix_regexp_ != NULL)
|
|
314
387
|
re->named_groups_ = re->suffix_regexp_->NamedCaptures();
|
|
315
388
|
if (re->named_groups_ == NULL)
|
|
316
|
-
re->named_groups_ = empty_named_groups;
|
|
389
|
+
re->named_groups_ = empty_named_groups();
|
|
317
390
|
}, this);
|
|
318
391
|
return *named_groups_;
|
|
319
392
|
}
|
|
@@ -324,7 +397,7 @@ const std::map<int, std::string>& RE2::CapturingGroupNames() const {
|
|
|
324
397
|
if (re->suffix_regexp_ != NULL)
|
|
325
398
|
re->group_names_ = re->suffix_regexp_->CaptureNames();
|
|
326
399
|
if (re->group_names_ == NULL)
|
|
327
|
-
re->group_names_ = empty_group_names;
|
|
400
|
+
re->group_names_ = empty_group_names();
|
|
328
401
|
}, this);
|
|
329
402
|
return *group_names_;
|
|
330
403
|
}
|
|
@@ -368,7 +441,9 @@ bool RE2::Replace(std::string* str,
|
|
|
368
441
|
const StringPiece& rewrite) {
|
|
369
442
|
StringPiece vec[kVecSize];
|
|
370
443
|
int nvec = 1 + MaxSubmatch(rewrite);
|
|
371
|
-
if (nvec >
|
|
444
|
+
if (nvec > 1 + re.NumberOfCapturingGroups())
|
|
445
|
+
return false;
|
|
446
|
+
if (nvec > static_cast<int>(arraysize(vec)))
|
|
372
447
|
return false;
|
|
373
448
|
if (!re.Match(*str, 0, str->size(), UNANCHORED, vec, nvec))
|
|
374
449
|
return false;
|
|
@@ -377,8 +452,8 @@ bool RE2::Replace(std::string* str,
|
|
|
377
452
|
if (!re.Rewrite(&s, rewrite, vec, nvec))
|
|
378
453
|
return false;
|
|
379
454
|
|
|
380
|
-
assert(vec[0].
|
|
381
|
-
assert(vec[0].
|
|
455
|
+
assert(vec[0].data() >= str->data());
|
|
456
|
+
assert(vec[0].data() + vec[0].size() <= str->data() + str->size());
|
|
382
457
|
str->replace(vec[0].data() - str->data(), vec[0].size(), s);
|
|
383
458
|
return true;
|
|
384
459
|
}
|
|
@@ -388,7 +463,9 @@ int RE2::GlobalReplace(std::string* str,
|
|
|
388
463
|
const StringPiece& rewrite) {
|
|
389
464
|
StringPiece vec[kVecSize];
|
|
390
465
|
int nvec = 1 + MaxSubmatch(rewrite);
|
|
391
|
-
if (nvec >
|
|
466
|
+
if (nvec > 1 + re.NumberOfCapturingGroups())
|
|
467
|
+
return false;
|
|
468
|
+
if (nvec > static_cast<int>(arraysize(vec)))
|
|
392
469
|
return false;
|
|
393
470
|
|
|
394
471
|
const char* p = str->data();
|
|
@@ -396,19 +473,16 @@ int RE2::GlobalReplace(std::string* str,
|
|
|
396
473
|
const char* lastend = NULL;
|
|
397
474
|
std::string out;
|
|
398
475
|
int count = 0;
|
|
399
|
-
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
400
|
-
// Iterate just once when fuzzing. Otherwise, we easily get bogged down
|
|
401
|
-
// and coverage is unlikely to improve despite significant expense.
|
|
402
|
-
while (p == str->data()) {
|
|
403
|
-
#else
|
|
404
476
|
while (p <= ep) {
|
|
405
|
-
|
|
477
|
+
if (maximum_global_replace_count != -1 &&
|
|
478
|
+
count >= maximum_global_replace_count)
|
|
479
|
+
break;
|
|
406
480
|
if (!re.Match(*str, static_cast<size_t>(p - str->data()),
|
|
407
481
|
str->size(), UNANCHORED, vec, nvec))
|
|
408
482
|
break;
|
|
409
|
-
if (p < vec[0].
|
|
410
|
-
out.append(p, vec[0].
|
|
411
|
-
if (vec[0].
|
|
483
|
+
if (p < vec[0].data())
|
|
484
|
+
out.append(p, vec[0].data() - p);
|
|
485
|
+
if (vec[0].data() == lastend && vec[0].empty()) {
|
|
412
486
|
// Disallow empty match at end of last match: skip ahead.
|
|
413
487
|
//
|
|
414
488
|
// fullrune() takes int, not ptrdiff_t. However, it just looks
|
|
@@ -439,7 +513,7 @@ int RE2::GlobalReplace(std::string* str,
|
|
|
439
513
|
continue;
|
|
440
514
|
}
|
|
441
515
|
re.Rewrite(&out, rewrite, vec, nvec);
|
|
442
|
-
p = vec[0].
|
|
516
|
+
p = vec[0].data() + vec[0].size();
|
|
443
517
|
lastend = p;
|
|
444
518
|
count++;
|
|
445
519
|
}
|
|
@@ -460,9 +534,10 @@ bool RE2::Extract(const StringPiece& text,
|
|
|
460
534
|
std::string* out) {
|
|
461
535
|
StringPiece vec[kVecSize];
|
|
462
536
|
int nvec = 1 + MaxSubmatch(rewrite);
|
|
463
|
-
if (nvec >
|
|
537
|
+
if (nvec > 1 + re.NumberOfCapturingGroups())
|
|
538
|
+
return false;
|
|
539
|
+
if (nvec > static_cast<int>(arraysize(vec)))
|
|
464
540
|
return false;
|
|
465
|
-
|
|
466
541
|
if (!re.Match(text, 0, text.size(), UNANCHORED, vec, nvec))
|
|
467
542
|
return false;
|
|
468
543
|
|
|
@@ -566,15 +641,6 @@ static int ascii_strcasecmp(const char* a, const char* b, size_t len) {
|
|
|
566
641
|
return 0;
|
|
567
642
|
}
|
|
568
643
|
|
|
569
|
-
RE2::Anchor RE2::Anchored() const {
|
|
570
|
-
if (prog_->anchor_start()) {
|
|
571
|
-
if (prog_->anchor_end()) {
|
|
572
|
-
return Anchor::ANCHOR_BOTH;
|
|
573
|
-
}
|
|
574
|
-
return Anchor::ANCHOR_START;
|
|
575
|
-
}
|
|
576
|
-
return Anchor::UNANCHORED;
|
|
577
|
-
}
|
|
578
644
|
|
|
579
645
|
/***** Actual matching and rewriting code *****/
|
|
580
646
|
|
|
@@ -619,6 +685,8 @@ bool RE2::Match(const StringPiece& text,
|
|
|
619
685
|
// If the regexp is anchored explicitly, must not be in middle of text.
|
|
620
686
|
if (prog_->anchor_start() && startpos != 0)
|
|
621
687
|
return false;
|
|
688
|
+
if (prog_->anchor_end() && endpos != text.size())
|
|
689
|
+
return false;
|
|
622
690
|
|
|
623
691
|
// If the regexp is anchored explicitly, update re_anchor
|
|
624
692
|
// so that we can potentially fall into a faster case below.
|
|
@@ -649,53 +717,89 @@ bool RE2::Match(const StringPiece& text,
|
|
|
649
717
|
}
|
|
650
718
|
|
|
651
719
|
Prog::Anchor anchor = Prog::kUnanchored;
|
|
652
|
-
Prog::MatchKind kind =
|
|
653
|
-
|
|
654
|
-
kind = Prog::kLongestMatch;
|
|
655
|
-
bool skipped_test = false;
|
|
656
|
-
|
|
657
|
-
bool can_one_pass = (is_one_pass_ && ncap <= Prog::kMaxOnePassCapture);
|
|
720
|
+
Prog::MatchKind kind =
|
|
721
|
+
longest_match_ ? Prog::kLongestMatch : Prog::kFirstMatch;
|
|
658
722
|
|
|
659
|
-
|
|
660
|
-
// It also allocates a stack of 3-word structures which could potentially
|
|
661
|
-
// grow as large as prog_->list_count() * text.size(), but in practice is
|
|
662
|
-
// much smaller.
|
|
663
|
-
const int kMaxBitStateBitmapSize = 256*1024; // bitmap size <= max (bits)
|
|
723
|
+
bool can_one_pass = is_one_pass_ && ncap <= Prog::kMaxOnePassCapture;
|
|
664
724
|
bool can_bit_state = prog_->CanBitState();
|
|
665
|
-
size_t
|
|
725
|
+
size_t bit_state_text_max_size = prog_->bit_state_text_max_size();
|
|
666
726
|
|
|
727
|
+
#ifdef RE2_HAVE_THREAD_LOCAL
|
|
728
|
+
hooks::context = this;
|
|
729
|
+
#endif
|
|
667
730
|
bool dfa_failed = false;
|
|
731
|
+
bool skipped_test = false;
|
|
668
732
|
switch (re_anchor) {
|
|
669
733
|
default:
|
|
734
|
+
LOG(DFATAL) << "Unexpected re_anchor value: " << re_anchor;
|
|
735
|
+
return false;
|
|
736
|
+
|
|
670
737
|
case UNANCHORED: {
|
|
738
|
+
if (prog_->anchor_end()) {
|
|
739
|
+
// This is a very special case: we don't need the forward DFA because
|
|
740
|
+
// we already know where the match must end! Instead, the reverse DFA
|
|
741
|
+
// can say whether there is a match and (optionally) where it starts.
|
|
742
|
+
Prog* prog = ReverseProg();
|
|
743
|
+
if (prog == NULL) {
|
|
744
|
+
// Fall back to NFA below.
|
|
745
|
+
skipped_test = true;
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
if (!prog->SearchDFA(subtext, text, Prog::kAnchored,
|
|
749
|
+
Prog::kLongestMatch, matchp, &dfa_failed, NULL)) {
|
|
750
|
+
if (dfa_failed) {
|
|
751
|
+
if (options_.log_errors())
|
|
752
|
+
LOG(ERROR) << "DFA out of memory: "
|
|
753
|
+
<< "pattern length " << pattern_->size() << ", "
|
|
754
|
+
<< "program size " << prog->size() << ", "
|
|
755
|
+
<< "list count " << prog->list_count() << ", "
|
|
756
|
+
<< "bytemap range " << prog->bytemap_range();
|
|
757
|
+
// Fall back to NFA below.
|
|
758
|
+
skipped_test = true;
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
if (matchp == NULL) // Matched. Don't care where.
|
|
764
|
+
return true;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
|
|
671
768
|
if (!prog_->SearchDFA(subtext, text, anchor, kind,
|
|
672
769
|
matchp, &dfa_failed, NULL)) {
|
|
673
770
|
if (dfa_failed) {
|
|
674
771
|
if (options_.log_errors())
|
|
675
|
-
LOG(ERROR) << "DFA out of memory:
|
|
676
|
-
<< "
|
|
677
|
-
<< "
|
|
772
|
+
LOG(ERROR) << "DFA out of memory: "
|
|
773
|
+
<< "pattern length " << pattern_->size() << ", "
|
|
774
|
+
<< "program size " << prog_->size() << ", "
|
|
775
|
+
<< "list count " << prog_->list_count() << ", "
|
|
776
|
+
<< "bytemap range " << prog_->bytemap_range();
|
|
678
777
|
// Fall back to NFA below.
|
|
679
778
|
skipped_test = true;
|
|
680
779
|
break;
|
|
681
780
|
}
|
|
682
781
|
return false;
|
|
683
782
|
}
|
|
684
|
-
if (matchp == NULL) // Matched. Don't care where
|
|
783
|
+
if (matchp == NULL) // Matched. Don't care where.
|
|
685
784
|
return true;
|
|
686
|
-
// SearchDFA set match
|
|
687
|
-
// match started. Run the regexp backward from match
|
|
785
|
+
// SearchDFA set match.end() but didn't know where the
|
|
786
|
+
// match started. Run the regexp backward from match.end()
|
|
688
787
|
// to find the longest possible match -- that's where it started.
|
|
689
788
|
Prog* prog = ReverseProg();
|
|
690
|
-
if (prog == NULL)
|
|
691
|
-
|
|
789
|
+
if (prog == NULL) {
|
|
790
|
+
// Fall back to NFA below.
|
|
791
|
+
skipped_test = true;
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
692
794
|
if (!prog->SearchDFA(match, text, Prog::kAnchored,
|
|
693
795
|
Prog::kLongestMatch, &match, &dfa_failed, NULL)) {
|
|
694
796
|
if (dfa_failed) {
|
|
695
797
|
if (options_.log_errors())
|
|
696
|
-
LOG(ERROR) << "DFA out of memory:
|
|
697
|
-
<< "
|
|
698
|
-
<< "
|
|
798
|
+
LOG(ERROR) << "DFA out of memory: "
|
|
799
|
+
<< "pattern length " << pattern_->size() << ", "
|
|
800
|
+
<< "program size " << prog->size() << ", "
|
|
801
|
+
<< "list count " << prog->list_count() << ", "
|
|
802
|
+
<< "bytemap range " << prog->bytemap_range();
|
|
699
803
|
// Fall back to NFA below.
|
|
700
804
|
skipped_test = true;
|
|
701
805
|
break;
|
|
@@ -721,11 +825,12 @@ bool RE2::Match(const StringPiece& text,
|
|
|
721
825
|
// it doesn't have the shared state and occasional mutex that
|
|
722
826
|
// the DFA does.
|
|
723
827
|
if (can_one_pass && text.size() <= 4096 &&
|
|
724
|
-
(ncap > 1 || text.size() <=
|
|
828
|
+
(ncap > 1 || text.size() <= 16)) {
|
|
725
829
|
skipped_test = true;
|
|
726
830
|
break;
|
|
727
831
|
}
|
|
728
|
-
if (can_bit_state && text.size() <=
|
|
832
|
+
if (can_bit_state && text.size() <= bit_state_text_max_size &&
|
|
833
|
+
ncap > 1) {
|
|
729
834
|
skipped_test = true;
|
|
730
835
|
break;
|
|
731
836
|
}
|
|
@@ -733,9 +838,11 @@ bool RE2::Match(const StringPiece& text,
|
|
|
733
838
|
&match, &dfa_failed, NULL)) {
|
|
734
839
|
if (dfa_failed) {
|
|
735
840
|
if (options_.log_errors())
|
|
736
|
-
LOG(ERROR) << "DFA out of memory:
|
|
737
|
-
<< "
|
|
738
|
-
<< "
|
|
841
|
+
LOG(ERROR) << "DFA out of memory: "
|
|
842
|
+
<< "pattern length " << pattern_->size() << ", "
|
|
843
|
+
<< "program size " << prog_->size() << ", "
|
|
844
|
+
<< "list count " << prog_->list_count() << ", "
|
|
845
|
+
<< "bytemap range " << prog_->bytemap_range();
|
|
739
846
|
// Fall back to NFA below.
|
|
740
847
|
skipped_test = true;
|
|
741
848
|
break;
|
|
@@ -770,7 +877,7 @@ bool RE2::Match(const StringPiece& text,
|
|
|
770
877
|
LOG(ERROR) << "SearchOnePass inconsistency";
|
|
771
878
|
return false;
|
|
772
879
|
}
|
|
773
|
-
} else if (can_bit_state && subtext1.size() <=
|
|
880
|
+
} else if (can_bit_state && subtext1.size() <= bit_state_text_max_size) {
|
|
774
881
|
if (!prog_->SearchBitState(subtext1, text, anchor,
|
|
775
882
|
kind, submatch, ncap)) {
|
|
776
883
|
if (!skipped_test && options_.log_errors())
|
|
@@ -825,7 +932,7 @@ bool RE2::DoMatch(const StringPiece& text,
|
|
|
825
932
|
StringPiece stkvec[kVecSize];
|
|
826
933
|
StringPiece* heapvec = NULL;
|
|
827
934
|
|
|
828
|
-
if (nvec <= arraysize(stkvec)) {
|
|
935
|
+
if (nvec <= static_cast<int>(arraysize(stkvec))) {
|
|
829
936
|
vec = stkvec;
|
|
830
937
|
} else {
|
|
831
938
|
vec = new StringPiece[nvec];
|
|
@@ -838,7 +945,7 @@ bool RE2::DoMatch(const StringPiece& text,
|
|
|
838
945
|
}
|
|
839
946
|
|
|
840
947
|
if (consumed != NULL)
|
|
841
|
-
*consumed = static_cast<size_t>(vec[0]
|
|
948
|
+
*consumed = static_cast<size_t>(EndPtr(vec[0]) - BeginPtr(text));
|
|
842
949
|
|
|
843
950
|
if (n == 0 || args == NULL) {
|
|
844
951
|
// We are not interested in results
|
|
@@ -891,9 +998,10 @@ bool RE2::CheckRewriteString(const StringPiece& rewrite,
|
|
|
891
998
|
}
|
|
892
999
|
|
|
893
1000
|
if (max_token > NumberOfCapturingGroups()) {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
1001
|
+
*error = StringPrintf(
|
|
1002
|
+
"Rewrite schema requests %d matches, but the regexp only has %d "
|
|
1003
|
+
"parenthesized subexpressions.",
|
|
1004
|
+
max_token, NumberOfCapturingGroups());
|
|
897
1005
|
return false;
|
|
898
1006
|
}
|
|
899
1007
|
return true;
|
|
@@ -936,13 +1044,13 @@ bool RE2::Rewrite(std::string* out,
|
|
|
936
1044
|
int n = (c - '0');
|
|
937
1045
|
if (n >= veclen) {
|
|
938
1046
|
if (options_.log_errors()) {
|
|
939
|
-
LOG(ERROR) << "
|
|
940
|
-
<< "
|
|
1047
|
+
LOG(ERROR) << "invalid substitution \\" << n
|
|
1048
|
+
<< " from " << veclen << " groups";
|
|
941
1049
|
}
|
|
942
1050
|
return false;
|
|
943
1051
|
}
|
|
944
1052
|
StringPiece snip = vec[n];
|
|
945
|
-
if (snip.
|
|
1053
|
+
if (!snip.empty())
|
|
946
1054
|
out->append(snip.data(), snip.size());
|
|
947
1055
|
} else if (c == '\\') {
|
|
948
1056
|
out->push_back('\\');
|
|
@@ -957,41 +1065,49 @@ bool RE2::Rewrite(std::string* out,
|
|
|
957
1065
|
|
|
958
1066
|
/***** Parsers for various types *****/
|
|
959
1067
|
|
|
960
|
-
|
|
1068
|
+
namespace re2_internal {
|
|
1069
|
+
|
|
1070
|
+
template <>
|
|
1071
|
+
bool Parse(const char* str, size_t n, void* dest) {
|
|
961
1072
|
// We fail if somebody asked us to store into a non-NULL void* pointer
|
|
962
1073
|
return (dest == NULL);
|
|
963
1074
|
}
|
|
964
1075
|
|
|
965
|
-
|
|
1076
|
+
template <>
|
|
1077
|
+
bool Parse(const char* str, size_t n, std::string* dest) {
|
|
966
1078
|
if (dest == NULL) return true;
|
|
967
|
-
|
|
1079
|
+
dest->assign(str, n);
|
|
968
1080
|
return true;
|
|
969
1081
|
}
|
|
970
1082
|
|
|
971
|
-
|
|
1083
|
+
template <>
|
|
1084
|
+
bool Parse(const char* str, size_t n, StringPiece* dest) {
|
|
972
1085
|
if (dest == NULL) return true;
|
|
973
|
-
*
|
|
1086
|
+
*dest = StringPiece(str, n);
|
|
974
1087
|
return true;
|
|
975
1088
|
}
|
|
976
1089
|
|
|
977
|
-
|
|
1090
|
+
template <>
|
|
1091
|
+
bool Parse(const char* str, size_t n, char* dest) {
|
|
978
1092
|
if (n != 1) return false;
|
|
979
1093
|
if (dest == NULL) return true;
|
|
980
|
-
*
|
|
1094
|
+
*dest = str[0];
|
|
981
1095
|
return true;
|
|
982
1096
|
}
|
|
983
1097
|
|
|
984
|
-
|
|
1098
|
+
template <>
|
|
1099
|
+
bool Parse(const char* str, size_t n, signed char* dest) {
|
|
985
1100
|
if (n != 1) return false;
|
|
986
1101
|
if (dest == NULL) return true;
|
|
987
|
-
*
|
|
1102
|
+
*dest = str[0];
|
|
988
1103
|
return true;
|
|
989
1104
|
}
|
|
990
1105
|
|
|
991
|
-
|
|
1106
|
+
template <>
|
|
1107
|
+
bool Parse(const char* str, size_t n, unsigned char* dest) {
|
|
992
1108
|
if (n != 1) return false;
|
|
993
1109
|
if (dest == NULL) return true;
|
|
994
|
-
*
|
|
1110
|
+
*dest = str[0];
|
|
995
1111
|
return true;
|
|
996
1112
|
}
|
|
997
1113
|
|
|
@@ -1055,10 +1171,40 @@ static const char* TerminateNumber(char* buf, size_t nbuf, const char* str,
|
|
|
1055
1171
|
return buf;
|
|
1056
1172
|
}
|
|
1057
1173
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1174
|
+
template <>
|
|
1175
|
+
bool Parse(const char* str, size_t n, float* dest) {
|
|
1176
|
+
if (n == 0) return false;
|
|
1177
|
+
static const int kMaxLength = 200;
|
|
1178
|
+
char buf[kMaxLength+1];
|
|
1179
|
+
str = TerminateNumber(buf, sizeof buf, str, &n, true);
|
|
1180
|
+
char* end;
|
|
1181
|
+
errno = 0;
|
|
1182
|
+
float r = strtof(str, &end);
|
|
1183
|
+
if (end != str + n) return false; // Leftover junk
|
|
1184
|
+
if (errno) return false;
|
|
1185
|
+
if (dest == NULL) return true;
|
|
1186
|
+
*dest = r;
|
|
1187
|
+
return true;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
template <>
|
|
1191
|
+
bool Parse(const char* str, size_t n, double* dest) {
|
|
1192
|
+
if (n == 0) return false;
|
|
1193
|
+
static const int kMaxLength = 200;
|
|
1194
|
+
char buf[kMaxLength+1];
|
|
1195
|
+
str = TerminateNumber(buf, sizeof buf, str, &n, true);
|
|
1196
|
+
char* end;
|
|
1197
|
+
errno = 0;
|
|
1198
|
+
double r = strtod(str, &end);
|
|
1199
|
+
if (end != str + n) return false; // Leftover junk
|
|
1200
|
+
if (errno) return false;
|
|
1201
|
+
if (dest == NULL) return true;
|
|
1202
|
+
*dest = r;
|
|
1203
|
+
return true;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
template <>
|
|
1207
|
+
bool Parse(const char* str, size_t n, long* dest, int radix) {
|
|
1062
1208
|
if (n == 0) return false;
|
|
1063
1209
|
char buf[kMaxNumberLength+1];
|
|
1064
1210
|
str = TerminateNumber(buf, sizeof buf, str, &n, false);
|
|
@@ -1068,14 +1214,12 @@ bool RE2::Arg::parse_long_radix(const char* str,
|
|
|
1068
1214
|
if (end != str + n) return false; // Leftover junk
|
|
1069
1215
|
if (errno) return false;
|
|
1070
1216
|
if (dest == NULL) return true;
|
|
1071
|
-
*
|
|
1217
|
+
*dest = r;
|
|
1072
1218
|
return true;
|
|
1073
1219
|
}
|
|
1074
1220
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
void* dest,
|
|
1078
|
-
int radix) {
|
|
1221
|
+
template <>
|
|
1222
|
+
bool Parse(const char* str, size_t n, unsigned long* dest, int radix) {
|
|
1079
1223
|
if (n == 0) return false;
|
|
1080
1224
|
char buf[kMaxNumberLength+1];
|
|
1081
1225
|
str = TerminateNumber(buf, sizeof buf, str, &n, false);
|
|
@@ -1091,62 +1235,52 @@ bool RE2::Arg::parse_ulong_radix(const char* str,
|
|
|
1091
1235
|
if (end != str + n) return false; // Leftover junk
|
|
1092
1236
|
if (errno) return false;
|
|
1093
1237
|
if (dest == NULL) return true;
|
|
1094
|
-
*
|
|
1238
|
+
*dest = r;
|
|
1095
1239
|
return true;
|
|
1096
1240
|
}
|
|
1097
1241
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
void* dest,
|
|
1101
|
-
int radix) {
|
|
1242
|
+
template <>
|
|
1243
|
+
bool Parse(const char* str, size_t n, short* dest, int radix) {
|
|
1102
1244
|
long r;
|
|
1103
|
-
if (!
|
|
1104
|
-
if ((short)r != r) return false;
|
|
1245
|
+
if (!Parse(str, n, &r, radix)) return false; // Could not parse
|
|
1246
|
+
if ((short)r != r) return false; // Out of range
|
|
1105
1247
|
if (dest == NULL) return true;
|
|
1106
|
-
*
|
|
1248
|
+
*dest = (short)r;
|
|
1107
1249
|
return true;
|
|
1108
1250
|
}
|
|
1109
1251
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
void* dest,
|
|
1113
|
-
int radix) {
|
|
1252
|
+
template <>
|
|
1253
|
+
bool Parse(const char* str, size_t n, unsigned short* dest, int radix) {
|
|
1114
1254
|
unsigned long r;
|
|
1115
|
-
if (!
|
|
1116
|
-
if ((unsigned short)r != r) return false;
|
|
1255
|
+
if (!Parse(str, n, &r, radix)) return false; // Could not parse
|
|
1256
|
+
if ((unsigned short)r != r) return false; // Out of range
|
|
1117
1257
|
if (dest == NULL) return true;
|
|
1118
|
-
*
|
|
1258
|
+
*dest = (unsigned short)r;
|
|
1119
1259
|
return true;
|
|
1120
1260
|
}
|
|
1121
1261
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
void* dest,
|
|
1125
|
-
int radix) {
|
|
1262
|
+
template <>
|
|
1263
|
+
bool Parse(const char* str, size_t n, int* dest, int radix) {
|
|
1126
1264
|
long r;
|
|
1127
|
-
if (!
|
|
1128
|
-
if ((int)r != r) return false;
|
|
1265
|
+
if (!Parse(str, n, &r, radix)) return false; // Could not parse
|
|
1266
|
+
if ((int)r != r) return false; // Out of range
|
|
1129
1267
|
if (dest == NULL) return true;
|
|
1130
|
-
*
|
|
1268
|
+
*dest = (int)r;
|
|
1131
1269
|
return true;
|
|
1132
1270
|
}
|
|
1133
1271
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
void* dest,
|
|
1137
|
-
int radix) {
|
|
1272
|
+
template <>
|
|
1273
|
+
bool Parse(const char* str, size_t n, unsigned int* dest, int radix) {
|
|
1138
1274
|
unsigned long r;
|
|
1139
|
-
if (!
|
|
1140
|
-
if ((unsigned int)r != r) return false;
|
|
1275
|
+
if (!Parse(str, n, &r, radix)) return false; // Could not parse
|
|
1276
|
+
if ((unsigned int)r != r) return false; // Out of range
|
|
1141
1277
|
if (dest == NULL) return true;
|
|
1142
|
-
*
|
|
1278
|
+
*dest = (unsigned int)r;
|
|
1143
1279
|
return true;
|
|
1144
1280
|
}
|
|
1145
1281
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
void* dest,
|
|
1149
|
-
int radix) {
|
|
1282
|
+
template <>
|
|
1283
|
+
bool Parse(const char* str, size_t n, long long* dest, int radix) {
|
|
1150
1284
|
if (n == 0) return false;
|
|
1151
1285
|
char buf[kMaxNumberLength+1];
|
|
1152
1286
|
str = TerminateNumber(buf, sizeof buf, str, &n, false);
|
|
@@ -1156,14 +1290,12 @@ bool RE2::Arg::parse_longlong_radix(const char* str,
|
|
|
1156
1290
|
if (end != str + n) return false; // Leftover junk
|
|
1157
1291
|
if (errno) return false;
|
|
1158
1292
|
if (dest == NULL) return true;
|
|
1159
|
-
*
|
|
1293
|
+
*dest = r;
|
|
1160
1294
|
return true;
|
|
1161
1295
|
}
|
|
1162
1296
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
void* dest,
|
|
1166
|
-
int radix) {
|
|
1297
|
+
template <>
|
|
1298
|
+
bool Parse(const char* str, size_t n, unsigned long long* dest, int radix) {
|
|
1167
1299
|
if (n == 0) return false;
|
|
1168
1300
|
char buf[kMaxNumberLength+1];
|
|
1169
1301
|
str = TerminateNumber(buf, sizeof buf, str, &n, false);
|
|
@@ -1178,67 +1310,47 @@ bool RE2::Arg::parse_ulonglong_radix(const char* str,
|
|
|
1178
1310
|
if (end != str + n) return false; // Leftover junk
|
|
1179
1311
|
if (errno) return false;
|
|
1180
1312
|
if (dest == NULL) return true;
|
|
1181
|
-
*
|
|
1313
|
+
*dest = r;
|
|
1182
1314
|
return true;
|
|
1183
1315
|
}
|
|
1184
1316
|
|
|
1185
|
-
|
|
1186
|
-
void* dest) {
|
|
1187
|
-
if (n == 0) return false;
|
|
1188
|
-
static const int kMaxLength = 200;
|
|
1189
|
-
char buf[kMaxLength+1];
|
|
1190
|
-
str = TerminateNumber(buf, sizeof buf, str, &n, true);
|
|
1191
|
-
char* end;
|
|
1192
|
-
errno = 0;
|
|
1193
|
-
double r;
|
|
1194
|
-
if (isfloat) {
|
|
1195
|
-
r = strtof(str, &end);
|
|
1196
|
-
} else {
|
|
1197
|
-
r = strtod(str, &end);
|
|
1198
|
-
}
|
|
1199
|
-
if (end != str + n) return false; // Leftover junk
|
|
1200
|
-
if (errno) return false;
|
|
1201
|
-
if (dest == NULL) return true;
|
|
1202
|
-
if (isfloat) {
|
|
1203
|
-
*(reinterpret_cast<float*>(dest)) = (float)r;
|
|
1204
|
-
} else {
|
|
1205
|
-
*(reinterpret_cast<double*>(dest)) = r;
|
|
1206
|
-
}
|
|
1207
|
-
return true;
|
|
1208
|
-
}
|
|
1317
|
+
} // namespace re2_internal
|
|
1209
1318
|
|
|
1210
|
-
|
|
1211
|
-
return parse_double_float(str, n, false, dest);
|
|
1212
|
-
}
|
|
1319
|
+
namespace hooks {
|
|
1213
1320
|
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1321
|
+
#ifdef RE2_HAVE_THREAD_LOCAL
|
|
1322
|
+
thread_local const RE2* context = NULL;
|
|
1323
|
+
#endif
|
|
1217
1324
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1325
|
+
template <typename T>
|
|
1326
|
+
union Hook {
|
|
1327
|
+
void Store(T* cb) { cb_.store(cb, std::memory_order_release); }
|
|
1328
|
+
T* Load() const { return cb_.load(std::memory_order_acquire); }
|
|
1329
|
+
|
|
1330
|
+
#if !defined(__clang__) && defined(_MSC_VER)
|
|
1331
|
+
// Citing https://github.com/protocolbuffers/protobuf/pull/4777 as precedent,
|
|
1332
|
+
// this is a gross hack to make std::atomic<T*> constant-initialized on MSVC.
|
|
1333
|
+
static_assert(ATOMIC_POINTER_LOCK_FREE == 2,
|
|
1334
|
+
"std::atomic<T*> must be always lock-free");
|
|
1335
|
+
T* cb_for_constinit_;
|
|
1336
|
+
#endif
|
|
1337
|
+
|
|
1338
|
+
std::atomic<T*> cb_;
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
template <typename T>
|
|
1342
|
+
static void DoNothing(const T&) {}
|
|
1343
|
+
|
|
1344
|
+
#define DEFINE_HOOK(type, name) \
|
|
1345
|
+
static Hook<type##Callback> name##_hook = {{&DoNothing<type>}}; \
|
|
1346
|
+
void Set##type##Hook(type##Callback* cb) { name##_hook.Store(cb); } \
|
|
1347
|
+
type##Callback* Get##type##Hook() { return name##_hook.Load(); }
|
|
1348
|
+
|
|
1349
|
+
DEFINE_HOOK(DFAStateCacheReset, dfa_state_cache_reset)
|
|
1350
|
+
DEFINE_HOOK(DFASearchFailure, dfa_search_failure)
|
|
1232
1351
|
|
|
1233
|
-
|
|
1234
|
-
DEFINE_INTEGER_PARSER(ushort)
|
|
1235
|
-
DEFINE_INTEGER_PARSER(int)
|
|
1236
|
-
DEFINE_INTEGER_PARSER(uint)
|
|
1237
|
-
DEFINE_INTEGER_PARSER(long)
|
|
1238
|
-
DEFINE_INTEGER_PARSER(ulong)
|
|
1239
|
-
DEFINE_INTEGER_PARSER(longlong)
|
|
1240
|
-
DEFINE_INTEGER_PARSER(ulonglong)
|
|
1352
|
+
#undef DEFINE_HOOK
|
|
1241
1353
|
|
|
1242
|
-
|
|
1354
|
+
} // namespace hooks
|
|
1243
1355
|
|
|
1244
|
-
} // namespace
|
|
1356
|
+
} // namespace re2
|