duckdb 0.6.2-dev971.0 → 0.7.1-dev2.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 (1144) hide show
  1. package/binding.gyp +14 -8
  2. package/configure.py +2 -2
  3. package/lib/duckdb.d.ts +20 -3
  4. package/lib/duckdb.js +13 -1
  5. package/package.json +3 -1
  6. package/src/connection.cpp +5 -3
  7. package/src/database.cpp +117 -11
  8. package/src/duckdb/extension/icu/icu-dateadd.cpp +70 -7
  9. package/src/duckdb/extension/icu/icu-datefunc.cpp +0 -8
  10. package/src/duckdb/extension/icu/icu-datepart.cpp +1 -1
  11. package/src/duckdb/extension/icu/icu-extension.cpp +5 -3
  12. package/src/duckdb/extension/icu/icu-strptime.cpp +2 -2
  13. package/src/duckdb/extension/icu/icu-timebucket.cpp +637 -0
  14. package/src/duckdb/extension/icu/icu-timezone.cpp +7 -3
  15. package/src/duckdb/extension/icu/include/icu-datefunc.hpp +11 -1
  16. package/src/duckdb/{src/include/duckdb/main/replacement_opens.hpp → extension/icu/include/icu-timebucket.hpp} +3 -6
  17. package/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp +3 -1
  18. package/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +1 -1
  19. package/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp +3 -1
  20. package/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp +3 -1
  21. package/src/duckdb/extension/json/buffered_json_reader.cpp +254 -0
  22. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +148 -0
  23. package/src/duckdb/extension/json/include/json_common.hpp +148 -226
  24. package/src/duckdb/extension/json/include/json_executors.hpp +139 -0
  25. package/src/duckdb/extension/json/include/json_functions.hpp +71 -30
  26. package/src/duckdb/extension/json/include/json_scan.hpp +310 -0
  27. package/src/duckdb/extension/json/include/json_structure.hpp +87 -0
  28. package/src/duckdb/extension/json/include/json_transform.hpp +72 -0
  29. package/src/duckdb/extension/json/json-extension.cpp +35 -17
  30. package/src/duckdb/extension/json/json_common.cpp +10 -87
  31. package/src/duckdb/extension/json/json_functions/copy_json.cpp +109 -0
  32. package/src/duckdb/extension/json/json_functions/json_array_length.cpp +18 -13
  33. package/src/duckdb/extension/json/json_functions/json_contains.cpp +95 -44
  34. package/src/duckdb/extension/json/json_functions/json_create.cpp +48 -39
  35. package/src/duckdb/extension/json/json_functions/json_extract.cpp +30 -21
  36. package/src/duckdb/extension/json/json_functions/json_keys.cpp +60 -0
  37. package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +33 -11
  38. package/src/duckdb/extension/json/json_functions/json_structure.cpp +483 -155
  39. package/src/duckdb/extension/json/json_functions/json_transform.cpp +369 -116
  40. package/src/duckdb/extension/json/json_functions/json_type.cpp +19 -14
  41. package/src/duckdb/extension/json/json_functions/json_valid.cpp +16 -6
  42. package/src/duckdb/extension/json/json_functions/read_json.cpp +282 -0
  43. package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +65 -0
  44. package/src/duckdb/extension/json/json_functions.cpp +225 -0
  45. package/src/duckdb/extension/json/json_scan.cpp +666 -0
  46. package/src/duckdb/extension/json/yyjson/include/yyjson.hpp +3847 -3398
  47. package/src/duckdb/extension/json/yyjson/yyjson.cpp +6625 -6411
  48. package/src/duckdb/extension/parquet/column_reader.cpp +28 -23
  49. package/src/duckdb/extension/parquet/column_writer.cpp +79 -77
  50. package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +5 -1
  51. package/src/duckdb/extension/parquet/include/callback_column_reader.hpp +1 -1
  52. package/src/duckdb/extension/parquet/include/column_reader.hpp +2 -0
  53. package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +1 -1
  54. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +18 -3
  55. package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -1
  56. package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +3 -3
  57. package/src/duckdb/extension/parquet/parquet-extension.cpp +102 -35
  58. package/src/duckdb/extension/parquet/parquet_metadata.cpp +2 -2
  59. package/src/duckdb/extension/parquet/parquet_reader.cpp +108 -39
  60. package/src/duckdb/extension/parquet/parquet_statistics.cpp +8 -4
  61. package/src/duckdb/extension/parquet/parquet_writer.cpp +23 -7
  62. package/src/duckdb/extension/parquet/zstd_file_system.cpp +2 -2
  63. package/src/duckdb/src/catalog/catalog.cpp +36 -134
  64. package/src/duckdb/src/catalog/catalog_entry/column_dependency_manager.cpp +2 -2
  65. package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +27 -0
  66. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +330 -0
  67. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +758 -0
  68. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +4 -13
  69. package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +2 -1
  70. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +1 -1
  71. package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +5 -5
  72. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +11 -308
  73. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +44 -708
  74. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +2 -1
  75. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +1 -1
  76. package/src/duckdb/src/catalog/catalog_entry.cpp +2 -2
  77. package/src/duckdb/src/catalog/catalog_search_path.cpp +10 -10
  78. package/src/duckdb/src/catalog/catalog_set.cpp +68 -62
  79. package/src/duckdb/src/catalog/catalog_transaction.cpp +9 -3
  80. package/src/duckdb/src/catalog/default/default_functions.cpp +7 -7
  81. package/src/duckdb/src/catalog/default/default_schemas.cpp +2 -2
  82. package/src/duckdb/src/catalog/default/default_types.cpp +2 -1
  83. package/src/duckdb/src/catalog/default/default_views.cpp +8 -16
  84. package/src/duckdb/src/catalog/dependency_manager.cpp +6 -6
  85. package/src/duckdb/src/catalog/duck_catalog.cpp +111 -0
  86. package/src/duckdb/src/catalog/similar_catalog_entry.cpp +26 -0
  87. package/src/duckdb/src/common/allocator.cpp +1 -1
  88. package/src/duckdb/src/common/arrow/arrow_appender.cpp +9 -9
  89. package/src/duckdb/src/common/arrow/arrow_converter.cpp +6 -6
  90. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +1 -1
  91. package/src/duckdb/src/common/bind_helpers.cpp +67 -0
  92. package/src/duckdb/src/common/box_renderer.cpp +11 -3
  93. package/src/duckdb/src/common/compressed_file_system.cpp +2 -2
  94. package/src/duckdb/src/common/enums/expression_type.cpp +2 -0
  95. package/src/duckdb/src/common/enums/logical_operator_type.cpp +2 -0
  96. package/src/duckdb/src/common/enums/optimizer_type.cpp +1 -0
  97. package/src/duckdb/src/common/enums/physical_operator_type.cpp +6 -0
  98. package/src/duckdb/src/common/enums/relation_type.cpp +2 -0
  99. package/src/duckdb/src/common/exception_format_value.cpp +2 -2
  100. package/src/duckdb/src/common/file_buffer.cpp +9 -34
  101. package/src/duckdb/src/common/file_system.cpp +28 -4
  102. package/src/duckdb/src/common/gzip_file_system.cpp +3 -3
  103. package/src/duckdb/src/common/hive_partitioning.cpp +129 -4
  104. package/src/duckdb/src/common/local_file_system.cpp +9 -7
  105. package/src/duckdb/src/common/operator/cast_operators.cpp +131 -28
  106. package/src/duckdb/src/common/pipe_file_system.cpp +2 -2
  107. package/src/duckdb/src/common/preserved_error.cpp +1 -1
  108. package/src/duckdb/src/common/radix_partitioning.cpp +5 -4
  109. package/src/duckdb/src/common/row_operations/row_aggregate.cpp +2 -2
  110. package/src/duckdb/src/common/serializer/buffered_serializer.cpp +1 -1
  111. package/src/duckdb/src/common/sort/merge_sorter.cpp +11 -5
  112. package/src/duckdb/src/common/sort/sort_state.cpp +19 -16
  113. package/src/duckdb/src/common/sort/sorted_block.cpp +12 -11
  114. package/src/duckdb/src/common/string_util.cpp +9 -1
  115. package/src/duckdb/src/common/tree_renderer.cpp +17 -8
  116. package/src/duckdb/src/common/types/batched_data_collection.cpp +4 -4
  117. package/src/duckdb/src/common/types/bit.cpp +278 -0
  118. package/src/duckdb/src/common/types/chunk_collection.cpp +7 -7
  119. package/src/duckdb/src/common/types/column_data_allocator.cpp +6 -6
  120. package/src/duckdb/src/common/types/column_data_collection.cpp +56 -32
  121. package/src/duckdb/src/common/types/column_data_collection_segment.cpp +2 -2
  122. package/src/duckdb/src/common/types/column_data_consumer.cpp +1 -1
  123. package/src/duckdb/src/common/types/conflict_info.cpp +18 -0
  124. package/src/duckdb/src/common/types/conflict_manager.cpp +257 -0
  125. package/src/duckdb/src/common/types/data_chunk.cpp +17 -7
  126. package/src/duckdb/src/common/types/date.cpp +7 -2
  127. package/src/duckdb/src/common/types/hash.cpp +2 -2
  128. package/src/duckdb/src/common/types/partitioned_column_data.cpp +7 -2
  129. package/src/duckdb/src/common/types/row_data_collection.cpp +7 -7
  130. package/src/duckdb/src/common/types/row_data_collection_scanner.cpp +10 -2
  131. package/src/duckdb/src/common/types/row_layout.cpp +4 -4
  132. package/src/duckdb/src/common/types/string_type.cpp +1 -0
  133. package/src/duckdb/src/common/types/time.cpp +10 -6
  134. package/src/duckdb/src/common/types/validity_mask.cpp +2 -2
  135. package/src/duckdb/src/common/types/value.cpp +35 -41
  136. package/src/duckdb/src/common/types/vector.cpp +149 -37
  137. package/src/duckdb/src/common/types/vector_buffer.cpp +4 -4
  138. package/src/duckdb/src/common/types/vector_cache.cpp +2 -2
  139. package/src/duckdb/src/common/types.cpp +64 -56
  140. package/src/duckdb/src/common/vector_operations/vector_cast.cpp +7 -2
  141. package/src/duckdb/src/common/virtual_file_system.cpp +3 -3
  142. package/src/duckdb/src/execution/aggregate_hashtable.cpp +10 -8
  143. package/src/duckdb/src/execution/base_aggregate_hashtable.cpp +1 -1
  144. package/src/duckdb/src/execution/column_binding_resolver.cpp +21 -1
  145. package/src/duckdb/src/execution/expression_executor/execute_case.cpp +1 -1
  146. package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +10 -4
  147. package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +1 -1
  148. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +1 -1
  149. package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +1 -1
  150. package/src/duckdb/src/execution/expression_executor.cpp +1 -1
  151. package/src/duckdb/src/execution/index/art/art.cpp +258 -197
  152. package/src/duckdb/src/execution/index/art/art_key.cpp +10 -0
  153. package/src/duckdb/src/execution/index/art/leaf.cpp +68 -25
  154. package/src/duckdb/src/execution/index/art/node.cpp +183 -90
  155. package/src/duckdb/src/execution/index/art/node16.cpp +62 -34
  156. package/src/duckdb/src/execution/index/art/node256.cpp +50 -30
  157. package/src/duckdb/src/execution/index/art/node4.cpp +63 -34
  158. package/src/duckdb/src/execution/index/art/node48.cpp +63 -38
  159. package/src/duckdb/src/execution/index/art/prefix.cpp +24 -14
  160. package/src/duckdb/src/execution/index/art/swizzleable_pointer.cpp +5 -2
  161. package/src/duckdb/src/execution/join_hashtable.cpp +18 -19
  162. package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +1 -1
  163. package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +2 -2
  164. package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +4 -4
  165. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +22 -20
  166. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +3 -3
  167. package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +1 -1
  168. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +11 -11
  169. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +322 -420
  170. package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +8 -5
  171. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +3 -3
  172. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +3 -2
  173. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +5 -5
  174. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +9 -8
  175. package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +3 -3
  176. package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +1 -1
  177. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +4 -3
  178. package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +2 -2
  179. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +3 -3
  180. package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +3 -2
  181. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -3
  182. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +6 -6
  183. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +19 -19
  184. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +7 -7
  185. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +11 -10
  186. package/src/duckdb/src/execution/operator/join/physical_join.cpp +8 -1
  187. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +4 -3
  188. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -8
  189. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +195 -0
  190. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +7 -7
  191. package/src/duckdb/src/execution/operator/order/physical_order.cpp +6 -6
  192. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +3 -3
  193. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +184 -26
  194. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +92 -46
  195. package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +19 -8
  196. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +44 -55
  197. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +137 -36
  198. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +32 -28
  199. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +114 -19
  200. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +2 -1
  201. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +258 -24
  202. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +5 -3
  203. package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +2 -2
  204. package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +5 -5
  205. package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +183 -124
  206. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +187 -0
  207. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +9 -8
  208. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +33 -8
  209. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +63 -86
  210. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +1 -1
  211. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +1 -1
  212. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +22 -0
  213. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +4 -3
  214. package/src/duckdb/src/execution/operator/set/physical_union.cpp +3 -3
  215. package/src/duckdb/src/execution/partitionable_hashtable.cpp +5 -5
  216. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +4 -4
  217. package/src/duckdb/src/execution/physical_operator.cpp +1 -1
  218. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +20 -19
  219. package/src/duckdb/src/execution/physical_plan/plan_any_join.cpp +2 -2
  220. package/src/duckdb/src/execution/physical_plan/plan_column_data_get.cpp +2 -2
  221. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +25 -23
  222. package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +11 -6
  223. package/src/duckdb/src/execution/physical_plan/plan_create.cpp +6 -6
  224. package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +63 -14
  225. package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +24 -18
  226. package/src/duckdb/src/execution/physical_plan/plan_cross_product.cpp +1 -1
  227. package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +14 -8
  228. package/src/duckdb/src/execution/physical_plan/plan_delim_get.cpp +1 -1
  229. package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +4 -4
  230. package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +14 -13
  231. package/src/duckdb/src/execution/physical_plan/plan_execute.cpp +3 -3
  232. package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +4 -4
  233. package/src/duckdb/src/execution/physical_plan/plan_export.cpp +4 -4
  234. package/src/duckdb/src/execution/physical_plan/plan_expression_get.cpp +4 -4
  235. package/src/duckdb/src/execution/physical_plan/plan_filter.cpp +6 -6
  236. package/src/duckdb/src/execution/physical_plan/plan_get.cpp +15 -13
  237. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +32 -17
  238. package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +8 -7
  239. package/src/duckdb/src/execution/physical_plan/plan_limit_percent.cpp +4 -4
  240. package/src/duckdb/src/execution/physical_plan/plan_order.cpp +5 -4
  241. package/src/duckdb/src/execution/physical_plan/plan_positional_join.cpp +21 -0
  242. package/src/duckdb/src/execution/physical_plan/plan_prepare.cpp +2 -2
  243. package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +3 -3
  244. package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +5 -5
  245. package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +2 -2
  246. package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +4 -4
  247. package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +2 -2
  248. package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +10 -8
  249. package/src/duckdb/src/execution/physical_plan/plan_top_n.cpp +3 -3
  250. package/src/duckdb/src/execution/physical_plan/plan_unnest.cpp +3 -3
  251. package/src/duckdb/src/execution/physical_plan/plan_update.cpp +13 -6
  252. package/src/duckdb/src/execution/physical_plan/plan_window.cpp +10 -8
  253. package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -1
  254. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +2 -2
  255. package/src/duckdb/src/execution/reservoir_sample.cpp +2 -2
  256. package/src/duckdb/src/execution/window_segment_tree.cpp +2 -1
  257. package/src/duckdb/src/function/aggregate/distributive/approx_count.cpp +2 -2
  258. package/src/duckdb/src/function/aggregate/distributive/arg_min_max.cpp +232 -72
  259. package/src/duckdb/src/function/aggregate/distributive/first.cpp +2 -2
  260. package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +3 -3
  261. package/src/duckdb/src/function/aggregate/distributive/string_agg.cpp +2 -2
  262. package/src/duckdb/src/function/aggregate/holistic/approximate_quantile.cpp +2 -2
  263. package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +4 -1
  264. package/src/duckdb/src/function/aggregate/holistic/reservoir_quantile.cpp +2 -2
  265. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +6 -5
  266. package/src/duckdb/src/function/built_in_functions.cpp +10 -10
  267. package/src/duckdb/src/function/cast/bit_cast.cpp +19 -0
  268. package/src/duckdb/src/function/cast/blob_cast.cpp +1 -0
  269. package/src/duckdb/src/function/cast/cast_function_set.cpp +5 -5
  270. package/src/duckdb/src/function/cast/decimal_cast.cpp +2 -2
  271. package/src/duckdb/src/function/cast/default_casts.cpp +12 -9
  272. package/src/duckdb/src/function/cast/enum_casts.cpp +2 -3
  273. package/src/duckdb/src/function/cast/list_casts.cpp +1 -2
  274. package/src/duckdb/src/function/cast/map_cast.cpp +12 -1
  275. package/src/duckdb/src/function/cast/numeric_casts.cpp +0 -1
  276. package/src/duckdb/src/function/cast/string_cast.cpp +92 -7
  277. package/src/duckdb/src/function/cast/struct_cast.cpp +3 -4
  278. package/src/duckdb/src/function/cast/time_casts.cpp +0 -9
  279. package/src/duckdb/src/function/cast/union_casts.cpp +11 -9
  280. package/src/duckdb/src/function/cast/uuid_casts.cpp +0 -1
  281. package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +161 -53
  282. package/src/duckdb/src/function/cast_rules.cpp +2 -7
  283. package/src/duckdb/src/function/function.cpp +5 -5
  284. package/src/duckdb/src/function/function_binder.cpp +8 -8
  285. package/src/duckdb/src/function/function_set.cpp +3 -3
  286. package/src/duckdb/src/function/macro_function.cpp +12 -10
  287. package/src/duckdb/src/function/pragma/pragma_functions.cpp +1 -0
  288. package/src/duckdb/src/function/pragma/pragma_queries.cpp +24 -6
  289. package/src/duckdb/src/function/pragma_function.cpp +7 -6
  290. package/src/duckdb/src/function/scalar/date/date_part.cpp +11 -11
  291. package/src/duckdb/src/function/scalar/date/date_trunc.cpp +1 -1
  292. package/src/duckdb/src/function/scalar/date/strftime.cpp +14 -13
  293. package/src/duckdb/src/function/scalar/date/time_bucket.cpp +371 -0
  294. package/src/duckdb/src/function/scalar/date_functions.cpp +1 -0
  295. package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +3 -3
  296. package/src/duckdb/src/function/scalar/generic/current_setting.cpp +1 -1
  297. package/src/duckdb/src/function/scalar/generic/stats.cpp +1 -1
  298. package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +9 -9
  299. package/src/duckdb/src/function/scalar/list/list_concat.cpp +1 -1
  300. package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +20 -4
  301. package/src/duckdb/src/function/scalar/list/list_sort.cpp +4 -5
  302. package/src/duckdb/src/function/scalar/list/list_value.cpp +3 -3
  303. package/src/duckdb/src/function/scalar/map/map_extract.cpp +1 -4
  304. package/src/duckdb/src/function/scalar/math/numeric.cpp +35 -5
  305. package/src/duckdb/src/function/scalar/math/setseed.cpp +1 -1
  306. package/src/duckdb/src/function/scalar/math_functions.cpp +1 -0
  307. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +11 -11
  308. package/src/duckdb/src/function/scalar/operators/bitwise.cpp +160 -10
  309. package/src/duckdb/src/function/scalar/sequence/nextval.cpp +5 -5
  310. package/src/duckdb/src/function/scalar/string/bar.cpp +93 -0
  311. package/src/duckdb/src/function/scalar/string/left_right.cpp +5 -1
  312. package/src/duckdb/src/function/scalar/string/length.cpp +30 -4
  313. package/src/duckdb/src/function/scalar/string/like.cpp +5 -4
  314. package/src/duckdb/src/function/scalar/string/regexp.cpp +12 -11
  315. package/src/duckdb/src/function/scalar/string/string_split.cpp +1 -1
  316. package/src/duckdb/src/function/scalar/string/substring.cpp +8 -0
  317. package/src/duckdb/src/function/scalar/string_functions.cpp +7 -0
  318. package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +2 -1
  319. package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +2 -2
  320. package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +2 -2
  321. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +4 -4
  322. package/src/duckdb/src/function/scalar/system/system_functions.cpp +9 -2
  323. package/src/duckdb/src/function/scalar/union/union_extract.cpp +2 -1
  324. package/src/duckdb/src/function/scalar/union/union_value.cpp +1 -1
  325. package/src/duckdb/src/function/scalar_function.cpp +5 -4
  326. package/src/duckdb/src/function/scalar_macro_function.cpp +2 -2
  327. package/src/duckdb/src/function/table/arrow.cpp +7 -7
  328. package/src/duckdb/src/function/table/arrow_conversion.cpp +1 -2
  329. package/src/duckdb/src/function/table/checkpoint.cpp +1 -0
  330. package/src/duckdb/src/function/table/copy_csv.cpp +23 -24
  331. package/src/duckdb/src/function/table/glob.cpp +1 -1
  332. package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +4 -4
  333. package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +3 -3
  334. package/src/duckdb/src/function/table/range.cpp +2 -2
  335. package/src/duckdb/src/function/table/read_csv.cpp +223 -122
  336. package/src/duckdb/src/function/table/repeat.cpp +1 -1
  337. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +6 -6
  338. package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +71 -60
  339. package/src/duckdb/src/function/table/system/duckdb_databases.cpp +89 -0
  340. package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +14 -10
  341. package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +5 -5
  342. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +13 -13
  343. package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +17 -10
  344. package/src/duckdb/src/function/table/system/duckdb_keywords.cpp +2 -2
  345. package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +1 -1
  346. package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -1
  347. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +4 -4
  348. package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -6
  349. package/src/duckdb/src/function/table/system/duckdb_types.cpp +1 -1
  350. package/src/duckdb/src/function/table/system/duckdb_views.cpp +2 -2
  351. package/src/duckdb/src/function/table/system/pragma_collations.cpp +1 -1
  352. package/src/duckdb/src/function/table/system/pragma_database_size.cpp +4 -4
  353. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +42 -19
  354. package/src/duckdb/src/function/table/system/pragma_table_info.cpp +17 -11
  355. package/src/duckdb/src/function/table/system/test_all_types.cpp +22 -19
  356. package/src/duckdb/src/function/table/system/test_vector_types.cpp +8 -8
  357. package/src/duckdb/src/function/table/system_functions.cpp +1 -1
  358. package/src/duckdb/src/function/table/table_scan.cpp +34 -30
  359. package/src/duckdb/src/function/table/unnest.cpp +5 -5
  360. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  361. package/src/duckdb/src/function/table_function.cpp +1 -1
  362. package/src/duckdb/src/function/table_macro_function.cpp +2 -2
  363. package/src/duckdb/src/function/udf_function.cpp +4 -4
  364. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +44 -20
  365. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +29 -0
  366. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +69 -0
  367. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +71 -0
  368. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +3 -2
  369. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +19 -50
  370. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +48 -39
  371. package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +9 -6
  372. package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +3 -3
  373. package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +75 -0
  374. package/src/duckdb/src/include/duckdb/catalog/mapping_value.hpp +2 -1
  375. package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +32 -0
  376. package/src/duckdb/src/include/duckdb/common/allocator.hpp +1 -1
  377. package/src/duckdb/src/include/duckdb/common/assert.hpp +4 -0
  378. package/src/duckdb/src/include/duckdb/common/bind_helpers.hpp +21 -0
  379. package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +4 -0
  380. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  381. package/src/duckdb/src/include/duckdb/common/enums/access_mode.hpp +17 -0
  382. package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +3 -1
  383. package/src/duckdb/src/include/duckdb/common/enums/joinref_type.hpp +25 -0
  384. package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +1 -0
  385. package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +1 -0
  386. package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +4 -1
  387. package/src/duckdb/src/include/duckdb/common/enums/relation_type.hpp +1 -0
  388. package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +0 -1
  389. package/src/duckdb/src/include/duckdb/common/field_writer.hpp +4 -4
  390. package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +3 -16
  391. package/src/duckdb/src/include/duckdb/common/file_opener.hpp +4 -1
  392. package/src/duckdb/src/include/duckdb/common/file_system.hpp +17 -6
  393. package/src/duckdb/src/include/duckdb/common/gzip_file_system.hpp +1 -1
  394. package/src/duckdb/src/include/duckdb/common/helper.hpp +8 -0
  395. package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +71 -2
  396. package/src/duckdb/src/include/duckdb/common/http_stats.hpp +1 -1
  397. package/src/duckdb/src/include/duckdb/common/index_vector.hpp +1 -1
  398. package/src/duckdb/src/include/duckdb/common/limits.hpp +3 -0
  399. package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +2 -1
  400. package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +41 -0
  401. package/src/duckdb/src/include/duckdb/common/operator/convert_to_string.hpp +18 -18
  402. package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +20 -0
  403. package/src/duckdb/src/include/duckdb/common/operator/numeric_cast.hpp +39 -0
  404. package/src/duckdb/src/include/duckdb/common/operator/subtract.hpp +1 -1
  405. package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +6 -7
  406. package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +4 -0
  407. package/src/duckdb/src/include/duckdb/common/serializer.hpp +3 -3
  408. package/src/duckdb/src/include/duckdb/common/string_util.hpp +2 -0
  409. package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +1 -1
  410. package/src/duckdb/src/include/duckdb/common/types/bit.hpp +57 -0
  411. package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +1 -1
  412. package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +71 -0
  413. package/src/duckdb/src/include/duckdb/common/types/constraint_conflict_info.hpp +27 -0
  414. package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -0
  415. package/src/duckdb/src/include/duckdb/common/types/hugeint.hpp +3 -3
  416. package/src/duckdb/src/include/duckdb/common/types/partitioned_column_data.hpp +1 -1
  417. package/src/duckdb/src/include/duckdb/common/types/row_data_collection_scanner.hpp +4 -1
  418. package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +84 -4
  419. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +1 -9
  420. package/src/duckdb/src/include/duckdb/common/types/value.hpp +6 -5
  421. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +17 -3
  422. package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +5 -5
  423. package/src/duckdb/src/include/duckdb/common/types.hpp +7 -5
  424. package/src/duckdb/src/include/duckdb/common/unicode_bar.hpp +35 -0
  425. package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +93 -0
  426. package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +141 -0
  427. package/src/duckdb/src/include/duckdb/common/vector_operations/ternary_executor.hpp +14 -0
  428. package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +23 -4
  429. package/src/duckdb/src/include/duckdb/execution/executor.hpp +3 -0
  430. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +2 -2
  431. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +26 -20
  432. package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +17 -8
  433. package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +21 -9
  434. package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +15 -5
  435. package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +14 -5
  436. package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +16 -8
  437. package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +14 -5
  438. package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +26 -20
  439. package/src/duckdb/src/include/duckdb/execution/index/art/swizzleable_pointer.hpp +4 -4
  440. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +1 -1
  441. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +3 -3
  442. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -1
  443. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -1
  444. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -1
  445. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -2
  446. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +3 -3
  447. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -1
  448. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -1
  449. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +50 -0
  450. package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +9 -8
  451. package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +3 -0
  452. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +9 -3
  453. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -2
  454. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +31 -3
  455. package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +14 -2
  456. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -0
  457. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +7 -1
  458. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +1 -1
  459. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -2
  460. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +37 -2
  461. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +5 -1
  462. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -1
  463. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -1
  464. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -1
  465. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +2 -2
  466. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +41 -0
  467. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -1
  468. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -1
  469. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -1
  470. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +9 -17
  471. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -1
  472. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -1
  473. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -1
  474. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -1
  475. package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +1 -0
  476. package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +37 -13
  477. package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +11 -2
  478. package/src/duckdb/src/include/duckdb/function/compression_function.hpp +1 -1
  479. package/src/duckdb/src/include/duckdb/function/copy_function.hpp +12 -3
  480. package/src/duckdb/src/include/duckdb/function/create_database_extension.hpp +37 -0
  481. package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +3 -3
  482. package/src/duckdb/src/include/duckdb/function/function_set.hpp +4 -2
  483. package/src/duckdb/src/include/duckdb/function/replacement_scan.hpp +4 -4
  484. package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +28 -0
  485. package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +4 -0
  486. package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +4 -0
  487. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +2 -2
  488. package/src/duckdb/src/include/duckdb/function/scalar/strftime.hpp +4 -3
  489. package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +4 -0
  490. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +7 -0
  491. package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +1 -1
  492. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +6 -4
  493. package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +6 -6
  494. package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +3 -2
  495. package/src/duckdb/src/include/duckdb/function/udf_function.hpp +2 -2
  496. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +6 -0
  497. package/src/duckdb/src/include/duckdb/main/client_config.hpp +3 -0
  498. package/src/duckdb/src/include/duckdb/main/client_context.hpp +9 -1
  499. package/src/duckdb/src/include/duckdb/main/config.hpp +13 -8
  500. package/src/duckdb/src/include/duckdb/main/connection.hpp +7 -3
  501. package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +1 -1
  502. package/src/duckdb/src/include/duckdb/main/database.hpp +6 -0
  503. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
  504. package/src/duckdb/src/include/duckdb/main/extension_functions.hpp +5 -0
  505. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +5 -5
  506. package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -0
  507. package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +2 -0
  508. package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -0
  509. package/src/duckdb/src/include/duckdb/main/relation/read_csv_relation.hpp +10 -11
  510. package/src/duckdb/src/include/duckdb/main/relation/read_json_relation.hpp +23 -0
  511. package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +11 -2
  512. package/src/duckdb/src/include/duckdb/main/relation/write_csv_relation.hpp +2 -1
  513. package/src/duckdb/src/include/duckdb/main/relation/write_parquet_relation.hpp +34 -0
  514. package/src/duckdb/src/include/duckdb/main/relation.hpp +14 -1
  515. package/src/duckdb/src/include/duckdb/main/settings.hpp +9 -0
  516. package/src/duckdb/src/include/duckdb/main/valid_checker.hpp +1 -1
  517. package/src/duckdb/src/include/duckdb/optimizer/deliminator.hpp +4 -1
  518. package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +3 -3
  519. package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +1 -1
  520. package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +3 -6
  521. package/src/duckdb/src/include/duckdb/optimizer/join_order/estimated_properties.hpp +0 -1
  522. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +0 -1
  523. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +1 -2
  524. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +1 -1
  525. package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_type_matcher.hpp +1 -1
  526. package/src/duckdb/src/include/duckdb/optimizer/matcher/function_matcher.hpp +2 -2
  527. package/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +1 -0
  528. package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +84 -0
  529. package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +1 -1
  530. package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +3 -3
  531. package/src/duckdb/src/include/duckdb/parser/column_list.hpp +3 -1
  532. package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
  533. package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
  534. package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
  535. package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
  536. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
  537. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
  538. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
  539. package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
  540. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +3 -3
  541. package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
  542. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
  543. package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
  544. package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
  545. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
  546. package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
  547. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
  548. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +1 -1
  549. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +4 -3
  550. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +50 -0
  551. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +1 -1
  552. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +1 -1
  553. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +1 -1
  554. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +1 -1
  555. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +2 -2
  556. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +5 -0
  557. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +28 -1
  558. package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +17 -0
  559. package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -2
  560. package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +1 -1
  561. package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +1 -1
  562. package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +4 -0
  563. package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +33 -0
  564. package/src/duckdb/src/include/duckdb/parser/statement/logical_plan_statement.hpp +1 -1
  565. package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +20 -3
  566. package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +6 -3
  567. package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +0 -1
  568. package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +1 -1
  569. package/src/duckdb/src/include/duckdb/parser/tokens.hpp +0 -1
  570. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +23 -0
  571. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +4 -3
  572. package/src/duckdb/src/include/duckdb/planner/binder.hpp +32 -20
  573. package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +0 -1
  574. package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +1 -0
  575. package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +2 -2
  576. package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +1 -1
  577. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +2 -2
  578. package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +54 -0
  579. package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +2 -2
  580. package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +1 -1
  581. package/src/duckdb/src/include/duckdb/planner/expression_binder/returning_binder.hpp +0 -4
  582. package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +1 -1
  583. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +3 -4
  584. package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +1 -0
  585. package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -0
  586. package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +8 -2
  587. package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +1 -1
  588. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +3 -3
  589. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +1 -1
  590. package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -8
  591. package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +4 -20
  592. package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +1 -1
  593. package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +1 -1
  594. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +1 -1
  595. package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +2 -2
  596. package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -1
  597. package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +2 -3
  598. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +28 -18
  599. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +1 -1
  600. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +1 -1
  601. package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +28 -0
  602. package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +2 -1
  603. package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +2 -2
  604. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +2 -2
  605. package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +2 -2
  606. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +1 -1
  607. package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +1 -1
  608. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +1 -1
  609. package/src/duckdb/src/include/duckdb/planner/operator/logical_unconditional_join.hpp +31 -0
  610. package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -2
  611. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +4 -18
  612. package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_function_info.hpp +1 -1
  613. package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +1 -1
  614. package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +8 -0
  615. package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +1 -1
  616. package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +5 -1
  617. package/src/duckdb/src/include/duckdb/planner/tableref/{bound_crossproductref.hpp → bound_pos_join_ref.hpp} +9 -9
  618. package/src/duckdb/src/include/duckdb/planner/tableref/bound_subqueryref.hpp +1 -1
  619. package/src/duckdb/src/include/duckdb/planner/tableref/bound_table_function.hpp +1 -1
  620. package/src/duckdb/src/include/duckdb/planner/tableref/list.hpp +0 -1
  621. package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +12 -7
  622. package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +10 -5
  623. package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +2 -1
  624. package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +1 -3
  625. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +3 -3
  626. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +1 -1
  627. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +3 -3
  628. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +14 -9
  629. package/src/duckdb/src/include/duckdb/storage/database_size.hpp +24 -0
  630. package/src/duckdb/src/include/duckdb/storage/index.hpp +32 -11
  631. package/src/duckdb/src/include/duckdb/storage/magic_bytes.hpp +28 -0
  632. package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +1 -1
  633. package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +3 -3
  634. package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +9 -1
  635. package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +1 -1
  636. package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +43 -0
  637. package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -9
  638. package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +1 -1
  639. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +2 -1
  640. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
  641. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +2 -1
  642. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +6 -4
  643. package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +3 -2
  644. package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +9 -1
  645. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +1 -1
  646. package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +1 -1
  647. package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +8 -2
  648. package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +48 -0
  649. package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +5 -5
  650. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +68 -0
  651. package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +75 -0
  652. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -7
  653. package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +3 -0
  654. package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +9 -42
  655. package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +3 -2
  656. package/src/duckdb/src/include/duckdb/transaction/transaction_manager.hpp +12 -41
  657. package/src/duckdb/src/include/duckdb.h +32 -2
  658. package/src/duckdb/src/include/duckdb.hpp +1 -0
  659. package/src/duckdb/src/main/appender.cpp +4 -3
  660. package/src/duckdb/src/main/attached_database.cpp +32 -9
  661. package/src/duckdb/src/main/capi/arrow-c.cpp +1 -1
  662. package/src/duckdb/src/main/capi/data_chunk-c.cpp +20 -1
  663. package/src/duckdb/src/main/capi/duckdb-c.cpp +1 -1
  664. package/src/duckdb/src/main/capi/helper-c.cpp +2 -4
  665. package/src/duckdb/src/main/capi/pending-c.cpp +1 -1
  666. package/src/duckdb/src/main/capi/prepared-c.cpp +2 -2
  667. package/src/duckdb/src/main/capi/replacement_scan-c.cpp +6 -6
  668. package/src/duckdb/src/main/capi/result-c.cpp +1 -1
  669. package/src/duckdb/src/main/capi/table_function-c.cpp +4 -4
  670. package/src/duckdb/src/main/capi/threading-c.cpp +8 -0
  671. package/src/duckdb/src/main/client_context.cpp +90 -61
  672. package/src/duckdb/src/main/client_context_file_opener.cpp +14 -0
  673. package/src/duckdb/src/main/client_data.cpp +2 -0
  674. package/src/duckdb/src/main/client_verify.cpp +7 -7
  675. package/src/duckdb/src/main/config.cpp +13 -2
  676. package/src/duckdb/src/main/connection.cpp +14 -15
  677. package/src/duckdb/src/main/database.cpp +88 -34
  678. package/src/duckdb/src/main/database_manager.cpp +6 -4
  679. package/src/duckdb/src/main/error_manager.cpp +1 -1
  680. package/src/duckdb/src/main/extension/extension_alias.cpp +1 -0
  681. package/src/duckdb/src/main/extension/extension_helper.cpp +18 -1
  682. package/src/duckdb/src/main/extension/extension_install.cpp +6 -1
  683. package/src/duckdb/src/main/extension/extension_load.cpp +22 -28
  684. package/src/duckdb/src/main/materialized_query_result.cpp +16 -4
  685. package/src/duckdb/src/main/pending_query_result.cpp +4 -4
  686. package/src/duckdb/src/main/prepared_statement.cpp +16 -3
  687. package/src/duckdb/src/main/query_profiler.cpp +6 -6
  688. package/src/duckdb/src/main/query_result.cpp +12 -7
  689. package/src/duckdb/src/main/relation/aggregate_relation.cpp +6 -6
  690. package/src/duckdb/src/main/relation/create_table_relation.cpp +4 -4
  691. package/src/duckdb/src/main/relation/create_view_relation.cpp +7 -6
  692. package/src/duckdb/src/main/relation/cross_product_relation.cpp +6 -5
  693. package/src/duckdb/src/main/relation/delete_relation.cpp +3 -3
  694. package/src/duckdb/src/main/relation/distinct_relation.cpp +1 -1
  695. package/src/duckdb/src/main/relation/explain_relation.cpp +2 -2
  696. package/src/duckdb/src/main/relation/filter_relation.cpp +4 -3
  697. package/src/duckdb/src/main/relation/insert_relation.cpp +3 -3
  698. package/src/duckdb/src/main/relation/join_relation.cpp +7 -7
  699. package/src/duckdb/src/main/relation/limit_relation.cpp +2 -2
  700. package/src/duckdb/src/main/relation/order_relation.cpp +3 -3
  701. package/src/duckdb/src/main/relation/projection_relation.cpp +3 -3
  702. package/src/duckdb/src/main/relation/query_relation.cpp +5 -4
  703. package/src/duckdb/src/main/relation/read_csv_relation.cpp +31 -39
  704. package/src/duckdb/src/main/relation/read_json_relation.cpp +20 -0
  705. package/src/duckdb/src/main/relation/setop_relation.cpp +3 -3
  706. package/src/duckdb/src/main/relation/subquery_relation.cpp +2 -1
  707. package/src/duckdb/src/main/relation/table_function_relation.cpp +29 -17
  708. package/src/duckdb/src/main/relation/table_relation.cpp +7 -7
  709. package/src/duckdb/src/main/relation/update_relation.cpp +9 -6
  710. package/src/duckdb/src/main/relation/value_relation.cpp +6 -6
  711. package/src/duckdb/src/main/relation/view_relation.cpp +4 -3
  712. package/src/duckdb/src/main/relation/write_csv_relation.cpp +6 -3
  713. package/src/duckdb/src/main/relation/write_parquet_relation.cpp +37 -0
  714. package/src/duckdb/src/main/relation.cpp +53 -30
  715. package/src/duckdb/src/main/settings/settings.cpp +20 -3
  716. package/src/duckdb/src/main/stream_query_result.cpp +6 -5
  717. package/src/duckdb/src/main/valid_checker.cpp +1 -1
  718. package/src/duckdb/src/optimizer/cse_optimizer.cpp +5 -5
  719. package/src/duckdb/src/optimizer/deliminator.cpp +16 -9
  720. package/src/duckdb/src/optimizer/expression_heuristics.cpp +2 -2
  721. package/src/duckdb/src/optimizer/expression_rewriter.cpp +7 -7
  722. package/src/duckdb/src/optimizer/filter_combiner.cpp +41 -36
  723. package/src/duckdb/src/optimizer/filter_pullup.cpp +17 -17
  724. package/src/duckdb/src/optimizer/filter_pushdown.cpp +24 -24
  725. package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +14 -14
  726. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +8 -7
  727. package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +77 -61
  728. package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +5 -5
  729. package/src/duckdb/src/optimizer/join_order/query_graph.cpp +1 -1
  730. package/src/duckdb/src/optimizer/optimizer.cpp +19 -11
  731. package/src/duckdb/src/optimizer/pullup/pullup_both_side.cpp +4 -4
  732. package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +4 -4
  733. package/src/duckdb/src/optimizer/pullup/pullup_from_left.cpp +3 -3
  734. package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +7 -7
  735. package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +2 -2
  736. package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +6 -6
  737. package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +8 -7
  738. package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +4 -4
  739. package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +5 -5
  740. package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +8 -8
  741. package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +13 -13
  742. package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +2 -2
  743. package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +4 -4
  744. package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +6 -6
  745. package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +9 -9
  746. package/src/duckdb/src/optimizer/pushdown/pushdown_single_join.cpp +4 -4
  747. package/src/duckdb/src/optimizer/regex_range_filter.cpp +5 -5
  748. package/src/duckdb/src/optimizer/remove_unused_columns.cpp +13 -4
  749. package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +6 -6
  750. package/src/duckdb/src/optimizer/rule/case_simplification.cpp +3 -3
  751. package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +6 -6
  752. package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +2 -2
  753. package/src/duckdb/src/optimizer/rule/constant_folding.cpp +1 -1
  754. package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +3 -3
  755. package/src/duckdb/src/optimizer/rule/distributivity.cpp +11 -11
  756. package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +2 -2
  757. package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +8 -7
  758. package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +7 -7
  759. package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +5 -5
  760. package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +8 -8
  761. package/src/duckdb/src/optimizer/rule/move_constants.cpp +14 -14
  762. package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +3 -3
  763. package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +12 -12
  764. package/src/duckdb/src/optimizer/statistics/expression/propagate_between.cpp +12 -10
  765. package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +2 -2
  766. package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +6 -6
  767. package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +1 -1
  768. package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +4 -4
  769. package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +3 -3
  770. package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +3 -3
  771. package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +2 -2
  772. package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +3 -3
  773. package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +69 -13
  774. package/src/duckdb/src/optimizer/statistics/operator/propagate_order.cpp +1 -1
  775. package/src/duckdb/src/optimizer/statistics/operator/propagate_projection.cpp +3 -3
  776. package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +1 -1
  777. package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +1 -1
  778. package/src/duckdb/src/optimizer/statistics_propagator.cpp +3 -1
  779. package/src/duckdb/src/optimizer/topn_optimizer.cpp +4 -4
  780. package/src/duckdb/src/optimizer/unnest_rewriter.cpp +312 -0
  781. package/src/duckdb/src/parallel/base_pipeline_event.cpp +1 -1
  782. package/src/duckdb/src/parallel/event.cpp +4 -4
  783. package/src/duckdb/src/parallel/executor.cpp +13 -9
  784. package/src/duckdb/src/parallel/pipeline.cpp +4 -4
  785. package/src/duckdb/src/parallel/pipeline_event.cpp +1 -1
  786. package/src/duckdb/src/parallel/pipeline_executor.cpp +1 -1
  787. package/src/duckdb/src/parallel/pipeline_finish_event.cpp +1 -1
  788. package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +3 -3
  789. package/src/duckdb/src/parallel/task_scheduler.cpp +10 -10
  790. package/src/duckdb/src/parser/column_definition.cpp +16 -12
  791. package/src/duckdb/src/parser/column_list.cpp +20 -2
  792. package/src/duckdb/src/parser/constraints/check_constraint.cpp +2 -2
  793. package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -3
  794. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +5 -5
  795. package/src/duckdb/src/parser/expression/between_expression.cpp +5 -5
  796. package/src/duckdb/src/parser/expression/case_expression.cpp +5 -5
  797. package/src/duckdb/src/parser/expression/cast_expression.cpp +5 -5
  798. package/src/duckdb/src/parser/expression/collate_expression.cpp +5 -5
  799. package/src/duckdb/src/parser/expression/columnref_expression.cpp +10 -8
  800. package/src/duckdb/src/parser/expression/comparison_expression.cpp +4 -4
  801. package/src/duckdb/src/parser/expression/conjunction_expression.cpp +9 -9
  802. package/src/duckdb/src/parser/expression/constant_expression.cpp +4 -4
  803. package/src/duckdb/src/parser/expression/default_expression.cpp +1 -1
  804. package/src/duckdb/src/parser/expression/function_expression.cpp +12 -11
  805. package/src/duckdb/src/parser/expression/lambda_expression.cpp +4 -4
  806. package/src/duckdb/src/parser/expression/operator_expression.cpp +6 -6
  807. package/src/duckdb/src/parser/expression/parameter_expression.cpp +3 -3
  808. package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +4 -4
  809. package/src/duckdb/src/parser/expression/star_expression.cpp +5 -5
  810. package/src/duckdb/src/parser/expression/subquery_expression.cpp +4 -4
  811. package/src/duckdb/src/parser/expression/window_expression.cpp +6 -6
  812. package/src/duckdb/src/parser/parsed_data/alter_function_info.cpp +4 -2
  813. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +2 -2
  814. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +45 -41
  815. package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +3 -3
  816. package/src/duckdb/src/parser/parsed_data/create_collation_info.cpp +3 -3
  817. package/src/duckdb/src/parser/parsed_data/create_copy_function_info.cpp +2 -2
  818. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +1 -1
  819. package/src/duckdb/src/parser/parsed_data/create_info.cpp +3 -0
  820. package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +4 -4
  821. package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +4 -4
  822. package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +4 -4
  823. package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +4 -3
  824. package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +56 -3
  825. package/src/duckdb/src/parser/parsed_expression.cpp +17 -17
  826. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +2 -7
  827. package/src/duckdb/src/parser/parser.cpp +148 -31
  828. package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +2 -2
  829. package/src/duckdb/src/parser/query_node/select_node.cpp +2 -2
  830. package/src/duckdb/src/parser/query_node/set_operation_node.cpp +2 -2
  831. package/src/duckdb/src/parser/query_node.cpp +5 -5
  832. package/src/duckdb/src/parser/result_modifier.cpp +9 -9
  833. package/src/duckdb/src/parser/statement/copy_statement.cpp +102 -0
  834. package/src/duckdb/src/parser/statement/explain_statement.cpp +1 -1
  835. package/src/duckdb/src/parser/statement/export_statement.cpp +1 -1
  836. package/src/duckdb/src/parser/statement/extension_statement.cpp +2 -1
  837. package/src/duckdb/src/parser/statement/insert_statement.cpp +87 -1
  838. package/src/duckdb/src/parser/statement/relation_statement.cpp +1 -1
  839. package/src/duckdb/src/parser/statement/set_statement.cpp +3 -3
  840. package/src/duckdb/src/parser/statement/update_statement.cpp +21 -6
  841. package/src/duckdb/src/parser/tableref/basetableref.cpp +2 -2
  842. package/src/duckdb/src/parser/tableref/expressionlistref.cpp +4 -4
  843. package/src/duckdb/src/parser/tableref/joinref.cpp +20 -9
  844. package/src/duckdb/src/parser/tableref/subqueryref.cpp +5 -5
  845. package/src/duckdb/src/parser/tableref/table_function.cpp +2 -2
  846. package/src/duckdb/src/parser/tableref.cpp +2 -5
  847. package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +2 -2
  848. package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +5 -5
  849. package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +9 -7
  850. package/src/duckdb/src/parser/transform/expression/transform_case.cpp +4 -4
  851. package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +1 -1
  852. package/src/duckdb/src/parser/transform/expression/transform_coalesce.cpp +2 -2
  853. package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +5 -5
  854. package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +1 -1
  855. package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +1 -1
  856. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +24 -24
  857. package/src/duckdb/src/parser/transform/expression/transform_grouping_function.cpp +1 -1
  858. package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +4 -4
  859. package/src/duckdb/src/parser/transform/expression/transform_is_null.cpp +1 -1
  860. package/src/duckdb/src/parser/transform/expression/transform_lambda.cpp +1 -1
  861. package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +37 -36
  862. package/src/duckdb/src/parser/transform/expression/transform_param_ref.cpp +1 -1
  863. package/src/duckdb/src/parser/transform/expression/transform_positional_reference.cpp +1 -1
  864. package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +13 -13
  865. package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +2 -0
  866. package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -1
  867. package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +6 -6
  868. package/src/duckdb/src/parser/transform/helpers/transform_orderby.cpp +1 -1
  869. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +35 -4
  870. package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +1 -1
  871. package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +8 -8
  872. package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +2 -2
  873. package/src/duckdb/src/parser/transform/statement/transform_checkpoint.cpp +3 -3
  874. package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +5 -3
  875. package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +29 -0
  876. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +6 -6
  877. package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +25 -18
  878. package/src/duckdb/src/parser/transform/statement/transform_create_schema.cpp +1 -1
  879. package/src/duckdb/src/parser/transform/statement/transform_create_sequence.cpp +1 -1
  880. package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +4 -4
  881. package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +2 -2
  882. package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +2 -2
  883. package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +1 -1
  884. package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +1 -2
  885. package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +13 -4
  886. package/src/duckdb/src/parser/transform/statement/transform_export.cpp +1 -1
  887. package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +20 -5
  888. package/src/duckdb/src/parser/transform/statement/transform_load.cpp +1 -1
  889. package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +9 -2
  890. package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +4 -4
  891. package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +5 -5
  892. package/src/duckdb/src/parser/transform/statement/transform_show.cpp +8 -7
  893. package/src/duckdb/src/parser/transform/statement/transform_update.cpp +15 -7
  894. package/src/duckdb/src/parser/transform/statement/transform_upsert.cpp +95 -0
  895. package/src/duckdb/src/parser/transform/statement/transform_use.cpp +1 -1
  896. package/src/duckdb/src/parser/transform/statement/transform_vacuum.cpp +1 -1
  897. package/src/duckdb/src/parser/transform/tableref/transform_base_tableref.cpp +1 -1
  898. package/src/duckdb/src/parser/transform/tableref/transform_from.cpp +10 -10
  899. package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +12 -10
  900. package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +2 -2
  901. package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +1 -1
  902. package/src/duckdb/src/parser/transformer.cpp +4 -2
  903. package/src/duckdb/src/planner/bind_context.cpp +15 -14
  904. package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +9 -9
  905. package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +12 -12
  906. package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +5 -5
  907. package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +5 -5
  908. package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +1 -1
  909. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +13 -12
  910. package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +9 -8
  911. package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +3 -2
  912. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +59 -16
  913. package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +44 -26
  914. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +1 -1
  915. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +6 -6
  916. package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +3 -3
  917. package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +12 -12
  918. package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +3 -3
  919. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +19 -19
  920. package/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +1 -1
  921. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +38 -34
  922. package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +5 -5
  923. package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +1 -1
  924. package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +14 -14
  925. package/src/duckdb/src/planner/binder/query_node/plan_recursive_cte_node.cpp +9 -8
  926. package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +31 -31
  927. package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +21 -19
  928. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +63 -61
  929. package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +1 -1
  930. package/src/duckdb/src/planner/binder/statement/bind_call.cpp +1 -1
  931. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +102 -25
  932. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +141 -52
  933. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +10 -10
  934. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +13 -12
  935. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +1 -1
  936. package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +7 -7
  937. package/src/duckdb/src/planner/binder/statement/bind_explain.cpp +2 -2
  938. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +30 -25
  939. package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +3 -2
  940. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +361 -20
  941. package/src/duckdb/src/planner/binder/statement/bind_load.cpp +1 -1
  942. package/src/duckdb/src/planner/binder/statement/bind_logical_plan.cpp +1 -1
  943. package/src/duckdb/src/planner/binder/statement/bind_prepare.cpp +3 -3
  944. package/src/duckdb/src/planner/binder/statement/bind_show.cpp +2 -2
  945. package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +2 -2
  946. package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +31 -29
  947. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +75 -57
  948. package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +11 -10
  949. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +19 -10
  950. package/src/duckdb/src/planner/binder/tableref/bind_expressionlistref.cpp +4 -4
  951. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +24 -16
  952. package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +2 -2
  953. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +22 -18
  954. package/src/duckdb/src/planner/binder/tableref/plan_basetableref.cpp +1 -1
  955. package/src/duckdb/src/planner/binder/tableref/plan_expressionlistref.cpp +3 -3
  956. package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +43 -32
  957. package/src/duckdb/src/planner/binder/tableref/plan_table_function.cpp +1 -1
  958. package/src/duckdb/src/planner/binder.cpp +38 -23
  959. package/src/duckdb/src/planner/bound_result_modifier.cpp +3 -3
  960. package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +6 -6
  961. package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -3
  962. package/src/duckdb/src/planner/expression/bound_case_expression.cpp +12 -12
  963. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +9 -8
  964. package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +4 -4
  965. package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +4 -3
  966. package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +5 -5
  967. package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +2 -2
  968. package/src/duckdb/src/planner/expression/bound_expression.cpp +1 -1
  969. package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -7
  970. package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +3 -3
  971. package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +71 -0
  972. package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +4 -4
  973. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +3 -3
  974. package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +3 -3
  975. package/src/duckdb/src/planner/expression/bound_subquery_expression.cpp +1 -1
  976. package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +4 -4
  977. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +8 -7
  978. package/src/duckdb/src/planner/expression.cpp +1 -1
  979. package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +3 -4
  980. package/src/duckdb/src/planner/expression_binder/check_binder.cpp +16 -2
  981. package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +6 -4
  982. package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +1 -1
  983. package/src/duckdb/src/planner/expression_binder/group_binder.cpp +2 -2
  984. package/src/duckdb/src/planner/expression_binder/having_binder.cpp +5 -2
  985. package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +1 -1
  986. package/src/duckdb/src/planner/expression_binder/order_binder.cpp +6 -5
  987. package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +1 -1
  988. package/src/duckdb/src/planner/expression_binder/returning_binder.cpp +1 -9
  989. package/src/duckdb/src/planner/expression_binder/select_binder.cpp +7 -2
  990. package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +15 -2
  991. package/src/duckdb/src/planner/expression_binder.cpp +6 -6
  992. package/src/duckdb/src/planner/expression_iterator.cpp +4 -7
  993. package/src/duckdb/src/planner/filter/conjunction_filter.cpp +2 -2
  994. package/src/duckdb/src/planner/filter/constant_filter.cpp +1 -1
  995. package/src/duckdb/src/planner/joinside.cpp +10 -9
  996. package/src/duckdb/src/planner/logical_operator.cpp +6 -3
  997. package/src/duckdb/src/planner/logical_operator_visitor.cpp +11 -1
  998. package/src/duckdb/src/planner/operator/logical_aggregate.cpp +8 -7
  999. package/src/duckdb/src/planner/operator/logical_any_join.cpp +2 -2
  1000. package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +4 -3
  1001. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +1 -1
  1002. package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +10 -5
  1003. package/src/duckdb/src/planner/operator/logical_create.cpp +1 -1
  1004. package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
  1005. package/src/duckdb/src/planner/operator/logical_create_table.cpp +1 -1
  1006. package/src/duckdb/src/planner/operator/logical_cross_product.cpp +3 -19
  1007. package/src/duckdb/src/planner/operator/logical_delete.cpp +22 -1
  1008. package/src/duckdb/src/planner/operator/logical_delim_join.cpp +1 -1
  1009. package/src/duckdb/src/planner/operator/logical_distinct.cpp +1 -1
  1010. package/src/duckdb/src/planner/operator/logical_empty_result.cpp +1 -1
  1011. package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
  1012. package/src/duckdb/src/planner/operator/logical_expression_get.cpp +1 -1
  1013. package/src/duckdb/src/planner/operator/logical_filter.cpp +6 -6
  1014. package/src/duckdb/src/planner/operator/logical_get.cpp +10 -10
  1015. package/src/duckdb/src/planner/operator/logical_insert.cpp +26 -3
  1016. package/src/duckdb/src/planner/operator/logical_limit.cpp +2 -2
  1017. package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +1 -1
  1018. package/src/duckdb/src/planner/operator/logical_order.cpp +3 -3
  1019. package/src/duckdb/src/planner/operator/logical_positional_join.cpp +30 -0
  1020. package/src/duckdb/src/planner/operator/logical_projection.cpp +2 -2
  1021. package/src/duckdb/src/planner/operator/logical_sample.cpp +4 -4
  1022. package/src/duckdb/src/planner/operator/logical_show.cpp +1 -1
  1023. package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -2
  1024. package/src/duckdb/src/planner/operator/logical_top_n.cpp +1 -1
  1025. package/src/duckdb/src/planner/operator/logical_unconditional_join.cpp +26 -0
  1026. package/src/duckdb/src/planner/operator/logical_unnest.cpp +2 -2
  1027. package/src/duckdb/src/planner/operator/logical_update.cpp +20 -1
  1028. package/src/duckdb/src/planner/operator/logical_window.cpp +1 -1
  1029. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +1 -1
  1030. package/src/duckdb/src/planner/planner.cpp +7 -9
  1031. package/src/duckdb/src/planner/pragma_handler.cpp +3 -3
  1032. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +66 -60
  1033. package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +4 -3
  1034. package/src/duckdb/src/planner/table_binding.cpp +61 -30
  1035. package/src/duckdb/src/planner/table_filter.cpp +6 -6
  1036. package/src/duckdb/src/storage/arena_allocator.cpp +37 -7
  1037. package/src/duckdb/src/storage/block.cpp +2 -2
  1038. package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -1
  1039. package/src/duckdb/src/storage/buffer_manager.cpp +48 -33
  1040. package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +2 -2
  1041. package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +1 -1
  1042. package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +6 -4
  1043. package/src/duckdb/src/storage/checkpoint_manager.cpp +14 -13
  1044. package/src/duckdb/src/storage/compression/bitpacking.cpp +5 -4
  1045. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +3 -3
  1046. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +5 -5
  1047. package/src/duckdb/src/storage/compression/fsst.cpp +40 -25
  1048. package/src/duckdb/src/storage/compression/rle.cpp +3 -3
  1049. package/src/duckdb/src/storage/compression/string_uncompressed.cpp +8 -8
  1050. package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +2 -2
  1051. package/src/duckdb/src/storage/data_table.cpp +309 -104
  1052. package/src/duckdb/src/storage/index.cpp +12 -6
  1053. package/src/duckdb/src/storage/local_storage.cpp +27 -32
  1054. package/src/duckdb/src/storage/magic_bytes.cpp +31 -0
  1055. package/src/duckdb/src/storage/meta_block_writer.cpp +1 -1
  1056. package/src/duckdb/src/storage/partial_block_manager.cpp +4 -4
  1057. package/src/duckdb/src/storage/single_file_block_manager.cpp +108 -71
  1058. package/src/duckdb/src/storage/statistics/base_statistics.cpp +13 -12
  1059. package/src/duckdb/src/storage/statistics/column_statistics.cpp +2 -2
  1060. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +2 -2
  1061. package/src/duckdb/src/storage/statistics/list_statistics.cpp +4 -4
  1062. package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +106 -8
  1063. package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -2
  1064. package/src/duckdb/src/storage/statistics/string_statistics.cpp +4 -4
  1065. package/src/duckdb/src/storage/statistics/struct_statistics.cpp +5 -4
  1066. package/src/duckdb/src/storage/storage_info.cpp +1 -1
  1067. package/src/duckdb/src/storage/storage_manager.cpp +8 -4
  1068. package/src/duckdb/src/storage/table/chunk_info.cpp +2 -2
  1069. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +4 -4
  1070. package/src/duckdb/src/storage/table/column_data.cpp +28 -38
  1071. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +5 -5
  1072. package/src/duckdb/src/storage/table/column_segment.cpp +16 -16
  1073. package/src/duckdb/src/storage/table/list_column_data.cpp +11 -11
  1074. package/src/duckdb/src/storage/table/row_group.cpp +21 -18
  1075. package/src/duckdb/src/storage/table/row_group_collection.cpp +21 -22
  1076. package/src/duckdb/src/storage/table/scan_state.cpp +3 -3
  1077. package/src/duckdb/src/storage/table/segment_tree.cpp +5 -5
  1078. package/src/duckdb/src/storage/table/standard_column_data.cpp +11 -11
  1079. package/src/duckdb/src/storage/table/struct_column_data.cpp +13 -13
  1080. package/src/duckdb/src/storage/table/table_statistics.cpp +1 -1
  1081. package/src/duckdb/src/storage/table/update_segment.cpp +7 -6
  1082. package/src/duckdb/src/storage/table_index_list.cpp +12 -10
  1083. package/src/duckdb/src/storage/wal_replay.cpp +6 -6
  1084. package/src/duckdb/src/transaction/commit_state.cpp +9 -3
  1085. package/src/duckdb/src/transaction/duck_transaction.cpp +155 -0
  1086. package/src/duckdb/src/transaction/duck_transaction_manager.cpp +342 -0
  1087. package/src/duckdb/src/transaction/meta_transaction.cpp +3 -0
  1088. package/src/duckdb/src/transaction/transaction.cpp +10 -132
  1089. package/src/duckdb/src/transaction/transaction_context.cpp +2 -2
  1090. package/src/duckdb/src/transaction/transaction_manager.cpp +1 -321
  1091. package/src/duckdb/src/verification/copied_statement_verifier.cpp +1 -1
  1092. package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +1 -1
  1093. package/src/duckdb/src/verification/external_statement_verifier.cpp +1 -1
  1094. package/src/duckdb/src/verification/parsed_statement_verifier.cpp +2 -2
  1095. package/src/duckdb/src/verification/prepared_statement_verifier.cpp +12 -12
  1096. package/src/duckdb/src/verification/statement_verifier.cpp +5 -4
  1097. package/src/duckdb/src/verification/unoptimized_statement_verifier.cpp +1 -1
  1098. package/src/duckdb/third_party/fast_float/fast_float/fast_float.h +22 -19
  1099. package/src/duckdb/third_party/fmt/include/fmt/core.h +5 -3
  1100. package/src/duckdb/third_party/fmt/include/fmt/format.h +10 -10
  1101. package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +19 -1
  1102. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +12 -0
  1103. package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +355 -352
  1104. package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +1 -0
  1105. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +19986 -19619
  1106. package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +2 -2
  1107. package/src/duckdb/third_party/mbedtls/library/bignum.cpp +1 -3
  1108. package/src/duckdb/third_party/thrift/thrift/TApplicationException.h +0 -3
  1109. package/src/duckdb/third_party/zstd/decompress/huf_decompress.cpp +4 -4
  1110. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
  1111. package/src/duckdb/ub_extension_json_json_functions.cpp +8 -0
  1112. package/src/duckdb/ub_src_catalog.cpp +4 -0
  1113. package/src/duckdb/ub_src_catalog_catalog_entry.cpp +6 -0
  1114. package/src/duckdb/ub_src_common.cpp +2 -0
  1115. package/src/duckdb/ub_src_common_types.cpp +6 -0
  1116. package/src/duckdb/ub_src_execution_operator_join.cpp +2 -0
  1117. package/src/duckdb/ub_src_execution_operator_scan.cpp +2 -0
  1118. package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
  1119. package/src/duckdb/ub_src_function_cast.cpp +2 -0
  1120. package/src/duckdb/ub_src_function_scalar_date.cpp +2 -0
  1121. package/src/duckdb/ub_src_function_scalar_string.cpp +2 -0
  1122. package/src/duckdb/ub_src_function_table_system.cpp +2 -2
  1123. package/src/duckdb/ub_src_main.cpp +0 -2
  1124. package/src/duckdb/ub_src_main_relation.cpp +4 -0
  1125. package/src/duckdb/ub_src_optimizer.cpp +2 -0
  1126. package/src/duckdb/ub_src_parser_tableref.cpp +0 -2
  1127. package/src/duckdb/ub_src_parser_transform_statement.cpp +4 -0
  1128. package/src/duckdb/ub_src_planner_binder_tableref.cpp +0 -4
  1129. package/src/duckdb/ub_src_planner_expression.cpp +2 -0
  1130. package/src/duckdb/ub_src_planner_operator.cpp +4 -0
  1131. package/src/duckdb/ub_src_storage.cpp +2 -0
  1132. package/src/duckdb/ub_src_transaction.cpp +4 -0
  1133. package/src/duckdb_node.hpp +8 -0
  1134. package/src/statement.cpp +5 -50
  1135. package/src/utils.cpp +42 -0
  1136. package/test/replacement_scan.test.ts +144 -0
  1137. package/test/udf.test.ts +9 -0
  1138. package/src/duckdb/src/function/table/system/pragma_database_list.cpp +0 -59
  1139. package/src/duckdb/src/include/duckdb/function/replacement_open.hpp +0 -45
  1140. package/src/duckdb/src/include/duckdb/parser/tableref/crossproductref.hpp +0 -36
  1141. package/src/duckdb/src/main/extension_prefix_opener.cpp +0 -47
  1142. package/src/duckdb/src/parser/tableref/crossproductref.cpp +0 -43
  1143. package/src/duckdb/src/planner/binder/tableref/bind_crossproductref.cpp +0 -31
  1144. package/src/duckdb/src/planner/binder/tableref/plan_crossproductref.cpp +0 -26
