duckdb 0.10.1-dev9.0 → 0.10.2-dev0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/NodeJS.yml +9 -16
- package/binding.gyp +4 -1
- package/package.json +1 -1
- package/src/database.cpp +1 -0
- package/src/duckdb/extension/icu/icu-strptime.cpp +46 -4
- package/src/duckdb/extension/icu/icu-table-range.cpp +5 -0
- package/src/duckdb/extension/icu/icu-timezone.cpp +28 -4
- package/src/duckdb/extension/json/buffered_json_reader.cpp +6 -5
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +3 -3
- package/src/duckdb/extension/json/include/json_transform.hpp +2 -0
- package/src/duckdb/extension/json/json_functions/json_create.cpp +6 -0
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +8 -9
- package/src/duckdb/extension/json/json_functions.cpp +1 -2
- package/src/duckdb/extension/json/json_scan.cpp +1 -0
- package/src/duckdb/extension/parquet/column_reader.cpp +17 -1
- package/src/duckdb/extension/parquet/column_writer.cpp +151 -20
- package/src/duckdb/extension/parquet/include/column_writer.hpp +3 -4
- package/src/duckdb/extension/parquet/parquet_extension.cpp +14 -9
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +10 -0
- package/src/duckdb/extension/parquet/parquet_writer.cpp +4 -0
- package/src/duckdb/src/catalog/catalog.cpp +94 -10
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +9 -5
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +1 -0
- package/src/duckdb/src/catalog/catalog_entry/ub_duckdb_catalog_entries.cpp +16 -0
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +28 -0
- package/src/duckdb/src/catalog/default/default_functions.cpp +3 -0
- package/src/duckdb/src/catalog/default/default_views.cpp +3 -3
- package/src/duckdb/src/catalog/default/ub_duckdb_catalog_default_entries.cpp +5 -0
- package/src/duckdb/src/catalog/dependency_catalog_set.cpp +1 -3
- package/src/duckdb/src/catalog/dependency_manager.cpp +2 -5
- package/src/duckdb/src/catalog/ub_duckdb_catalog.cpp +10 -0
- package/src/duckdb/src/common/adbc/adbc.cpp +1 -1
- package/src/duckdb/src/common/adbc/driver_manager.cpp +2 -1
- package/src/duckdb/src/common/adbc/nanoarrow/ub_duckdb_adbc_nanoarrow.cpp +5 -0
- package/src/duckdb/src/common/adbc/ub_duckdb_adbc.cpp +3 -0
- package/src/duckdb/src/common/allocator.cpp +34 -8
- package/src/duckdb/src/common/arrow/appender/fixed_size_list_data.cpp +39 -0
- package/src/duckdb/src/common/arrow/appender/ub_duckdb_common_arrow_appender.cpp +6 -0
- package/src/duckdb/src/common/arrow/appender/union_data.cpp +2 -1
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +5 -5
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +17 -0
- package/src/duckdb/src/common/arrow/ub_duckdb_common_arrow.cpp +4 -0
- package/src/duckdb/src/common/compressed_file_system.cpp +1 -0
- package/src/duckdb/src/common/crypto/ub_duckdb_common_crypto.cpp +2 -0
- package/src/duckdb/src/common/enum_util.cpp +153 -13
- package/src/duckdb/src/common/enums/logical_operator_type.cpp +0 -2
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -2
- package/src/duckdb/src/common/enums/ub_duckdb_common_enums.cpp +12 -0
- package/src/duckdb/src/common/exception/conversion_exception.cpp +23 -0
- package/src/duckdb/src/common/exception.cpp +7 -14
- package/src/duckdb/src/common/extra_type_info.cpp +6 -5
- package/src/duckdb/src/common/gzip_file_system.cpp +5 -4
- package/src/duckdb/src/common/local_file_system.cpp +85 -10
- package/src/duckdb/src/common/operator/cast_operators.cpp +413 -305
- package/src/duckdb/src/common/operator/ub_duckdb_common_operators.cpp +4 -0
- package/src/duckdb/src/common/progress_bar/ub_duckdb_progress_bar.cpp +3 -0
- package/src/duckdb/src/common/re2_regex.cpp +2 -1
- package/src/duckdb/src/common/row_operations/row_heap_scatter.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +1 -0
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +2 -2
- package/src/duckdb/src/common/row_operations/ub_duckdb_row_operations.cpp +9 -0
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +3 -3
- package/src/duckdb/src/common/serializer/ub_duckdb_common_serializer.cpp +7 -0
- package/src/duckdb/src/common/sort/partition_state.cpp +2 -3
- package/src/duckdb/src/common/sort/ub_duckdb_sort.cpp +7 -0
- package/src/duckdb/src/common/string_util.cpp +3 -3
- package/src/duckdb/src/common/types/bit.cpp +7 -6
- package/src/duckdb/src/common/types/blob.cpp +20 -9
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +8 -6
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +11 -1
- package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +5 -0
- package/src/duckdb/src/common/types/column/partitioned_column_data.cpp +1 -1
- package/src/duckdb/src/common/types/column/ub_duckdb_common_types_column.cpp +6 -0
- package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
- package/src/duckdb/src/common/types/date.cpp +1 -1
- package/src/duckdb/src/common/types/hugeint.cpp +3 -2
- package/src/duckdb/src/common/types/interval.cpp +1 -1
- package/src/duckdb/src/common/types/list_segment.cpp +2 -1
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +3 -9
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +7 -7
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +10 -27
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +168 -88
- package/src/duckdb/src/common/types/row/ub_duckdb_common_types_row.cpp +11 -0
- package/src/duckdb/src/common/types/selection_vector.cpp +1 -1
- package/src/duckdb/src/common/types/string_heap.cpp +5 -1
- package/src/duckdb/src/common/types/string_type.cpp +18 -4
- package/src/duckdb/src/common/types/time.cpp +4 -2
- package/src/duckdb/src/common/types/timestamp.cpp +32 -6
- package/src/duckdb/src/common/types/ub_duckdb_common_types.cpp +28 -0
- package/src/duckdb/src/common/types/uhugeint.cpp +3 -2
- package/src/duckdb/src/common/types/uuid.cpp +11 -0
- package/src/duckdb/src/common/types/validity_mask.cpp +4 -3
- package/src/duckdb/src/common/types/value.cpp +17 -6
- package/src/duckdb/src/common/types/vector.cpp +243 -68
- package/src/duckdb/src/common/types.cpp +7 -5
- package/src/duckdb/src/common/ub_duckdb_common.cpp +34 -0
- package/src/duckdb/src/common/value_operations/ub_duckdb_value_operations.cpp +2 -0
- package/src/duckdb/src/common/vector_operations/generators.cpp +2 -1
- package/src/duckdb/src/common/vector_operations/vector_cast.cpp +4 -4
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +2 -2
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +17 -6
- package/src/duckdb/src/core_functions/aggregate/algebraic/ub_duckdb_aggr_algebraic.cpp +5 -0
- package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +30 -6
- package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +1 -1
- package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +12 -5
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +2 -1
- package/src/duckdb/src/core_functions/aggregate/distributive/ub_duckdb_aggr_distributive.cpp +13 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +2 -1
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +2 -9
- package/src/duckdb/src/core_functions/aggregate/holistic/ub_duckdb_aggr_holistic.cpp +5 -0
- package/src/duckdb/src/core_functions/aggregate/nested/ub_duckdb_aggr_nested.cpp +3 -0
- package/src/duckdb/src/core_functions/aggregate/regression/ub_duckdb_aggr_regr.cpp +8 -0
- package/src/duckdb/src/core_functions/function_list.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/bit/bitstring.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/bit/ub_duckdb_func_bit.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/blob/ub_duckdb_func_blob.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/date/date_diff.cpp +8 -0
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +22 -3
- package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +29 -7
- package/src/duckdb/src/core_functions/scalar/date/to_interval.cpp +3 -1
- package/src/duckdb/src/core_functions/scalar/date/ub_duckdb_func_date.cpp +12 -0
- package/src/duckdb/src/core_functions/scalar/debug/ub_duckdb_func_debug.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/enum/ub_duckdb_func_enum.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/generic/ub_duckdb_func_generic.cpp +9 -0
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +12 -8
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +2 -1
- package/src/duckdb/src/core_functions/scalar/list/list_reduce.cpp +6 -5
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +5 -3
- package/src/duckdb/src/core_functions/scalar/list/list_value.cpp +28 -12
- package/src/duckdb/src/core_functions/scalar/list/ub_duckdb_func_list.cpp +11 -0
- package/src/duckdb/src/core_functions/scalar/map/map.cpp +129 -160
- package/src/duckdb/src/core_functions/scalar/map/ub_duckdb_func_map_nested.cpp +8 -0
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +19 -16
- package/src/duckdb/src/core_functions/scalar/math/ub_duckdb_func_math.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/operators/bitwise.cpp +4 -4
- package/src/duckdb/src/core_functions/scalar/operators/ub_duckdb_func_ops.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/random/ub_duckdb_func_random.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/string/hex.cpp +2 -1
- package/src/duckdb/src/core_functions/scalar/string/pad.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/string/repeat.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/string/replace.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/string/string_split.cpp +2 -1
- package/src/duckdb/src/core_functions/scalar/string/translate.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/string/ub_duckdb_func_string.cpp +26 -0
- package/src/duckdb/src/core_functions/scalar/struct/ub_duckdb_func_struct.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/union/ub_duckdb_func_union.cpp +4 -0
- package/src/duckdb/src/core_functions/ub_duckdb_core_functions.cpp +3 -0
- package/src/duckdb/src/execution/adaptive_filter.cpp +1 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/column_binding_resolver.cpp +7 -1
- package/src/duckdb/src/execution/expression_executor/execute_case.cpp +2 -2
- package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +2 -0
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +2 -2
- package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/ub_duckdb_expression_executor.cpp +11 -0
- package/src/duckdb/src/execution/expression_executor.cpp +5 -2
- package/src/duckdb/src/execution/index/art/art.cpp +12 -6
- package/src/duckdb/src/execution/index/art/art_key.cpp +3 -3
- package/src/duckdb/src/execution/index/art/leaf.cpp +2 -2
- package/src/duckdb/src/execution/index/art/node16.cpp +2 -2
- package/src/duckdb/src/execution/index/art/node256.cpp +3 -3
- package/src/duckdb/src/execution/index/art/node48.cpp +5 -5
- package/src/duckdb/src/execution/index/art/prefix.cpp +1 -1
- package/src/duckdb/src/execution/index/art/ub_duckdb_art_index_execution.cpp +12 -0
- package/src/duckdb/src/execution/index/art/ub_duckdb_execution_index_art.cpp +11 -0
- package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +6 -5
- package/src/duckdb/src/execution/index/ub_duckdb_execution_index.cpp +3 -0
- package/src/duckdb/src/execution/nested_loop_join/ub_duckdb_nested_loop_join.cpp +3 -0
- package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +3 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +0 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +3 -4
- package/src/duckdb/src/execution/operator/aggregate/ub_duckdb_operator_aggregate.cpp +9 -0
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +8 -3
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +5 -5
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +2 -3
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +5 -1
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/skip_scanner.cpp +2 -2
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +151 -79
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +11 -6
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +27 -6
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +71 -18
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +22 -11
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +6 -4
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +5 -3
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/ub_duckdb_operator_csv_sniffer.cpp +7 -0
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine.cpp +3 -3
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +30 -5
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +6 -2
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +47 -46
- package/src/duckdb/src/execution/operator/csv_scanner/ub_duckdb_operator_csv_scanner.cpp +10 -0
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +102 -54
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +8 -1
- package/src/duckdb/src/execution/operator/filter/ub_duckdb_operator_filter.cpp +2 -0
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +54 -36
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +56 -32
- package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +9 -13
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +12 -0
- package/src/duckdb/src/execution/operator/helper/physical_verify_vector.cpp +221 -0
- package/src/duckdb/src/execution/operator/helper/ub_duckdb_operator_helper.cpp +18 -0
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +1 -0
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +23 -8
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +8 -3
- package/src/duckdb/src/execution/operator/join/ub_duckdb_operator_join.cpp +16 -0
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +2 -3
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +2 -7
- package/src/duckdb/src/execution/operator/order/ub_duckdb_operator_order.cpp +3 -0
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +451 -55
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +312 -150
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +200 -75
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +1 -0
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +6 -5
- package/src/duckdb/src/execution/operator/persistent/ub_duckdb_operator_persistent.cpp +10 -0
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +3 -2
- package/src/duckdb/src/execution/operator/projection/ub_duckdb_operator_projection.cpp +5 -0
- package/src/duckdb/src/execution/operator/scan/ub_duckdb_operator_scan.cpp +7 -0
- package/src/duckdb/src/execution/operator/schema/ub_duckdb_operator_schema.cpp +12 -0
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +25 -0
- package/src/duckdb/src/execution/operator/set/ub_duckdb_operator_set.cpp +4 -0
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +7 -17
- package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +10 -0
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +7 -0
- package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +45 -13
- package/src/duckdb/src/execution/physical_plan/ub_duckdb_physical_plan.cpp +44 -0
- package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -3
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +13 -12
- package/src/duckdb/src/execution/ub_duckdb_execution.cpp +15 -0
- package/src/duckdb/src/execution/window_executor.cpp +71 -61
- package/src/duckdb/src/execution/window_segment_tree.cpp +6 -6
- package/src/duckdb/src/extension_forward_decl/icu.cpp +59 -0
- package/src/duckdb/src/function/aggregate/algebraic/ub_duckdb_aggr_algebraic.cpp +5 -0
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/ub_duckdb_aggr_distr.cpp +3 -0
- package/src/duckdb/src/function/aggregate/holistic/ub_duckdb_aggr_holistic.cpp +5 -0
- package/src/duckdb/src/function/aggregate/nested/ub_duckdb_aggr_nested.cpp +3 -0
- package/src/duckdb/src/function/aggregate/regression/ub_duckdb_aggr_regr.cpp +8 -0
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +3 -2
- package/src/duckdb/src/function/aggregate/ub_duckdb_func_aggr.cpp +3 -0
- package/src/duckdb/src/function/cast/array_casts.cpp +2 -4
- package/src/duckdb/src/function/cast/bit_cast.cpp +13 -13
- package/src/duckdb/src/function/cast/cast_function_set.cpp +2 -0
- package/src/duckdb/src/function/cast/decimal_cast.cpp +38 -44
- package/src/duckdb/src/function/cast/default_casts.cpp +5 -2
- package/src/duckdb/src/function/cast/enum_casts.cpp +5 -5
- package/src/duckdb/src/function/cast/list_casts.cpp +24 -14
- package/src/duckdb/src/function/cast/string_cast.cpp +48 -30
- package/src/duckdb/src/function/cast/struct_cast.cpp +2 -2
- package/src/duckdb/src/function/cast/time_casts.cpp +12 -0
- package/src/duckdb/src/function/cast/ub_duckdb_func_cast.cpp +17 -0
- package/src/duckdb/src/function/cast/union/ub_duckdb_union_cast.cpp +2 -0
- package/src/duckdb/src/function/cast/union_casts.cpp +13 -15
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +1 -1
- package/src/duckdb/src/function/cast_rules.cpp +2 -1
- package/src/duckdb/src/function/pragma/ub_duckdb_func_pragma.cpp +3 -0
- package/src/duckdb/src/function/scalar/bit/ub_duckdb_func_bit.cpp +2 -0
- package/src/duckdb/src/function/scalar/blob/ub_duckdb_func_blob.cpp +3 -0
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +7 -6
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +3 -3
- package/src/duckdb/src/function/scalar/compressed_materialization/ub_duckdb_func_compressed_materialization.cpp +3 -0
- package/src/duckdb/src/function/scalar/date/ub_duckdb_func_date.cpp +12 -0
- package/src/duckdb/src/function/scalar/enum/ub_duckdb_func_enum.cpp +2 -0
- package/src/duckdb/src/function/scalar/generic/ub_duckdb_func_generic.cpp +8 -0
- package/src/duckdb/src/function/scalar/generic/ub_duckdb_func_generic_main.cpp +2 -0
- package/src/duckdb/src/function/scalar/list/list_resize.cpp +3 -1
- package/src/duckdb/src/function/scalar/list/list_zip.cpp +3 -4
- package/src/duckdb/src/function/scalar/list/ub_duckdb_func_list.cpp +11 -0
- package/src/duckdb/src/function/scalar/list/ub_duckdb_func_list_nested.cpp +5 -0
- package/src/duckdb/src/function/scalar/map/ub_duckdb_func_map_nested.cpp +7 -0
- package/src/duckdb/src/function/scalar/math/ub_duckdb_func_math.cpp +4 -0
- package/src/duckdb/src/function/scalar/nested_functions.cpp +7 -3
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +1 -1
- package/src/duckdb/src/function/scalar/operators/multiply.cpp +4 -2
- package/src/duckdb/src/function/scalar/operators/subtract.cpp +9 -3
- package/src/duckdb/src/function/scalar/operators/ub_duckdb_func_ops.cpp +6 -0
- package/src/duckdb/src/function/scalar/operators/ub_duckdb_func_ops_main.cpp +5 -0
- package/src/duckdb/src/function/scalar/sequence/ub_duckdb_func_seq.cpp +2 -0
- package/src/duckdb/src/function/scalar/strftime_format.cpp +21 -20
- package/src/duckdb/src/function/scalar/string/like.cpp +14 -3
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +4 -2
- package/src/duckdb/src/function/scalar/string/regexp/ub_duckdb_func_string_regexp.cpp +3 -0
- package/src/duckdb/src/function/scalar/string/regexp.cpp +6 -4
- package/src/duckdb/src/function/scalar/string/suffix.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/ub_duckdb_func_string.cpp +31 -0
- package/src/duckdb/src/function/scalar/string/ub_duckdb_func_string_main.cpp +12 -0
- package/src/duckdb/src/function/scalar/struct/ub_duckdb_func_struct.cpp +4 -0
- package/src/duckdb/src/function/scalar/struct/ub_duckdb_func_struct_main.cpp +2 -0
- package/src/duckdb/src/function/scalar/system/ub_duckdb_func_system.cpp +2 -0
- package/src/duckdb/src/function/scalar/ub_duckdb_func_scalar.cpp +9 -0
- package/src/duckdb/src/function/scalar/union/ub_duckdb_func_union.cpp +4 -0
- package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +28 -2
- package/src/duckdb/src/function/table/arrow/ub_duckdb_arrow_conversion.cpp +2 -0
- package/src/duckdb/src/function/table/arrow.cpp +23 -6
- package/src/duckdb/src/function/table/arrow_conversion.cpp +75 -33
- package/src/duckdb/src/function/table/copy_csv.cpp +8 -3
- package/src/duckdb/src/function/table/range.cpp +5 -0
- package/src/duckdb/src/function/table/read_csv.cpp +9 -8
- package/src/duckdb/src/function/table/read_file.cpp +1 -1
- package/src/duckdb/src/function/table/sniff_csv.cpp +5 -5
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +6 -2
- package/src/duckdb/src/function/table/system/duckdb_secrets.cpp +5 -1
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +3 -1
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +13 -1
- package/src/duckdb/src/function/table/system/test_all_types.cpp +64 -0
- package/src/duckdb/src/function/table/system/ub_duckdb_table_func_system.cpp +23 -0
- package/src/duckdb/src/function/table/ub_duckdb_func_table.cpp +16 -0
- package/src/duckdb/src/function/table/version/pragma_version.cpp +11 -2
- package/src/duckdb/src/function/table/version/ub_duckdb_func_table_version.cpp +2 -0
- package/src/duckdb/src/function/ub_duckdb_function.cpp +14 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +11 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +8 -11
- package/src/duckdb/src/include/duckdb/common/arrow/appender/enum_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/arrow/appender/fixed_size_list_data.hpp +14 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/bswap.hpp +6 -2
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/enums/catalog_lookup_behavior.hpp +21 -0
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +0 -1
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/enums/prepared_statement_mode.hpp +20 -0
- package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/exception/conversion_exception.hpp +6 -0
- package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +6 -5
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/helper.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/limits.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +64 -0
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +34 -33
- package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +150 -124
- package/src/duckdb/src/include/duckdb/common/operator/integer_cast_operator.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/radix.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/blob.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/types/cast_helpers.hpp +15 -13
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/column/partitioned_column_data.hpp +1 -1
- 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_states.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/string_heap.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +11 -4
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +7 -2
- package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +40 -7
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/vector_operations/general_cast.hpp +12 -4
- package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/windows_undefs.hpp +4 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_count.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +9 -0
- package/src/duckdb/src/include/duckdb/execution/column_binding_resolver.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -0
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +262 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/column_count_scanner.hpp +70 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer.hpp +103 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +74 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_casting.hpp +154 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +130 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +60 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +70 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +155 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +166 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_sniffer.hpp +191 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +30 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +99 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine_cache.hpp +91 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +80 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/quote_rules.hpp +21 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner_boundary.hpp +93 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/skip_scanner.hpp +60 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine_options.hpp +35 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +200 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +13 -10
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +5 -11
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +4 -6
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_verify_vector.hpp +51 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/batch_memory_manager.hpp +165 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/batch_task_manager.hpp +48 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +10 -17
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +10 -6
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +14 -5
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +27 -43
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +10 -4
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +8 -6
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/capi/cast/from_decimal.hpp +6 -4
- package/src/duckdb/src/include/duckdb/main/capi/cast/to_decimal.hpp +17 -10
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +17 -3
- package/src/duckdb/src/include/duckdb/main/client_context_file_opener.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_context_state.hpp +20 -0
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/extension/generated_extension_loader.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +230 -199
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +18 -0
- package/src/duckdb/src/include/duckdb/main/relation/read_csv_relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +4 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +54 -10
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parallel/concurrentqueue.hpp +21 -5
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/executor_task.hpp +37 -0
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/task.hpp +0 -20
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +4 -2
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +10 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +0 -24
- package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_column_info.hpp +46 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/extra_drop_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +11 -4
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +59 -23
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_iterator.hpp +11 -3
- package/src/duckdb/src/include/duckdb/planner/extension_callback.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +0 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +5 -9
- package/src/duckdb/src/include/duckdb/planner/subquery/rewrite_correlated_expressions.hpp +0 -15
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +40 -5
- package/src/duckdb/src/include/duckdb/storage/compression/alp/algorithm/alp.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +5 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_utils.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/algorithm/alprd.hpp +10 -8
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +5 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/bit_reader.hpp +11 -10
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/bit_utils.hpp +3 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp128.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/leading_zero_buffer.hpp +5 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +3 -1
- package/src/duckdb/src/include/duckdb/storage/index.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +0 -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 +5 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +9 -2
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +2 -6
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/temporary_file_manager.hpp +169 -0
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +11 -1
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +1 -1
- package/src/duckdb/src/include/duckdb.h +119 -67
- package/src/duckdb/src/main/appender.cpp +2 -1
- package/src/duckdb/src/main/attached_database.cpp +49 -27
- package/src/duckdb/src/main/capi/appender-c.cpp +1 -1
- package/src/duckdb/src/main/capi/cast/ub_duckdb_main_capi_cast.cpp +3 -0
- package/src/duckdb/src/main/capi/cast/utils-c.cpp +1 -1
- package/src/duckdb/src/main/capi/data_chunk-c.cpp +9 -1
- package/src/duckdb/src/main/capi/datetime-c.cpp +14 -8
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +29 -2
- package/src/duckdb/src/main/capi/helper-c.cpp +2 -0
- package/src/duckdb/src/main/capi/hugeint-c.cpp +2 -1
- package/src/duckdb/src/main/capi/logical_types-c.cpp +35 -1
- package/src/duckdb/src/main/capi/result-c.cpp +9 -0
- package/src/duckdb/src/main/capi/ub_duckdb_main_capi.cpp +19 -0
- package/src/duckdb/src/main/chunk_scan_state/ub_duckdb_main_chunk_scan_state.cpp +2 -0
- package/src/duckdb/src/main/client_context.cpp +133 -33
- package/src/duckdb/src/main/client_context_file_opener.cpp +8 -7
- package/src/duckdb/src/main/config.cpp +2 -0
- package/src/duckdb/src/main/connection_manager.cpp +8 -0
- package/src/duckdb/src/main/database.cpp +13 -4
- package/src/duckdb/src/main/database_manager.cpp +10 -1
- package/src/duckdb/src/main/extension/extension_helper.cpp +8 -5
- package/src/duckdb/src/main/extension/extension_install.cpp +1 -1
- package/src/duckdb/src/main/extension/ub_duckdb_main_extension.cpp +6 -0
- package/src/duckdb/src/main/prepared_statement_data.cpp +23 -6
- package/src/duckdb/src/main/query_profiler.cpp +9 -7
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +17 -12
- package/src/duckdb/src/main/relation/ub_duckdb_main_relation.cpp +26 -0
- package/src/duckdb/src/main/relation/value_relation.cpp +2 -0
- package/src/duckdb/src/main/secret/secret.cpp +1 -1
- package/src/duckdb/src/main/secret/secret_manager.cpp +41 -8
- package/src/duckdb/src/main/secret/secret_storage.cpp +8 -2
- package/src/duckdb/src/main/settings/settings.cpp +42 -2
- package/src/duckdb/src/main/settings/ub_duckdb_main_settings.cpp +2 -0
- package/src/duckdb/src/main/ub_duckdb_main.cpp +25 -0
- package/src/duckdb/src/optimizer/compressed_materialization/ub_duckdb_optimizer_compressed_materialization.cpp +4 -0
- package/src/duckdb/src/optimizer/filter_combiner.cpp +20 -14
- package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +5 -1
- package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +23 -11
- package/src/duckdb/src/optimizer/join_order/ub_duckdb_optimizer_join_order.cpp +12 -0
- package/src/duckdb/src/optimizer/matcher/ub_duckdb_optimizer_matcher.cpp +2 -0
- package/src/duckdb/src/optimizer/pullup/ub_duckdb_optimizer_pullup.cpp +6 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/ub_duckdb_optimizer_pushdown.cpp +12 -0
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +7 -6
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +8 -6
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +1 -1
- package/src/duckdb/src/optimizer/rule/ub_duckdb_optimizer_rules.cpp +16 -0
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +71 -1
- package/src/duckdb/src/optimizer/statistics/expression/ub_duckdb_optimizer_statistics_expr.cpp +11 -0
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_limit.cpp +5 -1
- package/src/duckdb/src/optimizer/statistics/operator/ub_duckdb_optimizer_statistics_op.cpp +11 -0
- package/src/duckdb/src/optimizer/topn_optimizer.cpp +12 -11
- package/src/duckdb/src/optimizer/ub_duckdb_optimizer.cpp +20 -0
- package/src/duckdb/src/parallel/executor.cpp +8 -19
- package/src/duckdb/src/parallel/executor_task.cpp +6 -2
- package/src/duckdb/src/parallel/pipeline.cpp +12 -6
- package/src/duckdb/src/parallel/pipeline_executor.cpp +1 -1
- package/src/duckdb/src/parallel/pipeline_finish_event.cpp +2 -2
- package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -2
- package/src/duckdb/src/parallel/task_scheduler.cpp +15 -8
- package/src/duckdb/src/parallel/ub_duckdb_parallel.cpp +15 -0
- package/src/duckdb/src/parser/constraints/ub_duckdb_constraints.cpp +5 -0
- package/src/duckdb/src/parser/expression/ub_duckdb_expression.cpp +18 -0
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +0 -18
- package/src/duckdb/src/parser/parsed_data/comment_on_column_info.cpp +44 -0
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +1 -0
- package/src/duckdb/src/parser/parsed_data/extra_drop_info.cpp +2 -0
- package/src/duckdb/src/parser/parsed_data/ub_duckdb_parsed_data.cpp +24 -0
- package/src/duckdb/src/parser/parser.cpp +1 -1
- package/src/duckdb/src/parser/query_error_context.cpp +15 -1
- package/src/duckdb/src/parser/query_node/ub_duckdb_query_node.cpp +5 -0
- package/src/duckdb/src/parser/statement/export_statement.cpp +2 -1
- package/src/duckdb/src/parser/statement/relation_statement.cpp +2 -2
- package/src/duckdb/src/parser/statement/ub_duckdb_statement.cpp +25 -0
- package/src/duckdb/src/parser/tableref/pivotref.cpp +3 -3
- package/src/duckdb/src/parser/tableref/showref.cpp +2 -0
- package/src/duckdb/src/parser/tableref/ub_duckdb_parser_tableref.cpp +8 -0
- package/src/duckdb/src/parser/transform/constraint/ub_duckdb_transformer_constraint.cpp +2 -0
- package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +10 -2
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +7 -7
- package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +2 -1
- package/src/duckdb/src/parser/transform/expression/ub_duckdb_transformer_expression.cpp +20 -0
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +2 -2
- package/src/duckdb/src/parser/transform/helpers/ub_duckdb_transformer_helpers.cpp +8 -0
- package/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp +3 -8
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +3 -1
- package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +2 -3
- package/src/duckdb/src/parser/transform/statement/ub_duckdb_transformer_statement.cpp +37 -0
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +16 -0
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +49 -32
- package/src/duckdb/src/parser/transform/tableref/ub_duckdb_transformer_tableref.cpp +8 -0
- package/src/duckdb/src/parser/ub_duckdb_parser.cpp +15 -0
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +11 -4
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +4 -1
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +71 -5
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +35 -1
- package/src/duckdb/src/planner/binder/expression/ub_duckdb_bind_expression.cpp +20 -0
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +55 -51
- package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +1 -11
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/ub_duckdb_bind_query_node.cpp +12 -0
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +12 -6
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +8 -2
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +6 -3
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +13 -2
- package/src/duckdb/src/planner/binder/statement/ub_duckdb_bind_statement.cpp +26 -0
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +15 -4
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +9 -2
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +93 -45
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +6 -1
- package/src/duckdb/src/planner/binder/tableref/ub_duckdb_bind_tableref.cpp +17 -0
- package/src/duckdb/src/planner/binder.cpp +22 -23
- package/src/duckdb/src/planner/bound_result_modifier.cpp +67 -4
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +5 -1
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +3 -0
- package/src/duckdb/src/planner/expression/ub_duckdb_planner_expression.cpp +19 -0
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +14 -9
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +17 -9
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +61 -37
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +8 -4
- package/src/duckdb/src/planner/expression_binder/ub_duckdb_expression_binders.cpp +20 -0
- package/src/duckdb/src/planner/expression_binder/where_binder.cpp +3 -2
- package/src/duckdb/src/planner/expression_iterator.cpp +73 -52
- package/src/duckdb/src/planner/filter/ub_duckdb_planner_filter.cpp +4 -0
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +4 -14
- package/src/duckdb/src/planner/operator/logical_limit.cpp +14 -6
- package/src/duckdb/src/planner/operator/ub_duckdb_planner_operator.cpp +43 -0
- package/src/duckdb/src/planner/parsed_data/ub_duckdb_planner_parsed_data.cpp +2 -0
- package/src/duckdb/src/planner/planner.cpp +3 -0
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +46 -18
- package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +39 -33
- package/src/duckdb/src/planner/subquery/ub_duckdb_planner_subquery.cpp +4 -0
- package/src/duckdb/src/planner/ub_duckdb_planner.cpp +15 -0
- package/src/duckdb/src/storage/arena_allocator.cpp +9 -0
- package/src/duckdb/src/storage/buffer/block_handle.cpp +7 -2
- package/src/duckdb/src/storage/buffer/block_manager.cpp +7 -3
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +121 -24
- package/src/duckdb/src/storage/buffer/ub_duckdb_storage_buffer.cpp +6 -0
- package/src/duckdb/src/storage/checkpoint/ub_duckdb_storage_checkpoint.cpp +5 -0
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +4 -4
- package/src/duckdb/src/storage/compression/chimp/ub_duckdb_storage_compression_chimp.cpp +6 -0
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +6 -5
- package/src/duckdb/src/storage/compression/fsst.cpp +3 -2
- package/src/duckdb/src/storage/compression/rle.cpp +1 -1
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +4 -4
- package/src/duckdb/src/storage/compression/ub_duckdb_storage_compression.cpp +12 -0
- package/src/duckdb/src/storage/data_table.cpp +6 -3
- package/src/duckdb/src/storage/local_storage.cpp +5 -2
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +4 -4
- package/src/duckdb/src/storage/metadata/metadata_reader.cpp +1 -1
- package/src/duckdb/src/storage/metadata/metadata_writer.cpp +1 -1
- package/src/duckdb/src/storage/metadata/ub_duckdb_storage_metadata.cpp +4 -0
- package/src/duckdb/src/storage/partial_block_manager.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +3 -0
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +5 -29
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +22 -4
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +12 -32
- package/src/duckdb/src/storage/serialization/ub_duckdb_storage_serialization.cpp +16 -0
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +29 -397
- package/src/duckdb/src/storage/statistics/string_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/ub_duckdb_storage_statistics.cpp +10 -0
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +3 -3
- package/src/duckdb/src/storage/table/column_data.cpp +7 -16
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +4 -1
- package/src/duckdb/src/storage/table/column_segment.cpp +68 -78
- package/src/duckdb/src/storage/table/list_column_data.cpp +1 -0
- package/src/duckdb/src/storage/table/row_group.cpp +17 -7
- package/src/duckdb/src/storage/table/row_group_collection.cpp +28 -27
- package/src/duckdb/src/storage/table/ub_duckdb_storage_table.cpp +17 -0
- package/src/duckdb/src/storage/table/update_segment.cpp +7 -7
- package/src/duckdb/src/storage/temporary_file_manager.cpp +334 -0
- package/src/duckdb/src/storage/ub_duckdb_storage.cpp +20 -0
- package/src/duckdb/src/storage/write_ahead_log.cpp +3 -2
- package/src/duckdb/src/transaction/commit_state.cpp +4 -2
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +32 -17
- package/src/duckdb/src/transaction/meta_transaction.cpp +24 -0
- package/src/duckdb/src/transaction/transaction_context.cpp +0 -9
- package/src/duckdb/src/transaction/ub_duckdb_transaction.cpp +11 -0
- package/src/duckdb/src/transaction/undo_buffer.cpp +1 -1
- package/src/duckdb/third_party/jaro_winkler/details/common.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +2 -0
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +1032 -551
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +24122 -24304
- package/src/duckdb/third_party/mbedtls/include/mbedtls/mbedtls_config.h +0 -3
- package/src/duckdb/third_party/mbedtls/library/entropy_poll.cpp +32 -4
- package/src/duckdb/third_party/miniz/miniz_wrapper.hpp +4 -4
- package/src/duckdb/third_party/tdigest/t_digest.hpp +3 -3
- package/src/duckdb/ub_src_common_arrow_appender.cpp +2 -0
- package/src/duckdb/ub_src_common_exception.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_helper.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_persistent.cpp +0 -2
- package/src/duckdb/ub_src_execution_physical_plan.cpp +0 -2
- package/src/duckdb/ub_src_parser_parsed_data.cpp +1 -1
- package/src/duckdb/ub_src_planner_operator.cpp +0 -2
- package/src/duckdb/ub_src_storage.cpp +2 -0
- package/test/columns.test.ts +1 -1
- package/test/test_all_types.test.ts +1 -1
@@ -1,11 +1,12 @@
|
|
1
|
-
#include "duckdb/execution/operator/csv_scanner/
|
2
|
-
#include "duckdb/execution/operator/csv_scanner/
|
3
|
-
#include "duckdb/execution/operator/csv_scanner/
|
4
|
-
#include "duckdb/execution/operator/csv_scanner/
|
1
|
+
#include "duckdb/execution/operator/csv_scanner/string_value_scanner.hpp"
|
2
|
+
#include "duckdb/execution/operator/csv_scanner/csv_casting.hpp"
|
3
|
+
#include "duckdb/execution/operator/csv_scanner/skip_scanner.hpp"
|
4
|
+
#include "duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp"
|
5
5
|
#include "duckdb/main/client_data.hpp"
|
6
6
|
#include "duckdb/common/operator/integer_cast_operator.hpp"
|
7
7
|
#include "duckdb/common/operator/double_cast_operator.hpp"
|
8
8
|
#include <algorithm>
|
9
|
+
#include "utf8proc_wrapper.hpp"
|
9
10
|
|
10
11
|
namespace duckdb {
|
11
12
|
|
@@ -13,12 +14,14 @@ StringValueResult::StringValueResult(CSVStates &states, CSVStateMachine &state_m
|
|
13
14
|
const shared_ptr<CSVBufferHandle> &buffer_handle, Allocator &buffer_allocator,
|
14
15
|
idx_t result_size_p, idx_t buffer_position, CSVErrorHandler &error_hander_p,
|
15
16
|
CSVIterator &iterator_p, bool store_line_size_p,
|
16
|
-
shared_ptr<CSVFileScan> csv_file_scan_p, idx_t &lines_read_p)
|
17
|
-
: ScannerResult(states, state_machine),
|
17
|
+
shared_ptr<CSVFileScan> csv_file_scan_p, idx_t &lines_read_p, bool sniffing_p)
|
18
|
+
: ScannerResult(states, state_machine),
|
19
|
+
number_of_columns(NumericCast<uint32_t>(state_machine.dialect_options.num_cols)),
|
18
20
|
null_padding(state_machine.options.null_padding), ignore_errors(state_machine.options.ignore_errors),
|
19
21
|
null_str_ptr(state_machine.options.null_str.c_str()), null_str_size(state_machine.options.null_str.size()),
|
20
22
|
result_size(result_size_p), error_handler(error_hander_p), iterator(iterator_p),
|
21
|
-
store_line_size(store_line_size_p), csv_file_scan(std::move(csv_file_scan_p)), lines_read(lines_read_p)
|
23
|
+
store_line_size(store_line_size_p), csv_file_scan(std::move(csv_file_scan_p)), lines_read(lines_read_p),
|
24
|
+
sniffing(sniffing_p) {
|
22
25
|
// Vector information
|
23
26
|
D_ASSERT(number_of_columns > 0);
|
24
27
|
buffer_handles.push_back(buffer_handle);
|
@@ -32,10 +35,10 @@ StringValueResult::StringValueResult(CSVStates &states, CSVStateMachine &state_m
|
|
32
35
|
pre_previous_line_start = previous_line_start;
|
33
36
|
// Fill out Parse Types
|
34
37
|
vector<LogicalType> logical_types;
|
35
|
-
parse_types = make_unsafe_uniq_array<LogicalTypeId
|
38
|
+
parse_types = make_unsafe_uniq_array<pair<LogicalTypeId, bool>>(number_of_columns);
|
36
39
|
if (!csv_file_scan) {
|
37
40
|
for (idx_t i = 0; i < number_of_columns; i++) {
|
38
|
-
parse_types[i] = LogicalTypeId::VARCHAR;
|
41
|
+
parse_types[i] = {LogicalTypeId::VARCHAR, true};
|
39
42
|
logical_types.emplace_back(LogicalType::VARCHAR);
|
40
43
|
string name = "Column_" + to_string(i);
|
41
44
|
names.emplace_back(name);
|
@@ -49,10 +52,10 @@ StringValueResult::StringValueResult(CSVStates &states, CSVStateMachine &state_m
|
|
49
52
|
for (idx_t i = 0; i < csv_file_scan->file_types.size(); i++) {
|
50
53
|
auto &type = csv_file_scan->file_types[i];
|
51
54
|
if (StringValueScanner::CanDirectlyCast(type, state_machine.options.dialect_options.date_format)) {
|
52
|
-
parse_types[i] = type.id();
|
55
|
+
parse_types[i] = {type.id(), true};
|
53
56
|
logical_types.emplace_back(type);
|
54
57
|
} else {
|
55
|
-
parse_types[i] = LogicalTypeId::VARCHAR;
|
58
|
+
parse_types[i] = {LogicalTypeId::VARCHAR, type.id() == LogicalTypeId::VARCHAR || type.IsNested()};
|
56
59
|
logical_types.emplace_back(LogicalType::VARCHAR);
|
57
60
|
}
|
58
61
|
}
|
@@ -73,7 +76,7 @@ StringValueResult::StringValueResult(CSVStates &states, CSVStateMachine &state_m
|
|
73
76
|
if (!projecting_columns) {
|
74
77
|
for (idx_t j = logical_types.size(); j < number_of_columns; j++) {
|
75
78
|
// This can happen if we have sneaky null columns at the end that we wish to ignore
|
76
|
-
parse_types[j] = LogicalTypeId::VARCHAR;
|
79
|
+
parse_types[j] = {LogicalTypeId::VARCHAR, true};
|
77
80
|
logical_types.emplace_back(LogicalType::VARCHAR);
|
78
81
|
}
|
79
82
|
}
|
@@ -87,6 +90,16 @@ StringValueResult::StringValueResult(CSVStates &states, CSVStateMachine &state_m
|
|
87
90
|
}
|
88
91
|
}
|
89
92
|
|
93
|
+
StringValueResult::~StringValueResult() {
|
94
|
+
// We have to insert the lines read by this scanner
|
95
|
+
error_handler.Insert(iterator.GetBoundaryIdx(), lines_read);
|
96
|
+
if (!iterator.done) {
|
97
|
+
// Some operators, like Limit, might cause a future error to incorrectly report the wrong error line
|
98
|
+
// Better to print nothing to print something wrong
|
99
|
+
error_handler.DontPrintErrorLine();
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
90
103
|
inline bool IsValueNull(const char *null_str_ptr, const char *value_ptr, const idx_t size) {
|
91
104
|
for (idx_t i = 0; i < size; i++) {
|
92
105
|
if (null_str_ptr[i] != value_ptr[i]) {
|
@@ -124,7 +137,7 @@ void StringValueResult::AddValueToVector(const char *value_ptr, const idx_t size
|
|
124
137
|
empty = state_machine.options.force_not_null[chunk_col_id];
|
125
138
|
}
|
126
139
|
if (empty) {
|
127
|
-
if (parse_types[chunk_col_id] != LogicalTypeId::VARCHAR) {
|
140
|
+
if (parse_types[chunk_col_id].first != LogicalTypeId::VARCHAR) {
|
128
141
|
// If it is not a varchar, empty values are not accepted, we must error.
|
129
142
|
cast_errors[chunk_col_id] = std::string("");
|
130
143
|
}
|
@@ -143,7 +156,7 @@ void StringValueResult::AddValueToVector(const char *value_ptr, const idx_t size
|
|
143
156
|
}
|
144
157
|
}
|
145
158
|
bool success = true;
|
146
|
-
switch (parse_types[chunk_col_id]) {
|
159
|
+
switch (parse_types[chunk_col_id].first) {
|
147
160
|
case LogicalTypeId::TINYINT:
|
148
161
|
success = TrySimpleIntegerCast(value_ptr, size, static_cast<int8_t *>(vector_ptr[chunk_col_id])[number_of_rows],
|
149
162
|
false);
|
@@ -198,15 +211,30 @@ void StringValueResult::AddValueToVector(const char *value_ptr, const idx_t size
|
|
198
211
|
TimestampCastResult::SUCCESS;
|
199
212
|
break;
|
200
213
|
}
|
201
|
-
default:
|
214
|
+
default: {
|
215
|
+
// By default we add a string
|
216
|
+
// We only evaluate if a string is utf8 valid, if it's actually a varchar
|
217
|
+
if (parse_types[chunk_col_id].second && !Utf8Proc::IsValid(value_ptr, UnsafeNumericCast<uint32_t>(size))) {
|
218
|
+
bool force_error = !state_machine.options.ignore_errors && sniffing;
|
219
|
+
// Invalid unicode, we must error
|
220
|
+
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(), lines_read);
|
221
|
+
auto csv_error = CSVError::InvalidUTF8(state_machine.options, lines_per_batch);
|
222
|
+
error_handler.Error(csv_error, force_error);
|
223
|
+
// If we got here, we are ingoring errors, hence we must ignore this line.
|
224
|
+
ignore_current_row = true;
|
225
|
+
break;
|
226
|
+
}
|
202
227
|
if (allocate) {
|
203
|
-
|
204
|
-
|
228
|
+
// If it's a value produced over multiple buffers, we must allocate
|
229
|
+
static_cast<string_t *>(vector_ptr[chunk_col_id])[number_of_rows] = StringVector::AddStringOrBlob(
|
230
|
+
parse_chunk.data[chunk_col_id], string_t(value_ptr, UnsafeNumericCast<uint32_t>(size)));
|
205
231
|
} else {
|
206
|
-
static_cast<string_t *>(vector_ptr[chunk_col_id])[number_of_rows] =
|
232
|
+
static_cast<string_t *>(vector_ptr[chunk_col_id])[number_of_rows] =
|
233
|
+
string_t(value_ptr, UnsafeNumericCast<uint32_t>(size));
|
207
234
|
}
|
208
235
|
break;
|
209
236
|
}
|
237
|
+
}
|
210
238
|
if (!success) {
|
211
239
|
// We had a casting error, we push it here because we can only error when finishing the line read.
|
212
240
|
cast_errors[cur_col_id] = std::string(value_ptr, size);
|
@@ -242,6 +270,7 @@ void StringValueResult::Reset() {
|
|
242
270
|
v->SetAllValid(result_size);
|
243
271
|
}
|
244
272
|
buffer_handles.clear();
|
273
|
+
ignore_current_row = false;
|
245
274
|
}
|
246
275
|
|
247
276
|
void StringValueResult::AddQuotedValue(StringValueResult &result, const idx_t buffer_pos) {
|
@@ -287,10 +316,10 @@ void StringValueResult::AddValue(StringValueResult &result, const idx_t buffer_p
|
|
287
316
|
}
|
288
317
|
|
289
318
|
void StringValueResult::HandleOverLimitRows() {
|
290
|
-
auto csv_error =
|
291
|
-
CSVError::IncorrectColumnAmountError(state_machine.options, nullptr, number_of_columns, cur_col_id + 1);
|
292
319
|
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(), number_of_rows + 1);
|
293
|
-
|
320
|
+
auto csv_error = CSVError::IncorrectColumnAmountError(state_machine.options, nullptr, number_of_columns,
|
321
|
+
cur_col_id + 1, lines_per_batch);
|
322
|
+
error_handler.Error(csv_error);
|
294
323
|
// If we get here we need to remove the last line
|
295
324
|
cur_col_id = 0;
|
296
325
|
chunk_col_id = 0;
|
@@ -306,14 +335,16 @@ void StringValueResult::NullPaddingQuotedNewlineCheck() {
|
|
306
335
|
if (state_machine.options.null_padding && iterator.IsBoundarySet() && quoted_new_line && iterator.done) {
|
307
336
|
// If we have null_padding set, we found a quoted new line, we are scanning the file in parallel and it's the
|
308
337
|
// last row of this thread.
|
309
|
-
auto csv_error = CSVError::NullPaddingFail(state_machine.options);
|
310
338
|
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(), number_of_rows + 1);
|
311
|
-
|
339
|
+
auto csv_error = CSVError::NullPaddingFail(state_machine.options, lines_per_batch);
|
340
|
+
error_handler.Error(csv_error);
|
312
341
|
}
|
313
342
|
}
|
314
343
|
|
315
344
|
bool StringValueResult::AddRowInternal() {
|
316
345
|
if (ignore_current_row) {
|
346
|
+
cur_col_id = 0;
|
347
|
+
chunk_col_id = 0;
|
317
348
|
// An error occurred on this row, we are ignoring it and resetting our control flag
|
318
349
|
ignore_current_row = false;
|
319
350
|
return false;
|
@@ -335,12 +366,14 @@ bool StringValueResult::AddRowInternal() {
|
|
335
366
|
std::ostringstream error;
|
336
367
|
// Casting Error Message
|
337
368
|
error << "Could not convert string \"" << cast_error.second << "\" to \'"
|
338
|
-
<< LogicalTypeIdToString(parse_types[cast_error.first]) << "\'";
|
369
|
+
<< LogicalTypeIdToString(parse_types[cast_error.first].first) << "\'";
|
339
370
|
auto error_string = error.str();
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
371
|
+
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(), lines_read);
|
372
|
+
|
373
|
+
auto csv_error =
|
374
|
+
CSVError::CastError(state_machine.options, names[cast_error.first], error_string, cast_error.first, row,
|
375
|
+
lines_per_batch, parse_types[cast_error.first].first);
|
376
|
+
error_handler.Error(csv_error);
|
344
377
|
}
|
345
378
|
// If we got here it means we are ignoring errors, hence we need to signify to our result scanner to ignore this
|
346
379
|
// row
|
@@ -378,10 +411,10 @@ bool StringValueResult::AddRowInternal() {
|
|
378
411
|
}
|
379
412
|
} else {
|
380
413
|
// If we are not null-padding this is an error
|
381
|
-
auto csv_error =
|
382
|
-
CSVError::IncorrectColumnAmountError(state_machine.options, nullptr, number_of_columns, cur_col_id);
|
383
414
|
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(), number_of_rows + 1);
|
384
|
-
|
415
|
+
auto csv_error = CSVError::IncorrectColumnAmountError(state_machine.options, nullptr, number_of_columns,
|
416
|
+
cur_col_id, lines_per_batch);
|
417
|
+
error_handler.Error(csv_error);
|
385
418
|
// If we are here we ignore_errors, so we delete this line
|
386
419
|
number_of_rows--;
|
387
420
|
}
|
@@ -405,9 +438,9 @@ bool StringValueResult::AddRow(StringValueResult &result, const idx_t buffer_pos
|
|
405
438
|
result.error_handler.NewMaxLineSize(current_line_size);
|
406
439
|
}
|
407
440
|
if (current_line_size > result.state_machine.options.maximum_line_size) {
|
408
|
-
auto csv_error = CSVError::LineSizeError(result.state_machine.options, current_line_size);
|
409
441
|
LinesPerBoundary lines_per_batch(result.iterator.GetBoundaryIdx(), result.number_of_rows);
|
410
|
-
result.
|
442
|
+
auto csv_error = CSVError::LineSizeError(result.state_machine.options, current_line_size, lines_per_batch);
|
443
|
+
result.error_handler.Error(csv_error);
|
411
444
|
}
|
412
445
|
result.pre_previous_line_start = result.previous_line_start;
|
413
446
|
result.previous_line_start = current_line_start;
|
@@ -435,11 +468,11 @@ bool StringValueResult::AddRow(StringValueResult &result, const idx_t buffer_pos
|
|
435
468
|
|
436
469
|
void StringValueResult::InvalidState(StringValueResult &result) {
|
437
470
|
// FIXME: How do we recover from an invalid state? Can we restart the state machine and jump to the next row?
|
471
|
+
LinesPerBoundary lines_per_batch(result.iterator.GetBoundaryIdx(), result.number_of_rows);
|
438
472
|
auto csv_error = CSVError::UnterminatedQuotesError(result.state_machine.options,
|
439
473
|
static_cast<string_t *>(result.vector_ptr[result.chunk_col_id]),
|
440
|
-
result.number_of_rows, result.cur_col_id);
|
441
|
-
|
442
|
-
result.error_handler.Error(lines_per_batch, csv_error);
|
474
|
+
result.number_of_rows, result.cur_col_id, lines_per_batch);
|
475
|
+
result.error_handler.Error(csv_error);
|
443
476
|
}
|
444
477
|
|
445
478
|
bool StringValueResult::EmptyLine(StringValueResult &result, const idx_t buffer_pos) {
|
@@ -473,21 +506,22 @@ bool StringValueResult::EmptyLine(StringValueResult &result, const idx_t buffer_
|
|
473
506
|
StringValueScanner::StringValueScanner(idx_t scanner_idx_p, const shared_ptr<CSVBufferManager> &buffer_manager,
|
474
507
|
const shared_ptr<CSVStateMachine> &state_machine,
|
475
508
|
const shared_ptr<CSVErrorHandler> &error_handler,
|
476
|
-
const shared_ptr<CSVFileScan> &csv_file_scan,
|
477
|
-
idx_t result_size)
|
478
|
-
: BaseScanner(buffer_manager, state_machine, error_handler, csv_file_scan, boundary),
|
509
|
+
const shared_ptr<CSVFileScan> &csv_file_scan, bool sniffing,
|
510
|
+
CSVIterator boundary, idx_t result_size)
|
511
|
+
: BaseScanner(buffer_manager, state_machine, error_handler, sniffing, csv_file_scan, boundary),
|
512
|
+
scanner_idx(scanner_idx_p),
|
479
513
|
result(states, *state_machine, cur_buffer_handle, BufferAllocator::Get(buffer_manager->context), result_size,
|
480
514
|
iterator.pos.buffer_pos, *error_handler, iterator,
|
481
|
-
buffer_manager->context.client_data->debug_set_max_line_length, csv_file_scan, lines_read) {
|
515
|
+
buffer_manager->context.client_data->debug_set_max_line_length, csv_file_scan, lines_read, sniffing) {
|
482
516
|
}
|
483
517
|
|
484
518
|
StringValueScanner::StringValueScanner(const shared_ptr<CSVBufferManager> &buffer_manager,
|
485
519
|
const shared_ptr<CSVStateMachine> &state_machine,
|
486
520
|
const shared_ptr<CSVErrorHandler> &error_handler)
|
487
|
-
: BaseScanner(buffer_manager, state_machine, error_handler, nullptr, {}), scanner_idx(0),
|
521
|
+
: BaseScanner(buffer_manager, state_machine, error_handler, false, nullptr, {}), scanner_idx(0),
|
488
522
|
result(states, *state_machine, cur_buffer_handle, Allocator::DefaultAllocator(), STANDARD_VECTOR_SIZE,
|
489
523
|
iterator.pos.buffer_pos, *error_handler, iterator,
|
490
|
-
buffer_manager->context.client_data->debug_set_max_line_length, csv_file_scan, lines_read) {
|
524
|
+
buffer_manager->context.client_data->debug_set_max_line_length, csv_file_scan, lines_read, sniffing) {
|
491
525
|
}
|
492
526
|
|
493
527
|
unique_ptr<StringValueScanner> StringValueScanner::GetCSVScanner(ClientContext &context, CSVReaderOptions &options) {
|
@@ -517,6 +551,8 @@ void StringValueScanner::Flush(DataChunk &insert_chunk) {
|
|
517
551
|
auto &process_result = ParseChunk();
|
518
552
|
// First Get Parsed Chunk
|
519
553
|
auto &parse_chunk = process_result.ToChunk();
|
554
|
+
// We have to check if we got to error
|
555
|
+
error_handler->ErrorIfNeeded();
|
520
556
|
|
521
557
|
if (parse_chunk.size() == 0) {
|
522
558
|
return;
|
@@ -548,6 +584,7 @@ void StringValueScanner::Flush(DataChunk &insert_chunk) {
|
|
548
584
|
result_vector.Reinterpret(parse_vector);
|
549
585
|
} else {
|
550
586
|
string error_message;
|
587
|
+
CastParameters parameters(false, &error_message);
|
551
588
|
bool success;
|
552
589
|
idx_t line_error = 0;
|
553
590
|
bool line_error_set = true;
|
@@ -556,7 +593,7 @@ void StringValueScanner::Flush(DataChunk &insert_chunk) {
|
|
556
593
|
type.id() == LogicalTypeId::DATE) {
|
557
594
|
// use the date format to cast the chunk
|
558
595
|
success = CSVCast::TryCastDateVector(state_machine->options.dialect_options.date_format, parse_vector,
|
559
|
-
result_vector, parse_chunk.size(),
|
596
|
+
result_vector, parse_chunk.size(), parameters, line_error, true);
|
560
597
|
} else if (!state_machine->options.dialect_options.date_format.at(LogicalTypeId::TIMESTAMP)
|
561
598
|
.GetValue()
|
562
599
|
.Empty() &&
|
@@ -564,19 +601,21 @@ void StringValueScanner::Flush(DataChunk &insert_chunk) {
|
|
564
601
|
// use the date format to cast the chunk
|
565
602
|
success =
|
566
603
|
CSVCast::TryCastTimestampVector(state_machine->options.dialect_options.date_format, parse_vector,
|
567
|
-
result_vector, parse_chunk.size(),
|
604
|
+
result_vector, parse_chunk.size(), parameters, true);
|
568
605
|
} else if (state_machine->options.decimal_separator != "." &&
|
569
606
|
(type.id() == LogicalTypeId::FLOAT || type.id() == LogicalTypeId::DOUBLE)) {
|
570
607
|
success =
|
571
608
|
CSVCast::TryCastFloatingVectorCommaSeparated(state_machine->options, parse_vector, result_vector,
|
572
|
-
parse_chunk.size(),
|
609
|
+
parse_chunk.size(), parameters, type, line_error);
|
573
610
|
} else if (state_machine->options.decimal_separator != "." && type.id() == LogicalTypeId::DECIMAL) {
|
574
|
-
success =
|
575
|
-
state_machine->options, parse_vector, result_vector,
|
611
|
+
success =
|
612
|
+
CSVCast::TryCastDecimalVectorCommaSeparated(state_machine->options, parse_vector, result_vector,
|
613
|
+
parse_chunk.size(), parameters, type, line_error);
|
614
|
+
|
576
615
|
} else {
|
577
616
|
// target type is not varchar: perform a cast
|
578
617
|
success = VectorOperations::TryCast(buffer_manager->context, parse_vector, result_vector,
|
579
|
-
parse_chunk.size(), &error_message);
|
618
|
+
parse_chunk.size(), &error_message, false, true);
|
580
619
|
line_error_set = false;
|
581
620
|
}
|
582
621
|
if (success) {
|
@@ -597,14 +636,19 @@ void StringValueScanner::Flush(DataChunk &insert_chunk) {
|
|
597
636
|
}
|
598
637
|
{
|
599
638
|
vector<Value> row;
|
600
|
-
|
601
|
-
|
639
|
+
|
640
|
+
if (state_machine->options.ignore_errors) {
|
641
|
+
for (idx_t col = 0; col < parse_chunk.ColumnCount(); col++) {
|
642
|
+
row.push_back(parse_chunk.GetValue(col, line_error));
|
643
|
+
}
|
602
644
|
}
|
603
|
-
|
604
|
-
error_message, col_idx, row);
|
645
|
+
|
605
646
|
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(),
|
606
647
|
lines_read - parse_chunk.size() + line_error);
|
607
|
-
|
648
|
+
auto csv_error =
|
649
|
+
CSVError::CastError(state_machine->options, csv_file_scan->names[col_idx], error_message, col_idx,
|
650
|
+
row, lines_per_batch, result_vector.GetType().id());
|
651
|
+
error_handler->Error(csv_error);
|
608
652
|
}
|
609
653
|
borked_lines.insert(line_error++);
|
610
654
|
D_ASSERT(state_machine->options.ignore_errors);
|
@@ -617,11 +661,13 @@ void StringValueScanner::Flush(DataChunk &insert_chunk) {
|
|
617
661
|
for (idx_t col = 0; col < parse_chunk.ColumnCount(); col++) {
|
618
662
|
row.push_back(parse_chunk.GetValue(col, line_error));
|
619
663
|
}
|
620
|
-
auto csv_error = CSVError::CastError(state_machine->options, csv_file_scan->names[col_idx],
|
621
|
-
error_message, col_idx, row);
|
622
664
|
LinesPerBoundary lines_per_batch(iterator.GetBoundaryIdx(),
|
623
665
|
lines_read - parse_chunk.size() + line_error);
|
624
|
-
|
666
|
+
auto csv_error =
|
667
|
+
CSVError::CastError(state_machine->options, csv_file_scan->names[col_idx], error_message,
|
668
|
+
col_idx, row, lines_per_batch, result_vector.GetType().id());
|
669
|
+
|
670
|
+
error_handler->Error(csv_error);
|
625
671
|
}
|
626
672
|
}
|
627
673
|
}
|
@@ -675,17 +721,19 @@ void StringValueScanner::ProcessExtraRow() {
|
|
675
721
|
iterator.pos.buffer_pos++;
|
676
722
|
return;
|
677
723
|
}
|
724
|
+
lines_read++;
|
678
725
|
iterator.pos.buffer_pos++;
|
679
726
|
break;
|
680
727
|
case CSVState::CARRIAGE_RETURN:
|
681
|
-
lines_read++;
|
682
728
|
if (states.states[0] != CSVState::RECORD_SEPARATOR) {
|
683
729
|
result.AddRow(result, iterator.pos.buffer_pos);
|
684
730
|
iterator.pos.buffer_pos++;
|
731
|
+
lines_read++;
|
685
732
|
return;
|
686
733
|
} else {
|
687
734
|
result.EmptyLine(result, iterator.pos.buffer_pos);
|
688
735
|
iterator.pos.buffer_pos++;
|
736
|
+
lines_read++;
|
689
737
|
return;
|
690
738
|
}
|
691
739
|
case CSVState::DELIMITER:
|
@@ -816,25 +864,37 @@ void StringValueScanner::ProcessOverbufferValue() {
|
|
816
864
|
}
|
817
865
|
j++;
|
818
866
|
}
|
819
|
-
|
820
|
-
if (result.
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
const auto str_ptr = static_cast<const char *>(overbuffer_string.c_str() + result.quoted_position);
|
825
|
-
value =
|
826
|
-
StringValueScanner::RemoveEscape(str_ptr, overbuffer_string.size() - 2,
|
827
|
-
state_machine->dialect_options.state_machine_options.escape.GetValue(),
|
828
|
-
result.parse_chunk.data[result.chunk_col_id]);
|
867
|
+
bool skip_value = false;
|
868
|
+
if (result.projecting_columns) {
|
869
|
+
if (!result.projected_columns[result.cur_col_id]) {
|
870
|
+
result.cur_col_id++;
|
871
|
+
skip_value = true;
|
829
872
|
}
|
830
|
-
} else {
|
831
|
-
value = string_t(overbuffer_string.c_str(), overbuffer_string.size());
|
832
873
|
}
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
874
|
+
if (!skip_value) {
|
875
|
+
string_t value;
|
876
|
+
if (result.quoted) {
|
877
|
+
value = string_t(overbuffer_string.c_str() + result.quoted_position,
|
878
|
+
UnsafeNumericCast<uint32_t>(overbuffer_string.size() - 1 - result.quoted_position));
|
879
|
+
if (result.escaped) {
|
880
|
+
const auto str_ptr = static_cast<const char *>(overbuffer_string.c_str() + result.quoted_position);
|
881
|
+
value = StringValueScanner::RemoveEscape(
|
882
|
+
str_ptr, overbuffer_string.size() - 2,
|
883
|
+
state_machine->dialect_options.state_machine_options.escape.GetValue(),
|
884
|
+
result.parse_chunk.data[result.chunk_col_id]);
|
885
|
+
}
|
886
|
+
} else {
|
887
|
+
value = string_t(overbuffer_string.c_str(), UnsafeNumericCast<uint32_t>(overbuffer_string.size()));
|
888
|
+
}
|
889
|
+
if (states.EmptyLine() && state_machine->dialect_options.num_cols == 1) {
|
890
|
+
result.EmptyLine(result, iterator.pos.buffer_pos);
|
891
|
+
} else if (!states.IsNotSet()) {
|
892
|
+
result.AddValueToVector(value.GetData(), value.GetSize(), true);
|
893
|
+
}
|
894
|
+
} else {
|
895
|
+
if (states.EmptyLine() && state_machine->dialect_options.num_cols == 1) {
|
896
|
+
result.EmptyLine(result, iterator.pos.buffer_pos);
|
897
|
+
}
|
838
898
|
}
|
839
899
|
|
840
900
|
if (states.NewRow() && !states.IsNotSet()) {
|
@@ -876,17 +936,17 @@ bool StringValueScanner::MoveToNextBuffer() {
|
|
876
936
|
result.chunk_col_id = 0;
|
877
937
|
return false;
|
878
938
|
} else if (states.NewValue()) {
|
879
|
-
lines_read++;
|
880
939
|
// we add the value
|
881
940
|
result.AddValue(result, previous_buffer_handle->actual_size);
|
882
941
|
// And an extra empty value to represent what comes after the delimiter
|
883
942
|
result.AddRow(result, previous_buffer_handle->actual_size);
|
943
|
+
lines_read++;
|
884
944
|
} else if (states.IsQuotedCurrent()) {
|
885
945
|
// Unterminated quote
|
886
946
|
result.InvalidState(result);
|
887
947
|
} else {
|
888
|
-
lines_read++;
|
889
948
|
result.AddRow(result, previous_buffer_handle->actual_size);
|
949
|
+
lines_read++;
|
890
950
|
}
|
891
951
|
return false;
|
892
952
|
}
|
@@ -933,12 +993,15 @@ void StringValueScanner::SkipUntilNewLine() {
|
|
933
993
|
if (state_machine->options.dialect_options.state_machine_options.new_line.GetValue() ==
|
934
994
|
NewLineIdentifier::CARRY_ON) {
|
935
995
|
bool carriage_return = false;
|
996
|
+
bool not_carriage_return = false;
|
936
997
|
for (; iterator.pos.buffer_pos < cur_buffer_handle->actual_size; iterator.pos.buffer_pos++) {
|
937
998
|
if (buffer_handle_ptr[iterator.pos.buffer_pos] == '\r') {
|
938
999
|
carriage_return = true;
|
1000
|
+
} else if (buffer_handle_ptr[iterator.pos.buffer_pos] != '\n') {
|
1001
|
+
not_carriage_return = true;
|
939
1002
|
}
|
940
1003
|
if (buffer_handle_ptr[iterator.pos.buffer_pos] == '\n') {
|
941
|
-
if (carriage_return) {
|
1004
|
+
if (carriage_return || not_carriage_return) {
|
942
1005
|
iterator.pos.buffer_pos++;
|
943
1006
|
return;
|
944
1007
|
}
|
@@ -1010,8 +1073,9 @@ void StringValueScanner::SetStart() {
|
|
1010
1073
|
// When Null Padding, we assume we start from the correct new-line
|
1011
1074
|
return;
|
1012
1075
|
}
|
1013
|
-
|
1014
|
-
|
1076
|
+
|
1077
|
+
scan_finder = make_uniq<StringValueScanner>(
|
1078
|
+
0, buffer_manager, state_machine, make_shared<CSVErrorHandler>(true), csv_file_scan, false, iterator, 1);
|
1015
1079
|
auto &tuples = scan_finder->ParseChunk();
|
1016
1080
|
line_found = true;
|
1017
1081
|
if (tuples.number_of_rows != 1) {
|
@@ -1028,6 +1092,14 @@ void StringValueScanner::SetStart() {
|
|
1028
1092
|
return;
|
1029
1093
|
}
|
1030
1094
|
}
|
1095
|
+
if (iterator.pos.buffer_pos == cur_buffer_handle->actual_size) {
|
1096
|
+
// If things go terribly wrong, we never loop indefinetly.
|
1097
|
+
iterator.pos.buffer_idx = scan_finder->iterator.pos.buffer_idx;
|
1098
|
+
iterator.pos.buffer_pos = scan_finder->iterator.pos.buffer_pos;
|
1099
|
+
result.last_position = iterator.pos.buffer_pos;
|
1100
|
+
iterator.done = scan_finder->iterator.done;
|
1101
|
+
return;
|
1102
|
+
}
|
1031
1103
|
}
|
1032
1104
|
} while (!line_found);
|
1033
1105
|
iterator.pos.buffer_idx = scan_finder->result.pre_previous_line_start.buffer_idx;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/execution/operator/csv_scanner/
|
1
|
+
#include "duckdb/execution/operator/csv_scanner/csv_sniffer.hpp"
|
2
2
|
|
3
3
|
namespace duckdb {
|
4
4
|
|
@@ -94,10 +94,12 @@ SnifferResult CSVSniffer::SniffCSV(bool force_match) {
|
|
94
94
|
// 5. Type Replacement
|
95
95
|
ReplaceTypes();
|
96
96
|
if (!best_candidate->error_handler->errors.empty() && !options.ignore_errors) {
|
97
|
-
for (auto &
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
for (auto &error_vector : best_candidate->error_handler->errors) {
|
98
|
+
for (auto &error : error_vector.second) {
|
99
|
+
if (error.type == CSVErrorType::MAXIMUM_LINE_SIZE) {
|
100
|
+
// If it's a maximum line size error, we can do it now.
|
101
|
+
error_handler->Error(error);
|
102
|
+
}
|
101
103
|
}
|
102
104
|
}
|
103
105
|
auto error = CSVError::SniffingError(options.file_path);
|
@@ -134,6 +136,8 @@ SnifferResult CSVSniffer::SniffCSV(bool force_match) {
|
|
134
136
|
if (set_types[i] != detected_types[i] && !(set_types[i].IsNumeric() && detected_types[i].IsNumeric())) {
|
135
137
|
type_error += "Column at position: " + to_string(i) + " Set type: " + set_types[i].ToString() +
|
136
138
|
" Sniffed type: " + detected_types[i].ToString() + "\n";
|
139
|
+
detected_types[i] = set_types[i];
|
140
|
+
manually_set[i] = true;
|
137
141
|
match = false;
|
138
142
|
}
|
139
143
|
}
|
@@ -144,13 +148,14 @@ SnifferResult CSVSniffer::SniffCSV(bool force_match) {
|
|
144
148
|
if (!error.empty() && force_match) {
|
145
149
|
throw InvalidInputException(error);
|
146
150
|
}
|
147
|
-
|
151
|
+
options.was_type_manually_set = manually_set;
|
148
152
|
// We do not need to run type refinement, since the types have been given by the user
|
149
153
|
return SnifferResult({}, {});
|
150
154
|
}
|
151
155
|
if (!error.empty() && force_match) {
|
152
156
|
throw InvalidInputException(error);
|
153
157
|
}
|
158
|
+
options.was_type_manually_set = manually_set;
|
154
159
|
return SnifferResult(detected_types, names);
|
155
160
|
}
|
156
161
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "duckdb/execution/operator/csv_scanner/
|
1
|
+
#include "duckdb/execution/operator/csv_scanner/csv_sniffer.hpp"
|
2
2
|
#include "duckdb/main/client_data.hpp"
|
3
3
|
|
4
4
|
namespace duckdb {
|
@@ -89,6 +89,10 @@ void CSVSniffer::AnalyzeDialectCandidate(unique_ptr<ColumnCountScanner> scanner,
|
|
89
89
|
idx_t &best_consistent_rows, idx_t &prev_padding_count) {
|
90
90
|
// The sniffed_column_counts variable keeps track of the number of columns found for each row
|
91
91
|
auto &sniffed_column_counts = scanner->ParseChunk();
|
92
|
+
if (sniffed_column_counts.error) {
|
93
|
+
// This candidate has an error (i.e., over maximum line size or never unquoting quoted values)
|
94
|
+
return;
|
95
|
+
}
|
92
96
|
idx_t start_row = options.dialect_options.skip_rows.GetValue();
|
93
97
|
idx_t consistent_rows = 0;
|
94
98
|
idx_t num_cols = sniffed_column_counts.result_position == 0 ? 1 : sniffed_column_counts[start_row];
|
@@ -230,15 +234,14 @@ void CSVSniffer::RefineCandidates() {
|
|
230
234
|
// Only one candidate nothing to refine or all candidates already checked
|
231
235
|
return;
|
232
236
|
}
|
237
|
+
vector<unique_ptr<ColumnCountScanner>> successful_candidates;
|
233
238
|
for (auto &cur_candidate : candidates) {
|
234
239
|
for (idx_t i = 1; i <= options.sample_size_chunks; i++) {
|
235
240
|
bool finished_file = cur_candidate->FinishedFile();
|
236
241
|
if (finished_file || i == options.sample_size_chunks) {
|
237
|
-
// we finished the file or our chunk sample successfully
|
238
|
-
|
239
|
-
|
240
|
-
candidates.emplace_back(std::move(successful_candidate));
|
241
|
-
return;
|
242
|
+
// we finished the file or our chunk sample successfully
|
243
|
+
successful_candidates.push_back(std::move(cur_candidate));
|
244
|
+
break;
|
242
245
|
}
|
243
246
|
if (!RefineCandidateNextChunk(*cur_candidate) || cur_candidate->GetResult().error) {
|
244
247
|
// This candidate failed, move to the next one
|
@@ -246,7 +249,25 @@ void CSVSniffer::RefineCandidates() {
|
|
246
249
|
}
|
247
250
|
}
|
248
251
|
}
|
252
|
+
// If we have multiple candidates with quotes set, we will give the preference to ones
|
253
|
+
// that have actually quoted values, otherwise we will choose quotes = \0
|
249
254
|
candidates.clear();
|
255
|
+
if (!successful_candidates.empty()) {
|
256
|
+
unique_ptr<ColumnCountScanner> cc_best_candidate;
|
257
|
+
for (idx_t i = 0; i < successful_candidates.size(); i++) {
|
258
|
+
cc_best_candidate = std::move(successful_candidates[i]);
|
259
|
+
if (cc_best_candidate->state_machine->state_machine_options.quote != '\0' &&
|
260
|
+
cc_best_candidate->ever_quoted) {
|
261
|
+
candidates.clear();
|
262
|
+
candidates.push_back(std::move(cc_best_candidate));
|
263
|
+
return;
|
264
|
+
}
|
265
|
+
if (cc_best_candidate->state_machine->state_machine_options.quote == '\0') {
|
266
|
+
candidates.push_back(std::move(cc_best_candidate));
|
267
|
+
}
|
268
|
+
}
|
269
|
+
return;
|
270
|
+
}
|
250
271
|
return;
|
251
272
|
}
|
252
273
|
|