duckdb 0.7.2-dev225.0 → 0.7.2-dev2366.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 (1551) hide show
  1. package/binding.gyp +13 -6
  2. package/lib/duckdb.d.ts +55 -2
  3. package/lib/duckdb.js +20 -1
  4. package/package.json +1 -1
  5. package/src/connection.cpp +13 -14
  6. package/src/data_chunk.cpp +14 -2
  7. package/src/database.cpp +15 -16
  8. package/src/duckdb/extension/icu/icu-dateadd.cpp +2 -2
  9. package/src/duckdb/extension/icu/icu-datefunc.cpp +23 -11
  10. package/src/duckdb/extension/icu/icu-datepart.cpp +18 -18
  11. package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
  12. package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
  13. package/src/duckdb/extension/icu/icu-extension.cpp +34 -31
  14. package/src/duckdb/extension/icu/icu-list-range.cpp +207 -0
  15. package/src/duckdb/extension/icu/icu-makedate.cpp +53 -1
  16. package/src/duckdb/extension/icu/icu-strptime.cpp +134 -46
  17. package/src/duckdb/extension/icu/icu-table-range.cpp +10 -10
  18. package/src/duckdb/extension/icu/icu-timebucket.cpp +6 -6
  19. package/src/duckdb/extension/icu/icu-timezone.cpp +19 -18
  20. package/src/duckdb/extension/icu/include/icu-datefunc.hpp +10 -8
  21. package/src/duckdb/extension/icu/include/icu-list-range.hpp +17 -0
  22. package/src/duckdb/extension/icu/third_party/icu/common/unicode/localpointer.h +22 -22
  23. package/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +4 -0
  24. package/src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp +28 -28
  25. package/src/duckdb/extension/icu/third_party/icu/i18n/dangical.h +4 -4
  26. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/numberformatter.h +1 -1
  27. package/src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp +1 -1
  28. package/src/duckdb/extension/json/buffered_json_reader.cpp +3 -3
  29. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +5 -5
  30. package/src/duckdb/extension/json/include/json_common.hpp +2 -1
  31. package/src/duckdb/extension/json/include/json_deserializer.hpp +92 -0
  32. package/src/duckdb/extension/json/include/json_executors.hpp +2 -2
  33. package/src/duckdb/extension/json/include/json_functions.hpp +8 -1
  34. package/src/duckdb/extension/json/include/json_scan.hpp +9 -10
  35. package/src/duckdb/extension/json/include/json_serializer.hpp +82 -0
  36. package/src/duckdb/extension/json/include/json_structure.hpp +1 -1
  37. package/src/duckdb/extension/json/json-extension.cpp +6 -0
  38. package/src/duckdb/extension/json/json_deserializer.cpp +306 -0
  39. package/src/duckdb/extension/json/json_functions/copy_json.cpp +19 -19
  40. package/src/duckdb/extension/json/json_functions/json_create.cpp +28 -27
  41. package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -2
  42. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +279 -0
  43. package/src/duckdb/extension/json/json_functions/json_structure.cpp +1 -1
  44. package/src/duckdb/extension/json/json_functions/json_transform.cpp +4 -4
  45. package/src/duckdb/extension/json/json_functions/read_json.cpp +26 -35
  46. package/src/duckdb/extension/json/json_functions.cpp +37 -20
  47. package/src/duckdb/extension/json/json_scan.cpp +9 -32
  48. package/src/duckdb/extension/json/json_serializer.cpp +253 -0
  49. package/src/duckdb/extension/parquet/column_reader.cpp +163 -100
  50. package/src/duckdb/extension/parquet/column_writer.cpp +109 -108
  51. package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +5 -3
  52. package/src/duckdb/extension/parquet/include/callback_column_reader.hpp +3 -0
  53. package/src/duckdb/extension/parquet/include/cast_column_reader.hpp +7 -4
  54. package/src/duckdb/extension/parquet/include/column_reader.hpp +26 -10
  55. package/src/duckdb/extension/parquet/include/column_writer.hpp +7 -8
  56. package/src/duckdb/extension/parquet/include/decode_utils.hpp +5 -4
  57. package/src/duckdb/extension/parquet/include/list_column_reader.hpp +6 -4
  58. package/src/duckdb/extension/parquet/include/parquet_dbp_decoder.hpp +3 -3
  59. package/src/duckdb/extension/parquet/include/parquet_decimal_utils.hpp +3 -3
  60. package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +2 -2
  61. package/src/duckdb/extension/parquet/include/parquet_metadata.hpp +1 -0
  62. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +27 -52
  63. package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +2 -2
  64. package/src/duckdb/extension/parquet/include/parquet_support.hpp +10 -9
  65. package/src/duckdb/extension/parquet/include/parquet_timestamp.hpp +2 -1
  66. package/src/duckdb/extension/parquet/include/parquet_writer.hpp +3 -3
  67. package/src/duckdb/extension/parquet/include/row_number_column_reader.hpp +6 -3
  68. package/src/duckdb/extension/parquet/include/string_column_reader.hpp +4 -1
  69. package/src/duckdb/extension/parquet/include/struct_column_reader.hpp +7 -3
  70. package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +3 -0
  71. package/src/duckdb/extension/parquet/include/zstd_file_system.hpp +2 -2
  72. package/src/duckdb/extension/parquet/parquet-extension.cpp +113 -253
  73. package/src/duckdb/extension/parquet/parquet_metadata.cpp +11 -19
  74. package/src/duckdb/extension/parquet/parquet_reader.cpp +120 -255
  75. package/src/duckdb/extension/parquet/parquet_statistics.cpp +53 -40
  76. package/src/duckdb/extension/parquet/parquet_timestamp.cpp +16 -6
  77. package/src/duckdb/extension/parquet/parquet_writer.cpp +2 -2
  78. package/src/duckdb/extension/parquet/zstd_file_system.cpp +4 -4
  79. package/src/duckdb/src/catalog/catalog.cpp +79 -49
  80. package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +3 -3
  81. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +33 -33
  82. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +52 -75
  83. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +5 -5
  84. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +1 -1
  85. package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +8 -8
  86. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +3 -3
  87. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +3 -3
  88. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +8 -12
  89. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +1 -1
  90. package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +11 -5
  91. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +6 -6
  92. package/src/duckdb/src/catalog/catalog_entry.cpp +2 -2
  93. package/src/duckdb/src/catalog/catalog_set.cpp +56 -53
  94. package/src/duckdb/src/catalog/default/default_functions.cpp +15 -11
  95. package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
  96. package/src/duckdb/src/catalog/default/default_types.cpp +4 -4
  97. package/src/duckdb/src/catalog/default/default_views.cpp +5 -5
  98. package/src/duckdb/src/catalog/dependency_list.cpp +15 -2
  99. package/src/duckdb/src/catalog/dependency_manager.cpp +46 -40
  100. package/src/duckdb/src/catalog/duck_catalog.cpp +37 -10
  101. package/src/duckdb/src/common/adbc/adbc.cpp +441 -0
  102. package/src/duckdb/src/common/adbc/driver_manager.cpp +749 -0
  103. package/src/duckdb/src/common/allocator.cpp +2 -2
  104. package/src/duckdb/src/common/arrow/arrow_appender.cpp +122 -53
  105. package/src/duckdb/src/common/arrow/arrow_converter.cpp +5 -5
  106. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +21 -3
  107. package/src/duckdb/src/common/box_renderer.cpp +113 -25
  108. package/src/duckdb/src/common/compressed_file_system.cpp +15 -0
  109. package/src/duckdb/src/common/constants.cpp +10 -1
  110. package/src/duckdb/src/common/enums/expression_type.cpp +8 -222
  111. package/src/duckdb/src/common/enums/join_type.cpp +3 -22
  112. package/src/duckdb/src/common/enums/logical_operator_type.cpp +4 -0
  113. package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
  114. package/src/duckdb/src/common/exception.cpp +19 -1
  115. package/src/duckdb/src/common/exception_format_value.cpp +1 -1
  116. package/src/duckdb/src/common/field_writer.cpp +2 -1
  117. package/src/duckdb/src/common/file_system.cpp +5 -3
  118. package/src/duckdb/src/common/filename_pattern.cpp +41 -0
  119. package/src/duckdb/src/common/gzip_file_system.cpp +69 -5
  120. package/src/duckdb/src/common/hive_partitioning.cpp +150 -19
  121. package/src/duckdb/src/common/local_file_system.cpp +82 -14
  122. package/src/duckdb/src/common/multi_file_reader.cpp +373 -0
  123. package/src/duckdb/src/common/operator/cast_operators.cpp +25 -26
  124. package/src/duckdb/src/common/pipe_file_system.cpp +2 -1
  125. package/src/duckdb/src/common/preserved_error.cpp +7 -5
  126. package/src/duckdb/src/common/progress_bar/progress_bar.cpp +8 -1
  127. package/src/duckdb/src/common/radix_partitioning.cpp +102 -370
  128. package/src/duckdb/src/common/random_engine.cpp +1 -1
  129. package/src/duckdb/src/common/re2_regex.cpp +4 -4
  130. package/src/duckdb/src/common/row_operations/row_aggregate.cpp +22 -17
  131. package/src/duckdb/src/common/row_operations/row_external.cpp +1 -1
  132. package/src/duckdb/src/common/row_operations/row_gather.cpp +5 -3
  133. package/src/duckdb/src/common/row_operations/row_heap_scatter.cpp +2 -2
  134. package/src/duckdb/src/common/row_operations/row_match.cpp +117 -22
  135. package/src/duckdb/src/common/row_operations/row_scatter.cpp +7 -5
  136. package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +4 -0
  137. package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +21 -3
  138. package/src/duckdb/src/common/serializer/enum_serializer.cpp +1180 -0
  139. package/src/duckdb/src/common/sort/comparators.cpp +14 -5
  140. package/src/duckdb/src/common/sort/merge_sorter.cpp +3 -3
  141. package/src/duckdb/src/common/sort/partition_state.cpp +644 -0
  142. package/src/duckdb/src/common/sort/sort_state.cpp +18 -19
  143. package/src/duckdb/src/common/sort/sorted_block.cpp +23 -18
  144. package/src/duckdb/src/common/string_util.cpp +43 -3
  145. package/src/duckdb/src/common/tree_renderer.cpp +7 -9
  146. package/src/duckdb/src/common/types/batched_data_collection.cpp +5 -4
  147. package/src/duckdb/src/common/types/bit.cpp +107 -65
  148. package/src/duckdb/src/common/types/blob.cpp +10 -10
  149. package/src/duckdb/src/common/types/chunk_collection.cpp +4 -4
  150. package/src/duckdb/src/common/types/{column_data_allocator.cpp → column/column_data_allocator.cpp} +4 -3
  151. package/src/duckdb/src/common/types/{column_data_collection.cpp → column/column_data_collection.cpp} +68 -8
  152. package/src/duckdb/src/common/types/{column_data_collection_segment.cpp → column/column_data_collection_segment.cpp} +14 -11
  153. package/src/duckdb/src/common/types/{column_data_consumer.cpp → column/column_data_consumer.cpp} +1 -1
  154. package/src/duckdb/src/common/types/{partitioned_column_data.cpp → column/partitioned_column_data.cpp} +14 -12
  155. package/src/duckdb/src/common/types/conflict_manager.cpp +5 -4
  156. package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
  157. package/src/duckdb/src/common/types/hash.cpp +1 -1
  158. package/src/duckdb/src/common/types/hyperloglog.cpp +3 -3
  159. package/src/duckdb/src/common/types/interval.cpp +0 -41
  160. package/src/duckdb/src/common/types/list_segment.cpp +658 -0
  161. package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +316 -0
  162. package/src/duckdb/src/common/types/{row_data_collection.cpp → row/row_data_collection.cpp} +2 -2
  163. package/src/duckdb/src/common/types/{row_data_collection_scanner.cpp → row/row_data_collection_scanner.cpp} +3 -3
  164. package/src/duckdb/src/common/types/{row_layout.cpp → row/row_layout.cpp} +1 -1
  165. package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +465 -0
  166. package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +511 -0
  167. package/src/duckdb/src/common/types/row/tuple_data_iterator.cpp +96 -0
  168. package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +119 -0
  169. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +1200 -0
  170. package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +170 -0
  171. package/src/duckdb/src/common/types/string_heap.cpp +3 -3
  172. package/src/duckdb/src/common/types/string_type.cpp +3 -3
  173. package/src/duckdb/src/common/types/time.cpp +13 -0
  174. package/src/duckdb/src/common/types/timestamp.cpp +1 -1
  175. package/src/duckdb/src/common/types/validity_mask.cpp +24 -7
  176. package/src/duckdb/src/common/types/value.cpp +184 -101
  177. package/src/duckdb/src/common/types/vector.cpp +212 -151
  178. package/src/duckdb/src/common/types/vector_buffer.cpp +3 -3
  179. package/src/duckdb/src/common/types/vector_cache.cpp +4 -4
  180. package/src/duckdb/src/common/types.cpp +314 -152
  181. package/src/duckdb/src/common/value_operations/comparison_operations.cpp +14 -22
  182. package/src/duckdb/src/common/vector.cpp +12 -0
  183. package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +10 -10
  184. package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +11 -10
  185. package/src/duckdb/src/common/vector_operations/vector_cast.cpp +2 -1
  186. package/src/duckdb/src/common/vector_operations/vector_copy.cpp +14 -11
  187. package/src/duckdb/src/common/virtual_file_system.cpp +1 -1
  188. package/src/duckdb/src/execution/adaptive_filter.cpp +1 -1
  189. package/src/duckdb/src/execution/aggregate_hashtable.cpp +331 -339
  190. package/src/duckdb/src/execution/column_binding_resolver.cpp +27 -11
  191. package/src/duckdb/src/execution/expression_executor/execute_between.cpp +1 -1
  192. package/src/duckdb/src/execution/expression_executor/execute_case.cpp +1 -1
  193. package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +3 -2
  194. package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +3 -3
  195. package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +6 -6
  196. package/src/duckdb/src/execution/expression_executor/execute_constant.cpp +1 -1
  197. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +1 -1
  198. package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +1 -1
  199. package/src/duckdb/src/execution/expression_executor/execute_parameter.cpp +1 -1
  200. package/src/duckdb/src/execution/expression_executor/execute_reference.cpp +1 -1
  201. package/src/duckdb/src/execution/expression_executor.cpp +5 -4
  202. package/src/duckdb/src/execution/expression_executor_state.cpp +3 -4
  203. package/src/duckdb/src/execution/index/art/art.cpp +27 -15
  204. package/src/duckdb/src/execution/index/art/art_key.cpp +2 -2
  205. package/src/duckdb/src/execution/join_hashtable.cpp +203 -337
  206. package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +12 -3
  207. package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +12 -12
  208. package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +2 -2
  209. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +44 -44
  210. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +22 -23
  211. package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +13 -9
  212. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +43 -29
  213. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +237 -917
  214. package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +4 -4
  215. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +9 -9
  216. package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +3 -8
  217. package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +4 -4
  218. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +11 -8
  219. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +8 -9
  220. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +14 -10
  221. package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +5 -5
  222. package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +8 -14
  223. package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +6 -6
  224. package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +3 -3
  225. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +13 -11
  226. package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +37 -22
  227. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +78 -31
  228. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +7 -7
  229. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +18 -17
  230. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +193 -169
  231. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +42 -38
  232. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +29 -19
  233. package/src/duckdb/src/execution/operator/join/physical_join.cpp +9 -20
  234. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +21 -21
  235. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +28 -33
  236. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +6 -7
  237. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +4 -2
  238. package/src/duckdb/src/execution/operator/order/physical_order.cpp +17 -17
  239. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +14 -14
  240. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +55 -47
  241. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +96 -43
  242. package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +17 -13
  243. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +12 -19
  244. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +134 -30
  245. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +41 -36
  246. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +31 -29
  247. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +11 -12
  248. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +30 -29
  249. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +51 -49
  250. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +15 -14
  251. package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +81 -0
  252. package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +37 -3
  253. package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +7 -7
  254. package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +5 -6
  255. package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +14 -8
  256. package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +1 -1
  257. package/src/duckdb/src/execution/operator/scan/physical_expression_scan.cpp +1 -1
  258. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +26 -11
  259. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +27 -15
  260. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +2 -2
  261. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +2 -2
  262. package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +2 -2
  263. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +17 -16
  264. package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +2 -2
  265. package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +2 -2
  266. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -4
  267. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +26 -46
  268. package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +2 -2
  269. package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +2 -2
  270. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
  271. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +19 -23
  272. package/src/duckdb/src/execution/operator/set/physical_union.cpp +15 -4
  273. package/src/duckdb/src/execution/partitionable_hashtable.cpp +30 -43
  274. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +35 -39
  275. package/src/duckdb/src/execution/physical_operator.cpp +22 -37
  276. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +34 -28
  277. package/src/duckdb/src/execution/physical_plan/plan_any_join.cpp +2 -2
  278. package/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +97 -0
  279. package/src/duckdb/src/execution/physical_plan/plan_column_data_get.cpp +2 -4
  280. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +119 -70
  281. package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +3 -3
  282. package/src/duckdb/src/execution/physical_plan/plan_create.cpp +9 -9
  283. package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +16 -16
  284. package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +6 -6
  285. package/src/duckdb/src/execution/physical_plan/plan_cross_product.cpp +1 -1
  286. package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +4 -4
  287. package/src/duckdb/src/execution/physical_plan/plan_delim_get.cpp +1 -1
  288. package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +12 -13
  289. package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +15 -16
  290. package/src/duckdb/src/execution/physical_plan/plan_dummy_scan.cpp +1 -1
  291. package/src/duckdb/src/execution/physical_plan/plan_empty_result.cpp +1 -1
  292. package/src/duckdb/src/execution/physical_plan/plan_execute.cpp +2 -2
  293. package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +9 -12
  294. package/src/duckdb/src/execution/physical_plan/plan_export.cpp +2 -2
  295. package/src/duckdb/src/execution/physical_plan/plan_expression_get.cpp +6 -6
  296. package/src/duckdb/src/execution/physical_plan/plan_filter.cpp +3 -3
  297. package/src/duckdb/src/execution/physical_plan/plan_get.cpp +12 -13
  298. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +28 -8
  299. package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +6 -7
  300. package/src/duckdb/src/execution/physical_plan/plan_limit_percent.cpp +2 -2
  301. package/src/duckdb/src/execution/physical_plan/plan_order.cpp +2 -2
  302. package/src/duckdb/src/execution/physical_plan/plan_pivot.cpp +14 -0
  303. package/src/duckdb/src/execution/physical_plan/plan_positional_join.cpp +14 -5
  304. package/src/duckdb/src/execution/physical_plan/plan_pragma.cpp +1 -1
  305. package/src/duckdb/src/execution/physical_plan/plan_prepare.cpp +1 -1
  306. package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +2 -2
  307. package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +7 -7
  308. package/src/duckdb/src/execution/physical_plan/plan_reset.cpp +1 -1
  309. package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +4 -4
  310. package/src/duckdb/src/execution/physical_plan/plan_set.cpp +1 -1
  311. package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +5 -5
  312. package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +3 -5
  313. package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +14 -14
  314. package/src/duckdb/src/execution/physical_plan/plan_top_n.cpp +1 -1
  315. package/src/duckdb/src/execution/physical_plan/plan_unnest.cpp +1 -1
  316. package/src/duckdb/src/execution/physical_plan/plan_update.cpp +3 -3
  317. package/src/duckdb/src/execution/physical_plan/plan_window.cpp +13 -13
  318. package/src/duckdb/src/execution/physical_plan_generator.cpp +53 -43
  319. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +84 -54
  320. package/src/duckdb/src/execution/reservoir_sample.cpp +3 -3
  321. package/src/duckdb/src/execution/window_segment_tree.cpp +196 -26
  322. package/src/duckdb/src/function/aggregate/algebraic/avg.cpp +4 -4
  323. package/src/duckdb/src/function/aggregate/distributive/approx_count.cpp +1 -1
  324. package/src/duckdb/src/function/aggregate/distributive/arg_min_max.cpp +3 -3
  325. package/src/duckdb/src/function/aggregate/distributive/bitagg.cpp +3 -3
  326. package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +35 -27
  327. package/src/duckdb/src/function/aggregate/distributive/bool.cpp +2 -0
  328. package/src/duckdb/src/function/aggregate/distributive/count.cpp +3 -4
  329. package/src/duckdb/src/function/aggregate/distributive/entropy.cpp +1 -1
  330. package/src/duckdb/src/function/aggregate/distributive/first.cpp +12 -10
  331. package/src/duckdb/src/function/aggregate/distributive/kurtosis.cpp +3 -2
  332. package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +25 -25
  333. package/src/duckdb/src/function/aggregate/distributive/skew.cpp +5 -1
  334. package/src/duckdb/src/function/aggregate/distributive/string_agg.cpp +9 -9
  335. package/src/duckdb/src/function/aggregate/distributive/sum.cpp +19 -13
  336. package/src/duckdb/src/function/aggregate/holistic/approximate_quantile.cpp +10 -7
  337. package/src/duckdb/src/function/aggregate/holistic/mode.cpp +2 -2
  338. package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +25 -10
  339. package/src/duckdb/src/function/aggregate/holistic/reservoir_quantile.cpp +6 -6
  340. package/src/duckdb/src/function/aggregate/nested/histogram.cpp +2 -2
  341. package/src/duckdb/src/function/aggregate/nested/list.cpp +42 -804
  342. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +289 -98
  343. package/src/duckdb/src/function/cast/cast_function_set.cpp +3 -2
  344. package/src/duckdb/src/function/cast/enum_casts.cpp +28 -6
  345. package/src/duckdb/src/function/cast/list_casts.cpp +20 -7
  346. package/src/duckdb/src/function/cast/map_cast.cpp +6 -3
  347. package/src/duckdb/src/function/cast/string_cast.cpp +39 -13
  348. package/src/duckdb/src/function/cast/struct_cast.cpp +28 -8
  349. package/src/duckdb/src/function/cast/time_casts.cpp +2 -2
  350. package/src/duckdb/src/function/cast/union_casts.cpp +40 -14
  351. package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +5 -6
  352. package/src/duckdb/src/function/cast_rules.cpp +9 -4
  353. package/src/duckdb/src/function/compression_config.cpp +9 -9
  354. package/src/duckdb/src/function/function.cpp +4 -4
  355. package/src/duckdb/src/function/function_binder.cpp +8 -14
  356. package/src/duckdb/src/function/macro_function.cpp +3 -3
  357. package/src/duckdb/src/function/pragma/pragma_queries.cpp +25 -2
  358. package/src/duckdb/src/function/pragma_function.cpp +1 -1
  359. package/src/duckdb/src/function/scalar/bit/bitstring.cpp +4 -3
  360. package/src/duckdb/src/function/scalar/blob/encode.cpp +1 -1
  361. package/src/duckdb/src/function/scalar/date/current.cpp +0 -2
  362. package/src/duckdb/src/function/scalar/date/date_diff.cpp +0 -1
  363. package/src/duckdb/src/function/scalar/date/date_part.cpp +22 -30
  364. package/src/duckdb/src/function/scalar/date/date_sub.cpp +0 -1
  365. package/src/duckdb/src/function/scalar/date/date_trunc.cpp +10 -14
  366. package/src/duckdb/src/function/scalar/date/strftime.cpp +136 -39
  367. package/src/duckdb/src/function/scalar/generic/alias.cpp +1 -1
  368. package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +6 -6
  369. package/src/duckdb/src/function/scalar/generic/current_setting.cpp +5 -5
  370. package/src/duckdb/src/function/scalar/generic/error.cpp +21 -0
  371. package/src/duckdb/src/function/scalar/generic/stats.cpp +6 -8
  372. package/src/duckdb/src/function/scalar/generic_functions.cpp +1 -0
  373. package/src/duckdb/src/function/scalar/list/array_slice.cpp +1 -1
  374. package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +5 -147
  375. package/src/duckdb/src/function/scalar/list/flatten.cpp +7 -14
  376. package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +12 -11
  377. package/src/duckdb/src/function/scalar/list/list_concat.cpp +9 -13
  378. package/src/duckdb/src/function/scalar/list/list_extract.cpp +6 -13
  379. package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +13 -9
  380. package/src/duckdb/src/function/scalar/list/list_sort.cpp +32 -25
  381. package/src/duckdb/src/function/scalar/list/list_value.cpp +7 -11
  382. package/src/duckdb/src/function/scalar/map/cardinality.cpp +1 -1
  383. package/src/duckdb/src/function/scalar/map/map.cpp +48 -2
  384. package/src/duckdb/src/function/scalar/map/map_entries.cpp +2 -2
  385. package/src/duckdb/src/function/scalar/map/map_extract.cpp +69 -27
  386. package/src/duckdb/src/function/scalar/map/map_from_entries.cpp +1 -1
  387. package/src/duckdb/src/function/scalar/map/map_keys_values.cpp +1 -1
  388. package/src/duckdb/src/function/scalar/math/numeric.cpp +163 -22
  389. package/src/duckdb/src/function/scalar/math/random.cpp +3 -3
  390. package/src/duckdb/src/function/scalar/math/setseed.cpp +4 -4
  391. package/src/duckdb/src/function/scalar/math_functions.cpp +4 -0
  392. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +50 -51
  393. package/src/duckdb/src/function/scalar/operators/multiply.cpp +5 -0
  394. package/src/duckdb/src/function/scalar/sequence/nextval.cpp +35 -35
  395. package/src/duckdb/src/function/scalar/string/ascii.cpp +1 -1
  396. package/src/duckdb/src/function/scalar/string/caseconvert.cpp +4 -8
  397. package/src/duckdb/src/function/scalar/string/concat.cpp +6 -6
  398. package/src/duckdb/src/function/scalar/string/contains.cpp +2 -2
  399. package/src/duckdb/src/function/scalar/string/damerau_levenshtein.cpp +106 -0
  400. package/src/duckdb/src/function/scalar/string/hex.cpp +384 -0
  401. package/src/duckdb/src/function/scalar/string/instr.cpp +3 -7
  402. package/src/duckdb/src/function/scalar/string/jaccard.cpp +1 -1
  403. package/src/duckdb/src/function/scalar/string/jaro_winkler.cpp +5 -5
  404. package/src/duckdb/src/function/scalar/string/length.cpp +3 -7
  405. package/src/duckdb/src/function/scalar/string/levenshtein.cpp +4 -4
  406. package/src/duckdb/src/function/scalar/string/like.cpp +16 -21
  407. package/src/duckdb/src/function/scalar/string/mismatches.cpp +2 -2
  408. package/src/duckdb/src/function/scalar/string/nfc_normalize.cpp +1 -1
  409. package/src/duckdb/src/function/scalar/string/pad.cpp +3 -3
  410. package/src/duckdb/src/function/scalar/string/prefix.cpp +2 -2
  411. package/src/duckdb/src/function/scalar/string/printf.cpp +5 -5
  412. package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +243 -0
  413. package/src/duckdb/src/function/scalar/string/regexp/regexp_util.cpp +79 -0
  414. package/src/duckdb/src/function/scalar/string/regexp.cpp +183 -125
  415. package/src/duckdb/src/function/scalar/string/repeat.cpp +1 -1
  416. package/src/duckdb/src/function/scalar/string/replace.cpp +3 -3
  417. package/src/duckdb/src/function/scalar/string/reverse.cpp +1 -1
  418. package/src/duckdb/src/function/scalar/string/starts_with.cpp +2 -2
  419. package/src/duckdb/src/function/scalar/string/string_split.cpp +6 -6
  420. package/src/duckdb/src/function/scalar/string/strip_accents.cpp +2 -2
  421. package/src/duckdb/src/function/scalar/string/substring.cpp +5 -9
  422. package/src/duckdb/src/function/scalar/string/suffix.cpp +2 -2
  423. package/src/duckdb/src/function/scalar/string/translate.cpp +3 -3
  424. package/src/duckdb/src/function/scalar/string/trim.cpp +3 -3
  425. package/src/duckdb/src/function/scalar/string_functions.cpp +2 -0
  426. package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +10 -15
  427. package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +12 -15
  428. package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +9 -10
  429. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +17 -19
  430. package/src/duckdb/src/function/scalar/union/union_extract.cpp +5 -5
  431. package/src/duckdb/src/function/scalar/union/union_value.cpp +2 -2
  432. package/src/duckdb/src/function/scalar_macro_function.cpp +4 -4
  433. package/src/duckdb/src/function/table/arrow.cpp +17 -14
  434. package/src/duckdb/src/function/table/arrow_conversion.cpp +28 -4
  435. package/src/duckdb/src/function/table/checkpoint.cpp +12 -8
  436. package/src/duckdb/src/function/table/copy_csv.cpp +23 -19
  437. package/src/duckdb/src/function/table/glob.cpp +7 -12
  438. package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +15 -14
  439. package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +13 -11
  440. package/src/duckdb/src/function/table/range.cpp +10 -10
  441. package/src/duckdb/src/function/table/read_csv.cpp +318 -278
  442. package/src/duckdb/src/function/table/repeat.cpp +4 -4
  443. package/src/duckdb/src/function/table/summary.cpp +1 -1
  444. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +25 -25
  445. package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +21 -20
  446. package/src/duckdb/src/function/table/system/duckdb_databases.cpp +4 -4
  447. package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +13 -13
  448. package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +4 -4
  449. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +5 -5
  450. package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +3 -3
  451. package/src/duckdb/src/function/table/system/duckdb_keywords.cpp +2 -2
  452. package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +2 -2
  453. package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +3 -3
  454. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +2 -2
  455. package/src/duckdb/src/function/table/system/duckdb_tables.cpp +4 -4
  456. package/src/duckdb/src/function/table/system/duckdb_temporary_files.cpp +2 -2
  457. package/src/duckdb/src/function/table/system/duckdb_types.cpp +2 -2
  458. package/src/duckdb/src/function/table/system/duckdb_views.cpp +2 -2
  459. package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
  460. package/src/duckdb/src/function/table/system/pragma_database_size.cpp +3 -3
  461. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +9 -7
  462. package/src/duckdb/src/function/table/system/pragma_table_info.cpp +22 -23
  463. package/src/duckdb/src/function/table/system/test_all_types.cpp +6 -6
  464. package/src/duckdb/src/function/table/system/test_vector_types.cpp +6 -6
  465. package/src/duckdb/src/function/table/table_scan.cpp +55 -62
  466. package/src/duckdb/src/function/table/unnest.cpp +10 -10
  467. package/src/duckdb/src/function/table/version/pragma_version.cpp +6 -4
  468. package/src/duckdb/src/function/table_function.cpp +11 -11
  469. package/src/duckdb/src/function/table_macro_function.cpp +3 -3
  470. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +31 -12
  471. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +2 -2
  472. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -4
  473. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +5 -5
  474. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -2
  475. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
  476. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -2
  477. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +2 -2
  478. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +3 -4
  479. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
  480. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +2 -2
  481. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
  482. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -3
  483. package/src/duckdb/src/include/duckdb/catalog/catalog_entry_map.hpp +38 -0
  484. package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +5 -5
  485. package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +4 -3
  486. package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +2 -2
  487. package/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp +2 -2
  488. package/src/duckdb/src/include/duckdb/catalog/default/default_views.hpp +2 -2
  489. package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +4 -5
  490. package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +6 -4
  491. package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +10 -9
  492. package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +2 -1
  493. package/src/duckdb/src/include/duckdb/common/adbc/adbc-init.hpp +37 -0
  494. package/src/duckdb/src/include/duckdb/common/adbc/adbc.h +1088 -0
  495. package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +85 -0
  496. package/src/duckdb/src/include/duckdb/common/adbc/driver_manager.h +84 -0
  497. package/src/duckdb/src/include/duckdb/common/allocator.hpp +2 -1
  498. package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
  499. package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +147 -0
  500. package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +8 -2
  501. package/src/duckdb/src/include/duckdb/common/case_insensitive_map.hpp +2 -3
  502. package/src/duckdb/src/include/duckdb/common/common.hpp +1 -0
  503. package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +1 -0
  504. package/src/duckdb/src/include/duckdb/common/constants.hpp +9 -29
  505. package/src/duckdb/src/include/duckdb/common/crypto/md5.hpp +1 -1
  506. package/src/duckdb/src/include/duckdb/common/enums/aggregate_handling.hpp +2 -0
  507. package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +2 -3
  508. package/src/duckdb/src/include/duckdb/common/enums/file_glob_options.hpp +20 -0
  509. package/src/duckdb/src/include/duckdb/common/enums/joinref_type.hpp +7 -4
  510. package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +2 -0
  511. package/src/duckdb/src/include/duckdb/common/enums/order_preservation_type.hpp +24 -0
  512. package/src/duckdb/src/include/duckdb/common/enums/order_type.hpp +2 -0
  513. package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +2 -0
  514. package/src/duckdb/src/include/duckdb/common/enums/set_operation_type.hpp +2 -1
  515. package/src/duckdb/src/include/duckdb/common/exception.hpp +77 -5
  516. package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +6 -2
  517. package/src/duckdb/src/include/duckdb/common/fast_mem.hpp +528 -0
  518. package/src/duckdb/src/include/duckdb/common/field_writer.hpp +12 -4
  519. package/src/duckdb/src/include/duckdb/common/file_system.hpp +3 -2
  520. package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +34 -0
  521. package/src/duckdb/src/include/duckdb/common/gzip_file_system.hpp +4 -1
  522. package/src/duckdb/src/include/duckdb/common/helper.hpp +70 -9
  523. package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +16 -6
  524. package/src/duckdb/src/include/duckdb/common/{http_stats.hpp → http_state.hpp} +18 -4
  525. package/src/duckdb/src/include/duckdb/common/hugeint.hpp +63 -0
  526. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +199 -0
  527. package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +28 -0
  528. package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +45 -149
  529. package/src/duckdb/src/include/duckdb/common/operator/multiply.hpp +2 -0
  530. package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +76 -0
  531. package/src/duckdb/src/include/duckdb/common/perfect_map_set.hpp +34 -0
  532. package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +6 -1
  533. package/src/duckdb/src/include/duckdb/common/progress_bar/progress_bar.hpp +2 -0
  534. package/src/duckdb/src/include/duckdb/common/radix.hpp +1 -1
  535. package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +80 -27
  536. package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +3 -3
  537. package/src/duckdb/src/include/duckdb/common/reference_map.hpp +38 -0
  538. package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +21 -9
  539. package/src/duckdb/src/include/duckdb/common/serializer/buffered_deserializer.hpp +4 -2
  540. package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +9 -2
  541. package/src/duckdb/src/include/duckdb/common/serializer/enum_serializer.hpp +113 -0
  542. package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +373 -0
  543. package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +248 -0
  544. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +109 -0
  545. package/src/duckdb/src/include/duckdb/common/serializer.hpp +13 -0
  546. package/src/duckdb/src/include/duckdb/common/shared_ptr.hpp +11 -0
  547. package/src/duckdb/src/include/duckdb/common/sort/comparators.hpp +1 -1
  548. package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +247 -0
  549. package/src/duckdb/src/include/duckdb/common/sort/sort.hpp +1 -1
  550. package/src/duckdb/src/include/duckdb/common/sort/sorted_block.hpp +2 -2
  551. package/src/duckdb/src/include/duckdb/common/string_util.hpp +39 -0
  552. package/src/duckdb/src/include/duckdb/common/typedefs.hpp +31 -0
  553. package/src/duckdb/src/include/duckdb/common/types/batched_data_collection.hpp +1 -1
  554. package/src/duckdb/src/include/duckdb/common/types/bit.hpp +7 -6
  555. package/src/duckdb/src/include/duckdb/common/types/{column_data_allocator.hpp → column/column_data_allocator.hpp} +4 -4
  556. package/src/duckdb/src/include/duckdb/common/types/{column_data_collection.hpp → column/column_data_collection.hpp} +4 -4
  557. package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_iterators.hpp → column/column_data_collection_iterators.hpp} +2 -2
  558. package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_segment.hpp → column/column_data_collection_segment.hpp} +3 -3
  559. package/src/duckdb/src/include/duckdb/common/types/{column_data_consumer.hpp → column/column_data_consumer.hpp} +8 -4
  560. package/src/duckdb/src/include/duckdb/common/types/{column_data_scan_states.hpp → column/column_data_scan_states.hpp} +1 -1
  561. package/src/duckdb/src/include/duckdb/common/types/{partitioned_column_data.hpp → column/partitioned_column_data.hpp} +16 -8
  562. package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +3 -2
  563. package/src/duckdb/src/include/duckdb/common/types/interval.hpp +39 -3
  564. package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +62 -0
  565. package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +140 -0
  566. package/src/duckdb/src/include/duckdb/common/types/{row_data_collection.hpp → row/row_data_collection.hpp} +4 -3
  567. package/src/duckdb/src/include/duckdb/common/types/{row_data_collection_scanner.hpp → row/row_data_collection_scanner.hpp} +2 -2
  568. package/src/duckdb/src/include/duckdb/common/types/{row_layout.hpp → row/row_layout.hpp} +3 -1
  569. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +116 -0
  570. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +239 -0
  571. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_iterator.hpp +64 -0
  572. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +113 -0
  573. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +124 -0
  574. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +74 -0
  575. package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +1 -1
  576. package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +79 -7
  577. package/src/duckdb/src/include/duckdb/common/types/time.hpp +3 -0
  578. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +7 -1
  579. package/src/duckdb/src/include/duckdb/common/types/value.hpp +20 -53
  580. package/src/duckdb/src/include/duckdb/common/types/value_map.hpp +1 -1
  581. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +3 -1
  582. package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +1 -1
  583. package/src/duckdb/src/include/duckdb/common/types.hpp +43 -59
  584. package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +17 -66
  585. package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +61 -0
  586. package/src/duckdb/src/include/duckdb/common/vector.hpp +45 -2
  587. package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +2 -2
  588. package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +2 -2
  589. package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +69 -47
  590. package/src/duckdb/src/include/duckdb/execution/base_aggregate_hashtable.hpp +2 -2
  591. package/src/duckdb/src/include/duckdb/execution/execution_context.hpp +3 -2
  592. package/src/duckdb/src/include/duckdb/execution/executor.hpp +7 -7
  593. package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +1 -1
  594. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -3
  595. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +4 -15
  596. package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +41 -67
  597. package/src/duckdb/src/include/duckdb/execution/nested_loop_join.hpp +1 -1
  598. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/aggregate_object.hpp +15 -2
  599. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +12 -2
  600. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +12 -2
  601. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +5 -2
  602. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +9 -0
  603. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +9 -3
  604. package/src/duckdb/src/include/duckdb/execution/operator/filter/physical_filter.hpp +3 -0
  605. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +6 -4
  606. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +7 -0
  607. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +8 -1
  608. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +8 -1
  609. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +7 -0
  610. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -0
  611. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +7 -0
  612. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +7 -0
  613. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +4 -0
  614. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +7 -0
  615. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +6 -3
  616. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +7 -0
  617. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +4 -1
  618. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_sample.hpp +3 -0
  619. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +7 -0
  620. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +7 -0
  621. package/src/duckdb/src/include/duckdb/execution/operator/join/outer_join_marker.hpp +2 -2
  622. package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +2 -2
  623. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +3 -0
  624. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +13 -7
  625. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +10 -4
  626. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +3 -2
  627. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +3 -0
  628. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +9 -7
  629. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +11 -2
  630. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +3 -4
  631. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +3 -0
  632. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +5 -2
  633. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +11 -1
  634. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +10 -0
  635. package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +15 -10
  636. package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +4 -1
  637. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +8 -3
  638. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -0
  639. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +19 -15
  640. package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +5 -1
  641. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +11 -4
  642. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +12 -2
  643. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +7 -0
  644. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +8 -1
  645. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +18 -7
  646. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +7 -0
  647. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_pivot.hpp +38 -0
  648. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_projection.hpp +8 -0
  649. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +4 -2
  650. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +3 -1
  651. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +11 -5
  652. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +7 -0
  653. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +7 -0
  654. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +3 -0
  655. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +7 -0
  656. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +6 -0
  657. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +7 -0
  658. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +7 -0
  659. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +7 -0
  660. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +7 -0
  661. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +7 -0
  662. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +7 -0
  663. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +9 -2
  664. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +7 -0
  665. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +7 -0
  666. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +7 -0
  667. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +7 -0
  668. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +9 -2
  669. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +5 -1
  670. package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +7 -3
  671. package/src/duckdb/src/include/duckdb/execution/perfect_aggregate_hashtable.hpp +4 -0
  672. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +37 -70
  673. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +150 -0
  674. package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +2 -3
  675. package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +55 -5
  676. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +21 -9
  677. package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +84 -0
  678. package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +3 -3
  679. package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +42 -65
  680. package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +2 -2
  681. package/src/duckdb/src/include/duckdb/function/copy_function.hpp +22 -0
  682. package/src/duckdb/src/include/duckdb/function/function.hpp +22 -4
  683. package/src/duckdb/src/include/duckdb/function/function_binder.hpp +3 -6
  684. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +20 -3
  685. package/src/duckdb/src/include/duckdb/function/pragma_function.hpp +1 -1
  686. package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +4 -0
  687. package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +138 -0
  688. package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +12 -0
  689. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +50 -3
  690. package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +81 -1
  691. package/src/duckdb/src/include/duckdb/function/scalar/strftime.hpp +4 -0
  692. package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +10 -2
  693. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +13 -2
  694. package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +5 -2
  695. package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +13 -2
  696. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +41 -6
  697. package/src/duckdb/src/include/duckdb/function/table_function.hpp +30 -0
  698. package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +6 -3
  699. package/src/duckdb/src/include/duckdb/main/capi/cast/utils.hpp +1 -1
  700. package/src/duckdb/src/include/duckdb/main/client_config.hpp +10 -2
  701. package/src/duckdb/src/include/duckdb/main/client_data.hpp +6 -3
  702. package/src/duckdb/src/include/duckdb/main/config.hpp +4 -6
  703. package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +2 -0
  704. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +4 -3
  705. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +5 -0
  706. package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -1
  707. package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +2 -0
  708. package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +10 -9
  709. package/src/duckdb/src/include/duckdb/main/query_result.hpp +18 -4
  710. package/src/duckdb/src/include/duckdb/main/relation/explain_relation.hpp +2 -1
  711. package/src/duckdb/src/include/duckdb/main/relation.hpp +2 -1
  712. package/src/duckdb/src/include/duckdb/main/settings.hpp +29 -0
  713. package/src/duckdb/src/include/duckdb/optimizer/cse_optimizer.hpp +1 -1
  714. package/src/duckdb/src/include/duckdb/optimizer/expression_rewriter.hpp +3 -3
  715. package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +9 -9
  716. package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +2 -0
  717. package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +16 -16
  718. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +8 -8
  719. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +23 -15
  720. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +9 -10
  721. package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +18 -11
  722. package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +11 -11
  723. package/src/duckdb/src/include/duckdb/optimizer/matcher/set_matcher.hpp +8 -8
  724. package/src/duckdb/src/include/duckdb/optimizer/rule/arithmetic_simplification.hpp +1 -1
  725. package/src/duckdb/src/include/duckdb/optimizer/rule/case_simplification.hpp +1 -1
  726. package/src/duckdb/src/include/duckdb/optimizer/rule/comparison_simplification.hpp +1 -1
  727. package/src/duckdb/src/include/duckdb/optimizer/rule/conjunction_simplification.hpp +2 -2
  728. package/src/duckdb/src/include/duckdb/optimizer/rule/constant_folding.hpp +1 -1
  729. package/src/duckdb/src/include/duckdb/optimizer/rule/date_part_simplification.hpp +1 -1
  730. package/src/duckdb/src/include/duckdb/optimizer/rule/distributivity.hpp +1 -1
  731. package/src/duckdb/src/include/duckdb/optimizer/rule/empty_needle_removal.hpp +1 -1
  732. package/src/duckdb/src/include/duckdb/optimizer/rule/enum_comparison.hpp +1 -1
  733. package/src/duckdb/src/include/duckdb/optimizer/rule/equal_or_null_simplification.hpp +1 -1
  734. package/src/duckdb/src/include/duckdb/optimizer/rule/in_clause_simplification.hpp +1 -1
  735. package/src/duckdb/src/include/duckdb/optimizer/rule/like_optimizations.hpp +2 -2
  736. package/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp +1 -0
  737. package/src/duckdb/src/include/duckdb/optimizer/rule/move_constants.hpp +1 -1
  738. package/src/duckdb/src/include/duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp +24 -0
  739. package/src/duckdb/src/include/duckdb/optimizer/rule/regex_optimizations.hpp +1 -1
  740. package/src/duckdb/src/include/duckdb/optimizer/rule.hpp +2 -2
  741. package/src/duckdb/src/include/duckdb/parallel/concurrentqueue.hpp +2 -0
  742. package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +5 -5
  743. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +19 -18
  744. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +2 -2
  745. package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +19 -1
  746. package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +2 -0
  747. package/src/duckdb/src/include/duckdb/parser/constraint.hpp +18 -0
  748. package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
  749. package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +3 -0
  750. package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
  751. package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +3 -0
  752. package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +6 -0
  753. package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +5 -0
  754. package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +8 -0
  755. package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +5 -0
  756. package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +5 -0
  757. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +5 -0
  758. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +5 -0
  759. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +5 -0
  760. package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +6 -0
  761. package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +4 -0
  762. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +7 -2
  763. package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +5 -0
  764. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +5 -0
  765. package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +5 -0
  766. package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +5 -0
  767. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +7 -2
  768. package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +5 -0
  769. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +10 -0
  770. package/src/duckdb/src/include/duckdb/parser/expression_map.hpp +19 -6
  771. package/src/duckdb/src/include/duckdb/parser/expression_util.hpp +1 -1
  772. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +3 -0
  773. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +6 -0
  774. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +1 -1
  775. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +1 -1
  776. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +2 -2
  777. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +1 -1
  778. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +2 -2
  779. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +1 -1
  780. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +1 -1
  781. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +1 -1
  782. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +2 -2
  783. package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +6 -2
  784. package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +2 -2
  785. package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +1 -1
  786. package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +2 -0
  787. package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +1 -1
  788. package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +4 -3
  789. package/src/duckdb/src/include/duckdb/parser/parsed_expression.hpp +5 -0
  790. package/src/duckdb/src/include/duckdb/parser/parser.hpp +1 -7
  791. package/src/duckdb/src/include/duckdb/parser/parser_options.hpp +23 -0
  792. package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +4 -2
  793. package/src/duckdb/src/include/duckdb/parser/query_node/list.hpp +3 -0
  794. package/src/duckdb/src/include/duckdb/parser/query_node/recursive_cte_node.hpp +6 -0
  795. package/src/duckdb/src/include/duckdb/parser/query_node/select_node.hpp +8 -0
  796. package/src/duckdb/src/include/duckdb/parser/query_node/set_operation_node.hpp +6 -0
  797. package/src/duckdb/src/include/duckdb/parser/query_node.hpp +29 -1
  798. package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +24 -1
  799. package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +20 -1
  800. package/src/duckdb/src/include/duckdb/parser/statement/alter_statement.hpp +3 -0
  801. package/src/duckdb/src/include/duckdb/parser/statement/attach_statement.hpp +3 -0
  802. package/src/duckdb/src/include/duckdb/parser/statement/call_statement.hpp +3 -0
  803. package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +3 -0
  804. package/src/duckdb/src/include/duckdb/parser/statement/create_statement.hpp +3 -0
  805. package/src/duckdb/src/include/duckdb/parser/statement/delete_statement.hpp +3 -0
  806. package/src/duckdb/src/include/duckdb/parser/statement/detach_statement.hpp +3 -0
  807. package/src/duckdb/src/include/duckdb/parser/statement/drop_statement.hpp +3 -0
  808. package/src/duckdb/src/include/duckdb/parser/statement/execute_statement.hpp +3 -0
  809. package/src/duckdb/src/include/duckdb/parser/statement/explain_statement.hpp +3 -0
  810. package/src/duckdb/src/include/duckdb/parser/statement/export_statement.hpp +3 -0
  811. package/src/duckdb/src/include/duckdb/parser/statement/extension_statement.hpp +3 -0
  812. package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +3 -0
  813. package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -0
  814. package/src/duckdb/src/include/duckdb/parser/statement/load_statement.hpp +3 -0
  815. package/src/duckdb/src/include/duckdb/parser/statement/logical_plan_statement.hpp +3 -0
  816. package/src/duckdb/src/include/duckdb/parser/statement/multi_statement.hpp +3 -0
  817. package/src/duckdb/src/include/duckdb/parser/statement/pragma_statement.hpp +3 -0
  818. package/src/duckdb/src/include/duckdb/parser/statement/prepare_statement.hpp +3 -0
  819. package/src/duckdb/src/include/duckdb/parser/statement/relation_statement.hpp +3 -0
  820. package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +9 -1
  821. package/src/duckdb/src/include/duckdb/parser/statement/set_statement.hpp +3 -0
  822. package/src/duckdb/src/include/duckdb/parser/statement/show_statement.hpp +3 -0
  823. package/src/duckdb/src/include/duckdb/parser/statement/transaction_statement.hpp +3 -0
  824. package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +3 -0
  825. package/src/duckdb/src/include/duckdb/parser/statement/vacuum_statement.hpp +3 -0
  826. package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +7 -0
  827. package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +5 -0
  828. package/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +6 -0
  829. package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +6 -0
  830. package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +27 -2
  831. package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +6 -0
  832. package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +6 -0
  833. package/src/duckdb/src/include/duckdb/parser/tableref.hpp +20 -1
  834. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +25 -41
  835. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +17 -16
  836. package/src/duckdb/src/include/duckdb/planner/binder.hpp +39 -33
  837. package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +19 -1
  838. package/src/duckdb/src/include/duckdb/planner/bound_query_node.hpp +17 -0
  839. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +8 -1
  840. package/src/duckdb/src/include/duckdb/planner/bound_tableref.hpp +17 -0
  841. package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +1 -0
  842. package/src/duckdb/src/include/duckdb/planner/constraints/bound_check_constraint.hpp +3 -0
  843. package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +3 -0
  844. package/src/duckdb/src/include/duckdb/planner/constraints/bound_not_null_constraint.hpp +3 -0
  845. package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +3 -0
  846. package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +7 -0
  847. package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +3 -0
  848. package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +3 -0
  849. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +3 -0
  850. package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
  851. package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
  852. package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
  853. package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
  854. package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +4 -1
  855. package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +3 -0
  856. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -0
  857. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
  858. package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
  859. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +3 -0
  860. package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
  861. package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +3 -0
  862. package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
  863. package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +4 -1
  864. package/src/duckdb/src/include/duckdb/planner/expression.hpp +5 -2
  865. package/src/duckdb/src/include/duckdb/planner/expression_binder/aggregate_binder.hpp +1 -1
  866. package/src/duckdb/src/include/duckdb/planner/expression_binder/alter_binder.hpp +1 -1
  867. package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +65 -0
  868. package/src/duckdb/src/include/duckdb/planner/expression_binder/check_binder.hpp +1 -1
  869. package/src/duckdb/src/include/duckdb/planner/expression_binder/constant_binder.hpp +1 -1
  870. package/src/duckdb/src/include/duckdb/planner/expression_binder/group_binder.hpp +1 -1
  871. package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +4 -4
  872. package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +5 -5
  873. package/src/duckdb/src/include/duckdb/planner/expression_binder/insert_binder.hpp +1 -1
  874. package/src/duckdb/src/include/duckdb/planner/expression_binder/lateral_binder.hpp +2 -2
  875. package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +7 -4
  876. package/src/duckdb/src/include/duckdb/planner/expression_binder/qualify_binder.hpp +4 -4
  877. package/src/duckdb/src/include/duckdb/planner/expression_binder/relation_binder.hpp +1 -1
  878. package/src/duckdb/src/include/duckdb/planner/expression_binder/returning_binder.hpp +1 -1
  879. package/src/duckdb/src/include/duckdb/planner/expression_binder/select_binder.hpp +9 -38
  880. package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +2 -2
  881. package/src/duckdb/src/include/duckdb/planner/expression_binder/update_binder.hpp +1 -1
  882. package/src/duckdb/src/include/duckdb/planner/expression_binder/where_binder.hpp +4 -4
  883. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +18 -13
  884. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +17 -0
  885. package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +2 -0
  886. package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +2 -0
  887. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
  888. package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
  889. package/src/duckdb/src/include/duckdb/planner/operator/logical_asof_join.hpp +27 -0
  890. package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -1
  891. package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +8 -2
  892. package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +6 -1
  893. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +6 -2
  894. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +3 -0
  895. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +5 -2
  896. package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
  897. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +3 -0
  898. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +5 -2
  899. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
  900. package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_join.hpp +3 -0
  901. package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +15 -4
  902. package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +3 -0
  903. package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +3 -0
  904. package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +3 -0
  905. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +3 -0
  906. package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +3 -0
  907. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
  908. package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +4 -0
  909. package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
  910. package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +3 -0
  911. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +5 -2
  912. package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +3 -0
  913. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
  914. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
  915. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +3 -0
  916. package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +36 -0
  917. package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
  918. package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +3 -0
  919. package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +3 -0
  920. package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
  921. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +9 -5
  922. package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +3 -0
  923. package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +3 -0
  924. package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +3 -0
  925. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +3 -0
  926. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
  927. package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
  928. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +3 -0
  929. package/src/duckdb/src/include/duckdb/planner/operator/logical_unconditional_join.hpp +3 -0
  930. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +3 -0
  931. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +5 -2
  932. package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
  933. package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +2 -2
  934. package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_function_info.hpp +3 -2
  935. package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +3 -2
  936. package/src/duckdb/src/include/duckdb/planner/pragma_handler.hpp +3 -2
  937. package/src/duckdb/src/include/duckdb/planner/query_node/bound_recursive_cte_node.hpp +3 -0
  938. package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +11 -2
  939. package/src/duckdb/src/include/duckdb/planner/query_node/bound_set_operation_node.hpp +3 -0
  940. package/src/duckdb/src/include/duckdb/planner/query_node/list.hpp +3 -0
  941. package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +6 -5
  942. package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +5 -2
  943. package/src/duckdb/src/include/duckdb/planner/tableref/bound_cteref.hpp +3 -0
  944. package/src/duckdb/src/include/duckdb/planner/tableref/bound_dummytableref.hpp +3 -0
  945. package/src/duckdb/src/include/duckdb/planner/tableref/bound_expressionlistref.hpp +3 -0
  946. package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +3 -0
  947. package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +43 -0
  948. package/src/duckdb/src/include/duckdb/planner/tableref/bound_pos_join_ref.hpp +3 -0
  949. package/src/duckdb/src/include/duckdb/planner/tableref/bound_subqueryref.hpp +3 -0
  950. package/src/duckdb/src/include/duckdb/planner/tableref/bound_table_function.hpp +3 -0
  951. package/src/duckdb/src/include/duckdb/planner/tableref/list.hpp +1 -0
  952. package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +7 -0
  953. package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +16 -9
  954. package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +80 -0
  955. package/src/duckdb/src/include/duckdb/storage/buffer/temporary_file_information.hpp +12 -0
  956. package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +49 -182
  957. package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -2
  958. package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +1 -1
  959. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp128.hpp +1 -0
  960. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp_utils.hpp +0 -97
  961. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_analyze.hpp +1 -1
  962. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +6 -10
  963. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
  964. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +3 -2
  965. package/src/duckdb/src/include/duckdb/storage/compression/patas/algorithm/patas.hpp +1 -0
  966. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +1 -1
  967. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +6 -10
  968. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
  969. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +3 -2
  970. package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +4 -3
  971. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +7 -5
  972. package/src/duckdb/src/include/duckdb/storage/index.hpp +20 -6
  973. package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +7 -0
  974. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +159 -0
  975. package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +93 -31
  976. package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +22 -3
  977. package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +8 -6
  978. package/src/duckdb/src/include/duckdb/storage/statistics/list_stats.hpp +41 -0
  979. package/src/duckdb/src/include/duckdb/storage/statistics/node_statistics.hpp +3 -3
  980. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +114 -0
  981. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats_union.hpp +62 -0
  982. package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -7
  983. package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +74 -0
  984. package/src/duckdb/src/include/duckdb/storage/statistics/struct_stats.hpp +42 -0
  985. package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -1
  986. package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +4 -5
  987. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +2 -1
  988. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +21 -7
  989. package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +5 -3
  990. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +7 -7
  991. package/src/duckdb/src/include/duckdb/storage/table/column_segment_tree.hpp +18 -0
  992. package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +6 -3
  993. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +42 -46
  994. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +24 -8
  995. package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +35 -0
  996. package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +19 -29
  997. package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +6 -6
  998. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +281 -26
  999. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +0 -4
  1000. package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +1 -1
  1001. package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +5 -0
  1002. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +4 -5
  1003. package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +21 -21
  1004. package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +3 -3
  1005. package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +6 -6
  1006. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -3
  1007. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +37 -33
  1008. package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -5
  1009. package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +2 -1
  1010. package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
  1011. package/src/duckdb/src/include/duckdb.h +22 -1
  1012. package/src/duckdb/src/main/appender.cpp +9 -9
  1013. package/src/duckdb/src/main/attached_database.cpp +6 -7
  1014. package/src/duckdb/src/main/capi/appender-c.cpp +1 -1
  1015. package/src/duckdb/src/main/capi/cast/from_decimal-c.cpp +1 -1
  1016. package/src/duckdb/src/main/capi/duckdb-c.cpp +1 -1
  1017. package/src/duckdb/src/main/capi/pending-c.cpp +4 -4
  1018. package/src/duckdb/src/main/capi/replacement_scan-c.cpp +4 -4
  1019. package/src/duckdb/src/main/capi/result-c.cpp +3 -3
  1020. package/src/duckdb/src/main/capi/table_function-c.cpp +38 -15
  1021. package/src/duckdb/src/main/capi/threading-c.cpp +1 -1
  1022. package/src/duckdb/src/main/client_context.cpp +84 -85
  1023. package/src/duckdb/src/main/client_data.cpp +11 -10
  1024. package/src/duckdb/src/main/client_verify.cpp +2 -2
  1025. package/src/duckdb/src/main/config.cpp +73 -1
  1026. package/src/duckdb/src/main/connection.cpp +3 -3
  1027. package/src/duckdb/src/main/database.cpp +29 -19
  1028. package/src/duckdb/src/main/database_manager.cpp +6 -6
  1029. package/src/duckdb/src/main/extension/extension_helper.cpp +18 -3
  1030. package/src/duckdb/src/main/extension/extension_install.cpp +18 -2
  1031. package/src/duckdb/src/main/extension/extension_load.cpp +30 -4
  1032. package/src/duckdb/src/main/materialized_query_result.cpp +2 -2
  1033. package/src/duckdb/src/main/pending_query_result.cpp +1 -1
  1034. package/src/duckdb/src/main/prepared_statement.cpp +5 -1
  1035. package/src/duckdb/src/main/query_profiler.cpp +48 -44
  1036. package/src/duckdb/src/main/query_result.cpp +13 -0
  1037. package/src/duckdb/src/main/relation/aggregate_relation.cpp +2 -2
  1038. package/src/duckdb/src/main/relation/create_table_relation.cpp +2 -2
  1039. package/src/duckdb/src/main/relation/create_view_relation.cpp +2 -2
  1040. package/src/duckdb/src/main/relation/cross_product_relation.cpp +3 -3
  1041. package/src/duckdb/src/main/relation/delete_relation.cpp +1 -1
  1042. package/src/duckdb/src/main/relation/explain_relation.cpp +4 -4
  1043. package/src/duckdb/src/main/relation/filter_relation.cpp +4 -4
  1044. package/src/duckdb/src/main/relation/insert_relation.cpp +1 -1
  1045. package/src/duckdb/src/main/relation/join_relation.cpp +3 -3
  1046. package/src/duckdb/src/main/relation/limit_relation.cpp +3 -3
  1047. package/src/duckdb/src/main/relation/order_relation.cpp +3 -3
  1048. package/src/duckdb/src/main/relation/projection_relation.cpp +2 -2
  1049. package/src/duckdb/src/main/relation/query_relation.cpp +1 -1
  1050. package/src/duckdb/src/main/relation/read_csv_relation.cpp +4 -2
  1051. package/src/duckdb/src/main/relation/setop_relation.cpp +2 -2
  1052. package/src/duckdb/src/main/relation/table_function_relation.cpp +11 -11
  1053. package/src/duckdb/src/main/relation/table_relation.cpp +3 -3
  1054. package/src/duckdb/src/main/relation/update_relation.cpp +2 -2
  1055. package/src/duckdb/src/main/relation/value_relation.cpp +4 -4
  1056. package/src/duckdb/src/main/relation/view_relation.cpp +3 -3
  1057. package/src/duckdb/src/main/relation/write_csv_relation.cpp +1 -1
  1058. package/src/duckdb/src/main/relation/write_parquet_relation.cpp +1 -1
  1059. package/src/duckdb/src/main/relation.cpp +8 -7
  1060. package/src/duckdb/src/main/settings/settings.cpp +78 -15
  1061. package/src/duckdb/src/main/stream_query_result.cpp +5 -5
  1062. package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +4 -3
  1063. package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +3 -3
  1064. package/src/duckdb/src/optimizer/cse_optimizer.cpp +16 -15
  1065. package/src/duckdb/src/optimizer/deliminator.cpp +28 -27
  1066. package/src/duckdb/src/optimizer/expression_heuristics.cpp +11 -11
  1067. package/src/duckdb/src/optimizer/expression_rewriter.cpp +10 -10
  1068. package/src/duckdb/src/optimizer/filter_combiner.cpp +139 -138
  1069. package/src/duckdb/src/optimizer/filter_pullup.cpp +6 -4
  1070. package/src/duckdb/src/optimizer/filter_pushdown.cpp +17 -11
  1071. package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +12 -12
  1072. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +102 -111
  1073. package/src/duckdb/src/optimizer/join_order/join_node.cpp +8 -11
  1074. package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +224 -213
  1075. package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +30 -30
  1076. package/src/duckdb/src/optimizer/join_order/query_graph.cpp +37 -38
  1077. package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +28 -26
  1078. package/src/duckdb/src/optimizer/optimizer.cpp +15 -14
  1079. package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +1 -1
  1080. package/src/duckdb/src/optimizer/pullup/pullup_from_left.cpp +2 -2
  1081. package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +3 -3
  1082. package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +3 -3
  1083. package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +36 -8
  1084. package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +1 -1
  1085. package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +2 -2
  1086. package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +2 -2
  1087. package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +9 -6
  1088. package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +11 -18
  1089. package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +2 -2
  1090. package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +5 -5
  1091. package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +4 -4
  1092. package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +8 -8
  1093. package/src/duckdb/src/optimizer/pushdown/pushdown_single_join.cpp +2 -2
  1094. package/src/duckdb/src/optimizer/regex_range_filter.cpp +9 -9
  1095. package/src/duckdb/src/optimizer/remove_unused_columns.cpp +17 -12
  1096. package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +31 -30
  1097. package/src/duckdb/src/optimizer/rule/case_simplification.cpp +10 -10
  1098. package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +22 -23
  1099. package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +17 -16
  1100. package/src/duckdb/src/optimizer/rule/constant_folding.cpp +9 -9
  1101. package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +8 -8
  1102. package/src/duckdb/src/optimizer/rule/distributivity.cpp +23 -23
  1103. package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +14 -15
  1104. package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +15 -16
  1105. package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +35 -38
  1106. package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +16 -17
  1107. package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +22 -22
  1108. package/src/duckdb/src/optimizer/rule/move_constants.cpp +46 -40
  1109. package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +30 -0
  1110. package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +25 -17
  1111. package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +9 -3
  1112. package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +9 -10
  1113. package/src/duckdb/src/optimizer/statistics/expression/propagate_between.cpp +6 -6
  1114. package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +14 -11
  1115. package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
  1116. package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +15 -17
  1117. package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +2 -3
  1118. package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +3 -75
  1119. package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +7 -2
  1120. package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +12 -2
  1121. package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +2 -3
  1122. package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +40 -42
  1123. package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +1 -1
  1124. package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +9 -9
  1125. package/src/duckdb/src/optimizer/statistics/operator/propagate_limit.cpp +1 -1
  1126. package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +3 -3
  1127. package/src/duckdb/src/optimizer/statistics_propagator.cpp +34 -22
  1128. package/src/duckdb/src/optimizer/topn_optimizer.cpp +3 -3
  1129. package/src/duckdb/src/optimizer/unnest_rewriter.cpp +16 -16
  1130. package/src/duckdb/src/parallel/executor.cpp +59 -53
  1131. package/src/duckdb/src/parallel/meta_pipeline.cpp +8 -15
  1132. package/src/duckdb/src/parallel/pipeline.cpp +67 -35
  1133. package/src/duckdb/src/parallel/pipeline_executor.cpp +23 -23
  1134. package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
  1135. package/src/duckdb/src/parallel/task_scheduler.cpp +6 -6
  1136. package/src/duckdb/src/parser/column_definition.cpp +6 -6
  1137. package/src/duckdb/src/parser/common_table_expression_info.cpp +19 -0
  1138. package/src/duckdb/src/parser/constraints/check_constraint.cpp +2 -2
  1139. package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +2 -2
  1140. package/src/duckdb/src/parser/constraints/not_null_constraint.cpp +2 -2
  1141. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +4 -4
  1142. package/src/duckdb/src/parser/expression/between_expression.cpp +19 -2
  1143. package/src/duckdb/src/parser/expression/case_expression.cpp +30 -2
  1144. package/src/duckdb/src/parser/expression/cast_expression.cpp +19 -2
  1145. package/src/duckdb/src/parser/expression/collate_expression.cpp +18 -2
  1146. package/src/duckdb/src/parser/expression/columnref_expression.cpp +19 -7
  1147. package/src/duckdb/src/parser/expression/comparison_expression.cpp +18 -2
  1148. package/src/duckdb/src/parser/expression/conjunction_expression.cpp +20 -3
  1149. package/src/duckdb/src/parser/expression/constant_expression.cpp +17 -3
  1150. package/src/duckdb/src/parser/expression/default_expression.cpp +9 -2
  1151. package/src/duckdb/src/parser/expression/function_expression.cpp +42 -6
  1152. package/src/duckdb/src/parser/expression/lambda_expression.cpp +18 -2
  1153. package/src/duckdb/src/parser/expression/operator_expression.cpp +17 -2
  1154. package/src/duckdb/src/parser/expression/parameter_expression.cpp +17 -2
  1155. package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +16 -2
  1156. package/src/duckdb/src/parser/expression/star_expression.cpp +30 -8
  1157. package/src/duckdb/src/parser/expression/subquery_expression.cpp +22 -2
  1158. package/src/duckdb/src/parser/expression/window_expression.cpp +72 -2
  1159. package/src/duckdb/src/parser/expression_util.cpp +6 -6
  1160. package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +1 -1
  1161. package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +1 -1
  1162. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +27 -28
  1163. package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +1 -1
  1164. package/src/duckdb/src/parser/parsed_data/create_collation_info.cpp +1 -1
  1165. package/src/duckdb/src/parser/parsed_data/create_copy_function_info.cpp +1 -1
  1166. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +2 -2
  1167. package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +1 -1
  1168. package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -3
  1169. package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +3 -3
  1170. package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
  1171. package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +3 -3
  1172. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +24 -12
  1173. package/src/duckdb/src/parser/parsed_expression.cpp +72 -0
  1174. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +26 -20
  1175. package/src/duckdb/src/parser/parser.cpp +12 -12
  1176. package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +27 -6
  1177. package/src/duckdb/src/parser/query_node/select_node.cpp +43 -12
  1178. package/src/duckdb/src/parser/query_node/set_operation_node.cpp +23 -6
  1179. package/src/duckdb/src/parser/query_node.cpp +54 -4
  1180. package/src/duckdb/src/parser/result_modifier.cpp +97 -8
  1181. package/src/duckdb/src/parser/statement/copy_statement.cpp +1 -1
  1182. package/src/duckdb/src/parser/statement/drop_statement.cpp +1 -1
  1183. package/src/duckdb/src/parser/statement/extension_statement.cpp +1 -1
  1184. package/src/duckdb/src/parser/statement/insert_statement.cpp +1 -1
  1185. package/src/duckdb/src/parser/statement/pragma_statement.cpp +1 -1
  1186. package/src/duckdb/src/parser/statement/select_statement.cpp +59 -3
  1187. package/src/duckdb/src/parser/statement/show_statement.cpp +1 -1
  1188. package/src/duckdb/src/parser/statement/transaction_statement.cpp +2 -2
  1189. package/src/duckdb/src/parser/statement/vacuum_statement.cpp +1 -1
  1190. package/src/duckdb/src/parser/tableref/basetableref.cpp +23 -2
  1191. package/src/duckdb/src/parser/tableref/emptytableref.cpp +6 -2
  1192. package/src/duckdb/src/parser/tableref/expressionlistref.cpp +19 -2
  1193. package/src/duckdb/src/parser/tableref/joinref.cpp +31 -2
  1194. package/src/duckdb/src/parser/tableref/pivotref.cpp +88 -11
  1195. package/src/duckdb/src/parser/tableref/subqueryref.cpp +17 -2
  1196. package/src/duckdb/src/parser/tableref/table_function.cpp +19 -2
  1197. package/src/duckdb/src/parser/tableref.cpp +46 -0
  1198. package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +7 -7
  1199. package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +16 -5
  1200. package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +6 -6
  1201. package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +39 -0
  1202. package/src/duckdb/src/parser/transform/expression/transform_case.cpp +3 -3
  1203. package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +2 -2
  1204. package/src/duckdb/src/parser/transform/expression/transform_coalesce.cpp +1 -1
  1205. package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +19 -4
  1206. package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +7 -7
  1207. package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +5 -2
  1208. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +96 -119
  1209. package/src/duckdb/src/parser/transform/expression/transform_grouping_function.cpp +1 -1
  1210. package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +5 -5
  1211. package/src/duckdb/src/parser/transform/expression/transform_lambda.cpp +1 -1
  1212. package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +29 -25
  1213. package/src/duckdb/src/parser/transform/expression/transform_param_ref.cpp +1 -1
  1214. package/src/duckdb/src/parser/transform/expression/transform_positional_reference.cpp +1 -1
  1215. package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +11 -11
  1216. package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +5 -5
  1217. package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +11 -4
  1218. package/src/duckdb/src/parser/transform/helpers/transform_orderby.cpp +0 -7
  1219. package/src/duckdb/src/parser/transform/helpers/transform_sample.cpp +1 -1
  1220. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +3 -2
  1221. package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -3
  1222. package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +10 -10
  1223. package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +2 -2
  1224. package/src/duckdb/src/parser/transform/statement/transform_call.cpp +1 -1
  1225. package/src/duckdb/src/parser/transform/statement/transform_checkpoint.cpp +3 -3
  1226. package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +1 -1
  1227. package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +2 -2
  1228. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +4 -4
  1229. package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +4 -4
  1230. package/src/duckdb/src/parser/transform/statement/transform_create_schema.cpp +2 -2
  1231. package/src/duckdb/src/parser/transform/statement/transform_create_sequence.cpp +2 -2
  1232. package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +3 -3
  1233. package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +2 -2
  1234. package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +2 -3
  1235. package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -2
  1236. package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +1 -1
  1237. package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +2 -2
  1238. package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
  1239. package/src/duckdb/src/parser/transform/statement/transform_explain.cpp +1 -1
  1240. package/src/duckdb/src/parser/transform/statement/transform_export.cpp +2 -2
  1241. package/src/duckdb/src/parser/transform/statement/transform_import.cpp +1 -1
  1242. package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +2 -2
  1243. package/src/duckdb/src/parser/transform/statement/transform_load.cpp +2 -2
  1244. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +59 -25
  1245. package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +7 -7
  1246. package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +3 -3
  1247. package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +7 -8
  1248. package/src/duckdb/src/parser/transform/statement/transform_select.cpp +1 -1
  1249. package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +57 -54
  1250. package/src/duckdb/src/parser/transform/statement/transform_set.cpp +2 -2
  1251. package/src/duckdb/src/parser/transform/statement/transform_show.cpp +5 -5
  1252. package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +1 -1
  1253. package/src/duckdb/src/parser/transform/statement/transform_transaction.cpp +3 -3
  1254. package/src/duckdb/src/parser/transform/statement/transform_update.cpp +2 -2
  1255. package/src/duckdb/src/parser/transform/statement/transform_upsert.cpp +3 -3
  1256. package/src/duckdb/src/parser/transform/statement/transform_use.cpp +1 -1
  1257. package/src/duckdb/src/parser/transform/statement/transform_vacuum.cpp +1 -1
  1258. package/src/duckdb/src/parser/transform/tableref/transform_base_tableref.cpp +1 -1
  1259. package/src/duckdb/src/parser/transform/tableref/transform_from.cpp +3 -3
  1260. package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +13 -2
  1261. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +23 -7
  1262. package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +2 -2
  1263. package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +1 -1
  1264. package/src/duckdb/src/parser/transformer.cpp +54 -12
  1265. package/src/duckdb/src/planner/bind_context.cpp +96 -96
  1266. package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +19 -16
  1267. package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +8 -8
  1268. package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +1 -1
  1269. package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +1 -1
  1270. package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +2 -2
  1271. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +60 -16
  1272. package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +2 -2
  1273. package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +1 -1
  1274. package/src/duckdb/src/planner/binder/expression/bind_constant_expression.cpp +1 -1
  1275. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +40 -29
  1276. package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +14 -13
  1277. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +10 -10
  1278. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +16 -3
  1279. package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +2 -2
  1280. package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +176 -0
  1281. package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +9 -5
  1282. package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +163 -24
  1283. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +6 -6
  1284. package/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +1 -1
  1285. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +134 -133
  1286. package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +18 -18
  1287. package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +3 -3
  1288. package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +17 -6
  1289. package/src/duckdb/src/planner/binder/query_node/plan_recursive_cte_node.cpp +4 -5
  1290. package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +28 -25
  1291. package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +6 -7
  1292. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +34 -36
  1293. package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +1 -1
  1294. package/src/duckdb/src/planner/binder/statement/bind_call.cpp +3 -2
  1295. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +28 -16
  1296. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +51 -52
  1297. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +31 -23
  1298. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +10 -10
  1299. package/src/duckdb/src/planner/binder/statement/bind_detach.cpp +1 -1
  1300. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +1 -1
  1301. package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +2 -2
  1302. package/src/duckdb/src/planner/binder/statement/bind_explain.cpp +1 -1
  1303. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +25 -26
  1304. package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +1 -1
  1305. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +39 -36
  1306. package/src/duckdb/src/planner/binder/statement/bind_load.cpp +1 -1
  1307. package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +1 -1
  1308. package/src/duckdb/src/planner/binder/statement/bind_prepare.cpp +1 -1
  1309. package/src/duckdb/src/planner/binder/statement/bind_set.cpp +4 -4
  1310. package/src/duckdb/src/planner/binder/statement/bind_show.cpp +1 -1
  1311. package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +2 -2
  1312. package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +28 -28
  1313. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +29 -27
  1314. package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +10 -9
  1315. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +37 -34
  1316. package/src/duckdb/src/planner/binder/tableref/bind_emptytableref.cpp +1 -1
  1317. package/src/duckdb/src/planner/binder/tableref/bind_expressionlistref.cpp +1 -1
  1318. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +45 -27
  1319. package/src/duckdb/src/planner/binder/tableref/bind_named_parameters.cpp +1 -1
  1320. package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +324 -98
  1321. package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +7 -7
  1322. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +37 -18
  1323. package/src/duckdb/src/planner/binder/tableref/plan_cteref.cpp +2 -1
  1324. package/src/duckdb/src/planner/binder/tableref/plan_dummytableref.cpp +1 -1
  1325. package/src/duckdb/src/planner/binder/tableref/plan_expressionlistref.cpp +3 -3
  1326. package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +78 -30
  1327. package/src/duckdb/src/planner/binder/tableref/plan_pivotref.cpp +13 -0
  1328. package/src/duckdb/src/planner/binder.cpp +85 -94
  1329. package/src/duckdb/src/planner/bound_result_modifier.cpp +27 -1
  1330. package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +20 -13
  1331. package/src/duckdb/src/planner/expression/bound_between_expression.cpp +9 -9
  1332. package/src/duckdb/src/planner/expression/bound_case_expression.cpp +3 -3
  1333. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +8 -9
  1334. package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +4 -4
  1335. package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +5 -6
  1336. package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +4 -4
  1337. package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +4 -4
  1338. package/src/duckdb/src/planner/expression/bound_expression.cpp +4 -0
  1339. package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -8
  1340. package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +5 -5
  1341. package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +5 -5
  1342. package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +4 -4
  1343. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +5 -5
  1344. package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +4 -4
  1345. package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +4 -4
  1346. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +21 -22
  1347. package/src/duckdb/src/planner/expression.cpp +2 -1
  1348. package/src/duckdb/src/planner/expression_binder/aggregate_binder.cpp +2 -2
  1349. package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +4 -4
  1350. package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +146 -0
  1351. package/src/duckdb/src/planner/expression_binder/check_binder.cpp +7 -7
  1352. package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +1 -1
  1353. package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +13 -3
  1354. package/src/duckdb/src/planner/expression_binder/group_binder.cpp +6 -6
  1355. package/src/duckdb/src/planner/expression_binder/having_binder.cpp +11 -8
  1356. package/src/duckdb/src/planner/expression_binder/index_binder.cpp +6 -5
  1357. package/src/duckdb/src/planner/expression_binder/insert_binder.cpp +2 -2
  1358. package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +6 -6
  1359. package/src/duckdb/src/planner/expression_binder/order_binder.cpp +8 -8
  1360. package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +9 -8
  1361. package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +2 -2
  1362. package/src/duckdb/src/planner/expression_binder/returning_binder.cpp +2 -2
  1363. package/src/duckdb/src/planner/expression_binder/select_binder.cpp +1 -132
  1364. package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +10 -6
  1365. package/src/duckdb/src/planner/expression_binder/update_binder.cpp +2 -2
  1366. package/src/duckdb/src/planner/expression_binder/where_binder.cpp +6 -5
  1367. package/src/duckdb/src/planner/expression_binder.cpp +50 -51
  1368. package/src/duckdb/src/planner/expression_iterator.cpp +34 -27
  1369. package/src/duckdb/src/planner/filter/conjunction_filter.cpp +2 -2
  1370. package/src/duckdb/src/planner/filter/constant_filter.cpp +5 -7
  1371. package/src/duckdb/src/planner/filter/null_filter.cpp +2 -2
  1372. package/src/duckdb/src/planner/joinside.cpp +5 -5
  1373. package/src/duckdb/src/planner/logical_operator.cpp +10 -2
  1374. package/src/duckdb/src/planner/logical_operator_visitor.cpp +32 -26
  1375. package/src/duckdb/src/planner/operator/logical_aggregate.cpp +1 -1
  1376. package/src/duckdb/src/planner/operator/logical_any_join.cpp +1 -1
  1377. package/src/duckdb/src/planner/operator/logical_asof_join.cpp +14 -0
  1378. package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +2 -2
  1379. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +3 -3
  1380. package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +4 -4
  1381. package/src/duckdb/src/planner/operator/logical_create.cpp +1 -1
  1382. package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
  1383. package/src/duckdb/src/planner/operator/logical_create_table.cpp +2 -2
  1384. package/src/duckdb/src/planner/operator/logical_cross_product.cpp +1 -1
  1385. package/src/duckdb/src/planner/operator/logical_cteref.cpp +1 -1
  1386. package/src/duckdb/src/planner/operator/logical_delete.cpp +5 -5
  1387. package/src/duckdb/src/planner/operator/logical_delim_get.cpp +1 -1
  1388. package/src/duckdb/src/planner/operator/logical_delim_join.cpp +1 -1
  1389. package/src/duckdb/src/planner/operator/logical_distinct.cpp +6 -1
  1390. package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +1 -1
  1391. package/src/duckdb/src/planner/operator/logical_expression_get.cpp +1 -1
  1392. package/src/duckdb/src/planner/operator/logical_filter.cpp +2 -2
  1393. package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
  1394. package/src/duckdb/src/planner/operator/logical_insert.cpp +6 -7
  1395. package/src/duckdb/src/planner/operator/logical_join.cpp +1 -1
  1396. package/src/duckdb/src/planner/operator/logical_limit.cpp +1 -1
  1397. package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +1 -1
  1398. package/src/duckdb/src/planner/operator/logical_order.cpp +1 -1
  1399. package/src/duckdb/src/planner/operator/logical_pivot.cpp +35 -0
  1400. package/src/duckdb/src/planner/operator/logical_positional_join.cpp +1 -1
  1401. package/src/duckdb/src/planner/operator/logical_projection.cpp +1 -1
  1402. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +1 -1
  1403. package/src/duckdb/src/planner/operator/logical_reset.cpp +1 -1
  1404. package/src/duckdb/src/planner/operator/logical_sample.cpp +1 -1
  1405. package/src/duckdb/src/planner/operator/logical_set.cpp +1 -1
  1406. package/src/duckdb/src/planner/operator/logical_simple.cpp +1 -1
  1407. package/src/duckdb/src/planner/operator/logical_top_n.cpp +1 -1
  1408. package/src/duckdb/src/planner/operator/logical_unnest.cpp +1 -1
  1409. package/src/duckdb/src/planner/operator/logical_update.cpp +6 -7
  1410. package/src/duckdb/src/planner/operator/logical_window.cpp +1 -1
  1411. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -5
  1412. package/src/duckdb/src/planner/planner.cpp +2 -1
  1413. package/src/duckdb/src/planner/pragma_handler.cpp +9 -7
  1414. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +64 -60
  1415. package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +5 -6
  1416. package/src/duckdb/src/planner/table_binding.cpp +18 -17
  1417. package/src/duckdb/src/planner/table_filter.cpp +2 -2
  1418. package/src/duckdb/src/storage/arena_allocator.cpp +34 -2
  1419. package/src/duckdb/src/storage/buffer/block_handle.cpp +129 -0
  1420. package/src/duckdb/src/storage/buffer/block_manager.cpp +83 -0
  1421. package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -0
  1422. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +136 -0
  1423. package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +35 -0
  1424. package/src/duckdb/src/storage/buffer_manager.cpp +35 -1077
  1425. package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +1 -1
  1426. package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +5 -16
  1427. package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +13 -7
  1428. package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +2 -2
  1429. package/src/duckdb/src/storage/checkpoint_manager.cpp +38 -32
  1430. package/src/duckdb/src/storage/compression/bitpacking.cpp +12 -13
  1431. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +12 -13
  1432. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +9 -8
  1433. package/src/duckdb/src/storage/compression/fsst.cpp +15 -17
  1434. package/src/duckdb/src/storage/compression/numeric_constant.cpp +10 -11
  1435. package/src/duckdb/src/storage/compression/patas.cpp +1 -1
  1436. package/src/duckdb/src/storage/compression/rle.cpp +10 -11
  1437. package/src/duckdb/src/storage/compression/string_uncompressed.cpp +7 -7
  1438. package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +9 -9
  1439. package/src/duckdb/src/storage/data_table.cpp +50 -50
  1440. package/src/duckdb/src/storage/index.cpp +17 -7
  1441. package/src/duckdb/src/storage/local_storage.cpp +98 -91
  1442. package/src/duckdb/src/storage/meta_block_reader.cpp +23 -0
  1443. package/src/duckdb/src/storage/single_file_block_manager.cpp +2 -2
  1444. package/src/duckdb/src/storage/standard_buffer_manager.cpp +801 -0
  1445. package/src/duckdb/src/storage/statistics/base_statistics.cpp +373 -128
  1446. package/src/duckdb/src/storage/statistics/column_statistics.cpp +57 -3
  1447. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +10 -11
  1448. package/src/duckdb/src/storage/statistics/list_stats.cpp +121 -0
  1449. package/src/duckdb/src/storage/statistics/numeric_stats.cpp +591 -0
  1450. package/src/duckdb/src/storage/statistics/numeric_stats_union.cpp +65 -0
  1451. package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -11
  1452. package/src/duckdb/src/storage/statistics/string_stats.cpp +273 -0
  1453. package/src/duckdb/src/storage/statistics/struct_stats.cpp +133 -0
  1454. package/src/duckdb/src/storage/storage_info.cpp +2 -2
  1455. package/src/duckdb/src/storage/storage_lock.cpp +2 -2
  1456. package/src/duckdb/src/storage/storage_manager.cpp +20 -21
  1457. package/src/duckdb/src/storage/table/chunk_info.cpp +2 -2
  1458. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +7 -13
  1459. package/src/duckdb/src/storage/table/column_data.cpp +123 -70
  1460. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +28 -15
  1461. package/src/duckdb/src/storage/table/column_segment.cpp +55 -71
  1462. package/src/duckdb/src/storage/table/list_column_data.cpp +21 -27
  1463. package/src/duckdb/src/storage/table/persistent_table_data.cpp +2 -1
  1464. package/src/duckdb/src/storage/table/row_group.cpp +222 -152
  1465. package/src/duckdb/src/storage/table/row_group_collection.cpp +154 -108
  1466. package/src/duckdb/src/storage/table/scan_state.cpp +46 -34
  1467. package/src/duckdb/src/storage/table/standard_column_data.cpp +13 -14
  1468. package/src/duckdb/src/storage/table/struct_column_data.cpp +30 -37
  1469. package/src/duckdb/src/storage/table/table_statistics.cpp +28 -8
  1470. package/src/duckdb/src/storage/table/update_segment.cpp +41 -36
  1471. package/src/duckdb/src/storage/table_index_list.cpp +3 -3
  1472. package/src/duckdb/src/storage/wal_replay.cpp +11 -8
  1473. package/src/duckdb/src/storage/write_ahead_log.cpp +47 -47
  1474. package/src/duckdb/src/transaction/cleanup_state.cpp +10 -10
  1475. package/src/duckdb/src/transaction/commit_state.cpp +66 -62
  1476. package/src/duckdb/src/transaction/duck_transaction.cpp +9 -9
  1477. package/src/duckdb/src/transaction/duck_transaction_manager.cpp +4 -4
  1478. package/src/duckdb/src/transaction/meta_transaction.cpp +13 -13
  1479. package/src/duckdb/src/transaction/rollback_state.cpp +2 -2
  1480. package/src/duckdb/src/transaction/transaction.cpp +1 -1
  1481. package/src/duckdb/src/transaction/transaction_context.cpp +2 -2
  1482. package/src/duckdb/src/transaction/undo_buffer.cpp +2 -1
  1483. package/src/duckdb/src/verification/copied_statement_verifier.cpp +1 -1
  1484. package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +2 -3
  1485. package/src/duckdb/src/verification/external_statement_verifier.cpp +1 -1
  1486. package/src/duckdb/src/verification/parsed_statement_verifier.cpp +1 -1
  1487. package/src/duckdb/src/verification/prepared_statement_verifier.cpp +7 -7
  1488. package/src/duckdb/src/verification/statement_verifier.cpp +3 -3
  1489. package/src/duckdb/src/verification/unoptimized_statement_verifier.cpp +1 -1
  1490. package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +32 -0
  1491. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +2 -1
  1492. package/src/duckdb/third_party/libpg_query/include/nodes/primnodes.hpp +3 -3
  1493. package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +949 -961
  1494. package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +4 -11
  1495. package/src/duckdb/third_party/libpg_query/include/postgres_parser.hpp +3 -2
  1496. package/src/duckdb/third_party/libpg_query/postgres_parser.cpp +5 -6
  1497. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +18328 -17747
  1498. package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +503 -493
  1499. package/src/duckdb/third_party/parquet/parquet_types.cpp +32 -32
  1500. package/src/duckdb/third_party/parquet/parquet_types.h +34 -32
  1501. package/src/duckdb/third_party/re2/re2/re2.cc +9 -0
  1502. package/src/duckdb/third_party/re2/re2/re2.h +2 -0
  1503. package/src/duckdb/third_party/thrift/thrift/TToString.h +3 -3
  1504. package/src/duckdb/third_party/thrift/thrift/protocol/TProtocol.h +1 -1
  1505. package/src/duckdb/third_party/thrift/thrift/protocol/TProtocolDecorator.h +2 -1
  1506. package/src/duckdb/third_party/thrift/thrift/protocol/TVirtualProtocol.h +5 -4
  1507. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +5 -5
  1508. package/src/duckdb/ub_extension_json_json_functions.cpp +2 -0
  1509. package/src/duckdb/ub_src_common.cpp +6 -0
  1510. package/src/duckdb/ub_src_common_adbc.cpp +4 -0
  1511. package/src/duckdb/ub_src_common_serializer.cpp +2 -0
  1512. package/src/duckdb/ub_src_common_sort.cpp +2 -0
  1513. package/src/duckdb/ub_src_common_types.cpp +1 -15
  1514. package/src/duckdb/ub_src_common_types_column.cpp +10 -0
  1515. package/src/duckdb/ub_src_common_types_row.cpp +20 -0
  1516. package/src/duckdb/ub_src_execution_operator_projection.cpp +2 -0
  1517. package/src/duckdb/ub_src_execution_physical_plan.cpp +4 -0
  1518. package/src/duckdb/ub_src_function_scalar_generic.cpp +2 -0
  1519. package/src/duckdb/ub_src_function_scalar_string.cpp +4 -0
  1520. package/src/duckdb/ub_src_function_scalar_string_regexp.cpp +4 -0
  1521. package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
  1522. package/src/duckdb/ub_src_parser.cpp +2 -0
  1523. package/src/duckdb/ub_src_parser_transform_expression.cpp +2 -0
  1524. package/src/duckdb/ub_src_planner_binder_expression.cpp +2 -0
  1525. package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
  1526. package/src/duckdb/ub_src_planner_expression_binder.cpp +2 -0
  1527. package/src/duckdb/ub_src_planner_operator.cpp +4 -0
  1528. package/src/duckdb/ub_src_storage.cpp +2 -0
  1529. package/src/duckdb/ub_src_storage_buffer.cpp +8 -0
  1530. package/src/duckdb/ub_src_storage_statistics.cpp +6 -6
  1531. package/src/duckdb/ub_src_storage_table.cpp +0 -2
  1532. package/src/duckdb_node.hpp +15 -10
  1533. package/src/statement.cpp +31 -27
  1534. package/src/utils.cpp +27 -2
  1535. package/test/extension.test.ts +44 -26
  1536. package/test/syntax_error.test.ts +3 -1
  1537. package/test/udf.test.ts +9 -0
  1538. package/filelist.cache +0 -0
  1539. package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +0 -65
  1540. package/src/duckdb/src/include/duckdb/common/single_thread_ptr.hpp +0 -183
  1541. package/src/duckdb/src/include/duckdb/storage/statistics/list_statistics.hpp +0 -36
  1542. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_statistics.hpp +0 -75
  1543. package/src/duckdb/src/include/duckdb/storage/statistics/string_statistics.hpp +0 -49
  1544. package/src/duckdb/src/include/duckdb/storage/statistics/struct_statistics.hpp +0 -36
  1545. package/src/duckdb/src/include/duckdb/storage/statistics/validity_statistics.hpp +0 -45
  1546. package/src/duckdb/src/storage/statistics/list_statistics.cpp +0 -94
  1547. package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +0 -307
  1548. package/src/duckdb/src/storage/statistics/string_statistics.cpp +0 -220
  1549. package/src/duckdb/src/storage/statistics/struct_statistics.cpp +0 -108
  1550. package/src/duckdb/src/storage/statistics/validity_statistics.cpp +0 -91
  1551. package/src/duckdb/src/storage/table/segment_tree.cpp +0 -179