@@ -26,8 +26,8 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
26
26
  // uncorrelated EXISTS
27
27
  // we only care about existence, hence we push a LIMIT 1 operator
28
28
  auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
29
- limit->AddChild(move(plan));
30
- plan = move(limit);
29
+ limit->AddChild(std::move(plan));
30
+ plan = std::move(limit);
31
31
 
32
32
  // now we push a COUNT(*) aggregate onto the limit, this will be either 0 or 1 (EXISTS or NOT EXISTS)
33
33
  auto count_star_fun = CountStarFun::GetFunction();
@@ -37,29 +37,29 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
37
37
  function_binder.BindAggregateFunction(count_star_fun, {}, nullptr, AggregateType::NON_DISTINCT);
38
38
  auto idx_type = count_star->return_type;
39
39
  vector<unique_ptr<Expression>> aggregate_list;
40
- aggregate_list.push_back(move(count_star));
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, move(aggregate_list));
44
- aggregate->AddChild(move(plan));
45
- plan = move(aggregate);
43
+ make_unique<LogicalAggregate>(binder.GenerateTableIndex(), aggregate_index, std::move(aggregate_list));
44
+ aggregate->AddChild(std::move(plan));
45
+ plan = std::move(aggregate);
46
46
 
47
47
  // now we push a projection with a comparison to 1
