duckdb 0.7.2-dev1901.0 → 0.7.2-dev2233.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.
Files changed (198) hide show
  1. package/binding.gyp +2 -0
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/parquet/column_reader.cpp +3 -0
  4. package/src/duckdb/extension/parquet/include/parquet_writer.hpp +1 -1
  5. package/src/duckdb/extension/parquet/parquet_metadata.cpp +4 -2
  6. package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
  7. package/src/duckdb/src/common/arrow/arrow_appender.cpp +69 -44
  8. package/src/duckdb/src/common/arrow/arrow_converter.cpp +1 -1
  9. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +20 -2
  10. package/src/duckdb/src/common/box_renderer.cpp +4 -2
  11. package/src/duckdb/src/common/constants.cpp +10 -1
  12. package/src/duckdb/src/common/filename_pattern.cpp +41 -0
  13. package/src/duckdb/src/common/hive_partitioning.cpp +144 -15
  14. package/src/duckdb/src/common/radix_partitioning.cpp +101 -369
  15. package/src/duckdb/src/common/row_operations/row_aggregate.cpp +8 -9
  16. package/src/duckdb/src/common/row_operations/row_external.cpp +1 -1
  17. package/src/duckdb/src/common/row_operations/row_gather.cpp +5 -3
  18. package/src/duckdb/src/common/row_operations/row_match.cpp +117 -22
  19. package/src/duckdb/src/common/row_operations/row_scatter.cpp +2 -2
  20. package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
  21. package/src/duckdb/src/common/sort/sort_state.cpp +2 -1
  22. package/src/duckdb/src/common/sort/sorted_block.cpp +1 -1
  23. package/src/duckdb/src/common/types/{column_data_allocator.cpp → column/column_data_allocator.cpp} +2 -2
  24. package/src/duckdb/src/common/types/{column_data_collection.cpp → column/column_data_collection.cpp} +29 -6
  25. package/src/duckdb/src/common/types/{column_data_collection_segment.cpp → column/column_data_collection_segment.cpp} +2 -1
  26. package/src/duckdb/src/common/types/{column_data_consumer.cpp → column/column_data_consumer.cpp} +1 -1
  27. package/src/duckdb/src/common/types/{partitioned_column_data.cpp → column/partitioned_column_data.cpp} +11 -9
  28. package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +316 -0
  29. package/src/duckdb/src/common/types/{row_data_collection.cpp → row/row_data_collection.cpp} +1 -1
  30. package/src/duckdb/src/common/types/{row_data_collection_scanner.cpp → row/row_data_collection_scanner.cpp} +2 -2
  31. package/src/duckdb/src/common/types/{row_layout.cpp → row/row_layout.cpp} +1 -1
  32. package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +465 -0
  33. package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +511 -0
  34. package/src/duckdb/src/common/types/row/tuple_data_iterator.cpp +96 -0
  35. package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +119 -0
  36. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +1200 -0
  37. package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +170 -0
  38. package/src/duckdb/src/common/types/vector.cpp +1 -1
  39. package/src/duckdb/src/execution/aggregate_hashtable.cpp +252 -290
  40. package/src/duckdb/src/execution/join_hashtable.cpp +192 -328
  41. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +4 -4
  42. package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +3 -3
  43. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +2 -3
  44. package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +2 -3
  45. package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +36 -21
  46. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +2 -2
  47. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +1 -1
  48. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +2 -2
  49. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +166 -144
  50. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +5 -5
  51. package/src/duckdb/src/execution/operator/join/physical_join.cpp +2 -10
  52. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +0 -1
  53. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +2 -2
  54. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +3 -0
  55. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +71 -22
  56. package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +17 -13
  57. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +0 -7
  58. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +124 -29
  59. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +13 -11
  60. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +3 -2
  61. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +25 -24
  62. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -1
  63. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +4 -3
  64. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +1 -1
  65. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +1 -1
  66. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +3 -3
  67. package/src/duckdb/src/execution/partitionable_hashtable.cpp +9 -37
  68. package/src/duckdb/src/execution/physical_operator.cpp +1 -1
  69. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +19 -18
  70. package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +2 -1
  71. package/src/duckdb/src/execution/physical_plan/plan_execute.cpp +2 -2
  72. package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +5 -6
  73. package/src/duckdb/src/execution/physical_plan/plan_expression_get.cpp +2 -2
  74. package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +3 -3
  75. package/src/duckdb/src/execution/physical_plan_generator.cpp +1 -1
  76. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +39 -17
  77. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +2 -2
  78. package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +5 -5
  79. package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +2 -2
  80. package/src/duckdb/src/function/table/read_csv.cpp +124 -58
  81. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  82. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
  83. package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
  84. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  85. package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -0
  86. package/src/duckdb/src/include/duckdb/common/fast_mem.hpp +528 -0
  87. package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +34 -0
  88. package/src/duckdb/src/include/duckdb/common/helper.hpp +10 -0
  89. package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +13 -3
  90. package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +8 -0
  91. package/src/duckdb/src/include/duckdb/common/perfect_map_set.hpp +34 -0
  92. package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +80 -27
  93. package/src/duckdb/src/include/duckdb/common/reference_map.hpp +38 -0
  94. package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +7 -6
  95. package/src/duckdb/src/include/duckdb/common/sort/comparators.hpp +1 -1
  96. package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +1 -1
  97. package/src/duckdb/src/include/duckdb/common/sort/sort.hpp +1 -1
  98. package/src/duckdb/src/include/duckdb/common/sort/sorted_block.hpp +2 -2
  99. package/src/duckdb/src/include/duckdb/common/types/batched_data_collection.hpp +1 -1
  100. package/src/duckdb/src/include/duckdb/common/types/{column_data_allocator.hpp → column/column_data_allocator.hpp} +4 -4
  101. package/src/duckdb/src/include/duckdb/common/types/{column_data_collection.hpp → column/column_data_collection.hpp} +4 -4
  102. package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_iterators.hpp → column/column_data_collection_iterators.hpp} +2 -2
  103. package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_segment.hpp → column/column_data_collection_segment.hpp} +3 -3
  104. package/src/duckdb/src/include/duckdb/common/types/{column_data_consumer.hpp → column/column_data_consumer.hpp} +8 -4
  105. package/src/duckdb/src/include/duckdb/common/types/{column_data_scan_states.hpp → column/column_data_scan_states.hpp} +1 -1
  106. package/src/duckdb/src/include/duckdb/common/types/{partitioned_column_data.hpp → column/partitioned_column_data.hpp} +15 -7
  107. package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +140 -0
  108. package/src/duckdb/src/include/duckdb/common/types/{row_data_collection.hpp → row/row_data_collection.hpp} +1 -1
  109. package/src/duckdb/src/include/duckdb/common/types/{row_data_collection_scanner.hpp → row/row_data_collection_scanner.hpp} +2 -2
  110. package/src/duckdb/src/include/duckdb/common/types/{row_layout.hpp → row/row_layout.hpp} +3 -1
  111. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +116 -0
  112. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +239 -0
  113. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_iterator.hpp +64 -0
  114. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +113 -0
  115. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +124 -0
  116. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +74 -0
  117. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +3 -0
  118. package/src/duckdb/src/include/duckdb/common/types/value.hpp +4 -12
  119. package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +34 -31
  120. package/src/duckdb/src/include/duckdb/execution/base_aggregate_hashtable.hpp +2 -2
  121. package/src/duckdb/src/include/duckdb/execution/execution_context.hpp +3 -2
  122. package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +1 -1
  123. package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +41 -67
  124. package/src/duckdb/src/include/duckdb/execution/nested_loop_join.hpp +1 -1
  125. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +2 -2
  126. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +1 -1
  127. package/src/duckdb/src/include/duckdb/execution/operator/join/outer_join_marker.hpp +2 -2
  128. package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +1 -1
  129. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -1
  130. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +0 -2
  131. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +2 -2
  132. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +1 -1
  133. package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +4 -1
  134. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +8 -3
  135. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +5 -7
  136. package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +5 -1
  137. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +4 -1
  138. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -1
  139. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +1 -1
  140. package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +2 -2
  141. package/src/duckdb/src/include/duckdb/function/function.hpp +2 -0
  142. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +25 -0
  143. package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -0
  144. package/src/duckdb/src/include/duckdb/main/config.hpp +0 -2
  145. package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -1
  146. package/src/duckdb/src/include/duckdb/main/query_result.hpp +14 -1
  147. package/src/duckdb/src/include/duckdb/optimizer/expression_rewriter.hpp +3 -3
  148. package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +16 -16
  149. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +8 -8
  150. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +23 -15
  151. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +9 -10
  152. package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +18 -11
  153. package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +1 -1
  154. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +5 -1
  155. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +3 -2
  156. package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +4 -2
  157. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +9 -35
  158. package/src/duckdb/src/include/duckdb/planner/binder.hpp +24 -23
  159. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +3 -3
  160. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -1
  161. package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +3 -1
  162. package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +1 -1
  163. package/src/duckdb/src/main/appender.cpp +6 -6
  164. package/src/duckdb/src/main/client_context.cpp +1 -1
  165. package/src/duckdb/src/main/connection.cpp +2 -2
  166. package/src/duckdb/src/main/query_result.cpp +13 -0
  167. package/src/duckdb/src/main/settings/settings.cpp +3 -4
  168. package/src/duckdb/src/optimizer/expression_rewriter.cpp +4 -4
  169. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +91 -105
  170. package/src/duckdb/src/optimizer/join_order/join_node.cpp +5 -8
  171. package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +163 -160
  172. package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +30 -30
  173. package/src/duckdb/src/optimizer/join_order/query_graph.cpp +37 -38
  174. package/src/duckdb/src/parallel/executor.cpp +1 -1
  175. package/src/duckdb/src/parallel/meta_pipeline.cpp +2 -2
  176. package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -1
  177. package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +1 -1
  178. package/src/duckdb/src/parser/transformer.cpp +50 -9
  179. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +13 -0
  180. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +15 -5
  181. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +19 -17
  182. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +4 -4
  183. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +20 -21
  184. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +24 -22
  185. package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +2 -2
  186. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +9 -0
  187. package/src/duckdb/src/planner/binder.cpp +16 -19
  188. package/src/duckdb/src/planner/expression_binder.cpp +8 -8
  189. package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +3 -3
  190. package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
  191. package/src/duckdb/src/storage/standard_buffer_manager.cpp +1 -1
  192. package/src/duckdb/src/storage/table_index_list.cpp +3 -3
  193. package/src/duckdb/src/verification/statement_verifier.cpp +1 -1
  194. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +5552 -5598
  195. package/src/duckdb/ub_src_common.cpp +2 -0
  196. package/src/duckdb/ub_src_common_types.cpp +0 -16
  197. package/src/duckdb/ub_src_common_types_column.cpp +10 -0
  198. package/src/duckdb/ub_src_common_types_row.cpp +20 -0