@@ -3,16 +3,14 @@
3
3
  #include "duckdb/planner/expression/bound_reference_expression.hpp"
4
4
  #include "duckdb/planner/operator/list.hpp"
5
5
  #include "duckdb/planner/operator/logical_dummy_scan.hpp"
6
- #include "duckdb/planner/operator/logical_expression_get.hpp"
7
6
  #include "duckdb/planner/operator/logical_limit.hpp"
8
- #include "duckdb/planner/operator/logical_limit_percent.hpp"
9
7
  #include "duckdb/planner/query_node/bound_select_node.hpp"
10
8
 
11
9
  namespace duckdb {
12
10
 
13
11
  unique_ptr<LogicalOperator> Binder::PlanFilter(unique_ptr<Expression> condition, unique_ptr<LogicalOperator> root) {
14
- PlanSubqueries(&condition, &root);
15
- auto filter = make_unique<LogicalFilter>(std::move(condition));
12
+ PlanSubqueries(condition, root);
13
+ auto filter = make_uniq<LogicalFilter>(std::move(condition));
16
14
  filter->AddChild(std::move(root));
17
15
  return std::move(filter);
18
16
  }
@@ -25,7 +23,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
25
23
 
26
24
  // plan the sample clause
27
25
  if (statement.sample_options) {
28
- root = make_unique<LogicalSample>(std::move(statement.sample_options), std::move(root));
26
+ root = make_uniq<LogicalSample>(std::move(statement.sample_options), std::move(root));
29
27
  }
30
28
 
31
29
  if (statement.where_clause) {
@@ -36,16 +34,16 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
36
34
  if (!statement.groups.group_expressions.empty()) {
37
35
  // visit the groups
38
36
  for (auto &group : statement.groups.group_expressions) {
39
- PlanSubqueries(&group, &root);
37
+ PlanSubqueries(group, root);
40
38
  }
41
39
  }
42
40
  // now visit all aggregate expressions
43
41
  for (auto &expr : statement.aggregates) {
44
- PlanSubqueries(&expr, &root);
42
+ PlanSubqueries(expr, root);
45
43
  }
46
44
  // finally create the aggregate node with the group_index and aggregate_index as obtained from the binder
47
- auto aggregate = make_unique<LogicalAggregate>(statement.group_index, statement.aggregate_index,
48
- std::move(statement.aggregates));
45
+ auto aggregate = make_uniq<LogicalAggregate>(statement.group_index, statement.aggregate_index,
46
+ std::move(statement.aggregates));
49
47
  aggregate->groups = std::move(statement.groups.group_expressions);
50
48
  aggregate->groupings_index = statement.groupings_index;
51
49
  aggregate->grouping_sets = std::move(statement.groups.grouping_sets);
@@ -57,23 +55,23 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
57
55
  // edge case: we have grouping sets but no groups or aggregates
58
56
  // this can only happen if we have e.g. select 1 from tbl group by ();
59
57
  // just output a dummy scan
60
- root = make_unique_base<LogicalOperator, LogicalDummyScan>(statement.group_index);
58
+ root = make_uniq_base<LogicalOperator, LogicalDummyScan>(statement.group_index);
61
59
  }
62
60
 
63
61
  if (statement.having) {
64
- PlanSubqueries(&statement.having, &root);
65
- auto having = make_unique<LogicalFilter>(std::move(statement.having));
62
+ PlanSubqueries(statement.having, root);
63
+ auto having = make_uniq<LogicalFilter>(std::move(statement.having));
66
64
 
67
65
  having->AddChild(std::move(root));
68
66
  root = std::move(having);
69
67
  }
70
68
 
71
69
  if (!statement.windows.empty()) {
72
- auto win = make_unique<LogicalWindow>(statement.window_index);
70
+ auto win = make_uniq<LogicalWindow>(statement.window_index);
73
71
  win->expressions = std::move(statement.windows);
74
72
  // visit the window expressions
75
73
  for (auto &expr : win->expressions) {
76
- PlanSubqueries(&expr, &root);
74
+ PlanSubqueries(expr, root);
77
75
  }
78
76
  D_ASSERT(!win->expressions.empty());
79
77
  win->AddChild(std::move(root));
@@ -81,19 +79,25 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
81
79
  }
82
80
 
83
81
  if (statement.qualify) {
84
- PlanSubqueries(&statement.qualify, &root);
85
- auto qualify = make_unique<LogicalFilter>(std::move(statement.qualify));
82
+ PlanSubqueries(statement.qualify, root);
83
+ auto qualify = make_uniq<LogicalFilter>(std::move(statement.qualify));
86
84
 
87
85
  qualify->AddChild(std::move(root));
88
86
  root = std::move(qualify);
89
87
  }
90
88
 
91
- if (!statement.unnests.empty()) {
92
- auto unnest = make_unique<LogicalUnnest>(statement.unnest_index);
93
- unnest->expressions = std::move(statement.unnests);
89
+ for (idx_t i = statement.unnests.size(); i > 0; i--) {
90
+ auto unnest_level = i - 1;
91
+ auto entry = statement.unnests.find(unnest_level);
92
+ if (entry == statement.unnests.end()) {
93
+ throw InternalException("unnests specified at level %d but none were found", unnest_level);
94
+ }
95
+ auto &unnest_node = entry->second;
96
+ auto unnest = make_uniq<LogicalUnnest>(unnest_node.index);
97
+ unnest->expressions = std::move(unnest_node.expressions);
94
98
  // visit the unnest expressions
95
99
  for (auto &expr : unnest->expressions) {
96
- PlanSubqueries(&expr, &root);
100
+ PlanSubqueries(expr, root);
97
101
  }
98
102
  D_ASSERT(!unnest->expressions.empty());
99
103
  unnest->AddChild(std::move(root));
@@ -101,11 +105,10 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
101
105
  }
102
106
 
103
107
  for (auto &expr : statement.select_list) {
104
- PlanSubqueries(&expr, &root);
108
+ PlanSubqueries(expr, root);
105
109
  }
106
110
 
107
- // create the projection
108
- auto proj = make_unique<LogicalProjection>(statement.projection_index, std::move(statement.select_list));
111
+ auto proj = make_uniq<LogicalProjection>(statement.projection_index, std::move(statement.select_list));
109
112
  auto &projection = *proj;
110
113
  proj->AddChild(std::move(root));
111
114
  root = std::move(proj);
@@ -118,10 +121,10 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
118
121
  D_ASSERT(root);
119
122
  vector<unique_ptr<Expression>> prune_expressions;
120
123
  for (idx_t i = 0; i < statement.column_count; i++) {
121
- prune_expressions.push_back(make_unique<BoundColumnRefExpression>(
124
+ prune_expressions.push_back(make_uniq<BoundColumnRefExpression>(
122
125
  projection.expressions[i]->return_type, ColumnBinding(statement.projection_index, i)));
123
126
  }
124
- auto prune = make_unique<LogicalProjection>(statement.prune_index, std::move(prune_expressions));
127
+ auto prune = make_uniq<LogicalProjection>(statement.prune_index, std::move(prune_expressions));
125
128
  prune->AddChild(std::move(root));
126
129
  root = std::move(prune);
127
130
  }
@@ -45,14 +45,14 @@ unique_ptr<LogicalOperator> Binder::CastLogicalOperatorToTypes(vector<LogicalTyp
45
45
  // now generate the expression list
46
46
  vector<unique_ptr<Expression>> select_list;
47
47
  for (idx_t i = 0; i < target_types.size(); i++) {
48
- unique_ptr<Expression> result = make_unique<BoundColumnRefExpression>(source_types[i], setop_columns[i]);
48
+ unique_ptr<Expression> result = make_uniq<BoundColumnRefExpression>(source_types[i], setop_columns[i]);
49
49
  if (source_types[i] != target_types[i]) {
50
50
  // add a cast only if the source and target types are not equivalent
51
51
  result = BoundCastExpression::AddCastToType(context, std::move(result), target_types[i]);
52
52
  }
53
53
  select_list.push_back(std::move(result));
54
54
  }
55
- auto projection = make_unique<LogicalProjection>(GenerateTableIndex(), std::move(select_list));
55
+ auto projection = make_uniq<LogicalProjection>(GenerateTableIndex(), std::move(select_list));
56
56
  projection->children.push_back(std::move(op));
57
57
  return std::move(projection);
58
58
  }
@@ -79,12 +79,11 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSetOperationNode &node) {
79
79
  right_types.push_back(node.right_reorder_exprs[i]->return_type);
80
80
  }
81
81
 
82
- auto left_projection = make_unique<LogicalProjection>(GenerateTableIndex(), std::move(node.left_reorder_exprs));
82
+ auto left_projection = make_uniq<LogicalProjection>(GenerateTableIndex(), std::move(node.left_reorder_exprs));
83
83
  left_projection->children.push_back(std::move(left_node));
84
84
  left_node = std::move(left_projection);
85
85
 
86
- auto right_projection =
87
- make_unique<LogicalProjection>(GenerateTableIndex(), std::move(node.right_reorder_exprs));
86
+ auto right_projection = make_uniq<LogicalProjection>(GenerateTableIndex(), std::move(node.right_reorder_exprs));
88
87
  right_projection->children.push_back(std::move(right_node));
89
88
  right_node = std::move(right_projection);
90
89
 
@@ -115,8 +114,8 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSetOperationNode &node) {
115
114
  break;
116
115
  }
117
116
 
118
- auto root = make_unique<LogicalSetOperation>(node.setop_index, node.types.size(), std::move(left_node),
119
- std::move(right_node), logical_type);
117
+ auto root = make_uniq<LogicalSetOperation>(node.setop_index, node.types.size(), std::move(left_node),
118
+ std::move(right_node), logical_type);
120
119
 
121
120
  return VisitQueryNode(node, std::move(root));
122
121
  }