48
48
  auto left_child = make_unique<BoundColumnRefExpression>(idx_type, ColumnBinding(aggregate_index, 0));
49
49
  auto right_child = make_unique<BoundConstantExpression>(Value::Numeric(idx_type, 1));
50
- auto comparison =
51
- make_unique<BoundComparisonExpression>(ExpressionType::COMPARE_EQUAL, move(left_child), move(right_child));
50
+ auto comparison = make_unique<BoundComparisonExpression>(ExpressionType::COMPARE_EQUAL, std::move(left_child),
51
+ std::move(right_child));
52
52
 
53
53
  vector<unique_ptr<Expression>> projection_list;
54
- projection_list.push_back(move(comparison));
54
+ projection_list.push_back(std::move(comparison));
55
55
  auto projection_index = binder.GenerateTableIndex();
56
- auto projection = make_unique<LogicalProjection>(projection_index, move(projection_list));
57
- projection->AddChild(move(plan));
58
- plan = move(projection);
56
+ auto projection = make_unique<LogicalProjection>(projection_index, std::move(projection_list));
57
+ projection->AddChild(std::move(plan));
58
+ plan = std::move(projection);
59
59
 
60
60
  // we add it to the main query by adding a cross product
61
61
  // FIXME: should use something else besides cross product as we always add only one scalar constant