@@ -21,14 +21,15 @@ public:
21
21
 
22
22
  //! Constructor for Initial Buffer
23
23
  CSVBuffer(ClientContext &context, idx_t buffer_size_p, CSVFileHandle &file_handle,
24
- idx_t &global_csv_current_position);
24
+ idx_t &global_csv_current_position, idx_t file_number);
25
25
 
26
26
  //! Constructor for `Next()` Buffers
27
27
  CSVBuffer(ClientContext &context, BufferHandle handle, idx_t buffer_size_p, idx_t actual_size_p, bool final_buffer,
28
- idx_t global_csv_current_position);
28
+ idx_t global_csv_current_position, idx_t file_number);
29
29
 
30
30
  //! Creates a new buffer with the next part of the CSV File
31
- unique_ptr<CSVBuffer> Next(CSVFileHandle &file_handle, idx_t buffer_size, idx_t &global_csv_current_position);
31
+ unique_ptr<CSVBuffer> Next(CSVFileHandle &file_handle, idx_t buffer_size, idx_t &global_csv_current_position,
32
+ idx_t file_number);
32
33
 
33
34
  //! Gets the buffer actual size
34
35
  idx_t GetBufferSize();
@@ -44,6 +45,8 @@ public:
44
45
 
45
46
  idx_t GetCSVGlobalStart();