@@ -25,7 +25,7 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
25
25
  case SubqueryType::EXISTS: {
26
26
  // uncorrelated EXISTS
27
27
  // we only care about existence, hence we push a LIMIT 1 operator
28
- auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
28
+ auto limit = make_uniq<LogicalLimit>(1, 0, nullptr, nullptr);
29
29
  limit->AddChild(std::move(plan));
30
30
  plan = std::move(limit);
31
31
 
@@ -40,20 +40,20 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
40
40
  aggregate_list.push_back(std::move(count_star));
41
41
  auto aggregate_index = binder.GenerateTableIndex();
42
42
  auto aggregate =
43
- make_unique<LogicalAggregate>(binder.GenerateTableIndex(), aggregate_index, std::move(aggregate_list));
43
+ make_uniq<LogicalAggregate>(binder.GenerateTableIndex(), aggregate_index, std::move(aggregate_list));
44
44
  aggregate->AddChild(std::move(plan));
45
45
  plan = std::move(aggregate);
46
46
 
47
47
  // now we push a projection with a comparison to 1
48
- auto left_child = make_unique<BoundColumnRefExpression>(idx_type, ColumnBinding(aggregate_index, 0));
49
- auto right_child = make_unique<BoundConstantExpression>(Value::Numeric(idx_type, 1));
50
- auto comparison = make_unique<BoundComparisonExpression>(ExpressionType::COMPARE_EQUAL, std::move(left_child),
51
- std::move(right_child));
48
+ auto left_child = make_uniq<BoundColumnRefExpression>(idx_type, ColumnBinding(aggregate_index, 0));
49
+ auto right_child = make_uniq<BoundConstantExpression>(Value::Numeric(idx_type, 1));
50
+ auto comparison = make_uniq<BoundComparisonExpression>(ExpressionType::COMPARE_EQUAL, std::move(left_child),
51
+ std::move(right_child));
52
52
 
53
53
  vector<unique_ptr<Expression>> projection_list;
54
54
  projection_list.push_back(std::move(comparison));
55
55
  auto projection_index = binder.GenerateTableIndex();
56
- auto projection = make_unique<LogicalProjection>(projection_index, std::move(projection_list));
56
+ auto projection = make_uniq<LogicalProjection>(projection_index, std::move(projection_list));
57
57
  projection->AddChild(std::move(plan));
58
58
  plan = std::move(projection);
59
59
 
@@ -63,8 +63,8 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
63
63
 
64
64
  // we replace the original subquery with a ColumnRefExpression referring to the result of the projection (either
65
65
  // TRUE or FALSE)
66
- return make_unique<BoundColumnRefExpression>(expr.GetName(), LogicalType::BOOLEAN,
67
- ColumnBinding(projection_index, 0));
66
+ return make_uniq<BoundColumnRefExpression>(expr.GetName(), LogicalType::BOOLEAN,
67
+ ColumnBinding(projection_index, 0));
68
68
  }
