duckdb 0.10.1-dev6.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/NodeJS.yml +11 -18
- 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
@@ -7,11 +7,42 @@
|
|
7
7
|
#include "duckdb/common/types/uuid.hpp"
|
8
8
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
9
9
|
#include "duckdb/storage/storage_lock.hpp"
|
10
|
-
|
10
|
+
#include "duckdb/common/value_operations/value_operations.hpp"
|
11
11
|
#include <algorithm>
|
12
12
|
|
13
13
|
namespace duckdb {
|
14
14
|
|
15
|
+
struct PartitionWriteInfo {
|
16
|
+
unique_ptr<GlobalFunctionData> global_state;
|
17
|
+
};
|
18
|
+
|
19
|
+
struct VectorOfValuesHashFunction {
|
20
|
+
uint64_t operator()(const vector<Value> &values) const {
|
21
|
+
hash_t result = 0;
|
22
|
+
for (auto &val : values) {
|
23
|
+
result ^= val.Hash();
|
24
|
+
}
|
25
|
+
return result;
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
struct VectorOfValuesEquality {
|
30
|
+
bool operator()(const vector<Value> &a, const vector<Value> &b) const {
|
31
|
+
if (a.size() != b.size()) {
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
for (idx_t i = 0; i < a.size(); i++) {
|
35
|
+
if (ValueOperations::DistinctFrom(a[i], b[i])) {
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return true;
|
40
|
+
}
|
41
|
+
};
|
42
|
+
|
43
|
+
template <class T>
|
44
|
+
using vector_of_value_map_t = unordered_map<vector<Value>, T, VectorOfValuesHashFunction, VectorOfValuesEquality>;
|
45
|
+
|
15
46
|
class CopyToFunctionGlobalState : public GlobalSinkState {
|
16
47
|
public:
|
17
48
|
explicit CopyToFunctionGlobalState(unique_ptr<GlobalFunctionData> global_state)
|
@@ -25,8 +56,109 @@ public:
|
|
25
56
|
|
26
57
|
//! shared state for HivePartitionedColumnData
|
27
58
|
shared_ptr<GlobalHivePartitionState> partition_state;
|
59
|
+
|
60
|
+
static void CreateDir(const string &dir_path, FileSystem &fs) {
|
61
|
+
if (!fs.DirectoryExists(dir_path)) {
|
62
|
+
fs.CreateDirectory(dir_path);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
static void CreateDirectories(const vector<idx_t> &cols, const vector<string> &names, const vector<Value> &values,
|
67
|
+
string path, FileSystem &fs) {
|
68
|
+
CreateDir(path, fs);
|
69
|
+
|
70
|
+
for (idx_t i = 0; i < cols.size(); i++) {
|
71
|
+
const auto &partition_col_name = names[cols[i]];
|
72
|
+
const auto &partition_value = values[i];
|
73
|
+
string p_dir = partition_col_name + "=" + partition_value.ToString();
|
74
|
+
path = fs.JoinPath(path, p_dir);
|
75
|
+
CreateDir(path, fs);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
void CreatePartitionDirectories(ClientContext &context, const PhysicalCopyToFile &op) {
|
80
|
+
auto &fs = FileSystem::GetFileSystem(context);
|
81
|
+
|
82
|
+
auto trimmed_path = op.GetTrimmedPath(context);
|
83
|
+
|
84
|
+
auto l = lock.GetExclusiveLock();
|
85
|
+
lock_guard<mutex> global_lock_on_partition_state(partition_state->lock);
|
86
|
+
const auto &global_partitions = partition_state->partitions;
|
87
|
+
// global_partitions have partitions added only at the back, so it's fine to only traverse the last part
|
88
|
+
|
89
|
+
for (idx_t i = created_directories; i < global_partitions.size(); i++) {
|
90
|
+
CreateDirectories(op.partition_columns, op.names, global_partitions[i]->first.values, trimmed_path, fs);
|
91
|
+
}
|
92
|
+
created_directories = global_partitions.size();
|
93
|
+
}
|
94
|
+
|
95
|
+
static string GetDirectory(const vector<idx_t> &cols, const vector<string> &names, const vector<Value> &values,
|
96
|
+
string path, FileSystem &fs) {
|
97
|
+
for (idx_t i = 0; i < cols.size(); i++) {
|
98
|
+
const auto &partition_col_name = names[cols[i]];
|
99
|
+
const auto &partition_value = values[i];
|
100
|
+
string p_dir = partition_col_name + "=" + partition_value.ToString();
|
101
|
+
path = fs.JoinPath(path, p_dir);
|
102
|
+
}
|
103
|
+
return path;
|
104
|
+
}
|
105
|
+
|
106
|
+
void FinalizePartition(ClientContext &context, const PhysicalCopyToFile &op, PartitionWriteInfo &info) {
|
107
|
+
if (!info.global_state) {
|
108
|
+
// already finalized
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
// finalize the partition
|
112
|
+
op.function.copy_to_finalize(context, *op.bind_data, *info.global_state);
|
113
|
+
info.global_state.reset();
|
114
|
+
}
|
115
|
+
|
116
|
+
void FinalizePartitions(ClientContext &context, const PhysicalCopyToFile &op) {
|
117
|
+
// finalize any remaining partitions
|
118
|
+
for (auto &entry : active_partitioned_writes) {
|
119
|
+
FinalizePartition(context, op, *entry.second);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
PartitionWriteInfo &GetPartitionWriteInfo(ExecutionContext &context, const PhysicalCopyToFile &op,
|
124
|
+
const vector<Value> &values) {
|
125
|
+
auto l = lock.GetExclusiveLock();
|
126
|
+
// check if we have already started writing this partition
|
127
|
+
auto entry = active_partitioned_writes.find(values);
|
128
|
+
if (entry != active_partitioned_writes.end()) {
|
129
|
+
// we have - continue writing in this partition
|
130
|
+
return *entry->second;
|
131
|
+
}
|
132
|
+
auto &fs = FileSystem::GetFileSystem(context.client);
|
133
|
+
// Create a writer for the current file
|
134
|
+
auto trimmed_path = op.GetTrimmedPath(context.client);
|
135
|
+
string hive_path = GetDirectory(op.partition_columns, op.names, values, trimmed_path, fs);
|
136
|
+
string full_path(op.filename_pattern.CreateFilename(fs, hive_path, op.file_extension, 0));
|
137
|
+
if (fs.FileExists(full_path) && !op.overwrite_or_ignore) {
|
138
|
+
throw IOException("failed to create %s, file exists! Enable OVERWRITE_OR_IGNORE option to force writing",
|
139
|
+
full_path);
|
140
|
+
}
|
141
|
+
// initialize writes
|
142
|
+
auto info = make_uniq<PartitionWriteInfo>();
|
143
|
+
info->global_state = op.function.copy_to_initialize_global(context.client, *op.bind_data, full_path);
|
144
|
+
auto &result = *info;
|
145
|
+
// store in active write map
|
146
|
+
active_partitioned_writes.insert(make_pair(values, std::move(info)));
|
147
|
+
return result;
|
148
|
+
}
|
149
|
+
|
150
|
+
private:
|
151
|
+
//! The active writes per partition (for partitioned write)
|
152
|
+
vector_of_value_map_t<unique_ptr<PartitionWriteInfo>> active_partitioned_writes;
|
28
153
|
};
|
29
154
|
|
155
|
+
string PhysicalCopyToFile::GetTrimmedPath(ClientContext &context) const {
|
156
|
+
auto &fs = FileSystem::GetFileSystem(context);
|
157
|
+
string trimmed_path = file_path;
|
158
|
+
StringUtil::RTrim(trimmed_path, fs.PathSeparator(trimmed_path));
|
159
|
+
return trimmed_path;
|
160
|
+
}
|
161
|
+
|
30
162
|
class CopyToFunctionLocalState : public LocalSinkState {
|
31
163
|
public:
|
32
164
|
explicit CopyToFunctionLocalState(unique_ptr<LocalFunctionData> local_state)
|
@@ -40,6 +172,63 @@ public:
|
|
40
172
|
unique_ptr<PartitionedColumnDataAppendState> part_buffer_append_state;
|
41
173
|
|
42
174
|
idx_t writer_offset;
|
175
|
+
idx_t append_count = 0;
|
176
|
+
|
177
|
+
void InitializeAppendState(ClientContext &context, const PhysicalCopyToFile &op,
|
178
|
+
CopyToFunctionGlobalState &gstate) {
|
179
|
+
part_buffer = make_uniq<HivePartitionedColumnData>(context, op.expected_types, op.partition_columns,
|
180
|
+
gstate.partition_state);
|
181
|
+
part_buffer_append_state = make_uniq<PartitionedColumnDataAppendState>();
|
182
|
+
part_buffer->InitializeAppendState(*part_buffer_append_state);
|
183
|
+
append_count = 0;
|
184
|
+
}
|
185
|
+
|
186
|
+
void AppendToPartition(ExecutionContext &context, const PhysicalCopyToFile &op, CopyToFunctionGlobalState &g,
|
187
|
+
DataChunk &chunk) {
|
188
|
+
if (!part_buffer) {
|
189
|
+
// re-initialize the append
|
190
|
+
InitializeAppendState(context.client, op, g);
|
191
|
+
}
|
192
|
+
part_buffer->Append(*part_buffer_append_state, chunk);
|
193
|
+
append_count += chunk.size();
|
194
|
+
if (append_count >= ClientConfig::GetConfig(context.client).partitioned_write_flush_threshold) {
|
195
|
+
// flush all cached partitions
|
196
|
+
FlushPartitions(context, op, g);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
void ResetAppendState() {
|
201
|
+
part_buffer_append_state.reset();
|
202
|
+
part_buffer.reset();
|
203
|
+
append_count = 0;
|
204
|
+
}
|
205
|
+
|
206
|
+
void FlushPartitions(ExecutionContext &context, const PhysicalCopyToFile &op, CopyToFunctionGlobalState &g) {
|
207
|
+
if (!part_buffer) {
|
208
|
+
return;
|
209
|
+
}
|
210
|
+
part_buffer->FlushAppendState(*part_buffer_append_state);
|
211
|
+
auto &partitions = part_buffer->GetPartitions();
|
212
|
+
auto partition_key_map = part_buffer->GetReverseMap();
|
213
|
+
|
214
|
+
// ensure all partition directories are created before we start writing
|
215
|
+
g.CreatePartitionDirectories(context.client, op);
|
216
|
+
|
217
|
+
for (idx_t i = 0; i < partitions.size(); i++) {
|
218
|
+
// get the partition write info for this buffer
|
219
|
+
auto &info = g.GetPartitionWriteInfo(context, op, partition_key_map[i]->values);
|
220
|
+
|
221
|
+
auto local_copy_state = op.function.copy_to_initialize_local(context, *op.bind_data);
|
222
|
+
// push the chunks into the write state
|
223
|
+
for (auto &chunk : partitions[i]->Chunks()) {
|
224
|
+
op.function.copy_to_sink(context, *op.bind_data, *info.global_state, *local_copy_state, chunk);
|
225
|
+
}
|
226
|
+
op.function.copy_to_combine(context, *op.bind_data, *info.global_state, *local_copy_state);
|
227
|
+
local_copy_state.reset();
|
228
|
+
partitions[i].reset();
|
229
|
+
}
|
230
|
+
ResetAppendState();
|
231
|
+
}
|
43
232
|
};
|
44
233
|
|
45
234
|
unique_ptr<GlobalFunctionData> PhysicalCopyToFile::CreateFileState(ClientContext &context,
|
@@ -60,10 +249,7 @@ unique_ptr<LocalSinkState> PhysicalCopyToFile::GetLocalSinkState(ExecutionContex
|
|
60
249
|
|
61
250
|
auto state = make_uniq<CopyToFunctionLocalState>(nullptr);
|
62
251
|
state->writer_offset = g.last_file_offset++;
|
63
|
-
state->
|
64
|
-
make_uniq<HivePartitionedColumnData>(context.client, expected_types, partition_columns, g.partition_state);
|
65
|
-
state->part_buffer_append_state = make_uniq<PartitionedColumnDataAppendState>();
|
66
|
-
state->part_buffer->InitializeAppendState(*state->part_buffer_append_state);
|
252
|
+
state->InitializeAppendState(context.client, *this, g);
|
67
253
|
return std::move(state);
|
68
254
|
}
|
69
255
|
auto res = make_uniq<CopyToFunctionLocalState>(function.copy_to_initialize_local(context, *bind_data));
|
@@ -139,7 +325,7 @@ SinkResultType PhysicalCopyToFile::Sink(ExecutionContext &context, DataChunk &ch
|
|
139
325
|
auto &l = input.local_state.Cast<CopyToFunctionLocalState>();
|
140
326
|
|
141
327
|
if (partition_output) {
|
142
|
-
l.
|
328
|
+
l.AppendToPartition(context, *this, g, chunk);
|
143
329
|
return SinkResultType::NEED_MORE_INPUT;
|
144
330
|
}
|
145
331
|
|
@@ -179,79 +365,13 @@ SinkResultType PhysicalCopyToFile::Sink(ExecutionContext &context, DataChunk &ch
|
|
179
365
|
return SinkResultType::NEED_MORE_INPUT;
|
180
366
|
}
|
181
367
|
|
182
|
-
static void CreateDir(const string &dir_path, FileSystem &fs) {
|
183
|
-
if (!fs.DirectoryExists(dir_path)) {
|
184
|
-
fs.CreateDirectory(dir_path);
|
185
|
-
}
|
186
|
-
}
|
187
|
-
|
188
|
-
static void CreateDirectories(const vector<idx_t> &cols, const vector<string> &names, const vector<Value> &values,
|
189
|
-
string path, FileSystem &fs) {
|
190
|
-
CreateDir(path, fs);
|
191
|
-
|
192
|
-
for (idx_t i = 0; i < cols.size(); i++) {
|
193
|
-
const auto &partition_col_name = names[cols[i]];
|
194
|
-
const auto &partition_value = values[i];
|
195
|
-
string p_dir = partition_col_name + "=" + partition_value.ToString();
|
196
|
-
path = fs.JoinPath(path, p_dir);
|
197
|
-
CreateDir(path, fs);
|
198
|
-
}
|
199
|
-
}
|
200
|
-
|
201
|
-
static string GetDirectory(const vector<idx_t> &cols, const vector<string> &names, const vector<Value> &values,
|
202
|
-
string path, FileSystem &fs) {
|
203
|
-
for (idx_t i = 0; i < cols.size(); i++) {
|
204
|
-
const auto &partition_col_name = names[cols[i]];
|
205
|
-
const auto &partition_value = values[i];
|
206
|
-
string p_dir = partition_col_name + "=" + partition_value.ToString();
|
207
|
-
path = fs.JoinPath(path, p_dir);
|
208
|
-
}
|
209
|
-
return path;
|
210
|
-
}
|
211
|
-
|
212
368
|
SinkCombineResultType PhysicalCopyToFile::Combine(ExecutionContext &context, OperatorSinkCombineInput &input) const {
|
213
369
|
auto &g = input.global_state.Cast<CopyToFunctionGlobalState>();
|
214
370
|
auto &l = input.local_state.Cast<CopyToFunctionLocalState>();
|
215
371
|
|
216
372
|
if (partition_output) {
|
217
|
-
|
218
|
-
l.
|
219
|
-
auto &partitions = l.part_buffer->GetPartitions();
|
220
|
-
auto partition_key_map = l.part_buffer->GetReverseMap();
|
221
|
-
|
222
|
-
string trimmed_path = file_path;
|
223
|
-
StringUtil::RTrim(trimmed_path, fs.PathSeparator(trimmed_path));
|
224
|
-
{
|
225
|
-
// create directories
|
226
|
-
auto lock = g.lock.GetExclusiveLock();
|
227
|
-
lock_guard<mutex> global_lock_on_partition_state(g.partition_state->lock);
|
228
|
-
const auto &global_partitions = g.partition_state->partitions;
|
229
|
-
// global_partitions have partitions added only at the back, so it's fine to only traverse the last part
|
230
|
-
|
231
|
-
for (idx_t i = g.created_directories; i < global_partitions.size(); i++) {
|
232
|
-
CreateDirectories(partition_columns, names, global_partitions[i]->first.values, trimmed_path, fs);
|
233
|
-
}
|
234
|
-
g.created_directories = global_partitions.size();
|
235
|
-
}
|
236
|
-
|
237
|
-
for (idx_t i = 0; i < partitions.size(); i++) {
|
238
|
-
string hive_path = GetDirectory(partition_columns, names, partition_key_map[i]->values, trimmed_path, fs);
|
239
|
-
string full_path(filename_pattern.CreateFilename(fs, hive_path, file_extension, l.writer_offset));
|
240
|
-
if (fs.FileExists(full_path) && !overwrite_or_ignore) {
|
241
|
-
throw IOException(
|
242
|
-
"failed to create %s, file exists! Enable OVERWRITE_OR_IGNORE option to force writing", full_path);
|
243
|
-
}
|
244
|
-
// Create a writer for the current file
|
245
|
-
auto fun_data_global = function.copy_to_initialize_global(context.client, *bind_data, full_path);
|
246
|
-
auto fun_data_local = function.copy_to_initialize_local(context, *bind_data);
|
247
|
-
|
248
|
-
for (auto &chunk : partitions[i]->Chunks()) {
|
249
|
-
function.copy_to_sink(context, *bind_data, *fun_data_global, *fun_data_local, chunk);
|
250
|
-
}
|
251
|
-
|
252
|
-
function.copy_to_combine(context, *bind_data, *fun_data_global, *fun_data_local);
|
253
|
-
function.copy_to_finalize(context.client, *bind_data, *fun_data_global);
|
254
|
-
}
|
373
|
+
// flush all remaining partitions
|
374
|
+
l.FlushPartitions(context, *this, g);
|
255
375
|
} else if (function.copy_to_combine) {
|
256
376
|
if (per_thread_output) {
|
257
377
|
// For PER_THREAD_OUTPUT, we can combine/finalize immediately
|
@@ -272,7 +392,12 @@ SinkCombineResultType PhysicalCopyToFile::Combine(ExecutionContext &context, Ope
|
|
272
392
|
SinkFinalizeType PhysicalCopyToFile::Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
273
393
|
OperatorSinkFinalizeInput &input) const {
|
274
394
|
auto &gstate = input.global_state.Cast<CopyToFunctionGlobalState>();
|
275
|
-
if (
|
395
|
+
if (partition_output) {
|
396
|
+
// finalize any outstanding partitions
|
397
|
+
gstate.FinalizePartitions(context, *this);
|
398
|
+
return SinkFinalizeType::READY;
|
399
|
+
}
|
400
|
+
if (per_thread_output) {
|
276
401
|
// already happened in combine
|
277
402
|
return SinkFinalizeType::READY;
|
278
403
|
}
|
@@ -47,6 +47,7 @@ SinkResultType PhysicalDelete::Sink(ExecutionContext &context, DataChunk &chunk,
|
|
47
47
|
|
48
48
|
lock_guard<mutex> delete_guard(gstate.delete_lock);
|
49
49
|
if (return_chunk) {
|
50
|
+
ustate.delete_chunk.Reset();
|
50
51
|
row_identifiers.Flatten(chunk.size());
|
51
52
|
table.Fetch(transaction, ustate.delete_chunk, column_ids, row_identifiers, chunk.size(), cfs);
|
52
53
|
gstate.return_collection.Append(ustate.delete_chunk);
|
@@ -162,6 +162,7 @@ void PhysicalInsert::ResolveDefaults(const TableCatalogEntry &table, DataChunk &
|
|
162
162
|
}
|
163
163
|
|
164
164
|
bool AllConflictsMeetCondition(DataChunk &result) {
|
165
|
+
result.Flatten();
|
165
166
|
auto data = FlatVector::GetData<bool>(result.data[0]);
|
166
167
|
for (idx_t i = 0; i < result.size(); i++) {
|
167
168
|
if (!data[i]) {
|
@@ -236,6 +237,7 @@ static void CreateUpdateChunk(ExecutionContext &context, DataChunk &chunk, Table
|
|
236
237
|
ExpressionExecutor where_executor(context.client, *do_update_condition);
|
237
238
|
where_executor.Execute(chunk, do_update_filter_result);
|
238
239
|
do_update_filter_result.SetCardinality(chunk.size());
|
240
|
+
do_update_filter_result.Flatten();
|
239
241
|
|
240
242
|
ManagedSelection selection(chunk.size());
|
241
243
|
|
@@ -431,14 +433,13 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, DataChunk &chunk,
|
|
431
433
|
gstate.initialized = true;
|
432
434
|
}
|
433
435
|
|
436
|
+
if (return_chunk) {
|
437
|
+
gstate.return_collection.Append(lstate.insert_chunk);
|
438
|
+
}
|
434
439
|
idx_t updated_tuples = OnConflictHandling(table, context, lstate);
|
435
440
|
gstate.insert_count += lstate.insert_chunk.size();
|
436
441
|
gstate.insert_count += updated_tuples;
|
437
442
|
storage.LocalAppend(gstate.append_state, table, context.client, lstate.insert_chunk, true);
|
438
|
-
|
439
|
-
if (return_chunk) {
|
440
|
-
gstate.return_collection.Append(lstate.insert_chunk);
|
441
|
-
}
|
442
443
|
} else {
|
443
444
|
D_ASSERT(!return_chunk);
|
444
445
|
// parallel append
|
@@ -495,8 +496,8 @@ SinkCombineResultType PhysicalInsert::Combine(ExecutionContext &context, Operato
|
|
495
496
|
storage.FinalizeLocalAppend(gstate.append_state);
|
496
497
|
} else {
|
497
498
|
// we have written rows to disk optimistically - merge directly into the transaction-local storage
|
498
|
-
gstate.table.GetStorage().FinalizeOptimisticWriter(context.client, *lstate.writer);
|
499
499
|
gstate.table.GetStorage().LocalMerge(context.client, *lstate.local_collection);
|
500
|
+
gstate.table.GetStorage().FinalizeOptimisticWriter(context.client, *lstate.writer);
|
500
501
|
}
|
501
502
|
|
502
503
|
return SinkCombineResultType::FINISHED;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// Unity Build generated by CMake
|
2
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/csv_rejects_table.cpp>
|
3
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_fixed_batch_copy.cpp>
|
4
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp>
|
5
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp>
|
6
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp>
|
7
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_delete.cpp>
|
8
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_export.cpp>
|
9
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_insert.cpp>
|
10
|
+
#include </Users/carlo/duckdb/src/execution/operator/persistent/physical_update.cpp>
|
@@ -33,6 +33,7 @@ PhysicalPivot::PhysicalPivot(vector<LogicalType> types_p, unique_ptr<PhysicalOpe
|
|
33
33
|
OperatorResultType PhysicalPivot::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk,
|
34
34
|
GlobalOperatorState &gstate, OperatorState &state) const {
|
35
35
|
// copy the groups as-is
|
36
|
+
input.Flatten();
|
36
37
|
for (idx_t i = 0; i < bound_pivot.group_count; i++) {
|
37
38
|
chunk.data[i].Reference(input.data[i]);
|
38
39
|
}
|
@@ -68,10 +69,10 @@ OperatorResultType PhysicalPivot::Execute(ExecutionContext &context, DataChunk &
|
|
68
69
|
for (idx_t aggr = 0; aggr < empty_aggregates.size(); aggr++) {
|
69
70
|
auto pivot_value_lists = FlatVector::GetData<list_entry_t>(input.data[bound_pivot.group_count + aggr]);
|
70
71
|
auto &pivot_value_child = ListVector::GetEntry(input.data[bound_pivot.group_count + aggr]);
|
71
|
-
if (list.
|
72
|
+
if (list.length != pivot_value_lists[r].length) {
|
72
73
|
throw InternalException("Pivot - unaligned lists between values and columns!?");
|
73
74
|
}
|
74
|
-
chunk.data[column_idx + aggr].SetValue(r, pivot_value_child.GetValue(
|
75
|
+
chunk.data[column_idx + aggr].SetValue(r, pivot_value_child.GetValue(pivot_value_lists[r].offset + l));
|
75
76
|
}
|
76
77
|
}
|
77
78
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
// Unity Build generated by CMake
|
2
|
+
#include </Users/carlo/duckdb/src/execution/operator/projection/physical_projection.cpp>
|
3
|
+
#include </Users/carlo/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp>
|
4
|
+
#include </Users/carlo/duckdb/src/execution/operator/projection/physical_pivot.cpp>
|
5
|
+
#include </Users/carlo/duckdb/src/execution/operator/projection/physical_unnest.cpp>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// Unity Build generated by CMake
|
2
|
+
#include </Users/carlo/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp>
|
3
|
+
#include </Users/carlo/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp>
|
4
|
+
#include </Users/carlo/duckdb/src/execution/operator/scan/physical_empty_result.cpp>
|
5
|
+
#include </Users/carlo/duckdb/src/execution/operator/scan/physical_expression_scan.cpp>
|
6
|
+
#include </Users/carlo/duckdb/src/execution/operator/scan/physical_positional_scan.cpp>
|
7
|
+
#include </Users/carlo/duckdb/src/execution/operator/scan/physical_table_scan.cpp>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// Unity Build generated by CMake
|
2
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_alter.cpp>
|
3
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_attach.cpp>
|
4
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_art_index.cpp>
|
5
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_schema.cpp>
|
6
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_type.cpp>
|
7
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_sequence.cpp>
|
8
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_table.cpp>
|
9
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_view.cpp>
|
10
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_create_function.cpp>
|
11
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_detach.cpp>
|
12
|
+
#include </Users/carlo/duckdb/src/execution/operator/schema/physical_drop.cpp>
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
5
|
#include "duckdb/execution/aggregate_hashtable.hpp"
|
6
6
|
#include "duckdb/execution/executor.hpp"
|
7
|
+
#include "duckdb/execution/operator/scan/physical_column_data_scan.hpp"
|
7
8
|
#include "duckdb/parallel/event.hpp"
|
8
9
|
#include "duckdb/parallel/meta_pipeline.hpp"
|
9
10
|
#include "duckdb/parallel/pipeline.hpp"
|
@@ -173,6 +174,16 @@ void PhysicalRecursiveCTE::ExecuteRecursivePipelines(ExecutionContext &context)
|
|
173
174
|
//===--------------------------------------------------------------------===//
|
174
175
|
// Pipeline Construction
|
175
176
|
//===--------------------------------------------------------------------===//
|
177
|
+
|
178
|
+
static void GatherColumnDataScans(const PhysicalOperator &op, vector<const_reference<PhysicalOperator>> &delim_scans) {
|
179
|
+
if (op.type == PhysicalOperatorType::DELIM_SCAN || op.type == PhysicalOperatorType::CTE_SCAN) {
|
180
|
+
delim_scans.push_back(op);
|
181
|
+
}
|
182
|
+
for (auto &child : op.children) {
|
183
|
+
GatherColumnDataScans(*child, delim_scans);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
176
187
|
void PhysicalRecursiveCTE::BuildPipelines(Pipeline ¤t, MetaPipeline &meta_pipeline) {
|
177
188
|
op_state.reset();
|
178
189
|
sink_state.reset();
|
@@ -192,6 +203,20 @@ void PhysicalRecursiveCTE::BuildPipelines(Pipeline ¤t, MetaPipeline &meta_
|
|
192
203
|
recursive_meta_pipeline = make_shared<MetaPipeline>(executor, state, this);
|
193
204
|
recursive_meta_pipeline->SetRecursiveCTE();
|
194
205
|
recursive_meta_pipeline->Build(*children[1]);
|
206
|
+
|
207
|
+
vector<const_reference<PhysicalOperator>> ops;
|
208
|
+
GatherColumnDataScans(*children[1], ops);
|
209
|
+
|
210
|
+
for (auto op : ops) {
|
211
|
+
auto entry = state.cte_dependencies.find(op);
|
212
|
+
if (entry == state.cte_dependencies.end()) {
|
213
|
+
continue;
|
214
|
+
}
|
215
|
+
// this chunk scan introduces a dependency to the current pipeline
|
216
|
+
// namely a dependency on the CTE pipeline to finish
|
217
|
+
auto cte_dependency = entry->second.get().shared_from_this();
|
218
|
+
current.AddDependency(cte_dependency);
|
219
|
+
}
|
195
220
|
}
|
196
221
|
|
197
222
|
vector<const_reference<PhysicalOperator>> PhysicalRecursiveCTE::GetSources() const {
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// Unity Build generated by CMake
|
2
|
+
#include </Users/carlo/duckdb/src/execution/operator/set/physical_union.cpp>
|
3
|
+
#include </Users/carlo/duckdb/src/execution/operator/set/physical_recursive_cte.cpp>
|
4
|
+
#include </Users/carlo/duckdb/src/execution/operator/set/physical_cte.cpp>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#include "duckdb/execution/perfect_aggregate_hashtable.hpp"
|
2
|
-
|
2
|
+
#include "duckdb/common/numeric_utils.hpp"
|
3
3
|
#include "duckdb/common/row_operations/row_operations.hpp"
|
4
4
|
#include "duckdb/execution/expression_executor.hpp"
|
5
5
|
|
@@ -199,13 +199,13 @@ static void ReconstructGroupVectorTemplated(uint32_t group_values[], Value &min,
|
|
199
199
|
auto min_data = min.GetValueUnsafe<T>();
|
200
200
|
for (idx_t i = 0; i < entry_count; i++) {
|
201
201
|
// extract the value of this group from the total group index
|
202
|
-
auto group_index = (group_values[i] >> shift) & mask;
|
202
|
+
auto group_index = UnsafeNumericCast<int32_t>((group_values[i] >> shift) & mask);
|
203
203
|
if (group_index == 0) {
|
204
204
|
// if it is 0, the value is NULL
|
205
205
|
validity_mask.SetInvalid(i);
|
206
206
|
} else {
|
207
207
|
// otherwise we add the value (minus 1) to the min value
|
208
|
-
data[i] = min_data + group_index - 1;
|
208
|
+
data[i] = UnsafeNumericCast<T>(min_data + group_index - 1);
|
209
209
|
}
|
210
210
|
}
|
211
211
|
}
|
@@ -254,7 +254,7 @@ void PerfectAggregateHashTable::Scan(idx_t &scan_position, DataChunk &result) {
|
|
254
254
|
if (group_is_set[scan_position]) {
|
255
255
|
// this group is set: add it to the set of groups to extract
|
256
256
|
data_pointers[entry_count] = data + tuple_size * scan_position;
|
257
|
-
group_values[entry_count] = scan_position;
|
257
|
+
group_values[entry_count] = NumericCast<uint32_t>(scan_position);
|
258
258
|
entry_count++;
|
259
259
|
if (entry_count == STANDARD_VECTOR_SIZE) {
|
260
260
|
scan_position++;
|
@@ -20,7 +20,7 @@ static uint32_t RequiredBitsForValue(uint32_t n) {
|
|
20
20
|
n >>= 1;
|
21
21
|
required_bits++;
|
22
22
|
}
|
23
|
-
return required_bits;
|
23
|
+
return UnsafeNumericCast<uint32_t>(required_bits);
|
24
24
|
}
|
25
25
|
|
26
26
|
template <class T>
|
@@ -130,7 +130,7 @@ static bool CanUsePerfectHashAggregate(ClientContext &context, LogicalAggregate
|
|
130
130
|
|
131
131
|
range += 2;
|
132
132
|
// figure out how many bits we need
|
133
|
-
idx_t required_bits = RequiredBitsForValue(range);
|
133
|
+
idx_t required_bits = RequiredBitsForValue(UnsafeNumericCast<uint32_t>(range));
|
134
134
|
bits_per_group.push_back(required_bits);
|
135
135
|
perfect_hash_bits += required_bits;
|
136
136
|
// check if we have exceeded the bits for the hash
|
@@ -82,7 +82,7 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
|
|
82
82
|
}
|
83
83
|
|
84
84
|
// and when the build range is smaller than the threshold
|
85
|
-
auto &stats_build = *op.join_stats[
|
85
|
+
auto &stats_build = *op.join_stats[1].get(); // rhs stats
|
86
86
|
if (!NumericStats::HasMinMax(stats_build)) {
|
87
87
|
return;
|
88
88
|
}
|
@@ -97,7 +97,7 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
|
|
97
97
|
}
|
98
98
|
|
99
99
|
// Fill join_stats for invisible join
|
100
|
-
auto &stats_probe = *op.join_stats[
|
100
|
+
auto &stats_probe = *op.join_stats[0].get(); // lhs stats
|
101
101
|
if (!NumericStats::HasMinMax(stats_probe)) {
|
102
102
|
return;
|
103
103
|
}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
#include "duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp"
|
2
1
|
#include "duckdb/execution/operator/persistent/physical_copy_to_file.hpp"
|
3
|
-
#include "duckdb/execution/operator/persistent/
|
2
|
+
#include "duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp"
|
4
3
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
5
4
|
#include "duckdb/planner/operator/logical_copy_to_file.hpp"
|
6
5
|
|
@@ -32,21 +31,12 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCopyToFile
|
|
32
31
|
throw InternalException("BATCH_COPY_TO_FILE can only be used if batch indexes are supported");
|
33
32
|
}
|
34
33
|
// batched copy to file
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
return std::move(copy);
|
42
|
-
} else {
|
43
|
-
auto copy = make_uniq<PhysicalBatchCopyToFile>(op.types, op.function, std::move(op.bind_data),
|
44
|
-
op.estimated_cardinality);
|
45
|
-
copy->file_path = op.file_path;
|
46
|
-
copy->use_tmp_file = op.use_tmp_file;
|
47
|
-
copy->children.push_back(std::move(plan));
|
48
|
-
return std::move(copy);
|
49
|
-
}
|
34
|
+
auto copy = make_uniq<PhysicalBatchCopyToFile>(op.types, op.function, std::move(op.bind_data),
|
35
|
+
op.estimated_cardinality);
|
36
|
+
copy->file_path = op.file_path;
|
37
|
+
copy->use_tmp_file = op.use_tmp_file;
|
38
|
+
copy->children.push_back(std::move(plan));
|
39
|
+
return std::move(copy);
|
50
40
|
}
|
51
41
|
// COPY from select statement to file
|
52
42
|
auto copy = make_uniq<PhysicalCopyToFile>(op.types, op.function, std::move(op.bind_data), op.estimated_cardinality);
|
@@ -6,6 +6,7 @@
|
|
6
6
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
7
7
|
#include "duckdb/planner/operator/logical_distinct.hpp"
|
8
8
|
#include "duckdb/function/function_binder.hpp"
|
9
|
+
#include "duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp"
|
9
10
|
|
10
11
|
namespace duckdb {
|
11
12
|
|
@@ -61,6 +62,15 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalDistinct &
|
|
61
62
|
auto first_aggregate = function_binder.BindAggregateFunction(
|
62
63
|
FirstFun::GetFunction(logical_type), std::move(first_children), nullptr, AggregateType::NON_DISTINCT);
|
63
64
|
first_aggregate->order_bys = op.order_by ? op.order_by->Copy() : nullptr;
|
65
|
+
|
66
|
+
if (ClientConfig::GetConfig(context).enable_optimizer) {
|
67
|
+
bool changes_made = false;
|
68
|
+
auto new_expr = OrderedAggregateOptimizer::Apply(context, *first_aggregate, groups, changes_made);
|
69
|
+
if (new_expr) {
|
70
|
+
D_ASSERT(new_expr->type == ExpressionType::BOUND_AGGREGATE);
|
71
|
+
first_aggregate = unique_ptr_cast<Expression, BoundAggregateExpression>(std::move(new_expr));
|
72
|
+
}
|
73
|
+
}
|
64
74
|
// add the projection
|
65
75
|
projections.push_back(make_uniq<BoundReferenceExpression>(logical_type, group_count + aggregates.size()));
|
66
76
|
// push it to the list of aggregates
|
@@ -14,11 +14,18 @@ static OrderPreservationType OrderPreservationRecursive(PhysicalOperator &op) {
|
|
14
14
|
if (op.IsSource()) {
|
15
15
|
return op.SourceOrder();
|
16
16
|
}
|
17
|
+
|
18
|
+
idx_t child_idx = 0;
|
17
19
|
for (auto &child : op.children) {
|
20
|
+
// Do not take the materialization phase of physical CTEs into account
|
21
|
+
if (op.type == PhysicalOperatorType::CTE && child_idx == 0) {
|
22
|
+
continue;
|
23
|
+
}
|
18
24
|
auto child_preservation = OrderPreservationRecursive(*child);
|
19
25
|
if (child_preservation != OrderPreservationType::INSERTION_ORDER) {
|
20
26
|
return child_preservation;
|
21
27
|
}
|
28
|
+
child_idx++;
|
22
29
|
}
|
23
30
|
return OrderPreservationType::INSERTION_ORDER;
|
24
31
|
}
|