62
- root = LogicalCrossProduct::Create(move(root), move(plan));
62
+ root = LogicalCrossProduct::Create(std::move(root), std::move(plan));
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)
@@ -76,30 +76,30 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
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
78
  auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
79
- limit->AddChild(move(plan));
80
- plan = move(limit);
79
+ limit->AddChild(std::move(plan));
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
84
  auto bound = make_unique<BoundColumnRefExpression>(expr.return_type, ColumnBinding(table_idx, 0));
85
85
  vector<unique_ptr<Expression>> first_children;
86
- first_children.push_back(move(bound));
86
+ first_children.push_back(std::move(bound));
87
87
 
88
88
  FunctionBinder function_binder(binder.context);
89
89
  auto first_agg = function_binder.BindAggregateFunction(
90
- FirstFun::GetFunction(expr.return_type), move(first_children), nullptr, AggregateType::NON_DISTINCT);
90
+ FirstFun::GetFunction(expr.return_type), std::move(first_children), nullptr, AggregateType::NON_DISTINCT);
91
91
 
92
- expressions.push_back(move(first_agg));
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, move(expressions));
95
- aggr->AddChild(move(plan));
96
- plan = move(aggr);
94
+ auto aggr = make_unique<LogicalAggregate>(binder.GenerateTableIndex(), aggr_index, std::move(expressions));
95
+ aggr->AddChild(std::move(plan));
96
+ plan = std::move(aggr);
97
97
 