69
69
  case SubqueryType::SCALAR: {
70
70
  // uncorrelated scalar, we want to return the first entry
@@ -75,13 +75,13 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
75
75
 
76
76
  // in the uncorrelated case we are only interested in the first result of the query
77
77
  // hence we simply push a LIMIT 1 to get the first row of the subquery
78
- auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
78
+ auto limit = make_uniq<LogicalLimit>(1, 0, nullptr, nullptr);
79
79
  limit->AddChild(std::move(plan));
80
80
  plan = std::move(limit);
81
81
 
82
82
  // we push an aggregate that returns the FIRST element
83
83
  vector<unique_ptr<Expression>> expressions;
84
- auto bound = make_unique<BoundColumnRefExpression>(expr.return_type, ColumnBinding(table_idx, 0));
84
+ auto bound = make_uniq<BoundColumnRefExpression>(expr.return_type, ColumnBinding(table_idx, 0));
85
85
  vector<unique_ptr<Expression>> first_children;
86
86
  first_children.push_back(std::move(bound));
87
87
 
@@ -91,7 +91,7 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
91
91
 
92
92
  expressions.push_back(std::move(first_agg));
93
93
  auto aggr_index = binder.GenerateTableIndex();
94
- auto aggr = make_unique<LogicalAggregate>(binder.GenerateTableIndex(), aggr_index, std::move(expressions));
94
+ auto aggr = make_uniq<LogicalAggregate>(binder.GenerateTableIndex(), aggr_index, std::move(expressions));
95
95
  aggr->AddChild(std::move(plan));
96
96
  plan = std::move(aggr);
97
97
 
@@ -103,7 +103,7 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
103
103
 
104
104
  // we replace the original subquery with a BoundColumnRefExpression referring to the first result of the
105
105
  // aggregation
106
- return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(aggr_index, 0));
106
+ return make_uniq<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(aggr_index, 0));
107
107
  }
