duckdb 0.7.2-dev2820.0 → 0.7.2-dev2995.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +1 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +55 -1
- package/src/duckdb/extension/parquet/parquet-extension.cpp +5 -4
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +18 -7
- package/src/duckdb/src/catalog/default/default_functions.cpp +2 -0
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +3 -3
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +2 -2
- package/src/duckdb/src/common/local_file_system.cpp +1 -3
- package/src/duckdb/src/common/multi_file_reader.cpp +11 -8
- package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
- package/src/duckdb/src/common/string_util.cpp +6 -1
- package/src/duckdb/src/core_functions/function_list.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
- package/src/duckdb/src/execution/index/art/art.cpp +5 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +62 -43
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +17 -11
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +32 -39
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +10 -9
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +6 -21
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +13 -13
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +15 -14
- package/src/duckdb/src/execution/operator/helper/physical_load.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_prepare.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +10 -8
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +4 -3
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +7 -6
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +8 -8
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +17 -16
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +10 -8
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -4
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -5
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +16 -15
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +13 -12
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +12 -10
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -11
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +8 -6
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +13 -13
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +8 -8
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +160 -145
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +10 -25
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +14 -19
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +7 -6
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +18 -30
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +14 -18
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +6 -4
- package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +4 -19
- package/src/duckdb/src/execution/operator/scan/physical_empty_result.cpp +3 -2
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +14 -5
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -4
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +3 -19
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +4 -18
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -9
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +20 -28
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
- package/src/duckdb/src/execution/physical_operator.cpp +11 -5
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
- package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
- package/src/duckdb/src/function/table/read_csv.cpp +7 -4
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +16 -4
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -4
- package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
- package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +5 -8
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -7
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +6 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +7 -4
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +26 -6
- package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +5 -5
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +0 -1
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +0 -2
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +63 -0
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +16 -3
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +51 -7
- package/src/duckdb/src/include/duckdb/parallel/task.hpp +21 -2
- package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +46 -0
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +24 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +46 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +9 -10
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +22 -0
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -2
- package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -2
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -34
- package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +25 -0
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +5 -0
- package/src/duckdb/src/main/attached_database.cpp +5 -3
- package/src/duckdb/src/main/client_verify.cpp +4 -0
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/main/database.cpp +45 -48
- package/src/duckdb/src/main/extension/extension_load.cpp +32 -49
- package/src/duckdb/src/parallel/event.cpp +1 -1
- package/src/duckdb/src/parallel/executor.cpp +39 -3
- package/src/duckdb/src/parallel/executor_task.cpp +11 -0
- package/src/duckdb/src/parallel/interrupt.cpp +57 -0
- package/src/duckdb/src/parallel/pipeline.cpp +49 -6
- package/src/duckdb/src/parallel/pipeline_executor.cpp +248 -69
- package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
- package/src/duckdb/src/parallel/task_scheduler.cpp +57 -22
- package/src/duckdb/src/parser/base_expression.cpp +6 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +1 -4
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -4
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +43 -24
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +17 -28
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +17 -3
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +8 -2
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +13 -1
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_cteref.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_delete.cpp +10 -0
- package/src/duckdb/src/planner/operator/logical_delim_get.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_expression_get.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +10 -4
- package/src/duckdb/src/planner/operator/logical_insert.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_projection.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_set_operation.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_unnest.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +10 -0
- package/src/duckdb/src/planner/operator/logical_window.cpp +11 -0
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
- package/src/duckdb/src/storage/data_table.cpp +5 -0
- package/src/duckdb/src/storage/local_storage.cpp +40 -110
- package/src/duckdb/src/storage/optimistic_data_writer.cpp +96 -0
- package/src/duckdb/src/storage/partial_block_manager.cpp +73 -9
- package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -1
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +17 -12
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -0
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +90 -82
- package/src/duckdb/src/storage/table/column_data.cpp +19 -45
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +7 -7
- package/src/duckdb/src/storage/table/column_segment.cpp +1 -1
- package/src/duckdb/src/storage/table/list_column_data.cpp +6 -11
- package/src/duckdb/src/storage/table/row_group.cpp +13 -14
- package/src/duckdb/src/storage/table/row_group_collection.cpp +10 -4
- package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -10
- package/src/duckdb/src/storage/table/struct_column_data.cpp +7 -13
- package/src/duckdb/src/storage/table/update_segment.cpp +0 -25
- package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -6
- package/src/duckdb/src/transaction/commit_state.cpp +4 -4
- package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +13 -0
- package/src/duckdb/src/verification/statement_verifier.cpp +4 -0
- package/src/duckdb/third_party/fmt/format.cc +0 -5
- package/src/duckdb/third_party/fmt/include/fmt/core.h +10 -12
- package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +2 -33
- package/src/duckdb/third_party/fmt/include/fmt/format.h +61 -24
- package/src/duckdb/third_party/fmt/include/fmt/printf.h +15 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +10735 -10674
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_parallel.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
package/binding.gyp
CHANGED
@@ -136,6 +136,7 @@
|
|
136
136
|
"src/duckdb/src/verification/copied_statement_verifier.cpp",
|
137
137
|
"src/duckdb/src/verification/deserialized_statement_verifier.cpp",
|
138
138
|
"src/duckdb/src/verification/external_statement_verifier.cpp",
|
139
|
+
"src/duckdb/src/verification/no_operator_caching_verifier.cpp",
|
139
140
|
"src/duckdb/src/verification/parsed_statement_verifier.cpp",
|
140
141
|
"src/duckdb/src/verification/prepared_statement_verifier.cpp",
|
141
142
|
"src/duckdb/src/verification/statement_verifier.cpp",
|
package/package.json
CHANGED
@@ -203,6 +203,18 @@ struct ICUDatePart : public ICUDateFunc {
|
|
203
203
|
return Date::EpochToDate(ExtractEpoch(calendar, 0));
|
204
204
|
}
|
205
205
|
|
206
|
+
static string_t MonthName(icu::Calendar *calendar, const uint64_t micros) {
|
207
|
+
const auto mm = ExtractMonth(calendar, micros) - 1;
|
208
|
+
if (mm == 12) {
|
209
|
+
return "Undecember";
|
210
|
+
}
|
211
|
+
return Date::MONTH_NAMES[mm];
|
212
|
+
}
|
213
|
+
|
214
|
+
static string_t DayName(icu::Calendar *calendar, const uint64_t micros) {
|
215
|
+
return Date::DAY_NAMES[ExtractDayOfWeek(calendar, micros)];
|
216
|
+
}
|
217
|
+
|
206
218
|
template <typename RESULT_TYPE>
|
207
219
|
struct BindAdapterData : public BindData {
|
208
220
|
using result_t = RESULT_TYPE;
|
@@ -246,7 +258,7 @@ struct ICUDatePart : public ICUDateFunc {
|
|
246
258
|
return info.adapters[0](calendar, micros);
|
247
259
|
} else {
|
248
260
|
mask.SetInvalid(idx);
|
249
|
-
return RESULT_TYPE(
|
261
|
+
return RESULT_TYPE();
|
250
262
|
}
|
251
263
|
});
|
252
264
|
}
|
@@ -482,6 +494,44 @@ struct ICUDatePart : public ICUDateFunc {
|
|
482
494
|
CreateScalarFunctionInfo func_info(set);
|
483
495
|
catalog.AddFunction(context, func_info);
|
484
496
|
}
|
497
|
+
|
498
|
+
static unique_ptr<FunctionData> BindMonthName(ClientContext &context, ScalarFunction &bound_function,
|
499
|
+
vector<unique_ptr<Expression>> &arguments) {
|
500
|
+
using data_t = BindAdapterData<string_t>;
|
501
|
+
return BindAdapter<data_t>(context, bound_function, arguments, MonthName);
|
502
|
+
}
|
503
|
+
|
504
|
+
template <typename INPUT_TYPE>
|
505
|
+
static ScalarFunction GetMonthNameFunction(const LogicalType &temporal_type) {
|
506
|
+
return ScalarFunction({temporal_type}, LogicalType::VARCHAR, UnaryTimestampFunction<INPUT_TYPE, string_t>,
|
507
|
+
BindMonthName);
|
508
|
+
}
|
509
|
+
static void AddMonthNameFunctions(const string &name, ClientContext &context) {
|
510
|
+
auto &catalog = Catalog::GetSystemCatalog(context);
|
511
|
+
ScalarFunctionSet set(name);
|
512
|
+
set.AddFunction(GetMonthNameFunction<timestamp_t>(LogicalType::TIMESTAMP_TZ));
|
513
|
+
CreateScalarFunctionInfo func_info(set);
|
514
|
+
catalog.AddFunction(context, func_info);
|
515
|
+
}
|
516
|
+
|
517
|
+
static unique_ptr<FunctionData> BindDayName(ClientContext &context, ScalarFunction &bound_function,
|
518
|
+
vector<unique_ptr<Expression>> &arguments) {
|
519
|
+
using data_t = BindAdapterData<string_t>;
|
520
|
+
return BindAdapter<data_t>(context, bound_function, arguments, DayName);
|
521
|
+
}
|
522
|
+
|
523
|
+
template <typename INPUT_TYPE>
|
524
|
+
static ScalarFunction GetDayNameFunction(const LogicalType &temporal_type) {
|
525
|
+
return ScalarFunction({temporal_type}, LogicalType::VARCHAR, UnaryTimestampFunction<INPUT_TYPE, string_t>,
|
526
|
+
BindDayName);
|
527
|
+
}
|
528
|
+
static void AddDayNameFunctions(const string &name, ClientContext &context) {
|
529
|
+
auto &catalog = Catalog::GetSystemCatalog(context);
|
530
|
+
ScalarFunctionSet set(name);
|
531
|
+
set.AddFunction(GetDayNameFunction<timestamp_t>(LogicalType::TIMESTAMP_TZ));
|
532
|
+
CreateScalarFunctionInfo func_info(set);
|
533
|
+
catalog.AddFunction(context, func_info);
|
534
|
+
}
|
485
535
|
};
|
486
536
|
|
487
537
|
void RegisterICUDatePartFunctions(ClientContext &context) {
|
@@ -520,6 +570,10 @@ void RegisterICUDatePartFunctions(ClientContext &context) {
|
|
520
570
|
// register the last_day function
|
521
571
|
ICUDatePart::AddLastDayFunctions("last_day", context);
|
522
572
|
|
573
|
+
// register the dayname/monthname functions
|
574
|
+
ICUDatePart::AddMonthNameFunctions("monthname", context);
|
575
|
+
ICUDatePart::AddDayNameFunctions("dayname", context);
|
576
|
+
|
523
577
|
// finally the actual date_part function
|
524
578
|
ICUDatePart::AddDatePartFunctions("date_part", context);
|
525
579
|
ICUDatePart::AddDatePartFunctions("datepart", context);
|
@@ -369,7 +369,8 @@ public:
|
|
369
369
|
continue;
|
370
370
|
}
|
371
371
|
MultiFileReader::InitializeReader(*reader, bind_data.parquet_options.file_options, bind_data.reader_bind,
|
372
|
-
bind_data.types, bind_data.names, input.column_ids, input.filters
|
372
|
+
bind_data.types, bind_data.names, input.column_ids, input.filters,
|
373
|
+
bind_data.files[0]);
|
373
374
|
}
|
374
375
|
|
375
376
|
result->column_ids = input.column_ids;
|
@@ -561,9 +562,9 @@ public:
|
|
561
562
|
shared_ptr<ParquetReader> reader;
|
562
563
|
try {
|
563
564
|
reader = make_shared<ParquetReader>(context, file, pq_options);
|
564
|
-
MultiFileReader::InitializeReader(
|
565
|
-
|
566
|
-
|
565
|
+
MultiFileReader::InitializeReader(
|
566
|
+
*reader, bind_data.parquet_options.file_options, bind_data.reader_bind, bind_data.types,
|
567
|
+
bind_data.names, parallel_state.column_ids, parallel_state.filters, bind_data.files.front());
|
567
568
|
} catch (...) {
|
568
569
|
parallel_lock.lock();
|
569
570
|
parallel_state.error_opening_file = true;
|
@@ -51,16 +51,27 @@ vector<LogicalType> TableCatalogEntry::GetTypes() {
|
|
51
51
|
return types;
|
52
52
|
}
|
53
53
|
|
54
|
+
CreateTableInfo TableCatalogEntry::GetTableInfoForSerialization() const {
|
55
|
+
CreateTableInfo result;
|
56
|
+
result.catalog = catalog.GetName();
|
57
|
+
result.schema = schema.name;
|
58
|
+
result.table = name;
|
59
|
+
result.columns = columns.Copy();
|
60
|
+
result.constraints.reserve(constraints.size());
|
61
|
+
std::for_each(constraints.begin(), constraints.end(),
|
62
|
+
[&result](const unique_ptr<Constraint> &c) { result.constraints.emplace_back(c->Copy()); });
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
54
66
|
void TableCatalogEntry::Serialize(Serializer &serializer) const {
|
55
67
|
D_ASSERT(!internal);
|
56
|
-
|
68
|
+
const auto info = GetTableInfoForSerialization();
|
57
69
|
FieldWriter writer(serializer);
|
58
|
-
|
59
|
-
writer.WriteString(
|
60
|
-
writer.WriteString(
|
61
|
-
|
62
|
-
|
63
|
-
writer.WriteSerializableList(constraints);
|
70
|
+
writer.WriteString(info.catalog);
|
71
|
+
writer.WriteString(info.schema);
|
72
|
+
writer.WriteString(info.table);
|
73
|
+
info.columns.Serialize(writer);
|
74
|
+
writer.WriteSerializableList(info.constraints);
|
64
75
|
writer.Finalize();
|
65
76
|
}
|
66
77
|
|
@@ -79,6 +79,8 @@ static DefaultMacro internal_macros[] = {
|
|
79
79
|
{"pg_catalog", "pg_ts_template_is_visible", {"template_oid", nullptr}, "true"},
|
80
80
|
{"pg_catalog", "pg_type_is_visible", {"type_oid", nullptr}, "true"},
|
81
81
|
|
82
|
+
{"pg_catalog", "pg_size_pretty", {"bytes", nullptr}, "format_bytes(bytes)"},
|
83
|
+
|
82
84
|
{DEFAULT_SCHEMA, "round_even", {"x", "n", nullptr}, "CASE ((abs(x) * power(10, n+1)) % 10) WHEN 5 THEN round(x/2, n) * 2 ELSE round(x, n) END"},
|
83
85
|
{DEFAULT_SCHEMA, "roundbankers", {"x", "n", nullptr}, "round_even(x, n)"},
|
84
86
|
{DEFAULT_SCHEMA, "nullif", {"a", "b", nullptr}, "CASE WHEN a=b THEN NULL ELSE a END"},
|
@@ -320,7 +320,7 @@ struct ArrowUUIDConverter {
|
|
320
320
|
template <class SRC = string_t, class OP = ArrowVarcharConverter>
|
321
321
|
struct ArrowVarcharData {
|
322
322
|
static void Initialize(ArrowAppendData &result, const LogicalType &type, idx_t capacity) {
|
323
|
-
result.main_buffer.reserve((capacity + 1) * sizeof(
|
323
|
+
result.main_buffer.reserve((capacity + 1) * sizeof(uint64_t));
|
324
324
|
result.aux_buffer.reserve(capacity);
|
325
325
|
}
|
326
326
|
|
@@ -334,9 +334,9 @@ struct ArrowVarcharData {
|
|
334
334
|
auto validity_data = (uint8_t *)append_data.validity.data();
|
335
335
|
|
336
336
|
// resize the offset buffer - the offset buffer holds the offsets into the child array
|
337
|
-
append_data.main_buffer.resize(append_data.main_buffer.size() + sizeof(
|
337
|
+
append_data.main_buffer.resize(append_data.main_buffer.size() + sizeof(uint64_t) * (size + 1));
|
338
338
|
auto data = (SRC *)format.data;
|
339
|
-
auto offset_data = (
|
339
|
+
auto offset_data = (uint64_t *)append_data.main_buffer.data();
|
340
340
|
if (append_data.row_count == 0) {
|
341
341
|
// first entry
|
342
342
|
offset_data[0] = 0;
|
@@ -117,7 +117,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
117
117
|
break;
|
118
118
|
case LogicalTypeId::UUID:
|
119
119
|
case LogicalTypeId::VARCHAR:
|
120
|
-
child.format = "
|
120
|
+
child.format = "U";
|
121
121
|
break;
|
122
122
|
case LogicalTypeId::DATE:
|
123
123
|
child.format = "tdD";
|
@@ -171,7 +171,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
171
171
|
}
|
172
172
|
case LogicalTypeId::BLOB:
|
173
173
|
case LogicalTypeId::BIT: {
|
174
|
-
child.format = "
|
174
|
+
child.format = "Z";
|
175
175
|
break;
|
176
176
|
}
|
177
177
|
case LogicalTypeId::LIST: {
|
@@ -977,7 +977,6 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
|
|
977
977
|
throw IOException("Cannot use multiple \'**\' in one path");
|
978
978
|
}
|
979
979
|
|
980
|
-
bool recursive_search = false;
|
981
980
|
for (idx_t i = absolute_path ? 1 : 0; i < splits.size(); i++) {
|
982
981
|
bool is_last_chunk = i + 1 == splits.size();
|
983
982
|
bool has_glob = HasGlob(splits[i]);
|
@@ -989,7 +988,7 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
|
|
989
988
|
if (previous_directories.empty()) {
|
990
989
|
result.push_back(splits[i]);
|
991
990
|
} else {
|
992
|
-
if (
|
991
|
+
if (is_last_chunk) {
|
993
992
|
for (auto &prev_directory : previous_directories) {
|
994
993
|
const string filename = JoinPath(prev_directory, splits[i]);
|
995
994
|
if (FileExists(filename) || DirectoryExists(filename)) {
|
@@ -1004,7 +1003,6 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
|
|
1004
1003
|
}
|
1005
1004
|
} else {
|
1006
1005
|
if (IsCrawl(splits[i])) {
|
1007
|
-
recursive_search = true;
|
1008
1006
|
if (!is_last_chunk) {
|
1009
1007
|
result = previous_directories;
|
1010
1008
|
}
|
@@ -192,7 +192,7 @@ void MultiFileReader::FinalizeBind(const MultiFileReaderOptions &file_options, c
|
|
192
192
|
void MultiFileReader::CreateNameMapping(const string &file_name, const vector<LogicalType> &local_types,
|
193
193
|
const vector<string> &local_names, const vector<LogicalType> &global_types,
|
194
194
|
const vector<string> &global_names, const vector<column_t> &global_column_ids,
|
195
|
-
MultiFileReaderData &reader_data) {
|
195
|
+
MultiFileReaderData &reader_data, const string &initial_file) {
|
196
196
|
D_ASSERT(global_types.size() == global_names.size());
|
197
197
|
D_ASSERT(local_types.size() == local_names.size());
|
198
198
|
// we have expected types: create a map of name -> column index
|
@@ -229,11 +229,12 @@ void MultiFileReader::CreateNameMapping(const string &file_name, const vector<Lo
|
|
229
229
|
}
|
230
230
|
candidate_names += local_name;
|
231
231
|
}
|
232
|
-
throw IOException(
|
233
|
-
"Failed to read file \"%s\": schema mismatch in glob: column \"%s\" was read from "
|
234
|
-
|
235
|
-
|
236
|
-
|
232
|
+
throw IOException(
|
233
|
+
StringUtil::Format("Failed to read file \"%s\": schema mismatch in glob: column \"%s\" was read from "
|
234
|
+
"the original file \"%s\", but could not be found in file \"%s\".\nCandidate names: "
|
235
|
+
"%s\nIf you are trying to "
|
236
|
+
"read files with different schemas, try setting union_by_name=True",
|
237
|
+
file_name, global_name, initial_file, file_name, candidate_names));
|
237
238
|
}
|
238
239
|
// we found the column in the local file - check if the types are the same
|
239
240
|
auto local_id = entry->second;
|
@@ -254,8 +255,10 @@ void MultiFileReader::CreateNameMapping(const string &file_name, const vector<Lo
|
|
254
255
|
void MultiFileReader::CreateMapping(const string &file_name, const vector<LogicalType> &local_types,
|
255
256
|
const vector<string> &local_names, const vector<LogicalType> &global_types,
|
256
257
|
const vector<string> &global_names, const vector<column_t> &global_column_ids,
|
257
|
-
optional_ptr<TableFilterSet> filters, MultiFileReaderData &reader_data
|
258
|
-
|
258
|
+
optional_ptr<TableFilterSet> filters, MultiFileReaderData &reader_data,
|
259
|
+
const string &initial_file) {
|
260
|
+
CreateNameMapping(file_name, local_types, local_names, global_types, global_names, global_column_ids, reader_data,
|
261
|
+
initial_file);
|
259
262
|
if (filters) {
|
260
263
|
reader_data.filter_map.resize(global_types.size());
|
261
264
|
for (idx_t c = 0; c < reader_data.column_mapping.size(); c++) {
|
@@ -554,7 +554,7 @@ void PartitionMergeEvent::Schedule() {
|
|
554
554
|
auto &ts = TaskScheduler::GetScheduler(context);
|
555
555
|
idx_t num_threads = ts.NumberOfThreads();
|
556
556
|
|
557
|
-
vector<
|
557
|
+
vector<shared_ptr<Task>> merge_tasks;
|
558
558
|
for (idx_t tnum = 0; tnum < num_threads; tnum++) {
|
559
559
|
merge_tasks.emplace_back(make_uniq<PartitionMergeTask>(shared_from_this(), context, merge_states));
|
560
560
|
}
|
@@ -163,6 +163,11 @@ string StringUtil::BytesToHumanReadableString(idx_t bytes) {
|
|
163
163
|
megabytes -= gigabytes * 1000;
|
164
164
|
auto terabytes = gigabytes / 1000;
|
165
165
|
gigabytes -= terabytes * 1000;
|
166
|
+
auto petabytes = terabytes / 1000;
|
167
|
+
terabytes -= petabytes * 1000;
|
168
|
+
if (petabytes > 0) {
|
169
|
+
return to_string(petabytes) + "." + to_string(terabytes / 100) + "PB";
|
170
|
+
}
|
166
171
|
if (terabytes > 0) {
|
167
172
|
return to_string(terabytes) + "." + to_string(gigabytes / 100) + "TB";
|
168
173
|
} else if (gigabytes > 0) {
|
@@ -172,7 +177,7 @@ string StringUtil::BytesToHumanReadableString(idx_t bytes) {
|
|
172
177
|
} else if (kilobytes > 0) {
|
173
178
|
return to_string(kilobytes) + "KB";
|
174
179
|
} else {
|
175
|
-
return to_string(bytes) + " bytes";
|
180
|
+
return to_string(bytes) + (bytes == 1 ? " byte" : " bytes");
|
176
181
|
}
|
177
182
|
}
|
178
183
|
|
@@ -148,6 +148,8 @@ static StaticFunctionDefinition internal_functions[] = {
|
|
148
148
|
DUCKDB_SCALAR_FUNCTION(ListFlattenFun),
|
149
149
|
DUCKDB_SCALAR_FUNCTION_SET(FloorFun),
|
150
150
|
DUCKDB_SCALAR_FUNCTION(FormatFun),
|
151
|
+
DUCKDB_SCALAR_FUNCTION_ALIAS(FormatreadabledecimalsizeFun),
|
152
|
+
DUCKDB_SCALAR_FUNCTION(FormatBytesFun),
|
151
153
|
DUCKDB_SCALAR_FUNCTION(FromBase64Fun),
|
152
154
|
DUCKDB_SCALAR_FUNCTION_ALIAS(FromBinaryFun),
|
153
155
|
DUCKDB_SCALAR_FUNCTION_ALIAS(FromHexFun),
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
|
+
#include "duckdb/common/types/data_chunk.hpp"
|
3
|
+
#include "duckdb/common/string_util.hpp"
|
4
|
+
|
5
|
+
namespace duckdb {
|
6
|
+
|
7
|
+
static void FormatBytesFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
8
|
+
UnaryExecutor::Execute<int64_t, string_t>(args.data[0], result, args.size(), [&](int64_t bytes) {
|
9
|
+
bool is_negative = bytes < 0;
|
10
|
+
idx_t unsigned_bytes;
|
11
|
+
if (bytes < 0) {
|
12
|
+
if (bytes == NumericLimits<int64_t>::Minimum()) {
|
13
|
+
unsigned_bytes = idx_t(NumericLimits<int64_t>::Maximum()) + 1;
|
14
|
+
} else {
|
15
|
+
unsigned_bytes = idx_t(-bytes);
|
16
|
+
}
|
17
|
+
} else {
|
18
|
+
unsigned_bytes = idx_t(bytes);
|
19
|
+
}
|
20
|
+
return StringVector::AddString(result, (is_negative ? "-" : "") +
|
21
|
+
StringUtil::BytesToHumanReadableString(unsigned_bytes));
|
22
|
+
});
|
23
|
+
}
|
24
|
+
|
25
|
+
ScalarFunction FormatBytesFun::GetFunction() {
|
26
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::VARCHAR, FormatBytesFunction);
|
27
|
+
}
|
28
|
+
|
29
|
+
} // namespace duckdb
|
@@ -879,7 +879,11 @@ string ART::GenerateConstraintErrorMessage(VerifyExistenceType verify_type, cons
|
|
879
879
|
case VerifyExistenceType::APPEND: {
|
880
880
|
// APPEND to PK/UNIQUE table, but node/key already exists in PK/UNIQUE table
|
881
881
|
string type = IsPrimary() ? "primary key" : "unique";
|
882
|
-
return StringUtil::Format(
|
882
|
+
return StringUtil::Format(
|
883
|
+
"Duplicate key \"%s\" violates %s constraint. "
|
884
|
+
"If this is an unexpected constraint violation please double "
|
885
|
+
"check with the known index limitations section in our documentation (docs - sql - indexes).",
|
886
|
+
key_name, type);
|
883
887
|
}
|
884
888
|
case VerifyExistenceType::APPEND_FK: {
|
885
889
|
// APPEND_FK to FK table, node/key does not exist in PK/UNIQUE table
|
@@ -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/main/client_context.hpp"
|
7
|
+
#include "duckdb/parallel/interrupt.hpp"
|
7
8
|
#include "duckdb/parallel/pipeline.hpp"
|
8
9
|
#include "duckdb/parallel/task_scheduler.hpp"
|
9
10
|
#include "duckdb/parallel/thread_context.hpp"
|
@@ -250,10 +251,10 @@ unique_ptr<LocalSinkState> PhysicalHashAggregate::GetLocalSinkState(ExecutionCon
|
|
250
251
|
return make_uniq<HashAggregateLocalState>(*this, context);
|
251
252
|
}
|
252
253
|
|
253
|
-
void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context,
|
254
|
-
|
255
|
-
auto &sink =
|
256
|
-
auto &global_sink =
|
254
|
+
void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input,
|
255
|
+
idx_t grouping_idx) const {
|
256
|
+
auto &sink = input.local_state.Cast<HashAggregateLocalState>();
|
257
|
+
auto &global_sink = input.global_state.Cast<HashAggregateGlobalState>();
|
257
258
|
|
258
259
|
auto &grouping_gstate = global_sink.grouping_states[grouping_idx];
|
259
260
|
auto &grouping_lstate = sink.grouping_states[grouping_idx];
|
@@ -280,6 +281,9 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
280
281
|
auto &radix_global_sink = *distinct_state->radix_states[table_idx];
|
281
282
|
auto &radix_local_sink = *grouping_lstate.distinct_states[table_idx];
|
282
283
|
|
284
|
+
InterruptState interrupt_state;
|
285
|
+
OperatorSinkInput sink_input {radix_global_sink, radix_local_sink, interrupt_state};
|
286
|
+
|
283
287
|
if (aggregate.filter) {
|
284
288
|
DataChunk filter_chunk;
|
285
289
|
auto &filtered_data = sink.filter_set.GetFilterData(idx);
|
@@ -288,10 +292,10 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
288
292
|
// Add the filter Vector (BOOL)
|
289
293
|
auto it = filter_indexes.find(aggregate.filter.get());
|
290
294
|
D_ASSERT(it != filter_indexes.end());
|
291
|
-
D_ASSERT(it->second <
|
295
|
+
D_ASSERT(it->second < chunk.data.size());
|
292
296
|
auto &filter_bound_ref = aggregate.filter->Cast<BoundReferenceExpression>();
|
293
|
-
filter_chunk.data[filter_bound_ref.index].Reference(
|
294
|
-
filter_chunk.SetCardinality(
|
297
|
+
filter_chunk.data[filter_bound_ref.index].Reference(chunk.data[it->second]);
|
298
|
+
filter_chunk.SetCardinality(chunk.size());
|
295
299
|
|
296
300
|
// We cant use the AggregateFilterData::ApplyFilter method, because the chunk we need to
|
297
301
|
// apply the filter to also has the groups, and the filtered_data.filtered_payload does not have those.
|
@@ -305,43 +309,42 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
305
309
|
// Because the 'input' chunk needs to be re-used after this, we need to create
|
306
310
|
// a duplicate of it, that we can apply the filter to
|
307
311
|
DataChunk filtered_input;
|
308
|
-
filtered_input.InitializeEmpty(
|
312
|
+
filtered_input.InitializeEmpty(chunk.GetTypes());
|
309
313
|
|
310
314
|
for (idx_t group_idx = 0; group_idx < grouped_aggregate_data.groups.size(); group_idx++) {
|
311
315
|
auto &group = grouped_aggregate_data.groups[group_idx];
|
312
316
|
auto &bound_ref = group->Cast<BoundReferenceExpression>();
|
313
|
-
filtered_input.data[bound_ref.index].Reference(
|
317
|
+
filtered_input.data[bound_ref.index].Reference(chunk.data[bound_ref.index]);
|
314
318
|
}
|
315
319
|
for (idx_t child_idx = 0; child_idx < aggregate.children.size(); child_idx++) {
|
316
320
|
auto &child = aggregate.children[child_idx];
|
317
321
|
auto &bound_ref = child->Cast<BoundReferenceExpression>();
|
318
322
|
|
319
|
-
filtered_input.data[bound_ref.index].Reference(
|
323
|
+
filtered_input.data[bound_ref.index].Reference(chunk.data[bound_ref.index]);
|
320
324
|
}
|
321
325
|
filtered_input.Slice(sel_vec, count);
|
322
326
|
filtered_input.SetCardinality(count);
|
323
327
|
|
324
|
-
radix_table.Sink(context,
|
328
|
+
radix_table.Sink(context, filtered_input, sink_input, empty_chunk, empty_filter);
|
325
329
|
} else {
|
326
|
-
radix_table.Sink(context,
|
330
|
+
radix_table.Sink(context, chunk, sink_input, empty_chunk, empty_filter);
|
327
331
|
}
|
328
332
|
}
|
329
333
|
}
|
330
334
|
|
331
|
-
void PhysicalHashAggregate::SinkDistinct(ExecutionContext &context,
|
332
|
-
DataChunk &input) const {
|
335
|
+
void PhysicalHashAggregate::SinkDistinct(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
333
336
|
for (idx_t i = 0; i < groupings.size(); i++) {
|
334
|
-
SinkDistinctGrouping(context,
|
337
|
+
SinkDistinctGrouping(context, chunk, input, i);
|
335
338
|
}
|
336
339
|
}
|
337
340
|
|
338
|
-
SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context,
|
339
|
-
|
340
|
-
auto &llstate =
|
341
|
-
auto &gstate =
|
341
|
+
SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, DataChunk &chunk,
|
342
|
+
OperatorSinkInput &input) const {
|
343
|
+
auto &llstate = input.local_state.Cast<HashAggregateLocalState>();
|
344
|
+
auto &gstate = input.global_state.Cast<HashAggregateGlobalState>();
|
342
345
|
|
343
346
|
if (distinct_collection_info) {
|
344
|
-
SinkDistinct(context,
|
347
|
+
SinkDistinct(context, chunk, input);
|
345
348
|
}
|
346
349
|
|
347
350
|
if (CanSkipRegularSink()) {
|
@@ -359,8 +362,8 @@ SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, GlobalSink
|
|
359
362
|
for (auto &child_expr : aggr.children) {
|
360
363
|
D_ASSERT(child_expr->type == ExpressionType::BOUND_REF);
|
361
364
|
auto &bound_ref_expr = child_expr->Cast<BoundReferenceExpression>();
|
362
|
-
D_ASSERT(bound_ref_expr.index <
|
363
|
-
aggregate_input_chunk.data[aggregate_input_idx++].Reference(
|
365
|
+
D_ASSERT(bound_ref_expr.index < chunk.data.size());
|
366
|
+
aggregate_input_chunk.data[aggregate_input_idx++].Reference(chunk.data[bound_ref_expr.index]);
|
364
367
|
}
|
365
368
|
}
|
366
369
|
// Populate the filter vectors
|
@@ -369,23 +372,24 @@ SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, GlobalSink
|
|
369
372
|
if (aggr.filter) {
|
370
373
|
auto it = filter_indexes.find(aggr.filter.get());
|
371
374
|
D_ASSERT(it != filter_indexes.end());
|
372
|
-
D_ASSERT(it->second <
|
373
|
-
aggregate_input_chunk.data[aggregate_input_idx++].Reference(
|
375
|
+
D_ASSERT(it->second < chunk.data.size());
|
376
|
+
aggregate_input_chunk.data[aggregate_input_idx++].Reference(chunk.data[it->second]);
|
374
377
|
}
|
375
378
|
}
|
376
379
|
|
377
|
-
aggregate_input_chunk.SetCardinality(
|
380
|
+
aggregate_input_chunk.SetCardinality(chunk.size());
|
378
381
|
aggregate_input_chunk.Verify();
|
379
382
|
|
380
383
|
// For every grouping set there is one radix_table
|
381
384
|
for (idx_t i = 0; i < groupings.size(); i++) {
|
382
385
|
auto &grouping_gstate = gstate.grouping_states[i];
|
383
386
|
auto &grouping_lstate = llstate.grouping_states[i];
|
387
|
+
InterruptState interrupt_state;
|
388
|
+
OperatorSinkInput sink_input {*grouping_gstate.table_state, *grouping_lstate.table_state, interrupt_state};
|
384
389
|
|
385
390
|
auto &grouping = groupings[i];
|
386
391
|
auto &table = grouping.table_data;
|
387
|
-
table.Sink(context,
|
388
|
-
non_distinct_filter);
|
392
|
+
table.Sink(context, chunk, sink_input, aggregate_input_chunk, non_distinct_filter);
|
389
393
|
}
|
390
394
|
|
391
395
|
return SinkResultType::NEED_MORE_INPUT;
|
@@ -452,7 +456,7 @@ public:
|
|
452
456
|
|
453
457
|
public:
|
454
458
|
void Schedule() override {
|
455
|
-
vector<
|
459
|
+
vector<shared_ptr<Task>> tasks;
|
456
460
|
for (idx_t i = 0; i < op.groupings.size(); i++) {
|
457
461
|
auto &grouping_gstate = gstate.grouping_states[i];
|
458
462
|
|
@@ -504,7 +508,7 @@ public:
|
|
504
508
|
|
505
509
|
public:
|
506
510
|
void Schedule() override {
|
507
|
-
vector<
|
511
|
+
vector<shared_ptr<Task>> tasks;
|
508
512
|
tasks.push_back(make_uniq<HashAggregateFinalizeTask>(*pipeline, shared_from_this(), gstate, context, op));
|
509
513
|
D_ASSERT(!tasks.empty());
|
510
514
|
SetTasks(std::move(tasks));
|
@@ -579,11 +583,18 @@ public:
|
|
579
583
|
output_chunk.Reset();
|
580
584
|
group_chunk.Reset();
|
581
585
|
aggregate_input_chunk.Reset();
|
582
|
-
radix_table_p->GetData(temp_exec_context, output_chunk, *state.radix_states[table_idx], *global_source,
|
583
|
-
*local_source);
|
584
586
|
|
585
|
-
|
587
|
+
InterruptState interrupt_state;
|
588
|
+
OperatorSourceInput source_input {*global_source, *local_source, interrupt_state};
|
589
|
+
auto res = radix_table_p->GetData(temp_exec_context, output_chunk, *state.radix_states[table_idx],
|
590
|
+
source_input);
|
591
|
+
|
592
|
+
if (res == SourceResultType::FINISHED) {
|
593
|
+
D_ASSERT(output_chunk.size() == 0);
|
586
594
|
break;
|
595
|
+
} else if (res == SourceResultType::BLOCKED) {
|
596
|
+
throw InternalException(
|
597
|
+
"Unexpected interrupt from radix table GetData in HashDistinctAggregateFinalizeTask");
|
587
598
|
}
|
588
599
|
|
589
600
|
auto &grouped_aggregate_data = *data.grouped_aggregate_data[table_idx];
|
@@ -603,8 +614,8 @@ public:
|
|
603
614
|
aggregate_input_chunk.SetCardinality(output_chunk);
|
604
615
|
|
605
616
|
// Sink it into the main ht
|
606
|
-
|
607
|
-
|
617
|
+
OperatorSinkInput sink_input {table_state, *temp_local_state, interrupt_state};
|
618
|
+
grouping_data.table_data.Sink(temp_exec_context, group_chunk, sink_input, aggregate_input_chunk, {i});
|
608
619
|
}
|
609
620
|
}
|
610
621
|
grouping_data.table_data.Combine(temp_exec_context, table_state, *temp_local_state);
|
@@ -650,7 +661,7 @@ public:
|
|
650
661
|
void Schedule() override {
|
651
662
|
global_sources = CreateGlobalSources();
|
652
663
|
|
653
|
-
vector<
|
664
|
+
vector<shared_ptr<Task>> tasks;
|
654
665
|
auto &scheduler = TaskScheduler::GetScheduler(context);
|
655
666
|
auto number_of_threads = scheduler.NumberOfThreads();
|
656
667
|
tasks.reserve(number_of_threads);
|
@@ -714,7 +725,7 @@ public:
|
|
714
725
|
|
715
726
|
public:
|
716
727
|
void Schedule() override {
|
717
|
-
vector<
|
728
|
+
vector<shared_ptr<Task>> tasks;
|
718
729
|
for (idx_t i = 0; i < op.groupings.size(); i++) {
|
719
730
|
auto &grouping = op.groupings[i];
|
720
731
|
auto &distinct_data = *grouping.distinct_data;
|
@@ -868,11 +879,11 @@ unique_ptr<LocalSourceState> PhysicalHashAggregate::GetLocalSourceState(Executio
|
|
868
879
|
return make_uniq<PhysicalHashAggregateLocalSourceState>(context, *this);
|
869
880
|
}
|
870
881
|
|
871
|
-
|
872
|
-
|
882
|
+
SourceResultType PhysicalHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
883
|
+
OperatorSourceInput &input) const {
|
873
884
|
auto &sink_gstate = sink_state->Cast<HashAggregateGlobalState>();
|
874
|
-
auto &gstate =
|
875
|
-
auto &lstate =
|
885
|
+
auto &gstate = input.global_state.Cast<PhysicalHashAggregateGlobalSourceState>();
|
886
|
+
auto &lstate = input.local_state.Cast<PhysicalHashAggregateLocalSourceState>();
|
876
887
|
while (true) {
|
877
888
|
idx_t radix_idx = gstate.state_index;
|
878
889
|
if (radix_idx >= groupings.size()) {
|
@@ -881,11 +892,17 @@ void PhysicalHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
|
881
892
|
auto &grouping = groupings[radix_idx];
|
882
893
|
auto &radix_table = grouping.table_data;
|
883
894
|
auto &grouping_gstate = sink_gstate.grouping_states[radix_idx];
|
884
|
-
|
885
|
-
|
895
|
+
|
896
|
+
InterruptState interrupt_state;
|
897
|
+
OperatorSourceInput source_input {*gstate.radix_states[radix_idx], *lstate.radix_states[radix_idx],
|
898
|
+
interrupt_state};
|
899
|
+
auto res = radix_table.GetData(context, chunk, *grouping_gstate.table_state, source_input);
|
886
900
|
if (chunk.size() != 0) {
|
887
|
-
return;
|
901
|
+
return SourceResultType::HAVE_MORE_OUTPUT;
|
902
|
+
} else if (res == SourceResultType::BLOCKED) {
|
903
|
+
throw InternalException("Unexpectedly Blocked from radix_table");
|
888
904
|
}
|
905
|
+
|
889
906
|
// move to the next table
|
890
907
|
lock_guard<mutex> l(gstate.lock);
|
891
908
|
radix_idx++;
|
@@ -895,6 +912,8 @@ void PhysicalHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
|
895
912
|
gstate.state_index = radix_idx;
|
896
913
|
}
|
897
914
|
}
|
915
|
+
|
916
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
898
917
|
}
|
899
918
|
|
900
919
|
string PhysicalHashAggregate::ParamsToString() const {
|