98
98
  // in the uncorrelated case, we add the value to the main query through a cross product
99
99
  // FIXME: should use something else besides cross product as we always add only one scalar constant and cross
100
100
  // product is not optimized for this.
101
101
  D_ASSERT(root);
102
- root = LogicalCrossProduct::Create(move(root), move(plan));
102
+ root = LogicalCrossProduct::Create(std::move(root), std::move(plan));
103
103
 
104
104
  // we replace the original subquery with a BoundColumnRefExpression referring to the first result of the
105
105
  // aggregation
@@ -117,16 +117,16 @@ static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubq
117
117
  idx_t mark_index = binder.GenerateTableIndex();
118
118
  auto join = make_unique<LogicalComparisonJoin>(JoinType::MARK);
119
119
  join->mark_index = mark_index;
120
- join->AddChild(move(root));
121
- join->AddChild(move(plan));
120
+ join->AddChild(std::move(root));
121
+ join->AddChild(std::move(plan));
122
122
  // create the JOIN condition
123
123
  JoinCondition cond;
124
- cond.left = move(expr.child);
124
+ cond.left = std::move(expr.child);
125
125
  cond.right = BoundCastExpression::AddDefaultCastToType(
126
126
  make_unique<BoundColumnRefExpression>(expr.child_type, plan_columns[0]), expr.child_target);