108
108
  default: {
109
109
  D_ASSERT(expr.subquery_type == SubqueryType::ANY);
@@ -115,7 +115,7 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
115
115
 
116
116
  // then we generate the MARK join with the subquery
117
117
  idx_t mark_index = binder.GenerateTableIndex();
118
- auto join = make_unique<LogicalComparisonJoin>(JoinType::MARK);
118
+ auto join = make_uniq<LogicalComparisonJoin>(JoinType::MARK);
119
119
  join->mark_index = mark_index;
120
120
  join->AddChild(std::move(root));
121
121
  join->AddChild(std::move(plan));
@@ -123,13 +123,13 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
123
123
  JoinCondition cond;
124
124
  cond.left = std::move(expr.child);
125
125
  cond.right = BoundCastExpression::AddDefaultCastToType(
126
- make_unique<BoundColumnRefExpression>(expr.child_type, plan_columns[0]), expr.child_target);
126
+ make_uniq<BoundColumnRefExpression>(expr.child_type, plan_columns[0]), expr.child_target);
127
127
  cond.comparison = expr.comparison_type;
128
128
  join->conditions.push_back(std::move(cond));
129
129
  root = std::move(join);
130
130
 
131
131
  // we replace the original subquery with a BoundColumnRefExpression referring to the mark column
