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.
Files changed (254) hide show
  1. package/binding.gyp +1 -0
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-datepart.cpp +55 -1
  4. package/src/duckdb/extension/parquet/parquet-extension.cpp +5 -4
  5. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +18 -7
  6. package/src/duckdb/src/catalog/default/default_functions.cpp +2 -0
  7. package/src/duckdb/src/common/arrow/arrow_appender.cpp +3 -3
  8. package/src/duckdb/src/common/arrow/arrow_converter.cpp +2 -2
  9. package/src/duckdb/src/common/local_file_system.cpp +1 -3
  10. package/src/duckdb/src/common/multi_file_reader.cpp +11 -8
  11. package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
  12. package/src/duckdb/src/common/string_util.cpp +6 -1
  13. package/src/duckdb/src/core_functions/function_list.cpp +2 -0
  14. package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
  15. package/src/duckdb/src/execution/index/art/art.cpp +5 -1
  16. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +62 -43
  17. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +17 -11
  18. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +32 -39
  19. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +10 -9
  20. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +4 -4
  21. package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +6 -21
  22. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +13 -13
  23. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +15 -14
  24. package/src/duckdb/src/execution/operator/helper/physical_load.cpp +3 -2
  25. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
  26. package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +4 -2
  27. package/src/duckdb/src/execution/operator/helper/physical_prepare.cpp +4 -2
  28. package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +10 -8
  29. package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +4 -3
  30. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +7 -6
  31. package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -2
  32. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +8 -8
  33. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +17 -16
  34. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +10 -8
  35. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -4
  36. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -5
  37. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +16 -15
  38. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +13 -12
  39. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +12 -10
  40. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -11
  41. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +8 -6
  42. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
  43. package/src/duckdb/src/execution/operator/order/physical_order.cpp +13 -13
  44. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +8 -8
  45. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +160 -145
  46. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +10 -25
  47. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +14 -19
  48. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +7 -6
  49. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +18 -30
  50. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +14 -18
  51. package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +6 -4
  52. package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +4 -19
  53. package/src/duckdb/src/execution/operator/scan/physical_empty_result.cpp +3 -2
  54. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +14 -5
  55. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -4
  56. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +3 -19
  57. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +4 -18
  58. package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +4 -19
  59. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -9
  60. package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +4 -19
  61. package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +4 -19
  62. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -19
  63. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +20 -28
  64. package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
  65. package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
  66. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
  67. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
  68. package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
  69. package/src/duckdb/src/execution/physical_operator.cpp +11 -5
  70. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
  71. package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
  72. package/src/duckdb/src/function/table/read_csv.cpp +7 -4
  73. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  74. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +7 -1
  75. package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +16 -4
  76. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -4
  77. package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
  78. package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
  79. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
  80. package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
  81. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +5 -8
  82. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +2 -4
  83. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -7
  84. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -4
  85. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -2
  86. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -5
  87. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -4
  88. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -4
  89. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -2
  90. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -2
  91. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -2
  92. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -2
  93. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -4
  94. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +1 -2
  95. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -2
  96. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -2
  97. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -4
  98. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -4
  99. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +2 -4
  100. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -2
  101. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +1 -2
  102. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -4
  103. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -4
  104. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -4
  105. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -4
  106. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -4
  107. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -4
  108. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -4
  109. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -5
  110. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -5
  111. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -4
  112. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -4
  113. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -4
  114. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -4
  115. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -2
  116. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -3
  117. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -2
  118. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +1 -2
  119. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +1 -2
  120. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -3
  121. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -3
  122. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -3
  123. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -4
  124. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -3
  125. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -3
  126. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +1 -3
  127. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +6 -5
  128. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
  129. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
  130. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
  131. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
  132. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +7 -4
  133. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +26 -6
  134. package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +5 -5
  135. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
  136. package/src/duckdb/src/include/duckdb/function/table_function.hpp +0 -1
  137. package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
  138. package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
  139. package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
  140. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
  141. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +0 -2
  142. package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
  143. package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +63 -0
  144. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +16 -3
  145. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +51 -7
  146. package/src/duckdb/src/include/duckdb/parallel/task.hpp +21 -2
  147. package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +2 -2
  148. package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +2 -2
  149. package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +3 -0
  150. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +5 -1
  151. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +6 -0
  152. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -0
  153. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +1 -0
  154. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -0
  155. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
  156. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -0
  157. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -0
  158. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -0
  159. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -0
  160. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -0
  161. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +1 -0
  162. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +1 -0
  163. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +1 -0
  164. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +1 -0
  165. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -0
  166. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -0
  167. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +1 -0
  168. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
  169. package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +46 -0
  170. package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +24 -3
  171. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +46 -1
  172. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +9 -10
  173. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -1
  174. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -2
  175. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +3 -3
  176. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -0
  177. package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +1 -1
  178. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +22 -0
  179. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +3 -3
  180. package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -2
  181. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -2
  182. package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -2
  183. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -34
  184. package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +25 -0
  185. package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +5 -0
  186. package/src/duckdb/src/main/attached_database.cpp +5 -3
  187. package/src/duckdb/src/main/client_verify.cpp +4 -0
  188. package/src/duckdb/src/main/config.cpp +4 -0
  189. package/src/duckdb/src/main/database.cpp +45 -48
  190. package/src/duckdb/src/main/extension/extension_load.cpp +32 -49
  191. package/src/duckdb/src/parallel/event.cpp +1 -1
  192. package/src/duckdb/src/parallel/executor.cpp +39 -3
  193. package/src/duckdb/src/parallel/executor_task.cpp +11 -0
  194. package/src/duckdb/src/parallel/interrupt.cpp +57 -0
  195. package/src/duckdb/src/parallel/pipeline.cpp +49 -6
  196. package/src/duckdb/src/parallel/pipeline_executor.cpp +248 -69
  197. package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
  198. package/src/duckdb/src/parallel/task_scheduler.cpp +57 -22
  199. package/src/duckdb/src/parser/base_expression.cpp +6 -0
  200. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +1 -4
  201. package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -4
  202. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +43 -24
  203. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
  204. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +17 -28
  205. package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +17 -3
  206. package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +8 -2
  207. package/src/duckdb/src/planner/operator/logical_aggregate.cpp +13 -1
  208. package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
  209. package/src/duckdb/src/planner/operator/logical_cteref.cpp +11 -0
  210. package/src/duckdb/src/planner/operator/logical_delete.cpp +10 -0
  211. package/src/duckdb/src/planner/operator/logical_delim_get.cpp +12 -1
  212. package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +12 -1
  213. package/src/duckdb/src/planner/operator/logical_expression_get.cpp +12 -1
  214. package/src/duckdb/src/planner/operator/logical_get.cpp +10 -4
  215. package/src/duckdb/src/planner/operator/logical_insert.cpp +12 -1
  216. package/src/duckdb/src/planner/operator/logical_pivot.cpp +11 -0
  217. package/src/duckdb/src/planner/operator/logical_projection.cpp +11 -0
  218. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +11 -0
  219. package/src/duckdb/src/planner/operator/logical_set_operation.cpp +11 -0
  220. package/src/duckdb/src/planner/operator/logical_unnest.cpp +12 -1
  221. package/src/duckdb/src/planner/operator/logical_update.cpp +10 -0
  222. package/src/duckdb/src/planner/operator/logical_window.cpp +11 -0
  223. package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
  224. package/src/duckdb/src/storage/data_table.cpp +5 -0
  225. package/src/duckdb/src/storage/local_storage.cpp +40 -110
  226. package/src/duckdb/src/storage/optimistic_data_writer.cpp +96 -0
  227. package/src/duckdb/src/storage/partial_block_manager.cpp +73 -9
  228. package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -1
  229. package/src/duckdb/src/storage/standard_buffer_manager.cpp +17 -12
  230. package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -0
  231. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +90 -82
  232. package/src/duckdb/src/storage/table/column_data.cpp +19 -45
  233. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +7 -7
  234. package/src/duckdb/src/storage/table/column_segment.cpp +1 -1
  235. package/src/duckdb/src/storage/table/list_column_data.cpp +6 -11
  236. package/src/duckdb/src/storage/table/row_group.cpp +13 -14
  237. package/src/duckdb/src/storage/table/row_group_collection.cpp +10 -4
  238. package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -10
  239. package/src/duckdb/src/storage/table/struct_column_data.cpp +7 -13
  240. package/src/duckdb/src/storage/table/update_segment.cpp +0 -25
  241. package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -6
  242. package/src/duckdb/src/transaction/commit_state.cpp +4 -4
  243. package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +13 -0
  244. package/src/duckdb/src/verification/statement_verifier.cpp +4 -0
  245. package/src/duckdb/third_party/fmt/format.cc +0 -5
  246. package/src/duckdb/third_party/fmt/include/fmt/core.h +10 -12
  247. package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +2 -33
  248. package/src/duckdb/third_party/fmt/include/fmt/format.h +61 -24
  249. package/src/duckdb/third_party/fmt/include/fmt/printf.h +15 -1
  250. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +1 -0
  251. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +10735 -10674
  252. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
  253. package/src/duckdb/ub_src_parallel.cpp +2 -0
  254. package/src/duckdb/ub_src_storage.cpp +2 -0