127
127
  cond.comparison = expr.comparison_type;
128
- join->conditions.push_back(move(cond));
129
- root = move(join);
128
+ join->conditions.push_back(std::move(cond));
129
+ root = std::move(join);
130
130
 
131
131
  // we replace the original subquery with a BoundColumnRefExpression referring to the mark column
132
132
  return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
@@ -148,11 +148,11 @@ CreateDuplicateEliminatedJoin(const vector<CorrelatedColumnInfo> &correlated_col
148
148
  row_number->start = WindowBoundary::UNBOUNDED_PRECEDING;
149
149
  row_number->end = WindowBoundary::CURRENT_ROW_ROWS;
150
150
  row_number->alias = "delim_index";
151
- window->expressions.push_back(move(row_number));
152
- window->AddChild(move(original_plan));
153
- original_plan = move(window);
151
+ window->expressions.push_back(std::move(row_number));
152
+ window->AddChild(std::move(original_plan));
153
+ original_plan = std::move(window);
154
154
  }
155
- delim_join->AddChild(move(original_plan));
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
158
  delim_join->duplicate_eliminated_columns.push_back(
@@ -176,7 +176,7 @@ static void CreateDelimJoinConditions(LogicalDelimJoin &delim_join,
176
176
  cond.left = make_unique<BoundColumnRefExpression>(col.name, col.type, col.binding);
177
177
  cond.right = make_unique<BoundColumnRefExpression>(col.name, col.type, bindings[binding_idx]);
178
178
  cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM;
179
- delim_join.conditions.push_back(move(cond));
179
+ delim_join.conditions.push_back(std::move(cond));
180
180
  }
181
181
  }