132
- return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
132
+ return make_uniq<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
133
133
  }
134
134
  }
135
135
  }
@@ -137,14 +137,14 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
137
137
  static unique_ptr<LogicalDelimJoin>
138
138
  CreateDuplicateEliminatedJoin(const vector<CorrelatedColumnInfo> &correlated_columns, JoinType join_type,
139
139
  unique_ptr<LogicalOperator> original_plan, bool perform_delim) {
140
- auto delim_join = make_unique<LogicalDelimJoin>(join_type);
140
+ auto delim_join = make_uniq<LogicalDelimJoin>(join_type);
141
141
  if (!perform_delim) {
142
142
  // if we are not performing a delim join, we push a row_number() OVER() window operator on the LHS
143
143
  // and perform all duplicate elimination on that row number instead
144
144
  D_ASSERT(correlated_columns[0].type.id() == LogicalTypeId::BIGINT);
145
- auto window = make_unique<LogicalWindow>(correlated_columns[0].binding.table_index);
146
- auto row_number = make_unique<BoundWindowExpression>(ExpressionType::WINDOW_ROW_NUMBER, LogicalType::BIGINT,
147
- nullptr, nullptr);
145
+ auto window = make_uniq<LogicalWindow>(correlated_columns[0].binding.table_index);
146
+ auto row_number =
147
+ make_uniq<BoundWindowExpression>(ExpressionType::WINDOW_ROW_NUMBER, LogicalType::BIGINT, nullptr, nullptr);
148
148
  row_number->start = WindowBoundary::UNBOUNDED_PRECEDING;
149
149
  row_number->end = WindowBoundary::CURRENT_ROW_ROWS;
150
150
  row_number->alias = "delim_index";
@@ -155,8 +155,7 @@ CreateDuplicateEliminatedJoin(const vector<CorrelatedColumnInfo> &correlated_col
155
155
  delim_join->AddChild(std::move(original_plan));
156
156
  for (idx_t i = 0; i < correlated_columns.size(); i++) {
157
157
  auto &col = correlated_columns[i];
158
- delim_join->duplicate_eliminated_columns.push_back(
159
- make_unique<BoundColumnRefExpression>(col.type, col.binding));
158
+ delim_join->duplicate_eliminated_columns.push_back(make_uniq<BoundColumnRefExpression>(col.type, col.binding));
160
159
  delim_join->delim_types.push_back(col.type);
161
160
  }
162
161
  return delim_join;
@@ -173,8 +172,8 @@ static void CreateDelimJoinConditions(LogicalDelimJoin &delim_join,
173
172
  throw InternalException("Delim join - binding index out of range");
174
173
  }
175
174
  JoinCondition cond;
176
- cond.left = make_unique<BoundColumnRefExpression>(col.name, col.type, col.binding);
177
- cond.right = make_unique<BoundColumnRefExpression>(col.name, col.type, bindings[binding_idx]);
175
+ cond.left = make_uniq<BoundColumnRefExpression>(col.name, col.type, col.binding);
176
+ cond.right = make_uniq<BoundColumnRefExpression>(col.name, col.type, bindings[binding_idx]);
178
177
  cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM;
179
178
  delim_join.conditions.push_back(std::move(cond));
180
179
  }
@@ -265,8 +264,7 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
265
264
  delim_join->AddChild(std::move(dependent_join));
266
265
  root = std::move(delim_join);
267
266
  // finally push the BoundColumnRefExpression referring to the data element returned by the join
268
- return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type,
269
- plan_columns[flatten.data_offset]);
267
+ return make_uniq<BoundColumnRefExpression>(expr.GetName(), expr.return_type, plan_columns[flatten.data_offset]);
270
268
  }