@@ -24,15 +24,15 @@ struct SchedulerThread {
24
24
  };
25
25
 
26
26
  #ifndef DUCKDB_NO_THREADS
27
- typedef duckdb_moodycamel::ConcurrentQueue<unique_ptr<Task>> concurrent_queue_t;
27
+ typedef duckdb_moodycamel::ConcurrentQueue<shared_ptr<Task>> concurrent_queue_t;
28
28
  typedef duckdb_moodycamel::LightweightSemaphore lightweight_semaphore_t;
29
29
 
30
30
  struct ConcurrentQueue {
31
31
  concurrent_queue_t q;
32
32
  lightweight_semaphore_t semaphore;
33
33
 
34
- void Enqueue(ProducerToken &token, unique_ptr<Task> task);
35
- bool DequeueFromProducer(ProducerToken &token, unique_ptr<Task> &task);
34
+ void Enqueue(ProducerToken &token, shared_ptr<Task> task);
35
+ bool DequeueFromProducer(ProducerToken &token, shared_ptr<Task> &task);
36
36
  };
37
37
 
38
38
  struct QueueProducerToken {
@@ -42,7 +42,7 @@ struct QueueProducerToken {
42
42
  duckdb_moodycamel::ProducerToken queue_token;
43
43
  };
44
44
 
45
- void ConcurrentQueue::Enqueue(ProducerToken &token, unique_ptr<Task> task) {
45
+ void ConcurrentQueue::Enqueue(ProducerToken &token, shared_ptr<Task> task) {
46
46
  lock_guard<mutex> producer_lock(token.producer_lock);
47
47
  if (q.enqueue(token.token->queue_token, std::move(task))) {
48
48
  semaphore.signal();
@@ -51,26 +51,26 @@ void ConcurrentQueue::Enqueue(ProducerToken &token, unique_ptr<Task> task) {
51
51
  }
52
52
  }
53
53
 
54
- bool ConcurrentQueue::DequeueFromProducer(ProducerToken &token, unique_ptr<Task> &task) {
54
+ bool ConcurrentQueue::DequeueFromProducer(ProducerToken &token, shared_ptr<Task> &task) {
55
55
  lock_guard<mutex> producer_lock(token.producer_lock);
56
56
  return q.try_dequeue_from_producer(token.token->queue_token, task);
57
57
  }
58
58
 
59
59
  #else
60
60
  struct ConcurrentQueue {
61
- std::queue<unique_ptr<Task>> q;
61
+ std::queue<shared_ptr<Task>> q;
62
62
  mutex qlock;
63
63
 
64
- void Enqueue(ProducerToken &token, unique_ptr<Task> task);
65
- bool DequeueFromProducer(ProducerToken &token, unique_ptr<Task> &task);
64
+ void Enqueue(ProducerToken &token, shared_ptr<Task> task);
65
+ bool DequeueFromProducer(ProducerToken &token, shared_ptr<Task> &task);
66
66
  };
67
67
 
68
- void ConcurrentQueue::Enqueue(ProducerToken &token, unique_ptr<Task> task) {
68
+ void ConcurrentQueue::Enqueue(ProducerToken &token, shared_ptr<Task> task) {
69
69
  lock_guard<mutex> lock(qlock);
70
70
  q.push(std::move(task));
71
71
  }
72
72
 
73
- bool ConcurrentQueue::DequeueFromProducer(ProducerToken &token, unique_ptr<Task> &task) {
73
+ bool ConcurrentQueue::DequeueFromProducer(ProducerToken &token, shared_ptr<Task> &task) {
74
74
  lock_guard<mutex> lock(qlock);
75
75
  if (q.empty()) {
76
76
  return false;
@@ -115,25 +115,37 @@ unique_ptr<ProducerToken> TaskScheduler::CreateProducer() {
115
115
  return make_uniq<ProducerToken>(*this, std::move(token));
116
116
  }
117
117
 
118
- void TaskScheduler::ScheduleTask(ProducerToken &token, unique_ptr<Task> task) {
118
+ void TaskScheduler::ScheduleTask(ProducerToken &token, shared_ptr<Task> task) {
119
119
  // Enqueue a task for the given producer token and signal any sleeping threads
120
120
  queue->Enqueue(token, std::move(task));
121
121
  }
122
122
 
123
- bool TaskScheduler::GetTaskFromProducer(ProducerToken &token, unique_ptr<Task> &task) {
123
+ bool TaskScheduler::GetTaskFromProducer(ProducerToken &token, shared_ptr<Task> &task) {
124
124
  return queue->DequeueFromProducer(token, task);
125
125
  }
126
126
 
127
127
  void TaskScheduler::ExecuteForever(atomic<bool> *marker) {
128
128
  #ifndef DUCKDB_NO_THREADS
129
- unique_ptr<Task> task;
129
+ shared_ptr<Task> task;
130
130
  // loop until the marker is set to false
131
131
  while (*marker) {
132
132
  // wait for a signal with a timeout
133
133
  queue->semaphore.wait();
134
134
  if (queue->q.try_dequeue(task)) {
135
- task->Execute(TaskExecutionMode::PROCESS_ALL);
136
- task.reset();
135
+ auto execute_result = task->Execute(TaskExecutionMode::PROCESS_ALL);
136
+
137
+ switch (execute_result) {
138
+ case TaskExecutionResult::TASK_FINISHED:
139
+ case TaskExecutionResult::TASK_ERROR:
140
+ task.reset();
141
+ break;
142
+ case TaskExecutionResult::TASK_NOT_FINISHED:
143
+ throw InternalException("Task should not return TASK_NOT_FINISHED in PROCESS_ALL mode");
144
+ case TaskExecutionResult::TASK_BLOCKED:
145
+ task->Deschedule();
146
+ task.reset();
147
+ break;
148
+ }
137
149
  }
138
150
  }
139
151
  #else
@@ -146,13 +158,25 @@ idx_t TaskScheduler::ExecuteTasks(atomic<bool> *marker, idx_t max_tasks) {
146
158
  idx_t completed_tasks = 0;
147
159
  // loop until the marker is set to false
148
160
  while (*marker && completed_tasks < max_tasks) {
149
- unique_ptr<Task> task;
161
+ shared_ptr<Task> task;
150
162
  if (!queue->q.try_dequeue(task)) {
151
163
  return completed_tasks;
152
164
  }
153
- task->Execute(TaskExecutionMode::PROCESS_ALL);
154
- task.reset();
155
- completed_tasks++;
165
+ auto execute_result = task->Execute(TaskExecutionMode::PROCESS_ALL);
166
+
167
+ switch (execute_result) {
168
+ case TaskExecutionResult::TASK_FINISHED:
169
+ case TaskExecutionResult::TASK_ERROR:
170
+ task.reset();
171
+ completed_tasks++;
172
+ break;
173
+ case TaskExecutionResult::TASK_NOT_FINISHED:
174
+ throw InternalException("Task should not return TASK_NOT_FINISHED in PROCESS_ALL mode");
175
+ case TaskExecutionResult::TASK_BLOCKED:
176
+ task->Deschedule();
177
+ task.reset();
178
+ break;
179
+ }
156
180
  }
157
181
  return completed_tasks;
158
182
  #else
@@ -162,15 +186,26 @@ idx_t TaskScheduler::ExecuteTasks(atomic<bool> *marker, idx_t max_tasks) {
162
186
 
163
187
  void TaskScheduler::ExecuteTasks(idx_t max_tasks) {
164
188
  #ifndef DUCKDB_NO_THREADS
165
- unique_ptr<Task> task;
189
+ shared_ptr<Task> task;
166
190
  for (idx_t i = 0; i < max_tasks; i++) {
167
191
  queue->semaphore.wait(TASK_TIMEOUT_USECS);
168
192
  if (!queue->q.try_dequeue(task)) {
169
193
  return;
170
194
  }
171
195
  try {
172
- task->Execute(TaskExecutionMode::PROCESS_ALL);
173
- task.reset();
196
+ auto execute_result = task->Execute(TaskExecutionMode::PROCESS_ALL);
197
+ switch (execute_result) {
198
+ case TaskExecutionResult::TASK_FINISHED:
199
+ case TaskExecutionResult::TASK_ERROR:
200
+ task.reset();
201
+ break;
202
+ case TaskExecutionResult::TASK_NOT_FINISHED:
203
+ throw InternalException("Task should not return TASK_NOT_FINISHED in PROCESS_ALL mode");
204
+ case TaskExecutionResult::TASK_BLOCKED:
205
+ task->Deschedule();
206
+ task.reset();
207
+ break;
208
+ }
174
209
  } catch (...) {
175
210
  return;
176
211
  }
@@ -1,5 +1,6 @@
1
1
  #include "duckdb/parser/base_expression.hpp"
2
2
 
3
+ #include "duckdb/main/config.hpp"
3
4
  #include "duckdb/common/printer.hpp"
4
5
 
5
6
  namespace duckdb {
@@ -9,6 +10,11 @@ void BaseExpression::Print() const {
9
10
  }
10
11
 
11
12
  string BaseExpression::GetName() const {
13
+ #ifdef DEBUG
14
+ if (DBConfigOptions::debug_print_bindings) {
15
+ return ToString();
16
+ }
17
+ #endif
12
18
  return !alias.empty() ? alias : ToString();
13
19
  }
14
20
 
@@ -29,10 +29,7 @@ unique_ptr<CreateStatement> Transformer::TransformCreateFunction(duckdb_libpgque
29
29
  auto query_node = TransformSelect(stmt->query, true)->node->Copy();
30
30
  macro_func = make_uniq<TableMacroFunction>(std::move(query_node));
31
31
  }
32
- if (HasPivotEntries()) {
33
- throw ParserException("Cannot use PIVOT statement syntax in a macro. Use the SQL standard PIVOT syntax in the "
34
- "FROM clause instead.");
35
- }
32
+ PivotEntryCheck("macro");
36
33
 
37
34
  auto info =
38
35
  make_uniq<CreateMacroInfo>((stmt->function ? CatalogType::MACRO_ENTRY : CatalogType::TABLE_MACRO_ENTRY));
@@ -26,10 +26,8 @@ unique_ptr<CreateStatement> Transformer::TransformCreateView(duckdb_libpgquery::
26
26
  info->on_conflict = TransformOnConflict(stmt->onconflict);
27
27
 
28
28
  info->query = TransformSelect(stmt->query, false);
29
- if (HasPivotEntries()) {
30
- throw ParserException("Cannot use PIVOT statement syntax in a view. Use the SQL standard PIVOT syntax in the "
31
- "FROM clause instead.");
32
- }
29
+
30
+ PivotEntryCheck("view");
33
31
 
34
32
  if (stmt->aliases && stmt->aliases->length > 0) {
35
33
  for (auto c = stmt->aliases->head; c != nullptr; c = lnext(c)) {
@@ -18,33 +18,45 @@
18
18
 
19
19
  namespace duckdb {
20
20
 
21
- void Transformer::AddPivotEntry(string enum_name, unique_ptr<SelectNode> base, unique_ptr<ParsedExpression> column) {
21
+ void Transformer::AddPivotEntry(string enum_name, unique_ptr<SelectNode> base, unique_ptr<ParsedExpression> column,
22
+ unique_ptr<QueryNode> subquery) {
22
23
  if (parent) {
23
- parent->AddPivotEntry(std::move(enum_name), std::move(base), std::move(column));
24
+ parent->AddPivotEntry(std::move(enum_name), std::move(base), std::move(column), std::move(subquery));
24
25
  return;
25
26
  }
26
27
  auto result = make_uniq<CreatePivotEntry>();
27
28
  result->enum_name = std::move(enum_name);
28
29
  result->base = std::move(base);
29
30
  result->column = std::move(column);
31
+ result->subquery = std::move(subquery);
30
32
 
31
33
  pivot_entries.push_back(std::move(result));
32
34
  }
33
35
 
34
36
  bool Transformer::HasPivotEntries() {
35
- if (parent) {
36
- return parent->HasPivotEntries();
37
- }
38
- return !pivot_entries.empty();
37
+ return !GetPivotEntries().empty();
39
38
  }
40
39
 
41
40
  idx_t Transformer::PivotEntryCount() {
41
+ return GetPivotEntries().size();
42
+ }
43
+
44
+ vector<unique_ptr<Transformer::CreatePivotEntry>> &Transformer::GetPivotEntries() {
42
45
  if (parent) {
43
- return parent->PivotEntryCount();
46
+ return parent->GetPivotEntries();
44
47
  }
45
- return pivot_entries.size();
48
+ return pivot_entries;
46
49
  }
47
50
 
51
+ void Transformer::PivotEntryCheck(const string &type) {
52
+ auto &entries = GetPivotEntries();
53
+ if (!entries.empty()) {
54
+ throw ParserException(
55
+ "PIVOT statements with pivot elements extracted from the data cannot be used in %ss.\nIn order to use "
56
+ "PIVOT in a %s the PIVOT values must be manually specified, e.g.:\nPIVOT ... ON %s IN (val1, val2, ...)",
57
+ type, type, entries[0]->column->ToString());
58
+ }
59
+ }
48
60
  unique_ptr<SQLStatement> Transformer::GenerateCreateEnumStmt(unique_ptr<CreatePivotEntry> entry) {
49
61
  auto result = make_uniq<CreateStatement>();
50
62
  auto info = make_uniq<CreateTypeInfo>();
@@ -57,23 +69,30 @@ unique_ptr<SQLStatement> Transformer::GenerateCreateEnumStmt(unique_ptr<CreatePi
57
69
  info->on_conflict = OnCreateConflict::REPLACE_ON_CONFLICT;
58
70
 
59
71
  // generate the query that will result in the enum creation
60
- auto select_node = std::move(entry->base);
61
- auto columnref = entry->column->Copy();
62
- auto cast = make_uniq<CastExpression>(LogicalType::VARCHAR, std::move(columnref));
63
- select_node->select_list.push_back(std::move(cast));
64
-
65
- auto is_not_null = make_uniq<OperatorExpression>(ExpressionType::OPERATOR_IS_NOT_NULL, std::move(entry->column));
66
- select_node->where_clause = std::move(is_not_null);
67
-
68
- // order by the column
69
- select_node->modifiers.push_back(make_uniq<DistinctModifier>());
70
- auto modifier = make_uniq<OrderModifier>();
71
- modifier->orders.emplace_back(OrderType::ASCENDING, OrderByNullType::ORDER_DEFAULT,
72
- make_uniq<ConstantExpression>(Value::INTEGER(1)));
73
- select_node->modifiers.push_back(std::move(modifier));
72
+ unique_ptr<QueryNode> subselect;
73
+ if (!entry->subquery) {
74
+ auto select_node = std::move(entry->base);
75
+ auto columnref = entry->column->Copy();
76
+ auto cast = make_uniq<CastExpression>(LogicalType::VARCHAR, std::move(columnref));
77
+ select_node->select_list.push_back(std::move(cast));
78
+
79
+ auto is_not_null =
80
+ make_uniq<OperatorExpression>(ExpressionType::OPERATOR_IS_NOT_NULL, std::move(entry->column));
81
+ select_node->where_clause = std::move(is_not_null);
82
+
83
+ // order by the column
84
+ select_node->modifiers.push_back(make_uniq<DistinctModifier>());
85
+ auto modifier = make_uniq<OrderModifier>();
86
+ modifier->orders.emplace_back(OrderType::ASCENDING, OrderByNullType::ORDER_DEFAULT,
87
+ make_uniq<ConstantExpression>(Value::INTEGER(1)));
88
+ select_node->modifiers.push_back(std::move(modifier));
89
+ subselect = std::move(select_node);
90
+ } else {
91
+ subselect = std::move(entry->subquery);
92
+ }
74
93
 
75
94
  auto select = make_uniq<SelectStatement>();
76
- select->node = std::move(select_node);
95
+ select->node = std::move(subselect);
77
96
  info->query = std::move(select);
78
97
  info->type = LogicalType::INVALID;
79
98
 
@@ -150,7 +169,7 @@ unique_ptr<QueryNode> Transformer::TransformPivotStatement(duckdb_libpgquery::PG
150
169
  auto new_select = make_uniq<SelectNode>();
151
170
  ExtractCTEsRecursive(new_select->cte_map);
152
171
  new_select->from_table = source->Copy();
153
- AddPivotEntry(enum_name, std::move(new_select), col.pivot_expressions[0]->Copy());
172
+ AddPivotEntry(enum_name, std::move(new_select), col.pivot_expressions[0]->Copy(), std::move(col.subquery));
154
173
  col.pivot_enum = enum_name;
155
174
  }
156
175
 
@@ -59,6 +59,9 @@ PivotColumn Transformer::TransformPivotColumn(duckdb_libpgquery::PGPivot *pivot)
59
59
  col.entries.push_back(std::move(entry));
60
60
  }
61
61
  }
62
+ if (pivot->subquery) {
63
+ col.subquery = TransformSelectNode(reinterpret_cast<duckdb_libpgquery::PGSelectStmt *>(pivot->subquery));
64
+ }
62
65
  if (pivot->pivot_enum) {
63
66
  col.pivot_enum = pivot->pivot_enum;
64
67
  }
@@ -8,6 +8,8 @@
8
8
  #include "duckdb/parser/expression/constant_expression.hpp"
9
9
  #include "duckdb/parser/expression/function_expression.hpp"
10
10
  #include "duckdb/parser/expression/subquery_expression.hpp"
11
+ #include "duckdb/planner/expression/bound_cast_expression.hpp"
12
+ #include "duckdb/planner/expression/bound_columnref_expression.hpp"
11
13
  #include "duckdb/parser/parsed_data/create_index_info.hpp"
12
14
  #include "duckdb/parser/parsed_data/create_macro_info.hpp"
13
15
  #include "duckdb/parser/parsed_data/create_view_info.hpp"
@@ -24,6 +26,7 @@
24
26
  #include "duckdb/planner/operator/logical_create_table.hpp"
25
27
  #include "duckdb/planner/operator/logical_get.hpp"
26
28
  #include "duckdb/planner/operator/logical_distinct.hpp"
29
+ #include "duckdb/planner/operator/logical_projection.hpp"
27
30
  #include "duckdb/planner/parsed_data/bound_create_table_info.hpp"
28
31
  #include "duckdb/planner/query_node/bound_select_node.hpp"
29
32
  #include "duckdb/planner/tableref/bound_basetableref.hpp"
@@ -605,41 +608,27 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
605
608
  }
606
609
  case CatalogType::TYPE_ENTRY: {
607
610
  auto &schema = BindCreateSchema(*stmt.info);
608
- auto &create_type_info = (CreateTypeInfo &)(*stmt.info);
611
+ auto &create_type_info = stmt.info->Cast<CreateTypeInfo>();
609
612
  result.plan = make_uniq<LogicalCreate>(LogicalOperatorType::LOGICAL_CREATE_TYPE, std::move(stmt.info), &schema);
610
613
  if (create_type_info.query) {
611
614
  // CREATE TYPE mood AS ENUM (SELECT 'happy')
612
- auto &select_stmt = create_type_info.query->Cast<SelectStatement>();
613
- auto &query_node = *select_stmt.node;
614
-
615
- // We always add distinct modifier implicitly
616
- bool need_to_add = true;
617
- if (!query_node.modifiers.empty()) {
618
- if (query_node.modifiers[0]->type == ResultModifierType::DISTINCT_MODIFIER) {
619
- // There are cases where the same column is grouped repeatedly
620
- // CREATE TYPE mood AS ENUM (SELECT DISTINCT ON(x) x FROM test);
621
- // When we push into a constant expression
622
- // => CREATE TYPE mood AS ENUM (SELECT DISTINCT ON(x, x) x FROM test);
623
- auto &distinct_modifier = (DistinctModifier &)*query_node.modifiers[0];
624
- if (distinct_modifier.distinct_on_targets.empty()) {
625
- need_to_add = false;
626
- }
627
- }
628
- }
629
-
630
- // Add distinct modifier
631
- if (need_to_add) {
632
- auto distinct_modifier = make_uniq<DistinctModifier>();
633
- query_node.modifiers.emplace(query_node.modifiers.begin(), std::move(distinct_modifier));
634
- }
635
-
636
615
  auto query_obj = Bind(*create_type_info.query);
637
616
  auto query = std::move(query_obj.plan);
638
617
 
639
618
  auto &sql_types = query_obj.types;
640
- if (sql_types.size() != 1 || sql_types[0].id() != LogicalType::VARCHAR) {
619
+ if (sql_types.size() != 1) {
641
620
  // add cast expression?
642
- throw BinderException("The query must return one varchar column");
621
+ throw BinderException("The query must return a single column");
622
+ }
623
+ if (sql_types[0].id() != LogicalType::VARCHAR) {
624
+ // push a projection casting to varchar
625
+ vector<unique_ptr<Expression>> select_list;
626
+ auto ref = make_uniq<BoundColumnRefExpression>(sql_types[0], query->GetColumnBindings()[0]);
627
+ auto cast_expr = BoundCastExpression::AddCastToType(context, std::move(ref), LogicalType::VARCHAR);
628
+ select_list.push_back(std::move(cast_expr));
629
+ auto proj = make_uniq<LogicalProjection>(GenerateTableIndex(), std::move(select_list));
630
+ proj->AddChild(std::move(query));
631
+ query = std::move(proj);
643
632
  }
644
633
 
645
634
  result.plan->AddChild(std::move(query));
@@ -660,7 +649,7 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
660
649
  }
661
650
  case CatalogType::DATABASE_ENTRY: {
662
651
  // not supported in DuckDB yet but allow extensions to intercept and implement this functionality
663
- auto &base = (CreateDatabaseInfo &)*stmt.info;
652
+ auto &base = stmt.info->Cast<CreateDatabaseInfo>();
664
653
  string database_name = base.name;
665
654
  string source_path = base.path;
666
655
 
@@ -1,8 +1,8 @@
1
1
  #include "duckdb/planner/expression/bound_columnref_expression.hpp"
2
2
 
3
- #include "duckdb/common/types/hash.hpp"
4
- #include "duckdb/common/to_string.hpp"
5
3
  #include "duckdb/common/field_writer.hpp"
4
+ #include "duckdb/common/types/hash.hpp"
5
+ #include "duckdb/main/config.hpp"
6
6
 
7
7
  namespace duckdb {
8
8
 
@@ -35,11 +35,25 @@ bool BoundColumnRefExpression::Equals(const BaseExpression *other_p) const {
35
35
  return other.binding == binding && other.depth == depth;
36
36
  }
37
37
 
38
+ string BoundColumnRefExpression::GetName() const {
39
+ #ifdef DEBUG
40
+ if (DBConfigOptions::debug_print_bindings) {
41
+ return binding.ToString();
42
+ }
43
+ #endif
44
+ return Expression::GetName();
45
+ }
46
+
38
47
  string BoundColumnRefExpression::ToString() const {
48
+ #ifdef DEBUG
49
+ if (DBConfigOptions::debug_print_bindings) {
50
+ return binding.ToString();
51
+ }
52
+ #endif
39
53
  if (!alias.empty()) {
40
54
  return alias;
41
55
  }
42
- return "#[" + to_string(binding.table_index) + "." + to_string(binding.column_index) + "]";
56
+ return binding.ToString();
43
57
  }
44
58
 
45
59
  void BoundColumnRefExpression::Serialize(FieldWriter &writer) const {
@@ -1,9 +1,10 @@
1
1
  #include "duckdb/planner/expression/bound_reference_expression.hpp"
2
2
 
3
+ #include "duckdb/common/field_writer.hpp"
3
4
  #include "duckdb/common/serializer.hpp"
4
- #include "duckdb/common/types/hash.hpp"
5
5
  #include "duckdb/common/to_string.hpp"
6
- #include "duckdb/common/field_writer.hpp"
6
+ #include "duckdb/common/types/hash.hpp"
7
+ #include "duckdb/main/config.hpp"
7
8
 
8
9
  namespace duckdb {
9
10
 
@@ -16,6 +17,11 @@ BoundReferenceExpression::BoundReferenceExpression(LogicalType type, idx_t index
16
17
  }
17
18
 
18
19
  string BoundReferenceExpression::ToString() const {
20
+ #ifdef DEBUG
21
+ if (DBConfigOptions::debug_print_bindings) {
22
+ return "#" + to_string(index);
23
+ }
24
+ #endif
19
25
  if (!alias.empty()) {
20
26
  return alias;
21
27
  }
@@ -1,6 +1,8 @@
1
1
  #include "duckdb/planner/operator/logical_aggregate.hpp"
2
- #include "duckdb/common/string_util.hpp"
2
+
3
3
  #include "duckdb/common/field_writer.hpp"
4
+ #include "duckdb/common/string_util.hpp"
5
+ #include "duckdb/main/config.hpp"
4
6
 
5
7
  namespace duckdb {
6
8
 
@@ -117,4 +119,14 @@ vector<idx_t> LogicalAggregate::GetTableIndex() const {
117
119
  return result;
118
120
  }
119
121
 
122
+ string LogicalAggregate::GetName() const {
123
+ #ifdef DEBUG
124
+ if (DBConfigOptions::debug_print_bindings) {
125
+ return LogicalOperator::GetName() +
126
+ StringUtil::Format(" #%llu, #%llu, #%llu", group_index, aggregate_index, groupings_index);
127
+ }
128
+ #endif
129
+ return LogicalOperator::GetName();
130
+ }
131
+
120
132
  } // namespace duckdb
@@ -1,6 +1,8 @@
1
1
  #include "duckdb/planner/operator/logical_column_data_get.hpp"
2
+
2
3
  #include "duckdb/common/field_writer.hpp"
3
4
  #include "duckdb/common/types/data_chunk.hpp"
5
+ #include "duckdb/main/config.hpp"
4
6
 
5
7
  namespace duckdb {
6
8
 
@@ -42,4 +44,13 @@ vector<idx_t> LogicalColumnDataGet::GetTableIndex() const {
42
44
  return vector<idx_t> {table_index};
43
45
  }
44
46
 
47
+ string LogicalColumnDataGet::GetName() const {
48
+ #ifdef DEBUG
49
+ if (DBConfigOptions::debug_print_bindings) {
50
+ return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
51
+ }
52
+ #endif
53
+ return LogicalOperator::GetName();
54
+ }
55
+
45
56
  } // namespace duckdb
@@ -1,5 +1,7 @@
1
1
  #include "duckdb/planner/operator/logical_cteref.hpp"
2
+
2
3
  #include "duckdb/common/field_writer.hpp"
4
+ #include "duckdb/main/config.hpp"
3
5
 
4
6
  namespace duckdb {
5
7
 
@@ -22,4 +24,13 @@ vector<idx_t> LogicalCTERef::GetTableIndex() const {
22
24
  return vector<idx_t> {table_index};
23
25
  }
24
26
 
27
+ string LogicalCTERef::GetName() const {
28
+ #ifdef DEBUG
29
+ if (DBConfigOptions::debug_print_bindings) {
30
+ return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
31
+ }
32
+ #endif
33
+ return LogicalOperator::GetName();
34
+ }
35
+
25
36
  } // namespace duckdb
@@ -1,6 +1,7 @@
1
1
  #include "duckdb/planner/operator/logical_delete.hpp"
2
2
 
3
3
  #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
+ #include "duckdb/main/config.hpp"
4
5
  #include "duckdb/parser/parsed_data/create_table_info.hpp"
5
6
 
6
7
  namespace duckdb {
@@ -51,4 +52,13 @@ void LogicalDelete::ResolveTypes() {
51
52
  }
52
53
  }
53
54
 
55
+ string LogicalDelete::GetName() const {
56
+ #ifdef DEBUG
57
+ if (DBConfigOptions::debug_print_bindings) {
58
+ return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
59
+ }
60
+ #endif
61
+ return LogicalOperator::GetName();
62
+ }
63
+
54
64
  } // namespace duckdb
@@ -1,6 +1,8 @@
1
- #include "duckdb/common/field_writer.hpp"
2
1
  #include "duckdb/planner/operator/logical_delim_get.hpp"
3
2
 
3
+ #include "duckdb/common/field_writer.hpp"
4
+ #include "duckdb/main/config.hpp"
5
+
4
6
  namespace duckdb {
5
7
 
6
8
  void LogicalDelimGet::Serialize(FieldWriter &writer) const {
@@ -18,4 +20,13 @@ vector<idx_t> LogicalDelimGet::GetTableIndex() const {
18
20
  return vector<idx_t> {table_index};
19
21
  }
20
22
 
23
+ string LogicalDelimGet::GetName() const {
24
+ #ifdef DEBUG
25
+ if (DBConfigOptions::debug_print_bindings) {
26
+ return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
27
+ }
28
+ #endif
29
+ return LogicalOperator::GetName();
30
+ }
31
+
21
32
  } // namespace duckdb
@@ -1,6 +1,8 @@
1
- #include "duckdb/common/field_writer.hpp"
2
1
  #include "duckdb/planner/operator/logical_dummy_scan.hpp"
3
2
 
3
+ #include "duckdb/common/field_writer.hpp"
4
+ #include "duckdb/main/config.hpp"
5
+
4
6
  namespace duckdb {
5
7
 
6
8
  void LogicalDummyScan::Serialize(FieldWriter &writer) const {
@@ -16,4 +18,13 @@ vector<idx_t> LogicalDummyScan::GetTableIndex() const {
16
18
  return vector<idx_t> {table_index};
17
19
  }
18
20
 
21
+ string LogicalDummyScan::GetName() const {
22
+ #ifdef DEBUG
23
+ if (DBConfigOptions::debug_print_bindings) {
24
+ return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
25
+ }
26
+ #endif
27
+ return LogicalOperator::GetName();
28
+ }
29
+
19
30
  } // namespace duckdb
@@ -1,6 +1,8 @@
1
- #include "duckdb/common/field_writer.hpp"
2
1
  #include "duckdb/planner/operator/logical_expression_get.hpp"
3
2
 
3
+ #include "duckdb/common/field_writer.hpp"
4
+ #include "duckdb/main/config.hpp"
5
+
4
6
  namespace duckdb {
5
7
 
6
8
  void LogicalExpressionGet::Serialize(FieldWriter &writer) const {
@@ -30,4 +32,13 @@ vector<idx_t> LogicalExpressionGet::GetTableIndex() const {
30
32
  return vector<idx_t> {table_index};
31
33
  }
32
34
 
35
+ string LogicalExpressionGet::GetName() const {
36
+ #ifdef DEBUG
37
+ if (DBConfigOptions::debug_print_bindings) {
38
+ return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
39
+ }
40
+ #endif
41
+ return LogicalOperator::GetName();
42
+ }
43
+
33
44
  } // namespace duckdb
@@ -6,6 +6,7 @@
6
6
  #include "duckdb/common/string_util.hpp"
7
7
  #include "duckdb/function/function_serialization.hpp"
8
8
  #include "duckdb/function/table/table_scan.hpp"
9
+ #include "duckdb/main/config.hpp"
9
10
  #include "duckdb/storage/data_table.hpp"
10
11
 
11
12
  namespace duckdb {
@@ -16,10 +17,6 @@ LogicalGet::LogicalGet(idx_t table_index, TableFunction function, unique_ptr<Fun
16
17
  bind_data(std::move(bind_data)), returned_types(std::move(returned_types)), names(std::move(returned_names)) {
17
18
  }
18
19
 
19
- string LogicalGet::GetName() const {
20
- return StringUtil::Upper(function.name);
21
- }
22
-
23
20
  optional_ptr<TableCatalogEntry> LogicalGet::GetTable() const {
24
21
  return TableScanFunction::GetTableEntry(function, bind_data.get());
25
22
  }
@@ -201,4 +198,13 @@ vector<idx_t> LogicalGet::GetTableIndex() const {
201
198
  return vector<idx_t> {table_index};
202
199
  }
203
200
 
201
+ string LogicalGet::GetName() const {
202
+ #ifdef DEBUG
203
+ if (DBConfigOptions::debug_print_bindings) {
204
+ return StringUtil::Upper(function.name) + StringUtil::Format(" #%llu", table_index);
205
+ }
206
+ #endif
207
+ return StringUtil::Upper(function.name);
208
+ }
209
+
204
210
  } // namespace duckdb