46
47
 
48
+ idx_t GetFileNumber();
49
+
47
50
  BufferHandle AllocateBuffer(idx_t buffer_size);
48
51
 
49
52
  char *Ptr() {
@@ -65,5 +68,7 @@ private:
65
68
  bool first_buffer = false;
66
69
  //! Global position from the CSV File where this buffer starts
67
70
  idx_t global_csv_start = 0;
71
+ //! Number of the file that is in this buffer
72
+ idx_t file_number = 0;
68
73
  };
69
74
  } // namespace duckdb
@@ -39,11 +39,6 @@ struct BufferedCSVReaderOptions {
39
39
  bool has_newline = false;
40
40
  //! New Line separator
41
41
  NewLineIdentifier new_line = NewLineIdentifier::NOT_SET;
42
-
43
- //! Whether or not an option was provided for parallel
44
- bool has_parallel = false;
45
- //! Whether or not the read will use the ParallelCSVReader
46
- bool use_parallel = false;
47
42
  //! Whether or not a quote was defined by the user
48
43
  bool has_quote = false;
49
44
  //! Quote used for columns that contain reserved characters, e.g., delimiter
@@ -114,8 +109,12 @@ struct BufferedCSVReaderOptions {
114
109
  //! Decimal separator when reading as numeric
115
110
  string decimal_separator = ".";
116
111
  //! Whether or not to pad rows that do not have enough columns with NULL values
117
- bool null_padding = true;
112
+ bool null_padding = false;
118
113
 
114
+ //! If we are running the parallel version of the CSV Reader. In general, the system should always auto-detect
115
+ //! When it can't execute a parallel run before execution. However, there are (rather specific) situations where
116
+ //! setting up this manually might be important
117
+ bool run_parallel = true;
119
118
  //===--------------------------------------------------------------------===//
120
119
  // WriteCSVOptions
121
120
  //===--------------------------------------------------------------------===//
@@ -139,7 +138,6 @@ struct BufferedCSVReaderOptions {
139
138
  void SetEscape(const string &escape);
140
139
  void SetQuote(const string &quote);
141
140
  void SetDelimiter(const string &delimiter);
142
- void SetParallel(bool use_parallel);
143
141
 
144
142
  void SetNewline(const string &input);
145
143
  //! Set an option that is supported by both reading and writing functions, called by
@@ -99,7 +99,7 @@ struct VerificationPositions {
99
99
  class ParallelCSVReader : public BaseCSVReader {
100
100
  public:
101
101
  ParallelCSVReader(ClientContext &context, BufferedCSVReaderOptions options, unique_ptr<CSVBufferRead> buffer,
102
- const vector<LogicalType> &requested_types);
102
+ idx_t first_pos_first_buffer, const vector<LogicalType> &requested_types);
103
103
  ~ParallelCSVReader();
104
104
 
105
105
  //! Current Position (Relative to the Buffer)
@@ -136,6 +136,8 @@ private:
136
136
  bool TryParseCSV(ParserMode mode, DataChunk &insert_chunk, string &error_message);
137
137
  //! Sets Position depending on the byte_start of this thread
138
138
  bool SetPosition(DataChunk &insert_chunk);
139
+ //! Called when scanning the 1st buffer, skips empty lines
140
+ void SkipEmptyLines();
139
141
  //! When a buffer finishes reading its piece, it still can try to scan up to the real end of the buffer
140
142
  //! Up to finding a new line. This function sets the buffer_end and marks a boolean variable
141
143
  //! when changing the buffer end the first time.
@@ -148,6 +150,8 @@ private:
148
150
  bool TryParseSimpleCSV(DataChunk &insert_chunk, string &error_message, bool try_add_line = false);
149
151
  //! Position of the first read line and last read line for verification purposes
150
152
  VerificationPositions verification_positions;
153
+ //! First Position of First Buffer
154
+ idx_t first_pos_first_buffer = 0;
151
155
  };
152
156
 
153
157
  } // namespace duckdb
@@ -11,6 +11,8 @@
11
11
  #include "duckdb/execution/physical_operator.hpp"
12
12
  #include "duckdb/parser/parsed_data/copy_info.hpp"
13
13
  #include "duckdb/function/copy_function.hpp"
14
+ #include "duckdb/common/file_system.hpp"
15
+ #include "duckdb/common/filename_pattern.hpp"
14
16
 
15
17
  namespace duckdb {
16
18
 
@@ -27,7 +29,8 @@ public:
27
29
  unique_ptr<FunctionData> bind_data;
28
30
  string file_path;
29
31
  bool use_tmp_file;
30
- bool allow_overwrite;
32
+ FilenamePattern filename_pattern;
33
+ bool overwrite_or_ignore;
31
34
  bool parallel;
32
35
  bool per_thread_output;
33
36
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  #pragma once
10
10
 
11
- #include "duckdb/common/types/column_data_collection.hpp"
11
+ #include "duckdb/common/types/column/column_data_collection.hpp"
12
12
  #include "duckdb/execution/physical_operator.hpp"
13
13
 
14
14
  namespace duckdb {
@@ -8,7 +8,7 @@
8
8
 
9
9
  #pragma once
10
10
 
11
- #include "duckdb/common/types/column_data_collection.hpp"
11
+ #include "duckdb/common/types/column/column_data_collection.hpp"
12
12
  #include "duckdb/execution/physical_operator.hpp"
13
13
 
14
14
  namespace duckdb {
@@ -17,10 +17,10 @@ struct RadixPartitionInfo {
17
17
  const idx_t n_partitions;
18
18
  const idx_t radix_bits;
19
19
  const hash_t radix_mask;
20
- constexpr static idx_t RADIX_SHIFT = 40;
20
+ const idx_t radix_shift;
21
21
 
22
22
  inline hash_t GetHashPartition(hash_t hash) const {
23
- return (hash & radix_mask) >> RADIX_SHIFT;
23
+ return (hash & radix_mask) >> radix_shift;
24
24
  }
25
25
  };
26
26
 
@@ -91,6 +91,8 @@ public:
91
91
 
92
92
  //! The name of the function
93
93
  string name;
94
+ //! Additional Information to specify function from it's name
95
+ string extra_info;
94
96
 
95
97
  public:
96
98
  //! Returns the formatted string name(arg1, arg2, ...)
@@ -56,6 +56,28 @@ struct WriteCSVData : public BaseCSVData {
56
56
  idx_t flush_size = 4096 * 8;
57
57
  };
58
58
 
59
+ struct ColumnInfo {
60
+ ColumnInfo() {
61
+ }
62
+ ColumnInfo(vector<std::string> names_p, vector<LogicalType> types_p) {
63
+ names = std::move(names_p);
64
+ types = std::move(types_p);
65
+ }
66
+ void Serialize(FieldWriter &writer) {
67
+ writer.WriteList<string>(names);
68
+ writer.WriteRegularSerializableList<LogicalType>(types);
69
+ }
70
+
71
+ static ColumnInfo Deserialize(FieldReader &reader) {
72
+ ColumnInfo info;
73
+ info.names = reader.ReadRequiredList<string>();
74
+ info.types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
75
+ return info;
76
+ }
77
+ vector<std::string> names;
78
+ vector<LogicalType> types;
79
+ };
80
+
59
81
  struct ReadCSVData : public BaseCSVData {
60
82
  //! The expected SQL types to read from the file
61
83
  vector<LogicalType> csv_types;
@@ -75,6 +97,9 @@ struct ReadCSVData : public BaseCSVData {
75
97
  bool single_threaded = false;
76
98
  //! Reader bind data
77
99
  MultiFileReaderBindData reader_bind;
100
+ //! If all files are On-Disk file (e.g., not a pipe)
101
+ bool file_exists = true;
102
+ vector<ColumnInfo> column_info;
78
103
 
79
104
  void Initialize(unique_ptr<BufferedCSVReader> &reader) {
80
105
  this->initial_reader = std::move(reader);
@@ -58,6 +58,9 @@ struct ClientData {
58
58
  //! The file search path
59
59
  string file_search_path;
60
60
 
61
+ //! The Max Line Length Size of Last Query Executed on a CSV File. (Only used for testing)
62
+ idx_t max_line_length = 0;
63
+
61
64
  public:
62
65
  DUCKDB_API static ClientData &Get(ClientContext &context);
63
66
  };
@@ -143,8 +143,6 @@ struct DBConfigOptions {
143
143
  bool allow_unsigned_extensions = false;
144
144
  //! Enable emitting FSST Vectors
145
145
  bool enable_fsst_vectors = false;
146
- //! Experimental parallel CSV reader
147
- bool experimental_parallel_csv_reader = false;
148
146
  //! Start transactions immediately in all attached databases - instead of lazily when a database is referenced
149
147
  bool immediate_transaction_mode = false;
150
148
  //! The set of unrecognized (other) options
@@ -8,7 +8,7 @@
8
8
 
9
9
  #pragma once
10
10
 
11
- #include "duckdb/common/types/column_data_collection.hpp"
11
+ #include "duckdb/common/types/column/column_data_collection.hpp"
12
12
  #include "duckdb/common/winapi.hpp"
13
13
  #include "duckdb/main/query_result.hpp"
14
14
 
@@ -58,7 +58,16 @@ protected:
58
58
  //! The error (in case execution was not successful)
59
59
  PreservedError error;
60
60
  };
61
-
61
+ struct CurrentChunk {
62
+ //! The current data chunk
63
+ unique_ptr<DataChunk> data_chunk;
64
+ //! The current position in the data chunk
65
+ idx_t position;
66
+ //! If we have a current chunk we must scan for result production
67
+ bool Valid();
68
+ //! The remaining size of the current chunk
69
+ idx_t RemainingSize();
70
+ };
62
71
  //! The QueryResult object holds the result of a query. It can either be a MaterializedQueryResult, in which case the
63
72
  //! result contains the entire result set, or a StreamQueryResult in which case the Fetch method can be called to
64
73
  //! incrementally fetch data from the database.
@@ -75,6 +84,10 @@ public:
75
84
  ClientProperties client_properties;
76
85
  //! The next result (if any)
77
86
  unique_ptr<QueryResult> next;
87
+ //! In case we are converting the result from Native DuckDB to a different library (e.g., Arrow, Polars)
88
+ //! We might be producing chunks of a pre-determined size.
89
+ //! To comply, we use the following variable to store the current chunk, and it's position.
90
+ CurrentChunk current_chunk;
78
91
 
79
92
  public:
80
93
  //! Returns the name of the column for the given index
@@ -37,11 +37,11 @@ public:
37
37
 
38
38
  private:
39
39
  //! Apply a set of rules to a specific expression
40
- static unique_ptr<Expression> ApplyRules(LogicalOperator &op, const vector<Rule *> &rules,
40
+ static unique_ptr<Expression> ApplyRules(LogicalOperator &op, const vector<reference<Rule>> &rules,
41
41
  unique_ptr<Expression> expr, bool &changes_made, bool is_root = false);
42
42
 
43
- LogicalOperator *op;
44
- vector<Rule *> to_apply_rules;
43
+ optional_ptr<LogicalOperator> op;
44
+ vector<reference<Rule>> to_apply_rules;
45
45
  };
46
46
 
47
47
  } // namespace duckdb
@@ -41,9 +41,9 @@ struct RelationsToTDom {
41
41
 
42
42
  struct NodeOp {
43
43
  unique_ptr<JoinNode> node;
44
- LogicalOperator *op;
44
+ LogicalOperator &op;
45
45
 
46
- NodeOp(unique_ptr<JoinNode> node, LogicalOperator *op) : node(std::move(node)), op(op) {};
46
+ NodeOp(unique_ptr<JoinNode> node, LogicalOperator &op) : node(std::move(node)), op(op) {};
47
47
  };
48
48
 
49
49
  struct Subgraph2Denominator {
@@ -71,7 +71,7 @@ private:
71
71
  public:
72
72
  static constexpr double DEFAULT_SELECTIVITY = 0.2;
73
73
 
74
- static void VerifySymmetry(JoinNode *result, JoinNode *entry);
74
+ static void VerifySymmetry(JoinNode &result, JoinNode &entry);
75
75
 
76
76
  //! given a binding of (relation, column) used for DP, and a (table, column) in that catalog
77
77
  //! Add the key value entry into the relation_column_to_original_column
@@ -83,20 +83,20 @@ public:
83
83
  // in the child join plan.
84
84
  void CopyRelationMap(column_binding_map_t<ColumnBinding> &child_binding_map);
85
85
  void MergeBindings(idx_t, idx_t relation_id, vector<column_binding_map_t<ColumnBinding>> &child_binding_maps);
86
- void AddRelationColumnMapping(LogicalGet *get, idx_t relation_id);
86
+ void AddRelationColumnMapping(LogicalGet &get, idx_t relation_id);
87
87
 
88
88
  void InitTotalDomains();
89
- void UpdateTotalDomains(JoinNode *node, LogicalOperator *op);
90
- void InitEquivalentRelations(vector<unique_ptr<FilterInfo>> *filter_infos);
89
+ void UpdateTotalDomains(JoinNode &node, LogicalOperator &op);
90
+ void InitEquivalentRelations(vector<unique_ptr<FilterInfo>> &filter_infos);
91
91
 
92
- void InitCardinalityEstimatorProps(vector<NodeOp> *node_ops, vector<unique_ptr<FilterInfo>> *filter_infos);
93
- double EstimateCardinalityWithSet(JoinRelationSet *new_set);
94
- void EstimateBaseTableCardinality(JoinNode *node, LogicalOperator *op);
95
- double EstimateCrossProduct(const JoinNode *left, const JoinNode *right);
96
- static double ComputeCost(JoinNode *left, JoinNode *right, double expected_cardinality);
92
+ void InitCardinalityEstimatorProps(vector<NodeOp> &node_ops, vector<unique_ptr<FilterInfo>> &filter_infos);
93
+ double EstimateCardinalityWithSet(JoinRelationSet &new_set);
94
+ void EstimateBaseTableCardinality(JoinNode &node, LogicalOperator &op);
95
+ double EstimateCrossProduct(const JoinNode &left, const JoinNode &right);
96
+ static double ComputeCost(JoinNode &left, JoinNode &right, double expected_cardinality);
97
97
 
98
98
  private:
99
- bool SingleColumnFilter(FilterInfo *filter_info);
99
+ bool SingleColumnFilter(FilterInfo &filter_info);
100
100
  //! Filter & bindings -> list of indexes into the equivalent_relations array.
101
101
  // The column binding set at each index is an equivalence set.
102
102
  vector<idx_t> DetermineMatchingEquivalentSets(FilterInfo *filter_info);
@@ -106,16 +106,16 @@ private:
106
106
  //! If there are multiple equivalence sets, they are merged.
107
107
  void AddToEquivalenceSets(FilterInfo *filter_info, vector<idx_t> matching_equivalent_sets);
108
108
 
109
- TableFilterSet *GetTableFilters(LogicalOperator *op, idx_t table_index);
109
+ optional_ptr<TableFilterSet> GetTableFilters(LogicalOperator &op, idx_t table_index);
110
110
 
111
- void AddRelationTdom(FilterInfo *filter_info);
112
- bool EmptyFilter(FilterInfo *filter_info);
111
+ void AddRelationTdom(FilterInfo &filter_info);
112
+ bool EmptyFilter(FilterInfo &filter_info);
113
113
 
114
114
  idx_t InspectConjunctionAND(idx_t cardinality, idx_t column_index, ConjunctionAndFilter *fil,
115
115
  unique_ptr<BaseStatistics> base_stats);
116
116
  idx_t InspectConjunctionOR(idx_t cardinality, idx_t column_index, ConjunctionOrFilter *fil,
117
117
  unique_ptr<BaseStatistics> base_stats);
118
- idx_t InspectTableFilters(idx_t cardinality, LogicalOperator *op, TableFilterSet *table_filters, idx_t table_index);
118
+ idx_t InspectTableFilters(idx_t cardinality, LogicalOperator &op, TableFilterSet &table_filters, idx_t table_index);
119
119
  };
120
120
 
121
121
  } // namespace duckdb
@@ -25,27 +25,27 @@ class JoinOrderOptimizer;
25
25
  class JoinNode {
26
26
  public:
27
27
  //! Represents a node in the join plan
28
- JoinRelationSet *set;
29
- NeighborInfo *info;
28
+ JoinRelationSet &set;
29
+ optional_ptr<NeighborInfo> info;
30
30
  //! If the JoinNode is a base table, then base_cardinality is the cardinality before filters
31
31
  //! estimated_props.cardinality will be the cardinality after filters. With no filters, the two are equal
32
32
  bool has_filter;
33
- JoinNode *left;
34
- JoinNode *right;
33
+ optional_ptr<JoinNode> left;
34
+ optional_ptr<JoinNode> right;
35
35
 
36
36
  unique_ptr<EstimatedProperties> estimated_props;
37
37
 
38
38
  //! Create a leaf node in the join tree
39
39
  //! set cost to 0 for leaf nodes
40
40
  //! cost will be the cost to *produce* an intermediate table
41
- JoinNode(JoinRelationSet *set, const double base_cardinality);
41
+ JoinNode(JoinRelationSet &set, const double base_cardinality);
42
42
 
43
43
  //! Create an intermediate node in the join tree. base_cardinality = estimated_props.cardinality
44
- JoinNode(JoinRelationSet *set, NeighborInfo *info, JoinNode *left, JoinNode *right, const double base_cardinality,
45
- double cost);
44
+ JoinNode(JoinRelationSet &set, optional_ptr<NeighborInfo> info, JoinNode &left, JoinNode &right,
45
+ const double base_cardinality, double cost);
46
46
 
47
47
  bool operator==(const JoinNode &other) {
48
- return other.set->ToString().compare(set->ToString()) == 0;
48
+ return other.set.ToString().compare(set.ToString()) == 0;
49
49
  }
50
50
 
51
51
  private:
@@ -22,6 +22,14 @@
22
22
 
23
23
  namespace duckdb {
24
24
 
25
+ struct GenerateJoinRelation {
26
+ GenerateJoinRelation(JoinRelationSet &set, unique_ptr<LogicalOperator> op_p) : set(set), op(std::move(op_p)) {
27
+ }
28
+
29
+ JoinRelationSet &set;
30
+ unique_ptr<LogicalOperator> op;
31
+ };
32
+
25
33
  class JoinOrderOptimizer {
26
34
  public:
27
35
  explicit JoinOrderOptimizer(ClientContext &context)
@@ -31,8 +39,9 @@ public:
31
39
  //! Perform join reordering inside a plan
32
40
  unique_ptr<LogicalOperator> Optimize(unique_ptr<LogicalOperator> plan);
33
41
 
34
- unique_ptr<JoinNode> CreateJoinTree(JoinRelationSet *set, const vector<NeighborInfo *> &possible_connections,
35
- JoinNode *left, JoinNode *right);
42
+ unique_ptr<JoinNode> CreateJoinTree(JoinRelationSet &set,
43
+ const vector<reference<NeighborInfo>> &possible_connections, JoinNode &left,
44
+ JoinNode &right);
36
45
 
37
46
  private:
38
47
  ClientContext &context;
@@ -71,23 +80,23 @@ private:
71
80
 
72
81
  //! Traverse the query tree to find (1) base relations, (2) existing join conditions and (3) filters that can be
73
82
  //! rewritten into joins. Returns true if there are joins in the tree that can be reordered, false otherwise.
74
- bool ExtractJoinRelations(LogicalOperator &input_op, vector<LogicalOperator *> &filter_operators,
75
- LogicalOperator *parent = nullptr);
83
+ bool ExtractJoinRelations(LogicalOperator &input_op, vector<reference<LogicalOperator>> &filter_operators,
84
+ optional_ptr<LogicalOperator> parent = nullptr);
76
85
 
77
86
  //! Emit a pair as a potential join candidate. Returns the best plan found for the (left, right) connection (either
78
87
  //! the newly created plan, or an existing plan)
79
- JoinNode *EmitPair(JoinRelationSet *left, JoinRelationSet *right, const vector<NeighborInfo *> &info);
88
+ JoinNode &EmitPair(JoinRelationSet &left, JoinRelationSet &right, const vector<reference<NeighborInfo>> &info);
80
89
  //! Tries to emit a potential join candidate pair. Returns false if too many pairs have already been emitted,
81
90
  //! cancelling the dynamic programming step.
82
- bool TryEmitPair(JoinRelationSet *left, JoinRelationSet *right, const vector<NeighborInfo *> &info);
91
+ bool TryEmitPair(JoinRelationSet &left, JoinRelationSet &right, const vector<reference<NeighborInfo>> &info);
83
92
 
84
- bool EnumerateCmpRecursive(JoinRelationSet *left, JoinRelationSet *right, unordered_set<idx_t> exclusion_set);
93
+ bool EnumerateCmpRecursive(JoinRelationSet &left, JoinRelationSet &right, unordered_set<idx_t> exclusion_set);
85
94
  //! Emit a relation set node
86
- bool EmitCSG(JoinRelationSet *node);
95
+ bool EmitCSG(JoinRelationSet &node);
87
96
  //! Enumerate the possible connected subgraphs that can be joined together in the join graph
88
- bool EnumerateCSGRecursive(JoinRelationSet *node, unordered_set<idx_t> &exclusion_set);
97
+ bool EnumerateCSGRecursive(JoinRelationSet &node, unordered_set<idx_t> &exclusion_set);
89
98
  //! Rewrite a logical query plan given the join plan
90
- unique_ptr<LogicalOperator> RewritePlan(unique_ptr<LogicalOperator> plan, JoinNode *node);
99
+ unique_ptr<LogicalOperator> RewritePlan(unique_ptr<LogicalOperator> plan, JoinNode &node);
91
100
  //! Generate cross product edges inside the side
92
101
  void GenerateCrossProducts();
93
102
  //! Perform the join order solving
@@ -98,13 +107,12 @@ private:
98
107
  //! Solve the join order approximately using a greedy algorithm
99
108
  void SolveJoinOrderApproximately();
100
109
 
101
- void UpdateDPTree(JoinNode *new_plan);
110
+ void UpdateDPTree(JoinNode &new_plan);
102
111
 
103
- void UpdateJoinNodesInFullPlan(JoinNode *node);
104
- bool NodeInFullPlan(JoinNode *node);
112
+ void UpdateJoinNodesInFullPlan(JoinNode &node);
113
+ bool NodeInFullPlan(JoinNode &node);
105
114
 
106
- std::pair<JoinRelationSet *, unique_ptr<LogicalOperator>>
107
- GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted_relations, JoinNode *node);
115
+ GenerateJoinRelation GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted_relations, JoinNode &node);
108
116
  };
109
117
 
110
118
  } // namespace duckdb
@@ -11,18 +11,17 @@
11
11
  #include "duckdb/common/common.hpp"
12
12
  #include "duckdb/common/unordered_map.hpp"
13
13
  #include "duckdb/common/unordered_set.hpp"
14
+ #include "duckdb/common/optional_ptr.hpp"
14
15
 
15
16
  namespace duckdb {
16
17
  class LogicalOperator;
17
18
 
18
19
  //! Represents a single relation and any metadata accompanying that relation
19
20
  struct SingleJoinRelation {
20
- LogicalOperator *op;
21
- LogicalOperator *parent;
21
+ LogicalOperator &op;
22
+ optional_ptr<LogicalOperator> parent;
22
23
 
23
- SingleJoinRelation() {
24
- }
25
- SingleJoinRelation(LogicalOperator *op, LogicalOperator *parent) : op(op), parent(parent) {
24
+ SingleJoinRelation(LogicalOperator &op, optional_ptr<LogicalOperator> parent) : op(op), parent(parent) {
26
25
  }
27
26
  };
28
27
 
@@ -36,7 +35,7 @@ struct JoinRelationSet {
36
35
  unique_ptr<idx_t[]> relations;
37
36
  idx_t count;
38
37
 
39
- static bool IsSubset(JoinRelationSet *super, JoinRelationSet *sub);
38
+ static bool IsSubset(JoinRelationSet &super, JoinRelationSet &sub);
40
39
  };
41
40
 
42
41
  //! The JoinRelationTree is a structure holding all the created JoinRelationSet objects and allowing fast lookup on to
@@ -52,13 +51,13 @@ public:
52
51
 
53
52
  public:
54
53
  //! Create or get a JoinRelationSet from a single node with the given index
55
- JoinRelationSet *GetJoinRelation(idx_t index);
54
+ JoinRelationSet &GetJoinRelation(idx_t index);
56
55
  //! Create or get a JoinRelationSet from a set of relation bindings
57
- JoinRelationSet *GetJoinRelation(unordered_set<idx_t> &bindings);
56
+ JoinRelationSet &GetJoinRelation(unordered_set<idx_t> &bindings);
58
57
  //! Create or get a JoinRelationSet from a (sorted, duplicate-free!) list of relations
59
- JoinRelationSet *GetJoinRelation(unique_ptr<idx_t[]> relations, idx_t count);
58
+ JoinRelationSet &GetJoinRelation(unique_ptr<idx_t[]> relations, idx_t count);
60
59
  //! Union two sets of relations together and create a new relation set
61
- JoinRelationSet *Union(JoinRelationSet *left, JoinRelationSet *right);
60
+ JoinRelationSet &Union(JoinRelationSet &left, JoinRelationSet &right);
62
61
  // //! Create the set difference of left \ right (i.e. all elements in left that are not in right)
63
62
  // JoinRelationSet *Difference(JoinRelationSet *left, JoinRelationSet *right);
64
63
 
@@ -15,6 +15,7 @@
15
15
  #include "duckdb/optimizer/join_order/join_relation.hpp"
16
16
  #include "duckdb/common/vector.hpp"
17
17
  #include "duckdb/planner/column_binding.hpp"
18
+ #include "duckdb/common/optional_ptr.hpp"
18
19
 
19
20
  #include <functional>
20
21
 
@@ -23,22 +24,28 @@ class Expression;
23
24
  class LogicalOperator;
24
25
 
25
26
  struct FilterInfo {
27
+ FilterInfo(JoinRelationSet &set, idx_t filter_index) : set(set), filter_index(filter_index) {
28
+ }
29
+
30
+ JoinRelationSet &set;
26
31
  idx_t filter_index;
27
- JoinRelationSet *left_set = nullptr;
28
- JoinRelationSet *right_set = nullptr;
32
+ optional_ptr<JoinRelationSet> left_set;
33
+ optional_ptr<JoinRelationSet> right_set;
29
34
  ColumnBinding left_binding;
30
35
  ColumnBinding right_binding;
31
- JoinRelationSet *set = nullptr;
32
36
  };
33
37
 
34
38
  struct FilterNode {
35
- vector<FilterInfo *> filters;
39
+ vector<reference<FilterInfo>> filters;
36
40
  unordered_map<idx_t, unique_ptr<FilterNode>> children;
37
41
  };
38
42
 
39
43
  struct NeighborInfo {
40
- JoinRelationSet *neighbor;
41
- vector<FilterInfo *> filters;
44
+ NeighborInfo(JoinRelationSet &neighbor) : neighbor(neighbor) {
45
+ }
46
+
47
+ JoinRelationSet &neighbor;
48
+ vector<reference<FilterInfo>> filters;
42
49
  };
43
50
 
44
51
  //! The QueryGraph contains edges between relations and allows edges to be created/queried
@@ -55,18 +62,18 @@ public:
55
62
  void Print();
56
63
 
57
64
  //! Create an edge in the edge_set
58
- void CreateEdge(JoinRelationSet *left, JoinRelationSet *right, FilterInfo *info);
65
+ void CreateEdge(JoinRelationSet &left, JoinRelationSet &right, optional_ptr<FilterInfo> info);
59
66
  //! Returns a connection if there is an edge that connects these two sets, or nullptr otherwise
60
- vector<NeighborInfo *> GetConnections(JoinRelationSet *node, JoinRelationSet *other);
67
+ vector<reference<NeighborInfo>> GetConnections(JoinRelationSet &node, JoinRelationSet &other);
61
68
  //! Enumerate the neighbors of a specific node that do not belong to any of the exclusion_set. Note that if a
62
69
  //! neighbor has multiple nodes, this function will return the lowest entry in that set.
63
- vector<idx_t> GetNeighbors(JoinRelationSet *node, unordered_set<idx_t> &exclusion_set);
70
+ vector<idx_t> GetNeighbors(JoinRelationSet &node, unordered_set<idx_t> &exclusion_set);
64
71
  //! Enumerate all neighbors of a given JoinRelationSet node
65
- void EnumerateNeighbors(JoinRelationSet *node, const std::function<bool(NeighborInfo *)> &callback);
72
+ void EnumerateNeighbors(JoinRelationSet &node, const std::function<bool(NeighborInfo &)> &callback);
66
73
 
67
74
  private:
68
75
  //! Get the QueryEdge of a specific node
69
- QueryEdge *GetQueryEdge(JoinRelationSet *left);
76
+ QueryEdge &GetQueryEdge(JoinRelationSet &left);
70
77
 
71
78
  QueryEdge root;
72
79
  };
@@ -61,7 +61,7 @@ public:
61
61
 
62
62
  public:
63
63
  //! Build the MetaPipeline with 'op' as the first operator (excl. the shared sink)
64
- void Build(PhysicalOperator *op);
64
+ void Build(PhysicalOperator &op);
65
65
  //! Ready all the pipelines (recursively)
66
66
  void Ready();
67
67
 
@@ -29,7 +29,11 @@ struct ExportedTableData {
29
29
  };
30
30
 
31
31
  struct ExportedTableInfo {
32
- TableCatalogEntry *entry;
32
+ ExportedTableInfo(TableCatalogEntry &entry, ExportedTableData table_data)
33
+ : entry(entry), table_data(std::move(table_data)) {
34
+ }
35
+
36
+ TableCatalogEntry &entry;
33
37
  ExportedTableData table_data;
34
38
  };
35
39
 
@@ -12,6 +12,7 @@
12
12
  #include "duckdb/parser/tableref.hpp"
13
13
  #include "duckdb/planner/tableref/bound_basetableref.hpp"
14
14
  #include "duckdb/common/unordered_map.hpp"
15
+ #include "duckdb/common/optional_ptr.hpp"
15
16
 
16
17
  namespace duckdb {
17
18
 
@@ -22,7 +23,7 @@ struct VacuumOptions {
22
23
 
23
24
  struct VacuumInfo : public ParseInfo {
24
25
  public:
25
- explicit VacuumInfo(VacuumOptions options) : options(options), has_table(false), table(nullptr) {};
26
+ explicit VacuumInfo(VacuumOptions options) : options(options), has_table(false) {};
26
27
 
27
28
  unique_ptr<VacuumInfo> Copy() {
28
29
  auto result = make_uniq<VacuumInfo>(options);
@@ -38,7 +39,7 @@ public:
38
39
  public:
39
40
  bool has_table;
40
41
  unique_ptr<TableRef> ref;
41
- TableCatalogEntry *table;
42
+ optional_ptr<TableCatalogEntry> table;
42
43
  unordered_map<idx_t, idx_t> column_id_map;
43
44
  vector<string> columns;
44
45
  };