271
269
  case SubqueryType::EXISTS: {
272
270
  // correlated EXISTS query
@@ -288,7 +286,7 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
288
286
  delim_join->AddChild(std::move(dependent_join));
289
287
  root = std::move(delim_join);
290
288
  // finally push the BoundColumnRefExpression referring to the marker
291
- return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
289
+ return make_uniq<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
292
290
  }
293
291
  default: {
294
292
  D_ASSERT(expr.subquery_type == SubqueryType::ANY);
@@ -317,14 +315,14 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
317
315
  JoinCondition compare_cond;
318
316
  compare_cond.left = std::move(expr.child);
319
317
  compare_cond.right = BoundCastExpression::AddDefaultCastToType(
320
- make_unique<BoundColumnRefExpression>(expr.child_type, plan_columns[0]), expr.child_target);
318
+ make_uniq<BoundColumnRefExpression>(expr.child_type, plan_columns[0]), expr.child_target);
321
319
  compare_cond.comparison = expr.comparison_type;
322
320
  delim_join->conditions.push_back(std::move(compare_cond));
323
321
 
324
322
  delim_join->AddChild(std::move(dependent_join));
325
323
  root = std::move(delim_join);
326
324
  // finally push the BoundColumnRefExpression referring to the marker
327
- return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
325
+ return make_uniq<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
328
326
  }