182
182
 
@@ -213,7 +213,7 @@ static bool PerformDuplicateElimination(Binder &binder, vector<CorrelatedColumnI
213
213
  auto type = LogicalType::BIGINT;
214
214
  auto name = "delim_index";
215
215
  CorrelatedColumnInfo info(binding, type, name, 0);
216
- correlated_columns.insert(correlated_columns.begin(), move(info));
216
+ correlated_columns.insert(correlated_columns.begin(), std::move(info));
217
217
  return false;
218
218
  }
219
219
 
@@ -243,7 +243,7 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
243
243
  // the left side is the original plan
244
244
  // this is the side that will be duplicate eliminated and pushed into the RHS
245
245
  auto delim_join =
246
- CreateDuplicateEliminatedJoin(correlated_columns, JoinType::SINGLE, move(root), perform_delim);
246
+ CreateDuplicateEliminatedJoin(correlated_columns, JoinType::SINGLE, std::move(root), perform_delim);
247
247
 
248
248
  // the right side initially is a DEPENDENT join between the duplicate eliminated scan and the subquery
249
249
  // HOWEVER: we do not explicitly create the dependent join
@@ -253,7 +253,7 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
253
253
  // first we check which logical operators have correlated expressions in the first place
254
254
  flatten.DetectCorrelatedExpressions(plan.get());
255
255
  // now we push the dependent join down
256
- auto dependent_join = flatten.PushDownDependentJoin(move(plan));
256
+ auto dependent_join = flatten.PushDownDependentJoin(std::move(plan));
257
257
 
258
258
  // now the dependent join is fully eliminated
259
259
  // we only need to create the join conditions between the LHS and the RHS
@@ -262,8 +262,8 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
262
262
 
263
263
  // now create the join conditions
264
264
  CreateDelimJoinConditions(*delim_join, correlated_columns, plan_columns, flatten.delim_offset, perform_delim);
265
- delim_join->AddChild(move(dependent_join));
266
- root = move(delim_join);
265
+ delim_join->AddChild(std::move(dependent_join));
266
+ root = std::move(delim_join);
267
267
  // finally push the BoundColumnRefExpression referring to the data element returned by the join
268
268
  return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type,
269
269
  plan_columns[flatten.data_offset]);
@@ -272,20 +272,21 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
272
272
  // correlated EXISTS query
273
273
  // this query is similar to the correlated SCALAR query, except we use a MARK join here
274
274
  idx_t mark_index = binder.GenerateTableIndex();
275
- auto delim_join = CreateDuplicateEliminatedJoin(correlated_columns, JoinType::MARK, move(root), perform_delim);
275
+ auto delim_join =
276
+ CreateDuplicateEliminatedJoin(correlated_columns, JoinType::MARK, std::move(root), perform_delim);
276
277
  delim_join->mark_index = mark_index;
277
278
  // RHS
278
279
  FlattenDependentJoins flatten(binder, correlated_columns, perform_delim, true);
279
280
  flatten.DetectCorrelatedExpressions(plan.get());
280
- auto dependent_join = flatten.PushDownDependentJoin(move(plan));
281
+ auto dependent_join = flatten.PushDownDependentJoin(std::move(plan));
281
282
 
282
283
  // fetch the set of columns
283
284
  auto plan_columns = dependent_join->GetColumnBindings();
284
285
 
285
286
  // now we create the join conditions between the dependent join and the original table
286
287
  CreateDelimJoinConditions(*delim_join, correlated_columns, plan_columns, flatten.delim_offset, perform_delim);
287
- delim_join->AddChild(move(dependent_join));
288
- root = move(delim_join);
288
+ delim_join->AddChild(std::move(dependent_join));
289
+ root = std::move(delim_join);
289
290
  // finally push the BoundColumnRefExpression referring to the marker
290
291
  return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
291
292
  }
@@ -299,12 +300,13 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
299
300
  // as the MARK join has one extra join condition (the original condition, of the ANY expression, e.g.
300
301
  // [i=ANY(...)])
301
302
  idx_t mark_index = binder.GenerateTableIndex();
302
- auto delim_join = CreateDuplicateEliminatedJoin(correlated_columns, JoinType::MARK, move(root), perform_delim);
303
+ auto delim_join =
304
+ CreateDuplicateEliminatedJoin(correlated_columns, JoinType::MARK, std::move(root), perform_delim);
303
305
  delim_join->mark_index = mark_index;
304
306
  // RHS
305
307
  FlattenDependentJoins flatten(binder, correlated_columns, true, true);
306
308
  flatten.DetectCorrelatedExpressions(plan.get());
307
- auto dependent_join = flatten.PushDownDependentJoin(move(plan));
309
+ auto dependent_join = flatten.PushDownDependentJoin(std::move(plan));
308
310
 
309
311
  // fetch the columns
310
312
  auto plan_columns = dependent_join->GetColumnBindings();
@@ -313,14 +315,14 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
313
315
  CreateDelimJoinConditions(*delim_join, correlated_columns, plan_columns, flatten.delim_offset, perform_delim);
314
316
  // add the actual condition based on the ANY/ALL predicate
315
317
  JoinCondition compare_cond;
316
- compare_cond.left = move(expr.child);
318
+ compare_cond.left = std::move(expr.child);
317
319
  compare_cond.right = BoundCastExpression::AddDefaultCastToType(
318
320
  make_unique<BoundColumnRefExpression>(expr.child_type, plan_columns[0]), expr.child_target);
319
321
  compare_cond.comparison = expr.comparison_type;
320
- delim_join->conditions.push_back(move(compare_cond));
322
+ delim_join->conditions.push_back(std::move(compare_cond));
321
323
 
322
- delim_join->AddChild(move(dependent_join));
323
- root = move(delim_join);
324
+ delim_join->AddChild(std::move(dependent_join));
325
+ root = std::move(delim_join);
324
326
  // finally push the BoundColumnRefExpression referring to the marker
325
327
  return make_unique<BoundColumnRefExpression>(expr.GetName(), expr.return_type, ColumnBinding(mark_index, 0));
326
328
  }
@@ -333,10 +335,10 @@ public:
333
335
  }