329
327
  }
330
328
  }
@@ -380,18 +378,18 @@ unique_ptr<Expression> Binder::PlanSubquery(BoundSubqueryExpression &expr, uniqu
380
378
  return result_expression;
381
379
  }
382
380
 
383
- void Binder::PlanSubqueries(unique_ptr<Expression> *expr_ptr, unique_ptr<LogicalOperator> *root) {
384
- if (!*expr_ptr) {
381
+ void Binder::PlanSubqueries(unique_ptr<Expression> &expr_ptr, unique_ptr<LogicalOperator> &root) {
382
+ if (!expr_ptr) {
385
383
  return;
386
384
  }
387
- auto &expr = **expr_ptr;
385
+ auto &expr = *expr_ptr;
388
386
 
389
387
  // first visit the children of the node, if any
390
- ExpressionIterator::EnumerateChildren(expr, [&](unique_ptr<Expression> &expr) { PlanSubqueries(&expr, root); });
388
+ ExpressionIterator::EnumerateChildren(expr, [&](unique_ptr<Expression> &expr) { PlanSubqueries(expr, root); });
391
389
 
392
390
  // check if this is a subquery node
393
391
  if (expr.expression_class == ExpressionClass::BOUND_SUBQUERY) {
394
- auto &subquery = (BoundSubqueryExpression &)expr;
392
+ auto &subquery = expr.Cast<BoundSubqueryExpression>();
395
393
  // subquery node! plan it
396
394
  if (subquery.IsCorrelated() && !plan_subquery) {
397
395
  // detected a nested correlated subquery
@@ -400,7 +398,7 @@ void Binder::PlanSubqueries(unique_ptr<Expression> *expr_ptr, unique_ptr<Logical
400
398
  has_unplanned_subqueries = true;
401
399
  return;
402
400
  }
403
- *expr_ptr = PlanSubquery(subquery, *root);
401
+ expr_ptr = PlanSubquery(subquery, root);
404
402
  }
405
403
  }
406
404
 
@@ -447,7 +445,7 @@ unique_ptr<LogicalOperator> Binder::PlanLateralJoin(unique_ptr<LogicalOperator>
447
445
  throw BinderException(
448
446
  "Join condition for non-inner LATERAL JOIN must be a comparison between the left and right side");
449
447
  }
450
- auto filter = make_unique<LogicalFilter>();
448
+ auto filter = make_uniq<LogicalFilter>();
451
449
  filter->expressions = std::move(arbitrary_expressions);
452
450
  filter->AddChild(std::move(delim_join));
453
451
  return std::move(filter);
@@ -11,7 +11,7 @@ BoundStatement Binder::Bind(AttachStatement &stmt) {
11
11
  result.types = {LogicalType::BOOLEAN};
12
12
  result.names = {"Success"};
13
13
 
14
- result.plan = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_ATTACH, std::move(stmt.info));
14
+ result.plan = make_uniq<LogicalSimple>(LogicalOperatorType::LOGICAL_ATTACH, std::move(stmt.info));
15
15
  properties.allow_stream_result = false;
16
16
  properties.return_type = StatementReturnType::NOTHING;
17
17
  return result;
@@ -13,8 +13,9 @@ BoundStatement Binder::Bind(CallStatement &stmt) {
13
13
  ref.function = std::move(stmt.function);
14
14
 
15
15
  auto bound_func = Bind(ref);
16
- auto &bound_table_func = (BoundTableFunction &)*bound_func;
17
- auto &get = (LogicalGet &)*bound_table_func.get;
16
+ auto &bound_table_func = bound_func->Cast<BoundTableFunction>();
17
+ ;
18
+ auto &get = bound_table_func.get->Cast<LogicalGet>();
18
19
  D_ASSERT(get.returned_types.size() > 0);
19
20
  for (idx_t i = 0; i < get.returned_types.size(); i++) {
20
21
  get.column_ids.push_back(i);
@@ -3,6 +3,7 @@
3
3
  #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
4
  #include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
5
5
  #include "duckdb/common/bind_helpers.hpp"
6
+ #include "duckdb/common/filename_pattern.hpp"
6
7
  #include "duckdb/common/local_file_system.hpp"
7
8
  #include "duckdb/execution/operator/persistent/parallel_csv_reader.hpp"
8
9
  #include "duckdb/function/table/read_csv.hpp"
@@ -76,7 +77,8 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
76
77
  throw NotImplementedException("COPY TO is not supported for FORMAT \"%s\"", stmt.info->format);
77
78
  }
78
79
  bool use_tmp_file = true;
79
- bool allow_overwrite = false;
80
+ bool overwrite_or_ignore = false;
81
+ FilenamePattern filename_pattern;
80
82
  bool user_set_use_tmp_file = false;
81
83
  bool per_thread_output = false;
82
84
  vector<idx_t> partition_cols;
@@ -92,11 +94,19 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
92
94
  user_set_use_tmp_file = true;
93
95
  continue;
94
96
  }
95
- if (loption == "allow_overwrite") {
96
- allow_overwrite =
97
+ if (loption == "overwrite_or_ignore") {
98
+ overwrite_or_ignore =
97
99
  option.second.empty() || option.second[0].CastAs(context, LogicalType::BOOLEAN).GetValue<bool>();
98
100
  continue;
99
101
  }
102
+ if (loption == "filename_pattern") {
103
+ if (option.second.empty()) {
104
+ throw IOException("FILENAME_PATTERN cannot be empty");
105
+ }
106
+ filename_pattern.SetFilenamePattern(
107
+ option.second[0].CastAs(context, LogicalType::VARCHAR).GetValue<string>());
108
+ continue;
109
+ }
100
110
 
101
111
  if (loption == "per_thread_output") {
102
112
  per_thread_output =
@@ -130,11 +140,11 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
130
140
  auto function_data =
131
141
  copy_function->function.copy_to_bind(context, *stmt.info, unique_column_names, select_node.types);
132
142
  // now create the copy information
133
- auto copy = make_unique<LogicalCopyToFile>(copy_function->function, std::move(function_data));
143
+ auto copy = make_uniq<LogicalCopyToFile>(copy_function->function, std::move(function_data));
134
144
  copy->file_path = stmt.info->file_path;
135
145
  copy->use_tmp_file = use_tmp_file;
136
- copy->allow_overwrite = allow_overwrite;
137
- copy->per_thread_output = per_thread_output;
146
+ copy->overwrite_or_ignore = overwrite_or_ignore;
147
+ copy->filename_pattern = filename_pattern;
138
148
  copy->per_thread_output = per_thread_output;
139
149
  copy->partition_output = !partition_cols.empty();
140
150
  copy->partition_columns = std::move(partition_cols);
@@ -158,7 +168,9 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
158
168
  result.types = {LogicalType::BIGINT};
159
169
  result.names = {"Count"};
160
170
 
161
- D_ASSERT(!stmt.info->table.empty());
171
+ if (stmt.info->table.empty()) {
172
+ throw ParserException("COPY FROM requires a table name to be specified");
173
+ }
162
174
  // COPY FROM a file
163
175
  // generate an insert statement for the the to-be-inserted table
164
176
  InsertStatement insert;
@@ -171,7 +183,7 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
171
183
  auto insert_statement = Bind(insert);
172
184
  D_ASSERT(insert_statement.plan->type == LogicalOperatorType::LOGICAL_INSERT);
173
185
 
174
- auto &bound_insert = (LogicalInsert &)*insert_statement.plan;
186
+ auto &bound_insert = insert_statement.plan->Cast<LogicalInsert>();
175
187
 
176
188
  // lookup the format in the catalog
177
189
  auto &catalog = Catalog::GetSystemCatalog(context);
@@ -185,7 +197,7 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
185
197
  vector<string> expected_names;
186
198
  if (!bound_insert.column_index_map.empty()) {
187
199
  expected_names.resize(bound_insert.expected_types.size());
188
- for (auto &col : table->GetColumns().Logical()) {
200
+ for (auto &col : table->GetColumns().Physical()) {
189
201
  auto i = col.Physical();
190
202
  if (bound_insert.column_index_map[i] != DConstants::INVALID_INDEX) {
191
203
  expected_names[bound_insert.column_index_map[i]] = col.Name();
@@ -193,15 +205,15 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
193
205
  }
194
206
  } else {
195
207
  expected_names.reserve(bound_insert.expected_types.size());
196
- for (auto &col : table->GetColumns().Logical()) {
208
+ for (auto &col : table->GetColumns().Physical()) {
197
209
  expected_names.push_back(col.Name());
198
210
  }
199
211
  }
200
212
 
201
213
  auto function_data =
202
214
  copy_function->function.copy_from_bind(context, *stmt.info, expected_names, bound_insert.expected_types);
203
- auto get = make_unique<LogicalGet>(GenerateTableIndex(), copy_function->function.copy_from_function,
204
- std::move(function_data), bound_insert.expected_types, expected_names);
215
+ auto get = make_uniq<LogicalGet>(GenerateTableIndex(), copy_function->function.copy_from_function,
216
+ std::move(function_data), bound_insert.expected_types, expected_names);
205
217
  for (idx_t i = 0; i < bound_insert.expected_types.size(); i++) {
206
218
  get->column_ids.push_back(i);
207
219
  }
@@ -214,19 +226,19 @@ BoundStatement Binder::Bind(CopyStatement &stmt) {
214
226
  if (!stmt.info->is_from && !stmt.select_statement) {
215
227
  // copy table into file without a query
216
228
  // generate SELECT * FROM table;
217
- auto ref = make_unique<BaseTableRef>();
229
+ auto ref = make_uniq<BaseTableRef>();
218
230
  ref->catalog_name = stmt.info->catalog;
219
231
  ref->schema_name = stmt.info->schema;
220
232
  ref->table_name = stmt.info->table;
221
233
 
222
- auto statement = make_unique<SelectNode>();
234
+ auto statement = make_uniq<SelectNode>();
223
235
  statement->from_table = std::move(ref);
224
236
  if (!stmt.info->select_list.empty()) {
225
237
  for (auto &name : stmt.info->select_list) {
226
- statement->select_list.push_back(make_unique<ColumnRefExpression>(name));
238
+ statement->select_list.push_back(make_uniq<ColumnRefExpression>(name));
227
239
  }
228
240
  } else {
229
- statement->select_list.push_back(make_unique<StarExpression>());
241
+ statement->select_list.push_back(make_uniq<StarExpression>());
230
242
  }
231
243
  stmt.select_statement = std::move(statement);
232
244
  }