334
336
  void VisitOperator(LogicalOperator &op) override {
335
337
  if (!op.children.empty()) {
336
- root = move(op.children[0]);
338
+ root = std::move(op.children[0]);
337
339
  D_ASSERT(root);
338
340
  VisitOperatorExpressions(op);
339
- op.children[0] = move(root);
341
+ op.children[0] = std::move(root);
340
342
  for (idx_t i = 0; i < op.children.size(); i++) {
341
343
  D_ASSERT(op.children[i]);
342
344
  VisitOperator(*op.children[i]);
@@ -363,12 +365,12 @@ unique_ptr<Expression> Binder::PlanSubquery(BoundSubqueryExpression &expr, uniqu
363
365
  D_ASSERT(subquery_root);
364
366
 
365
367
  // now we actually flatten the subquery
366
- auto plan = move(subquery_root);
368
+ auto plan = std::move(subquery_root);
367
369
  unique_ptr<Expression> result_expression;
368
370
  if (!expr.IsCorrelated()) {
369
- result_expression = PlanUncorrelatedSubquery(*this, expr, root, move(plan));
371
+ result_expression = PlanUncorrelatedSubquery(*this, expr, root, std::move(plan));
370
372
  } else {
371
- result_expression = PlanCorrelatedSubquery(*this, expr, root, move(plan));
373
+ result_expression = PlanCorrelatedSubquery(*this, expr, root, std::move(plan));
372
374
  }
373
375
  // finally, we recursively plan the nested subqueries (if there are any)
374
376
  if (sub_binder->has_unplanned_subqueries) {
@@ -411,19 +413,19 @@ unique_ptr<LogicalOperator> Binder::PlanLateralJoin(unique_ptr<LogicalOperator>
411
413
  vector<unique_ptr<Expression>> arbitrary_expressions;
412
414
  if (condition) {
413
415
  // extract join conditions, if there are any
414
- LogicalComparisonJoin::ExtractJoinConditions(join_type, left, right, move(condition), conditions,
416
+ LogicalComparisonJoin::ExtractJoinConditions(join_type, left, right, std::move(condition), conditions,
415
417
  arbitrary_expressions);
416
418
  }
417
419
 
418
420
  auto perform_delim = PerformDuplicateElimination(*this, correlated_columns);
419
- auto delim_join = CreateDuplicateEliminatedJoin(correlated_columns, join_type, move(left), perform_delim);
421
+ auto delim_join = CreateDuplicateEliminatedJoin(correlated_columns, join_type, std::move(left), perform_delim);
420
422
 
421
423
  FlattenDependentJoins flatten(*this, correlated_columns, perform_delim);
422
424
 
423
425
  // first we check which logical operators have correlated expressions in the first place
424
426
  flatten.DetectCorrelatedExpressions(right.get(), true);
425
427
  // now we push the dependent join down
426
- auto dependent_join = flatten.PushDownDependentJoin(move(right));
428
+ auto dependent_join = flatten.PushDownDependentJoin(std::move(right));
427
429
 
428
430
  // now the dependent join is fully eliminated
429
431
  // we only need to create the join conditions between the LHS and the RHS
@@ -433,10 +435,10 @@ unique_ptr<LogicalOperator> Binder::PlanLateralJoin(unique_ptr<LogicalOperator>
433
435
  // now create the join conditions
434
436
  // start off with the conditions that were passed in (if any)
435
437
  D_ASSERT(delim_join->conditions.empty());
436
- delim_join->conditions = move(conditions);
438
+ delim_join->conditions = std::move(conditions);
437
439
  // then add the delim join conditions
438
440
  CreateDelimJoinConditions(*delim_join, correlated_columns, plan_columns, flatten.delim_offset, perform_delim);
439
- delim_join->AddChild(move(dependent_join));
441
+ delim_join->AddChild(std::move(dependent_join));
440
442
 
441
443
  // check if there are any arbitrary expressions left
442
444
  if (!arbitrary_expressions.empty()) {
@@ -446,11 +448,11 @@ unique_ptr<LogicalOperator> Binder::PlanLateralJoin(unique_ptr<LogicalOperator>
446
448
  "Join condition for non-inner LATERAL JOIN must be a comparison between the left and right side");
447
449
  }
448
450
  auto filter = make_unique<LogicalFilter>();
449
- filter->expressions = move(arbitrary_expressions);
450
- filter->AddChild(move(delim_join));
451
- return move(filter);
451
+ filter->expressions = std::move(arbitrary_expressions);
452
+ filter->AddChild(std::move(delim_join));
453
+ return std::move(filter);
452
454
  }
453
- return move(delim_join);
455
+ return std::move(delim_join);
454
456
  }
455
457
 
456
458
  } // namespace duckdb
@@ -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, move(stmt.info));
14
+ result.plan = make_unique<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;
@@ -10,7 +10,7 @@ BoundStatement Binder::Bind(CallStatement &stmt) {
10
10
  BoundStatement result;
11
11
 
12
12
  TableFunctionRef ref;
13
- ref.function = move(stmt.function);
13
+ ref.function = std::move(stmt.function);
14
14
 
15
15
  auto bound_func = Bind(ref);
16
16
  auto &bound_table_func = (BoundTableFunction &)*bound_func;
@@ -1,25 +1,66 @@
1
1
  #include "duckdb/catalog/catalog.hpp"
2
+ #include "duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp"
3
+ #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
+ #include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
5
+ #include "duckdb/common/bind_helpers.hpp"
2
6
  #include "duckdb/common/local_file_system.hpp"
7
+ #include "duckdb/execution/operator/persistent/parallel_csv_reader.hpp"
8
+ #include "duckdb/function/table/read_csv.hpp"
9
+ #include "duckdb/main/client_context.hpp"
10
+ #include "duckdb/main/database.hpp"
11
+ #include "duckdb/parser/expression/columnref_expression.hpp"
12
+ #include "duckdb/parser/expression/star_expression.hpp"
13
+ #include "duckdb/parser/query_node/select_node.hpp"
3
14
  #include "duckdb/parser/statement/copy_statement.hpp"
4
- #include "duckdb/planner/binder.hpp"
5
15
  #include "duckdb/parser/statement/insert_statement.hpp"
16
+ #include "duckdb/parser/tableref/basetableref.hpp"
17
+ #include "duckdb/planner/binder.hpp"
6
18
  #include "duckdb/planner/operator/logical_copy_to_file.hpp"
7
19
  #include "duckdb/planner/operator/logical_get.hpp"
8
20
  #include "duckdb/planner/operator/logical_insert.hpp"
9
- #include "duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp"
10
- #include "duckdb/main/client_context.hpp"
11
- #include "duckdb/main/database.hpp"
12
21
 
13
- #include "duckdb/parser/expression/columnref_expression.hpp"
14
- #include "duckdb/parser/expression/star_expression.hpp"
15
- #include "duckdb/parser/tableref/basetableref.hpp"
16
- #include "duckdb/parser/query_node/select_node.hpp"
17
- #include "duckdb/execution/operator/persistent/parallel_csv_reader.hpp"
18
- #include "duckdb/function/table/read_csv.hpp"
19
22
  #include <algorithm>
20
23
 
21
24
  namespace duckdb {
22
25
 
26
+ static vector<idx_t> ColumnListToIndices(const vector<bool> &vec) {
27
+ vector<idx_t> ret;
28
+ for (idx_t i = 0; i < vec.size(); i++) {
29
+ if (vec[i]) {
30
+ ret.push_back(i);
31
+ }
32
+ }
33
+ return ret;
34
+ }
35
+
36
+ vector<string> GetUniqueNames(const vector<string> &original_names) {
37
+ unordered_set<string> name_set;
38
+ vector<string> unique_names;
39
+ unique_names.reserve(original_names.size());
40
+
41
+ for (auto &name : original_names) {
42
+ auto insert_result = name_set.insert(name);
43
+ if (insert_result.second == false) {
44
+ // Could not be inserted, name already exists
45
+ idx_t index = 1;
46
+ string postfixed_name;
47
+ while (true) {
48
+ postfixed_name = StringUtil::Format("%s:%d", name, index);
49
+ auto res = name_set.insert(postfixed_name);
50
+ if (!res.second) {
51
+ index++;
52
+ continue;
53
+ }
54
+ break;
55
+ }
56
+ unique_names.push_back(postfixed_name);
57
+ } else {
58
+ unique_names.push_back(name);
59
+ }
60
+ }
61
+ return unique_names;
62
+ }
63
+
23
64
  BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
24
65
  // COPY TO a file
25
66
  auto &config = DBConfig::GetConfig(context);
@@ -30,18 +71,25 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
30
71
  result.types = {LogicalType::BIGINT};
31
72
  result.names = {"Count"};
32
73
 
33
- // bind the select statement
34
- auto select_node = Bind(*stmt.select_statement);
35
-
36
74
  // lookup the format in the catalog
37
75
  auto copy_function =
38
76
  Catalog::GetEntry<CopyFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, stmt.info->format);
77
+ if (copy_function->function.plan) {
78
+ // plan rewrite COPY TO
79
+ return copy_function->function.plan(*this, stmt);
80
+ }
81
+
82
+ // bind the select statement
83
+ auto select_node = Bind(*stmt.select_statement);
84
+
39
85
  if (!copy_function->function.copy_to_bind) {
40
86
  throw NotImplementedException("COPY TO is not supported for FORMAT \"%s\"", stmt.info->format);
41
87
  }
42
88
  bool use_tmp_file = true;
89
+ bool allow_overwrite = false;
43
90
  bool user_set_use_tmp_file = false;
44
91
  bool per_thread_output = false;
92
+ vector<idx_t> partition_cols;
45
93
 
46
94
  auto original_options = stmt.info->options;
47
95
  stmt.info->options.clear();
@@ -53,28 +101,57 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
53
101
  user_set_use_tmp_file = true;
54
102
  continue;
55
103
  }
104
+ if (loption == "allow_overwrite") {
105
+ allow_overwrite = option.second[0].CastAs(context, LogicalType::BOOLEAN).GetValue<bool>();
106
+ continue;
107
+ }
108
+
56
109
  if (loption == "per_thread_output") {
57
110
  per_thread_output = option.second[0].CastAs(context, LogicalType::BOOLEAN).GetValue<bool>();
58
111
  continue;
59
112
  }
113
+ if (loption == "partition_by") {
114
+ auto converted = ConvertVectorToValue(std::move(option.second));
115
+ partition_cols = ColumnListToIndices(ParseColumnList(converted, select_node.names, loption));
116
+ continue;
117
+ }
60
118
  stmt.info->options[option.first] = option.second;
61
119
  }
62
120
  if (user_set_use_tmp_file && per_thread_output) {
63
121
  throw NotImplementedException("Can't combine USE_TMP_FILE and PER_THREAD_OUTPUT for COPY");
64
122
  }
123
+ if (user_set_use_tmp_file && !partition_cols.empty()) {
124
+ throw NotImplementedException("Can't combine USE_TMP_FILE and PARTITION_BY for COPY");
125
+ }
126
+ if (per_thread_output && !partition_cols.empty()) {
127
+ throw NotImplementedException("Can't combine PER_THREAD_OUTPUT and PARTITION_BY for COPY");
128
+ }
129
+ bool is_file_and_exists = config.file_system->FileExists(stmt.info->file_path);
130
+ bool is_stdout = stmt.info->file_path == "/dev/stdout";
131
+ if (!user_set_use_tmp_file) {
132
+ use_tmp_file = is_file_and_exists && !per_thread_output && partition_cols.empty() && !is_stdout;
133
+ }
134
+
135
+ auto unique_column_names = GetUniqueNames(select_node.names);
65
136
 
66
137
  auto function_data =
67
- copy_function->function.copy_to_bind(context, *stmt.info, select_node.names, select_node.types);
138
+ copy_function->function.copy_to_bind(context, *stmt.info, unique_column_names, select_node.types);
68
139
  // now create the copy information
69
- auto copy = make_unique<LogicalCopyToFile>(copy_function->function, move(function_data));
140
+ auto copy = make_unique<LogicalCopyToFile>(copy_function->function, std::move(function_data));
70
141
  copy->file_path = stmt.info->file_path;
71
142
  copy->use_tmp_file = use_tmp_file;
143
+ copy->allow_overwrite = allow_overwrite;
144
+ copy->per_thread_output = per_thread_output;
72
145
  copy->per_thread_output = per_thread_output;
73
- copy->is_file_and_exists = config.file_system->FileExists(copy->file_path);
146
+ copy->partition_output = !partition_cols.empty();
147
+ copy->partition_columns = std::move(partition_cols);
148
+
149
+ copy->names = unique_column_names;
150
+ copy->expected_types = select_node.types;
74
151
 
75
- copy->AddChild(move(select_node.plan));
152
+ copy->AddChild(std::move(select_node.plan));
76
153
 
77
- result.plan = move(copy);
154
+ result.plan = std::move(copy);
78
155
 
79
156
  return result;
80
157
  }
@@ -115,7 +192,7 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
115
192
  vector<string> expected_names;
116
193
  if (!bound_insert.column_index_map.empty()) {
117
194
  expected_names.resize(bound_insert.expected_types.size());
118
- for (auto &col : table->columns.Logical()) {
195
+ for (auto &col : table->GetColumns().Logical()) {
119
196
  auto i = col.Physical();
120
197
  if (bound_insert.column_index_map[i] != DConstants::INVALID_INDEX) {
121
198
  expected_names[bound_insert.column_index_map[i]] = col.Name();
@@ -123,7 +200,7 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
123
200
  }
124
201
  } else {
125
202
  expected_names.reserve(bound_insert.expected_types.size());
126
- for (auto &col : table->columns.Logical()) {
203
+ for (auto &col : table->GetColumns().Logical()) {
127
204
  expected_names.push_back(col.Name());
128
205
  }
129
206
  }
@@ -131,12 +208,12 @@ BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
131
208
  auto function_data =
132
209
  copy_function->function.copy_from_bind(context, *stmt.info, expected_names, bound_insert.expected_types);
133
210
  auto get = make_unique<LogicalGet>(GenerateTableIndex(), copy_function->function.copy_from_function,
134
- move(function_data), bound_insert.expected_types, expected_names);
211
+ std::move(function_data), bound_insert.expected_types, expected_names);
135
212
  for (idx_t i = 0; i < bound_insert.expected_types.size(); i++) {
136
213
  get->column_ids.push_back(i);
137
214
  }
138
- insert_statement.plan->children.push_back(move(get));
139
- result.plan = move(insert_statement.plan);
215
+ insert_statement.plan->children.push_back(std::move(get));
216
+ result.plan = std::move(insert_statement.plan);
140
217
  return result;
141
218
  }
142
219
 
@@ -150,7 +227,7 @@ BoundStatement Binder::Bind(CopyStatement &stmt) {
150
227
  ref->table_name = stmt.info->table;
151
228
 
152
229
  auto statement = make_unique<SelectNode>();
153
- statement->from_table = move(ref);
230
+ statement->from_table = std::move(ref);
154
231
  if (!stmt.info->select_list.empty()) {
155
232
  for (auto &name : stmt.info->select_list) {
156
233
  statement->select_list.push_back(make_unique<ColumnRefExpression>(name));
@@ -158,7 +235,7 @@ BoundStatement Binder::Bind(CopyStatement &stmt) {
158
235
  } else {
159
236
  statement->select_list.push_back(make_unique<StarExpression>());
160
237
  }
161
- stmt.select_statement = move(statement);
238
+ stmt.select_statement = std::move(statement);
162
239
  }
163
240
  properties.allow_stream_result = false;
164
241
  properties.return_type = StatementReturnType::CHANGED_ROWS;