duckdb 1.3.4 → 1.4.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 (1367) hide show
  1. package/.github/workflows/NodeJS.yml +8 -20
  2. package/binding.gyp +9 -1
  3. package/package.json +1 -1
  4. package/src/connection.cpp +1 -1
  5. package/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp +4 -0
  6. package/src/duckdb/extension/core_functions/aggregate/distributive/approx_count.cpp +8 -4
  7. package/src/duckdb/extension/core_functions/aggregate/distributive/arg_min_max.cpp +16 -12
  8. package/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp +5 -1
  9. package/src/duckdb/extension/core_functions/aggregate/distributive/bitstring_agg.cpp +5 -1
  10. package/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp +4 -0
  11. package/src/duckdb/extension/core_functions/aggregate/distributive/kurtosis.cpp +4 -0
  12. package/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp +4 -0
  13. package/src/duckdb/extension/core_functions/aggregate/distributive/skew.cpp +4 -0
  14. package/src/duckdb/extension/core_functions/aggregate/distributive/string_agg.cpp +6 -2
  15. package/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp +64 -0
  16. package/src/duckdb/extension/core_functions/aggregate/holistic/approx_top_k.cpp +7 -3
  17. package/src/duckdb/extension/core_functions/aggregate/holistic/approximate_quantile.cpp +7 -4
  18. package/src/duckdb/extension/core_functions/aggregate/holistic/mad.cpp +6 -3
  19. package/src/duckdb/extension/core_functions/aggregate/holistic/mode.cpp +8 -1
  20. package/src/duckdb/extension/core_functions/aggregate/holistic/quantile.cpp +7 -46
  21. package/src/duckdb/extension/core_functions/aggregate/holistic/reservoir_quantile.cpp +9 -15
  22. package/src/duckdb/extension/core_functions/aggregate/nested/binned_histogram.cpp +12 -8
  23. package/src/duckdb/extension/core_functions/aggregate/nested/histogram.cpp +7 -5
  24. package/src/duckdb/extension/core_functions/aggregate/nested/list.cpp +14 -24
  25. package/src/duckdb/extension/core_functions/aggregate/regression/regr_avg.cpp +5 -0
  26. package/src/duckdb/extension/core_functions/aggregate/regression/regr_intercept.cpp +3 -0
  27. package/src/duckdb/extension/core_functions/aggregate/regression/regr_r2.cpp +5 -0
  28. package/src/duckdb/extension/core_functions/aggregate/regression/regr_sxx_syy.cpp +3 -0
  29. package/src/duckdb/extension/core_functions/aggregate/regression/regr_sxy.cpp +4 -0
  30. package/src/duckdb/extension/core_functions/core_functions_extension.cpp +6 -18
  31. package/src/duckdb/extension/core_functions/function_list.cpp +6 -3
  32. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/algebraic/stddev.hpp +1 -1
  33. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/algebraic_functions.hpp +2 -2
  34. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/distributive_functions.hpp +4 -4
  35. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/holistic_functions.hpp +1 -1
  36. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/quantile_sort_tree.hpp +32 -45
  37. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/quantile_state.hpp +1 -1
  38. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/regression_functions.hpp +8 -8
  39. package/src/duckdb/extension/core_functions/include/core_functions/aggregate/sum_helpers.hpp +1 -1
  40. package/src/duckdb/extension/core_functions/include/core_functions/scalar/array_functions.hpp +22 -22
  41. package/src/duckdb/extension/core_functions/include/core_functions/scalar/blob_functions.hpp +2 -2
  42. package/src/duckdb/extension/core_functions/include/core_functions/scalar/date_functions.hpp +15 -5
  43. package/src/duckdb/extension/core_functions/include/core_functions/scalar/generic_functions.hpp +22 -12
  44. package/src/duckdb/extension/core_functions/include/core_functions/scalar/list_functions.hpp +56 -56
  45. package/src/duckdb/extension/core_functions/include/core_functions/scalar/map_functions.hpp +2 -2
  46. package/src/duckdb/extension/core_functions/include/core_functions/scalar/math_functions.hpp +3 -3
  47. package/src/duckdb/extension/core_functions/include/core_functions/scalar/string_functions.hpp +118 -118
  48. package/src/duckdb/extension/core_functions/include/core_functions/scalar/struct_functions.hpp +10 -0
  49. package/src/duckdb/extension/core_functions/include/core_functions_extension.hpp +1 -1
  50. package/src/duckdb/extension/core_functions/lambda_functions.cpp +4 -4
  51. package/src/duckdb/extension/core_functions/scalar/array/array_functions.cpp +2 -1
  52. package/src/duckdb/extension/core_functions/scalar/array/array_value.cpp +7 -3
  53. package/src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp +7 -0
  54. package/src/duckdb/extension/core_functions/scalar/blob/base64.cpp +5 -2
  55. package/src/duckdb/extension/core_functions/scalar/blob/encode.cpp +6 -2
  56. package/src/duckdb/extension/core_functions/scalar/date/date_diff.cpp +7 -3
  57. package/src/duckdb/extension/core_functions/scalar/date/date_part.cpp +187 -33
  58. package/src/duckdb/extension/core_functions/scalar/date/date_sub.cpp +7 -3
  59. package/src/duckdb/extension/core_functions/scalar/date/date_trunc.cpp +12 -8
  60. package/src/duckdb/extension/core_functions/scalar/date/epoch.cpp +16 -12
  61. package/src/duckdb/extension/core_functions/scalar/date/make_date.cpp +11 -7
  62. package/src/duckdb/extension/core_functions/scalar/date/time_bucket.cpp +7 -3
  63. package/src/duckdb/extension/core_functions/scalar/date/to_interval.cpp +4 -0
  64. package/src/duckdb/extension/core_functions/scalar/enum/enum_functions.cpp +6 -6
  65. package/src/duckdb/extension/core_functions/scalar/generic/binning.cpp +8 -4
  66. package/src/duckdb/extension/core_functions/scalar/generic/can_implicitly_cast.cpp +6 -2
  67. package/src/duckdb/extension/core_functions/scalar/generic/cast_to_type.cpp +4 -1
  68. package/src/duckdb/extension/core_functions/scalar/generic/current_setting.cpp +9 -3
  69. package/src/duckdb/extension/core_functions/scalar/generic/least.cpp +5 -2
  70. package/src/duckdb/extension/core_functions/scalar/generic/replace_type.cpp +34 -0
  71. package/src/duckdb/extension/core_functions/scalar/generic/stats.cpp +5 -2
  72. package/src/duckdb/extension/core_functions/scalar/generic/system_functions.cpp +13 -9
  73. package/src/duckdb/extension/core_functions/scalar/generic/typeof.cpp +5 -1
  74. package/src/duckdb/extension/core_functions/scalar/list/array_slice.cpp +29 -26
  75. package/src/duckdb/extension/core_functions/scalar/list/flatten.cpp +9 -49
  76. package/src/duckdb/extension/core_functions/scalar/list/list_aggregates.cpp +17 -34
  77. package/src/duckdb/extension/core_functions/scalar/list/list_has_any_or_all.cpp +4 -50
  78. package/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp +46 -42
  79. package/src/duckdb/extension/core_functions/scalar/list/list_sort.cpp +48 -51
  80. package/src/duckdb/extension/core_functions/scalar/list/list_value.cpp +224 -144
  81. package/src/duckdb/extension/core_functions/scalar/list/range.cpp +5 -1
  82. package/src/duckdb/extension/core_functions/scalar/map/map.cpp +13 -41
  83. package/src/duckdb/extension/core_functions/scalar/map/map_concat.cpp +6 -6
  84. package/src/duckdb/extension/core_functions/scalar/map/map_entries.cpp +6 -42
  85. package/src/duckdb/extension/core_functions/scalar/map/map_extract.cpp +10 -59
  86. package/src/duckdb/extension/core_functions/scalar/map/map_from_entries.cpp +7 -32
  87. package/src/duckdb/extension/core_functions/scalar/map/map_keys_values.cpp +10 -45
  88. package/src/duckdb/extension/core_functions/scalar/math/numeric.cpp +364 -139
  89. package/src/duckdb/extension/core_functions/scalar/operators/bitwise.cpp +29 -7
  90. package/src/duckdb/extension/core_functions/scalar/random/random.cpp +18 -14
  91. package/src/duckdb/extension/core_functions/scalar/random/setseed.cpp +5 -1
  92. package/src/duckdb/extension/core_functions/scalar/string/hex.cpp +2 -2
  93. package/src/duckdb/extension/core_functions/scalar/string/instr.cpp +5 -3
  94. package/src/duckdb/extension/core_functions/scalar/string/printf.cpp +16 -0
  95. package/src/duckdb/extension/core_functions/scalar/string/repeat.cpp +2 -17
  96. package/src/duckdb/extension/core_functions/scalar/struct/struct_insert.cpp +1 -1
  97. package/src/duckdb/extension/core_functions/scalar/struct/struct_update.cpp +161 -0
  98. package/src/duckdb/extension/core_functions/scalar/union/union_extract.cpp +7 -3
  99. package/src/duckdb/extension/core_functions/scalar/union/union_tag.cpp +7 -3
  100. package/src/duckdb/extension/core_functions/scalar/union/union_value.cpp +7 -3
  101. package/src/duckdb/extension/icu/icu-current.cpp +5 -5
  102. package/src/duckdb/extension/icu/icu-dateadd.cpp +11 -11
  103. package/src/duckdb/extension/icu/icu-datepart.cpp +44 -44
  104. package/src/duckdb/extension/icu/icu-datesub.cpp +10 -10
  105. package/src/duckdb/extension/icu/icu-datetrunc.cpp +6 -6
  106. package/src/duckdb/extension/icu/icu-list-range.cpp +7 -6
  107. package/src/duckdb/extension/icu/icu-makedate.cpp +8 -11
  108. package/src/duckdb/extension/icu/icu-strptime.cpp +23 -29
  109. package/src/duckdb/extension/icu/icu-table-range.cpp +8 -6
  110. package/src/duckdb/extension/icu/icu-timebucket.cpp +5 -5
  111. package/src/duckdb/extension/icu/icu-timezone.cpp +24 -30
  112. package/src/duckdb/extension/icu/icu_extension.cpp +22 -34
  113. package/src/duckdb/extension/icu/include/icu-casts.hpp +2 -2
  114. package/src/duckdb/extension/icu/include/icu-current.hpp +3 -3
  115. package/src/duckdb/extension/icu/include/icu-dateadd.hpp +3 -3
  116. package/src/duckdb/extension/icu/include/icu-datepart.hpp +3 -3
  117. package/src/duckdb/extension/icu/include/icu-datesub.hpp +3 -3
  118. package/src/duckdb/extension/icu/include/icu-datetrunc.hpp +3 -3
  119. package/src/duckdb/extension/icu/include/icu-list-range.hpp +3 -3
  120. package/src/duckdb/extension/icu/include/icu-makedate.hpp +3 -3
  121. package/src/duckdb/extension/icu/include/icu-strptime.hpp +3 -3
  122. package/src/duckdb/extension/icu/include/icu-table-range.hpp +3 -3
  123. package/src/duckdb/extension/icu/include/icu-timebucket.hpp +3 -3
  124. package/src/duckdb/extension/icu/include/icu-timezone.hpp +3 -3
  125. package/src/duckdb/extension/icu/include/icu_extension.hpp +1 -1
  126. package/src/duckdb/extension/json/include/json_common.hpp +10 -2
  127. package/src/duckdb/extension/json/include/json_enums.hpp +3 -1
  128. package/src/duckdb/extension/json/include/json_extension.hpp +1 -1
  129. package/src/duckdb/extension/json/include/json_functions.hpp +4 -4
  130. package/src/duckdb/extension/json/include/json_multi_file_info.hpp +2 -2
  131. package/src/duckdb/extension/json/include/json_reader.hpp +3 -1
  132. package/src/duckdb/extension/json/json_enums.cpp +5 -0
  133. package/src/duckdb/extension/json/json_extension.cpp +27 -38
  134. package/src/duckdb/extension/json/json_functions/copy_json.cpp +8 -3
  135. package/src/duckdb/extension/json/json_functions/json_create.cpp +9 -6
  136. package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +3 -20
  137. package/src/duckdb/extension/json/json_functions/json_pretty.cpp +3 -3
  138. package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +6 -4
  139. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +6 -4
  140. package/src/duckdb/extension/json/json_functions/json_table_in_out.cpp +6 -2
  141. package/src/duckdb/extension/json/json_functions/json_transform.cpp +5 -3
  142. package/src/duckdb/extension/json/json_functions/read_json.cpp +4 -3
  143. package/src/duckdb/extension/json/json_functions.cpp +135 -8
  144. package/src/duckdb/extension/json/json_multi_file_info.cpp +5 -2
  145. package/src/duckdb/extension/json/json_reader.cpp +7 -6
  146. package/src/duckdb/extension/parquet/column_reader.cpp +46 -21
  147. package/src/duckdb/extension/parquet/column_writer.cpp +16 -105
  148. package/src/duckdb/extension/parquet/geo_parquet.cpp +231 -171
  149. package/src/duckdb/extension/parquet/include/column_reader.hpp +0 -2
  150. package/src/duckdb/extension/parquet/include/column_writer.hpp +2 -1
  151. package/src/duckdb/extension/parquet/include/geo_parquet.hpp +160 -66
  152. package/src/duckdb/extension/parquet/include/parquet_column_schema.hpp +6 -4
  153. package/src/duckdb/extension/parquet/include/parquet_crypto.hpp +0 -3
  154. package/src/duckdb/extension/parquet/include/parquet_extension.hpp +1 -1
  155. package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +5 -2
  156. package/src/duckdb/extension/parquet/include/parquet_multi_file_info.hpp +2 -2
  157. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +10 -2
  158. package/src/duckdb/extension/parquet/include/parquet_rle_bp_encoder.hpp +3 -0
  159. package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +0 -2
  160. package/src/duckdb/extension/parquet/include/parquet_timestamp.hpp +10 -6
  161. package/src/duckdb/extension/parquet/include/parquet_writer.hpp +4 -3
  162. package/src/duckdb/extension/parquet/include/reader/row_number_column_reader.hpp +0 -2
  163. package/src/duckdb/extension/parquet/include/reader/uuid_column_reader.hpp +3 -13
  164. package/src/duckdb/extension/parquet/include/reader/variant/variant_binary_decoder.hpp +150 -0
  165. package/src/duckdb/extension/parquet/include/reader/variant/variant_shredded_conversion.hpp +23 -0
  166. package/src/duckdb/extension/parquet/include/reader/variant/variant_value.hpp +54 -0
  167. package/src/duckdb/extension/parquet/include/reader/variant_column_reader.hpp +44 -0
  168. package/src/duckdb/extension/parquet/include/resizable_buffer.hpp +0 -2
  169. package/src/duckdb/extension/parquet/include/thrift_tools.hpp +3 -3
  170. package/src/duckdb/extension/parquet/include/writer/array_column_writer.hpp +2 -1
  171. package/src/duckdb/extension/parquet/include/writer/list_column_writer.hpp +2 -1
  172. package/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp +47 -10
  173. package/src/duckdb/extension/parquet/include/writer/parquet_write_stats.hpp +55 -1
  174. package/src/duckdb/extension/parquet/include/writer/primitive_column_writer.hpp +4 -3
  175. package/src/duckdb/extension/parquet/include/writer/struct_column_writer.hpp +2 -1
  176. package/src/duckdb/extension/parquet/include/writer/templated_column_writer.hpp +6 -3
  177. package/src/duckdb/extension/parquet/include/zstd_file_system.hpp +1 -3
  178. package/src/duckdb/extension/parquet/parquet_crypto.cpp +11 -11
  179. package/src/duckdb/extension/parquet/parquet_extension.cpp +84 -68
  180. package/src/duckdb/extension/parquet/parquet_file_metadata_cache.cpp +4 -4
  181. package/src/duckdb/extension/parquet/parquet_float16.cpp +0 -3
  182. package/src/duckdb/extension/parquet/parquet_metadata.cpp +115 -17
  183. package/src/duckdb/extension/parquet/parquet_multi_file_info.cpp +25 -10
  184. package/src/duckdb/extension/parquet/parquet_reader.cpp +181 -56
  185. package/src/duckdb/extension/parquet/parquet_statistics.cpp +26 -8
  186. package/src/duckdb/extension/parquet/parquet_timestamp.cpp +14 -4
  187. package/src/duckdb/extension/parquet/parquet_writer.cpp +117 -16
  188. package/src/duckdb/extension/parquet/reader/decimal_column_reader.cpp +1 -1
  189. package/src/duckdb/extension/parquet/reader/variant/variant_binary_decoder.cpp +367 -0
  190. package/src/duckdb/extension/parquet/reader/variant/variant_shredded_conversion.cpp +565 -0
  191. package/src/duckdb/extension/parquet/reader/variant/variant_value.cpp +85 -0
  192. package/src/duckdb/extension/parquet/reader/variant_column_reader.cpp +161 -0
  193. package/src/duckdb/extension/parquet/writer/array_column_writer.cpp +5 -2
  194. package/src/duckdb/extension/parquet/writer/enum_column_writer.cpp +1 -1
  195. package/src/duckdb/extension/parquet/writer/list_column_writer.cpp +6 -3
  196. package/src/duckdb/extension/parquet/writer/primitive_column_writer.cpp +24 -8
  197. package/src/duckdb/extension/parquet/writer/struct_column_writer.cpp +4 -2
  198. package/src/duckdb/extension/parquet/zstd_file_system.cpp +7 -6
  199. package/src/duckdb/src/catalog/catalog.cpp +92 -62
  200. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +8 -8
  201. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +14 -8
  202. package/src/duckdb/src/catalog/catalog_set.cpp +1 -0
  203. package/src/duckdb/src/catalog/default/default_functions.cpp +4 -4
  204. package/src/duckdb/src/catalog/default/default_table_functions.cpp +5 -4
  205. package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
  206. package/src/duckdb/src/catalog/duck_catalog.cpp +28 -0
  207. package/src/duckdb/src/common/adbc/adbc.cpp +243 -125
  208. package/src/duckdb/src/common/adbc/driver_manager.cpp +3 -3
  209. package/src/duckdb/src/common/arrow/appender/append_data.cpp +29 -0
  210. package/src/duckdb/src/common/arrow/appender/bool_data.cpp +6 -7
  211. package/src/duckdb/src/common/arrow/appender/fixed_size_list_data.cpp +1 -1
  212. package/src/duckdb/src/common/arrow/appender/struct_data.cpp +1 -1
  213. package/src/duckdb/src/common/arrow/appender/union_data.cpp +0 -1
  214. package/src/duckdb/src/common/arrow/arrow_appender.cpp +13 -17
  215. package/src/duckdb/src/common/arrow/arrow_converter.cpp +14 -6
  216. package/src/duckdb/src/common/arrow/arrow_type_extension.cpp +6 -6
  217. package/src/duckdb/src/common/arrow/physical_arrow_collector.cpp +16 -10
  218. package/src/duckdb/src/common/arrow/schema_metadata.cpp +2 -2
  219. package/src/duckdb/src/common/bignum.cpp +362 -0
  220. package/src/duckdb/src/common/box_renderer.cpp +83 -32
  221. package/src/duckdb/src/common/complex_json.cpp +20 -5
  222. package/src/duckdb/src/common/compressed_file_system.cpp +6 -5
  223. package/src/duckdb/src/common/csv_writer.cpp +381 -0
  224. package/src/duckdb/src/common/encryption_functions.cpp +228 -0
  225. package/src/duckdb/src/common/encryption_key_manager.cpp +143 -0
  226. package/src/duckdb/src/common/encryption_state.cpp +56 -9
  227. package/src/duckdb/src/common/enum_util.cpp +405 -51
  228. package/src/duckdb/src/common/enums/expression_type.cpp +2 -0
  229. package/src/duckdb/src/common/enums/logical_operator_type.cpp +2 -0
  230. package/src/duckdb/src/common/enums/metric_type.cpp +6 -0
  231. package/src/duckdb/src/common/enums/optimizer_type.cpp +1 -0
  232. package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
  233. package/src/duckdb/src/common/enums/statement_type.cpp +2 -0
  234. package/src/duckdb/src/common/error_data.cpp +11 -0
  235. package/src/duckdb/src/common/exception_format_value.cpp +15 -1
  236. package/src/duckdb/src/common/extra_type_info.cpp +43 -0
  237. package/src/duckdb/src/common/file_buffer.cpp +11 -8
  238. package/src/duckdb/src/common/file_system.cpp +82 -12
  239. package/src/duckdb/src/common/gzip_file_system.cpp +13 -11
  240. package/src/duckdb/src/common/local_file_system.cpp +25 -16
  241. package/src/duckdb/src/common/multi_file/base_file_reader.cpp +4 -0
  242. package/src/duckdb/src/common/multi_file/multi_file_column_mapper.cpp +7 -11
  243. package/src/duckdb/src/common/multi_file/multi_file_function.cpp +8 -0
  244. package/src/duckdb/src/common/multi_file/multi_file_list.cpp +8 -4
  245. package/src/duckdb/src/common/multi_file/multi_file_reader.cpp +9 -5
  246. package/src/duckdb/src/common/operator/cast_operators.cpp +147 -6
  247. package/src/duckdb/src/common/operator/string_cast.cpp +41 -12
  248. package/src/duckdb/src/common/pipe_file_system.cpp +10 -5
  249. package/src/duckdb/src/common/progress_bar/progress_bar.cpp +2 -2
  250. package/src/duckdb/src/common/progress_bar/terminal_progress_bar_display.cpp +81 -7
  251. package/src/duckdb/src/common/progress_bar/unscented_kalman_filter.cpp +288 -0
  252. package/src/duckdb/src/common/radix_partitioning.cpp +2 -2
  253. package/src/duckdb/src/common/row_operations/row_aggregate.cpp +8 -11
  254. package/src/duckdb/src/common/row_operations/row_external.cpp +0 -7
  255. package/src/duckdb/src/common/row_operations/row_gather.cpp +0 -5
  256. package/src/duckdb/src/common/row_operations/row_matcher.cpp +55 -37
  257. package/src/duckdb/src/common/row_operations/row_scatter.cpp +0 -6
  258. package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +4 -0
  259. package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +4 -0
  260. package/src/duckdb/src/common/serializer/memory_stream.cpp +4 -0
  261. package/src/duckdb/src/common/sort/partition_state.cpp +3 -3
  262. package/src/duckdb/src/common/sorting/hashed_sort.cpp +724 -0
  263. package/src/duckdb/src/common/sorting/sort.cpp +513 -0
  264. package/src/duckdb/src/common/sorting/sorted_run.cpp +341 -0
  265. package/src/duckdb/src/common/sorting/sorted_run_merger.cpp +969 -0
  266. package/src/duckdb/src/common/string_util.cpp +64 -44
  267. package/src/duckdb/src/common/tree_renderer/text_tree_renderer.cpp +40 -3
  268. package/src/duckdb/src/common/tree_renderer/yaml_tree_renderer.cpp +144 -0
  269. package/src/duckdb/src/common/tree_renderer.cpp +3 -0
  270. package/src/duckdb/src/common/types/bignum.cpp +350 -0
  271. package/src/duckdb/src/common/types/column/column_data_allocator.cpp +27 -29
  272. package/src/duckdb/src/common/types/column/column_data_collection.cpp +216 -68
  273. package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +3 -2
  274. package/src/duckdb/src/common/types/conflict_info.cpp +1 -2
  275. package/src/duckdb/src/common/types/conflict_manager.cpp +82 -207
  276. package/src/duckdb/src/common/types/data_chunk.cpp +10 -3
  277. package/src/duckdb/src/common/types/date.cpp +8 -10
  278. package/src/duckdb/src/common/types/hash.cpp +7 -7
  279. package/src/duckdb/src/common/types/row/block_iterator.cpp +34 -0
  280. package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +38 -29
  281. package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +272 -54
  282. package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +156 -45
  283. package/src/duckdb/src/common/types/row/tuple_data_iterator.cpp +5 -5
  284. package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +122 -18
  285. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +466 -83
  286. package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +8 -28
  287. package/src/duckdb/src/common/types/time.cpp +2 -2
  288. package/src/duckdb/src/common/types/timestamp.cpp +26 -14
  289. package/src/duckdb/src/common/types/uuid.cpp +33 -2
  290. package/src/duckdb/src/common/types/value.cpp +79 -16
  291. package/src/duckdb/src/common/types/vector.cpp +190 -22
  292. package/src/duckdb/src/common/types/vector_buffer.cpp +4 -0
  293. package/src/duckdb/src/common/types/vector_cache.cpp +4 -0
  294. package/src/duckdb/src/common/types.cpp +110 -22
  295. package/src/duckdb/src/common/value_operations/comparison_operations.cpp +24 -27
  296. package/src/duckdb/src/common/vector_operations/boolean_operators.cpp +12 -9
  297. package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +5 -4
  298. package/src/duckdb/src/common/vector_operations/generators.cpp +1 -1
  299. package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +70 -135
  300. package/src/duckdb/src/common/vector_operations/null_operations.cpp +1 -1
  301. package/src/duckdb/src/common/vector_operations/vector_copy.cpp +5 -2
  302. package/src/duckdb/src/common/vector_operations/vector_hash.cpp +110 -55
  303. package/src/duckdb/src/common/vector_operations/vector_storage.cpp +14 -10
  304. package/src/duckdb/src/common/virtual_file_system.cpp +12 -3
  305. package/src/duckdb/src/execution/aggregate_hashtable.cpp +88 -50
  306. package/src/duckdb/src/execution/column_binding_resolver.cpp +7 -6
  307. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +113 -2
  308. package/src/duckdb/src/execution/expression_executor.cpp +44 -4
  309. package/src/duckdb/src/execution/index/art/art.cpp +78 -216
  310. package/src/duckdb/src/execution/index/art/art_builder.cpp +91 -0
  311. package/src/duckdb/src/execution/index/art/art_key.cpp +0 -23
  312. package/src/duckdb/src/execution/index/art/art_merger.cpp +3 -4
  313. package/src/duckdb/src/execution/index/art/base_leaf.cpp +10 -11
  314. package/src/duckdb/src/execution/index/art/base_node.cpp +103 -75
  315. package/src/duckdb/src/execution/index/art/iterator.cpp +3 -3
  316. package/src/duckdb/src/execution/index/art/leaf.cpp +9 -11
  317. package/src/duckdb/src/execution/index/art/node.cpp +54 -53
  318. package/src/duckdb/src/execution/index/art/node256.cpp +30 -56
  319. package/src/duckdb/src/execution/index/art/node256_leaf.cpp +43 -30
  320. package/src/duckdb/src/execution/index/art/node48.cpp +69 -101
  321. package/src/duckdb/src/execution/index/art/plan_art.cpp +2 -1
  322. package/src/duckdb/src/execution/index/art/prefix.cpp +115 -125
  323. package/src/duckdb/src/execution/index/bound_index.cpp +39 -10
  324. package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +23 -8
  325. package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +35 -23
  326. package/src/duckdb/src/execution/index/unbound_index.cpp +26 -6
  327. package/src/duckdb/src/execution/join_hashtable.cpp +52 -55
  328. package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +3 -0
  329. package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +6 -4
  330. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +27 -18
  331. package/src/duckdb/src/execution/operator/aggregate/physical_partitioned_aggregate.cpp +4 -2
  332. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +4 -2
  333. package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +8 -2
  334. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +6 -4
  335. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +433 -387
  336. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +5 -4
  337. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +12 -4
  338. package/src/duckdb/src/execution/operator/csv_scanner/encode/csv_encoder.cpp +8 -7
  339. package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +7 -5
  340. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +15 -2
  341. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +1 -1
  342. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +4 -4
  343. package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_multi_file_info.cpp +12 -3
  344. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +7 -2
  345. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +4 -0
  346. package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +14 -12
  347. package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +2 -1
  348. package/src/duckdb/src/execution/operator/helper/physical_buffered_batch_collector.cpp +2 -2
  349. package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +3 -2
  350. package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +2 -2
  351. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +3 -3
  352. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +4 -3
  353. package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +3 -2
  354. package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +29 -9
  355. package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +23 -20
  356. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +28 -11
  357. package/src/duckdb/src/execution/operator/helper/physical_set_variable.cpp +3 -2
  358. package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +4 -3
  359. package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +3 -3
  360. package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -4
  361. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +7 -3
  362. package/src/duckdb/src/execution/operator/helper/physical_verify_vector.cpp +4 -2
  363. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +11 -10
  364. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +3 -2
  365. package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +4 -4
  366. package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +4 -3
  367. package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +2 -2
  368. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +13 -8
  369. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +15 -14
  370. package/src/duckdb/src/execution/operator/join/physical_join.cpp +3 -3
  371. package/src/duckdb/src/execution/operator/join/physical_left_delim_join.cpp +5 -4
  372. package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +7 -7
  373. package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +20 -21
  374. package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +4 -3
  375. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +18 -6
  376. package/src/duckdb/src/execution/operator/join/physical_right_delim_join.cpp +5 -4
  377. package/src/duckdb/src/execution/operator/order/physical_order.cpp +62 -203
  378. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +5 -4
  379. package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +5 -3
  380. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +9 -7
  381. package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +7 -5
  382. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +12 -7
  383. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +34 -5
  384. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +6 -20
  385. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +91 -74
  386. package/src/duckdb/src/execution/operator/persistent/physical_merge_into.cpp +516 -0
  387. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +11 -9
  388. package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +7 -4
  389. package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +3 -36
  390. package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +26 -4
  391. package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +5 -3
  392. package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +9 -7
  393. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +3 -3
  394. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -5
  395. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +11 -9
  396. package/src/duckdb/src/execution/operator/schema/physical_create_art_index.cpp +5 -4
  397. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +3 -3
  398. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +3 -2
  399. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -2
  400. package/src/duckdb/src/execution/operator/set/physical_cte.cpp +5 -4
  401. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +5 -3
  402. package/src/duckdb/src/execution/operator/set/physical_union.cpp +3 -3
  403. package/src/duckdb/src/execution/physical_operator.cpp +42 -32
  404. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +24 -12
  405. package/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +5 -3
  406. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +12 -18
  407. package/src/duckdb/src/execution/physical_plan/plan_get.cpp +3 -1
  408. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +11 -10
  409. package/src/duckdb/src/execution/physical_plan/plan_merge_into.cpp +132 -0
  410. package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +16 -18
  411. package/src/duckdb/src/execution/physical_plan_generator.cpp +8 -5
  412. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -27
  413. package/src/duckdb/src/execution/sample/base_reservoir_sample.cpp +22 -22
  414. package/src/duckdb/src/function/aggregate/distributive/count.cpp +14 -11
  415. package/src/duckdb/src/function/aggregate/distributive/first_last_any.cpp +23 -19
  416. package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +14 -7
  417. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +185 -234
  418. package/src/duckdb/src/function/cast/bignum_casts.cpp +315 -0
  419. package/src/duckdb/src/function/cast/blob_cast.cpp +3 -0
  420. package/src/duckdb/src/function/cast/cast_function_set.cpp +24 -4
  421. package/src/duckdb/src/function/cast/decimal_cast.cpp +3 -3
  422. package/src/duckdb/src/function/cast/default_casts.cpp +12 -4
  423. package/src/duckdb/src/function/cast/enum_casts.cpp +4 -3
  424. package/src/duckdb/src/function/cast/numeric_casts.cpp +3 -3
  425. package/src/duckdb/src/function/cast/string_cast.cpp +14 -11
  426. package/src/duckdb/src/function/cast/struct_cast.cpp +127 -2
  427. package/src/duckdb/src/function/cast/time_casts.cpp +18 -0
  428. package/src/duckdb/src/function/cast/union_casts.cpp +7 -6
  429. package/src/duckdb/src/function/cast/uuid_casts.cpp +3 -0
  430. package/src/duckdb/src/function/cast/variant/from_variant.cpp +697 -0
  431. package/src/duckdb/src/function/cast/variant/to_json.cpp +272 -0
  432. package/src/duckdb/src/function/cast/variant/to_variant.cpp +193 -0
  433. package/src/duckdb/src/function/cast_rules.cpp +38 -4
  434. package/src/duckdb/src/function/copy_blob.cpp +157 -0
  435. package/src/duckdb/src/function/copy_function.cpp +15 -0
  436. package/src/duckdb/src/function/function.cpp +2 -0
  437. package/src/duckdb/src/function/function_binder.cpp +239 -13
  438. package/src/duckdb/src/function/function_list.cpp +8 -0
  439. package/src/duckdb/src/function/macro_function.cpp +263 -70
  440. package/src/duckdb/src/function/pragma/pragma_functions.cpp +6 -38
  441. package/src/duckdb/src/function/pragma/pragma_queries.cpp +37 -22
  442. package/src/duckdb/src/function/register_function_list.cpp +5 -5
  443. package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +43 -34
  444. package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +61 -38
  445. package/src/duckdb/src/function/scalar/create_sort_key.cpp +374 -154
  446. package/src/duckdb/src/function/scalar/date/strftime.cpp +31 -28
  447. package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +18 -14
  448. package/src/duckdb/src/function/scalar/generic/error.cpp +18 -7
  449. package/src/duckdb/src/function/scalar/generic/getvariable.cpp +5 -2
  450. package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +4 -52
  451. package/src/duckdb/src/function/scalar/list/list_extract.cpp +5 -12
  452. package/src/duckdb/src/function/scalar/list/list_resize.cpp +1 -1
  453. package/src/duckdb/src/function/scalar/list/list_select.cpp +11 -27
  454. package/src/duckdb/src/function/scalar/map/map_contains.cpp +5 -31
  455. package/src/duckdb/src/function/scalar/operator/add.cpp +6 -1
  456. package/src/duckdb/src/function/scalar/operator/arithmetic.cpp +130 -10
  457. package/src/duckdb/src/function/scalar/operator/multiply.cpp +4 -2
  458. package/src/duckdb/src/function/scalar/operator/subtract.cpp +3 -1
  459. package/src/duckdb/src/function/scalar/sequence/nextval.cpp +7 -3
  460. package/src/duckdb/src/function/scalar/strftime_format.cpp +2 -2
  461. package/src/duckdb/src/function/scalar/string/caseconvert.cpp +4 -0
  462. package/src/duckdb/src/function/scalar/string/concat.cpp +18 -19
  463. package/src/duckdb/src/function/scalar/string/contains.cpp +14 -7
  464. package/src/duckdb/src/function/scalar/string/length.cpp +13 -9
  465. package/src/duckdb/src/function/scalar/string/like.cpp +146 -143
  466. package/src/duckdb/src/function/scalar/string/md5.cpp +6 -2
  467. package/src/duckdb/src/function/scalar/string/nfc_normalize.cpp +5 -1
  468. package/src/duckdb/src/function/scalar/string/prefix.cpp +11 -8
  469. package/src/duckdb/src/function/scalar/string/regexp_escape.cpp +5 -1
  470. package/src/duckdb/src/function/scalar/string/sha1.cpp +5 -1
  471. package/src/duckdb/src/function/scalar/string/sha256.cpp +5 -1
  472. package/src/duckdb/src/function/scalar/string/string_split.cpp +7 -3
  473. package/src/duckdb/src/function/scalar/string/strip_accents.cpp +5 -1
  474. package/src/duckdb/src/function/scalar/string/substring.cpp +10 -6
  475. package/src/duckdb/src/function/scalar/string/suffix.cpp +10 -8
  476. package/src/duckdb/src/function/scalar/struct/remap_struct.cpp +20 -17
  477. package/src/duckdb/src/function/scalar/struct/struct_concat.cpp +1 -1
  478. package/src/duckdb/src/function/scalar/struct/struct_contains.cpp +255 -0
  479. package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +2 -2
  480. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +34 -31
  481. package/src/duckdb/src/function/scalar/system/current_connection_id.cpp +5 -1
  482. package/src/duckdb/src/function/scalar/system/current_query_id.cpp +5 -1
  483. package/src/duckdb/src/function/scalar/system/current_transaction_id.cpp +5 -1
  484. package/src/duckdb/src/function/scalar/system/parse_log_message.cpp +5 -1
  485. package/src/duckdb/src/function/scalar/system/write_log.cpp +11 -13
  486. package/src/duckdb/src/function/scalar/variant/variant_extract.cpp +234 -0
  487. package/src/duckdb/src/function/scalar/variant/variant_typeof.cpp +70 -0
  488. package/src/duckdb/src/function/scalar/variant/variant_utils.cpp +412 -0
  489. package/src/duckdb/src/function/scalar_macro_function.cpp +8 -11
  490. package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +2 -3
  491. package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +27 -2
  492. package/src/duckdb/src/function/table/arrow.cpp +37 -17
  493. package/src/duckdb/src/function/table/arrow_conversion.cpp +186 -236
  494. package/src/duckdb/src/function/table/copy_csv.cpp +76 -245
  495. package/src/duckdb/src/function/table/direct_file_reader.cpp +172 -0
  496. package/src/duckdb/src/function/table/read_file.cpp +90 -220
  497. package/src/duckdb/src/function/table/sniff_csv.cpp +0 -1
  498. package/src/duckdb/src/function/table/system/duckdb_approx_database_count.cpp +43 -0
  499. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +2 -2
  500. package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +3 -7
  501. package/src/duckdb/src/function/table/system/duckdb_databases.cpp +20 -5
  502. package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +10 -5
  503. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +6 -22
  504. package/src/duckdb/src/function/table/system/duckdb_log.cpp +41 -5
  505. package/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp +15 -6
  506. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +29 -6
  507. package/src/duckdb/src/function/table/system/duckdb_types.cpp +4 -0
  508. package/src/duckdb/src/function/table/system/logging_utils.cpp +154 -0
  509. package/src/duckdb/src/function/table/system/pragma_database_size.cpp +2 -2
  510. package/src/duckdb/src/function/table/system/test_all_types.cpp +30 -6
  511. package/src/duckdb/src/function/table/system_functions.cpp +2 -0
  512. package/src/duckdb/src/function/table/table_scan.cpp +82 -48
  513. package/src/duckdb/src/function/table/version/pragma_version.cpp +7 -4
  514. package/src/duckdb/src/function/window/window_aggregate_function.cpp +56 -46
  515. package/src/duckdb/src/function/window/window_aggregator.cpp +33 -19
  516. package/src/duckdb/src/function/window/window_boundaries_state.cpp +12 -2
  517. package/src/duckdb/src/function/window/window_collection.cpp +30 -0
  518. package/src/duckdb/src/function/window/window_constant_aggregator.cpp +32 -24
  519. package/src/duckdb/src/function/window/window_custom_aggregator.cpp +54 -40
  520. package/src/duckdb/src/function/window/window_distinct_aggregator.cpp +200 -251
  521. package/src/duckdb/src/function/window/window_executor.cpp +44 -36
  522. package/src/duckdb/src/function/window/window_index_tree.cpp +26 -16
  523. package/src/duckdb/src/function/window/window_merge_sort_tree.cpp +98 -151
  524. package/src/duckdb/src/function/window/window_naive_aggregator.cpp +94 -72
  525. package/src/duckdb/src/function/window/window_rank_function.cpp +57 -63
  526. package/src/duckdb/src/function/window/window_rownumber_function.cpp +45 -47
  527. package/src/duckdb/src/function/window/window_segment_tree.cpp +28 -22
  528. package/src/duckdb/src/function/window/window_token_tree.cpp +46 -41
  529. package/src/duckdb/src/function/window/window_value_function.cpp +632 -93
  530. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +24 -5
  531. package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +5 -2
  532. package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +16 -0
  533. package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +68 -1
  534. package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
  535. package/src/duckdb/src/include/duckdb/common/arena_linked_list.hpp +169 -0
  536. package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +31 -55
  537. package/src/duckdb/src/include/duckdb/common/arrow/appender/enum_data.hpp +1 -1
  538. package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +1 -1
  539. package/src/duckdb/src/include/duckdb/common/arrow/appender/list_view_data.hpp +1 -1
  540. package/src/duckdb/src/include/duckdb/common/arrow/appender/map_data.hpp +1 -1
  541. package/src/duckdb/src/include/duckdb/common/arrow/appender/scalar_data.hpp +1 -1
  542. package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +6 -6
  543. package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +10 -0
  544. package/src/duckdb/src/include/duckdb/common/arrow/physical_arrow_batch_collector.hpp +2 -2
  545. package/src/duckdb/src/include/duckdb/common/arrow/physical_arrow_collector.hpp +3 -4
  546. package/src/duckdb/src/include/duckdb/common/bignum.hpp +85 -0
  547. package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +4 -4
  548. package/src/duckdb/src/include/duckdb/common/chrono.hpp +1 -0
  549. package/src/duckdb/src/include/duckdb/common/complex_json.hpp +15 -4
  550. package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +2 -2
  551. package/src/duckdb/src/include/duckdb/common/csv_writer.hpp +153 -0
  552. package/src/duckdb/src/include/duckdb/common/encryption_functions.hpp +54 -0
  553. package/src/duckdb/src/include/duckdb/common/encryption_key_manager.hpp +80 -0
  554. package/src/duckdb/src/include/duckdb/common/encryption_state.hpp +25 -9
  555. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +120 -0
  556. package/src/duckdb/src/include/duckdb/common/enums/arrow_format_version.hpp +33 -0
  557. package/src/duckdb/src/include/duckdb/common/enums/checkpoint_abort.hpp +22 -0
  558. package/src/duckdb/src/include/duckdb/common/enums/checkpoint_type.hpp +3 -1
  559. package/src/duckdb/src/include/duckdb/common/enums/copy_option_mode.hpp +17 -0
  560. package/src/duckdb/src/include/duckdb/common/enums/debug_vector_verification.hpp +2 -1
  561. package/src/duckdb/src/include/duckdb/common/enums/explain_format.hpp +1 -1
  562. package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +1 -0
  563. package/src/duckdb/src/include/duckdb/common/enums/file_glob_options.hpp +11 -3
  564. package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +1 -0
  565. package/src/duckdb/src/include/duckdb/common/enums/merge_action_type.hpp +19 -0
  566. package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +3 -0
  567. package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +2 -1
  568. package/src/duckdb/src/include/duckdb/common/enums/ordinality_request_type.hpp +16 -0
  569. package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
  570. package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +1 -0
  571. package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +2 -1
  572. package/src/duckdb/src/include/duckdb/common/enums/thread_pin_mode.hpp +17 -0
  573. package/src/duckdb/src/include/duckdb/common/enums/tuple_data_layout_enums.hpp +25 -0
  574. package/src/duckdb/src/include/duckdb/common/enums/undo_flags.hpp +2 -1
  575. package/src/duckdb/src/include/duckdb/common/error_data.hpp +4 -2
  576. package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +9 -1
  577. package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +25 -1
  578. package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +15 -6
  579. package/src/duckdb/src/include/duckdb/common/file_open_flags.hpp +14 -0
  580. package/src/duckdb/src/include/duckdb/common/file_opener.hpp +2 -1
  581. package/src/duckdb/src/include/duckdb/common/file_system.hpp +14 -6
  582. package/src/duckdb/src/include/duckdb/common/fsst.hpp +3 -2
  583. package/src/duckdb/src/include/duckdb/common/gzip_file_system.hpp +1 -1
  584. package/src/duckdb/src/include/duckdb/common/helper.hpp +21 -3
  585. package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +1 -1
  586. package/src/duckdb/src/include/duckdb/common/multi_file/base_file_reader.hpp +4 -0
  587. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_function.hpp +43 -14
  588. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_list.hpp +4 -3
  589. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_reader.hpp +10 -3
  590. package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_states.hpp +2 -0
  591. package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +57 -0
  592. package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +7 -3
  593. package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +84 -0
  594. package/src/duckdb/src/include/duckdb/common/operator/interpolate.hpp +39 -0
  595. package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +6 -0
  596. package/src/duckdb/src/include/duckdb/common/optionally_owned_ptr.hpp +18 -2
  597. package/src/duckdb/src/include/duckdb/common/owning_string_map.hpp +8 -0
  598. package/src/duckdb/src/include/duckdb/common/pipe_file_system.hpp +1 -1
  599. package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +44 -5
  600. package/src/duckdb/src/include/duckdb/common/progress_bar/progress_bar.hpp +1 -1
  601. package/src/duckdb/src/include/duckdb/common/progress_bar/unscented_kalman_filter.hpp +65 -0
  602. package/src/duckdb/src/include/duckdb/common/row_operations/row_matcher.hpp +8 -14
  603. package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +0 -12
  604. package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +2 -0
  605. package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +17 -2
  606. package/src/duckdb/src/include/duckdb/common/serializer/memory_stream.hpp +1 -0
  607. package/src/duckdb/src/include/duckdb/common/serializer/read_stream.hpp +9 -1
  608. package/src/duckdb/src/include/duckdb/common/serializer/varint.hpp +62 -0
  609. package/src/duckdb/src/include/duckdb/common/sorting/hashed_sort.hpp +76 -0
  610. package/src/duckdb/src/include/duckdb/common/sorting/sort.hpp +85 -0
  611. package/src/duckdb/src/include/duckdb/common/sorting/sort_key.hpp +442 -0
  612. package/src/duckdb/src/include/duckdb/common/sorting/sort_projection_column.hpp +21 -0
  613. package/src/duckdb/src/include/duckdb/common/sorting/sorted_run.hpp +55 -0
  614. package/src/duckdb/src/include/duckdb/common/sorting/sorted_run_merger.hpp +62 -0
  615. package/src/duckdb/src/include/duckdb/common/tree_renderer/text_tree_renderer.hpp +5 -0
  616. package/src/duckdb/src/include/duckdb/common/tree_renderer/yaml_tree_renderer.hpp +40 -0
  617. package/src/duckdb/src/include/duckdb/common/type_util.hpp +34 -4
  618. package/src/duckdb/src/include/duckdb/common/type_visitor.hpp +36 -6
  619. package/src/duckdb/src/include/duckdb/common/types/bignum.hpp +159 -0
  620. package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +3 -2
  621. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +4 -2
  622. package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +202 -56
  623. package/src/duckdb/src/include/duckdb/common/types/constraint_conflict_info.hpp +7 -5
  624. package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +3 -1
  625. package/src/duckdb/src/include/duckdb/common/types/date.hpp +9 -5
  626. package/src/duckdb/src/include/duckdb/common/types/datetime.hpp +11 -2
  627. package/src/duckdb/src/include/duckdb/common/types/double_na_equal.hpp +65 -0
  628. package/src/duckdb/src/include/duckdb/common/types/hash.hpp +22 -10
  629. package/src/duckdb/src/include/duckdb/common/types/hugeint.hpp +6 -6
  630. package/src/duckdb/src/include/duckdb/common/types/row/block_iterator.hpp +360 -0
  631. package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +1 -1
  632. package/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp +1 -2
  633. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +7 -0
  634. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +26 -2
  635. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +43 -5
  636. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +4 -11
  637. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +10 -1
  638. package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +8 -58
  639. package/src/duckdb/src/include/duckdb/common/types/string.hpp +338 -0
  640. package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +7 -1
  641. package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +7 -3
  642. package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +4 -4
  643. package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +5 -0
  644. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +14 -5
  645. package/src/duckdb/src/include/duckdb/common/types/value.hpp +15 -2
  646. package/src/duckdb/src/include/duckdb/common/types/variant.hpp +202 -0
  647. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +118 -5
  648. package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +8 -0
  649. package/src/duckdb/src/include/duckdb/common/types.hpp +26 -6
  650. package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +50 -11
  651. package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +2 -3
  652. package/src/duckdb/src/include/duckdb/common/winapi.hpp +0 -4
  653. package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +8 -6
  654. package/src/duckdb/src/include/duckdb/execution/executor.hpp +0 -2
  655. package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +4 -0
  656. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +21 -2
  657. package/src/duckdb/src/include/duckdb/execution/ht_entry.hpp +4 -0
  658. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +15 -16
  659. package/src/duckdb/src/include/duckdb/execution/index/art/art_builder.hpp +55 -0
  660. package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +0 -13
  661. package/src/duckdb/src/include/duckdb/execution/index/art/art_merger.hpp +1 -0
  662. package/src/duckdb/src/include/duckdb/execution/index/art/art_operator.hpp +113 -1
  663. package/src/duckdb/src/include/duckdb/execution/index/art/art_scanner.hpp +5 -2
  664. package/src/duckdb/src/include/duckdb/execution/index/art/base_leaf.hpp +2 -1
  665. package/src/duckdb/src/include/duckdb/execution/index/art/base_node.hpp +18 -15
  666. package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +1 -1
  667. package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +1 -1
  668. package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +30 -3
  669. package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +30 -8
  670. package/src/duckdb/src/include/duckdb/execution/index/art/node256_leaf.hpp +8 -5
  671. package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +36 -9
  672. package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +9 -20
  673. package/src/duckdb/src/include/duckdb/execution/index/bound_index.hpp +8 -6
  674. package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +21 -4
  675. package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +95 -11
  676. package/src/duckdb/src/include/duckdb/execution/index/unbound_index.hpp +22 -11
  677. package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +6 -1
  678. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/distinct_aggregate_data.hpp +3 -2
  679. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +12 -8
  680. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_partitioned_aggregate.hpp +1 -1
  681. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
  682. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +2 -2
  683. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -2
  684. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +4 -2
  685. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +1 -1
  686. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +3 -0
  687. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_multi_file_info.hpp +3 -3
  688. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +1 -1
  689. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +1 -1
  690. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +1 -1
  691. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/encode/csv_encoder.hpp +3 -0
  692. package/src/duckdb/src/include/duckdb/execution/operator/filter/physical_filter.hpp +2 -1
  693. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -1
  694. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_batch_collector.hpp +1 -1
  695. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_collector.hpp +1 -1
  696. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_create_secret.hpp +3 -2
  697. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +1 -1
  698. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -2
  699. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -2
  700. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -2
  701. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +2 -2
  702. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -1
  703. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +2 -2
  704. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +3 -2
  705. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +4 -2
  706. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +5 -4
  707. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +2 -2
  708. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +6 -3
  709. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set_variable.hpp +1 -1
  710. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +2 -2
  711. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_sample.hpp +2 -1
  712. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +4 -2
  713. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_update_extensions.hpp +3 -2
  714. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +1 -1
  715. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_verify_vector.hpp +1 -1
  716. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -1
  717. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +3 -2
  718. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp +2 -2
  719. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +2 -2
  720. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +4 -3
  721. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +4 -4
  722. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +5 -4
  723. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +2 -1
  724. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_left_delim_join.hpp +4 -3
  725. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +6 -5
  726. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +3 -3
  727. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -2
  728. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +3 -3
  729. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_right_delim_join.hpp +4 -3
  730. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +13 -9
  731. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -2
  732. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +2 -2
  733. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -3
  734. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_database.hpp +2 -1
  735. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -2
  736. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -2
  737. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -2
  738. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +3 -3
  739. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_merge_into.hpp +87 -0
  740. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -2
  741. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_pivot.hpp +2 -1
  742. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_projection.hpp +2 -7
  743. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +6 -1
  744. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +2 -2
  745. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +4 -4
  746. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +2 -2
  747. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +2 -2
  748. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +4 -3
  749. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +2 -1
  750. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +4 -3
  751. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +2 -2
  752. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +2 -2
  753. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_art_index.hpp +4 -4
  754. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +4 -2
  755. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +4 -2
  756. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +4 -2
  757. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +2 -2
  758. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
  759. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +4 -2
  760. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +2 -2
  761. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +2 -2
  762. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_cte.hpp +2 -2
  763. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -2
  764. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +2 -2
  765. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +23 -22
  766. package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +7 -2
  767. package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +4 -1
  768. package/src/duckdb/src/include/duckdb/execution/reservoir_sample.hpp +0 -1
  769. package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +3 -3
  770. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +36 -11
  771. package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +1 -0
  772. package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +28 -0
  773. package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +6 -1
  774. package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +5 -1
  775. package/src/duckdb/src/include/duckdb/function/cast/variant/array_to_variant.hpp +66 -0
  776. package/src/duckdb/src/include/duckdb/function/cast/variant/json_to_variant.hpp +283 -0
  777. package/src/duckdb/src/include/duckdb/function/cast/variant/list_to_variant.hpp +70 -0
  778. package/src/duckdb/src/include/duckdb/function/cast/variant/primitive_to_variant.hpp +399 -0
  779. package/src/duckdb/src/include/duckdb/function/cast/variant/struct_to_variant.hpp +111 -0
  780. package/src/duckdb/src/include/duckdb/function/cast/variant/to_variant.hpp +66 -0
  781. package/src/duckdb/src/include/duckdb/function/cast/variant/to_variant_fwd.hpp +179 -0
  782. package/src/duckdb/src/include/duckdb/function/cast/variant/union_to_variant.hpp +59 -0
  783. package/src/duckdb/src/include/duckdb/function/cast/variant/variant_to_variant.hpp +275 -0
  784. package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +2 -3
  785. package/src/duckdb/src/include/duckdb/function/copy_function.hpp +28 -10
  786. package/src/duckdb/src/include/duckdb/function/create_sort_key.hpp +13 -0
  787. package/src/duckdb/src/include/duckdb/function/function_binder.hpp +3 -0
  788. package/src/duckdb/src/include/duckdb/function/function_list.hpp +1 -1
  789. package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +25 -3
  790. package/src/duckdb/src/include/duckdb/function/macro_function.hpp +18 -6
  791. package/src/duckdb/src/include/duckdb/function/pragma/pragma_functions.hpp +1 -1
  792. package/src/duckdb/src/include/duckdb/function/register_function_list_helper.hpp +34 -2
  793. package/src/duckdb/src/include/duckdb/function/scalar/compressed_materialization_functions.hpp +10 -0
  794. package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +6 -6
  795. package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +5 -5
  796. package/src/duckdb/src/include/duckdb/function/scalar/list_functions.hpp +19 -19
  797. package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +103 -103
  798. package/src/duckdb/src/include/duckdb/function/scalar/struct_functions.hpp +32 -0
  799. package/src/duckdb/src/include/duckdb/function/scalar/system_functions.hpp +1 -1
  800. package/src/duckdb/src/include/duckdb/function/scalar/variant_functions.hpp +38 -0
  801. package/src/duckdb/src/include/duckdb/function/scalar/variant_utils.hpp +85 -0
  802. package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +8 -2
  803. package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_type_info.hpp +2 -0
  804. package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +26 -11
  805. package/src/duckdb/src/include/duckdb/function/table/direct_file_reader.hpp +39 -0
  806. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +2 -12
  807. package/src/duckdb/src/include/duckdb/function/table/read_file.hpp +83 -0
  808. package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +9 -1
  809. package/src/duckdb/src/include/duckdb/function/table_function.hpp +8 -5
  810. package/src/duckdb/src/include/duckdb/function/window/window_aggregate_function.hpp +10 -10
  811. package/src/duckdb/src/include/duckdb/function/window/window_aggregator.hpp +25 -48
  812. package/src/duckdb/src/include/duckdb/function/window/window_collection.hpp +142 -0
  813. package/src/duckdb/src/include/duckdb/function/window/window_constant_aggregator.hpp +11 -12
  814. package/src/duckdb/src/include/duckdb/function/window/window_custom_aggregator.hpp +8 -8
  815. package/src/duckdb/src/include/duckdb/function/window/window_distinct_aggregator.hpp +10 -10
  816. package/src/duckdb/src/include/duckdb/function/window/window_executor.hpp +26 -40
  817. package/src/duckdb/src/include/duckdb/function/window/window_index_tree.hpp +2 -2
  818. package/src/duckdb/src/include/duckdb/function/window/window_merge_sort_tree.hpp +32 -30
  819. package/src/duckdb/src/include/duckdb/function/window/window_naive_aggregator.hpp +5 -3
  820. package/src/duckdb/src/include/duckdb/function/window/window_rank_function.hpp +17 -16
  821. package/src/duckdb/src/include/duckdb/function/window/window_rownumber_function.hpp +10 -9
  822. package/src/duckdb/src/include/duckdb/function/window/window_segment_tree.hpp +8 -8
  823. package/src/duckdb/src/include/duckdb/function/window/window_token_tree.hpp +6 -6
  824. package/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp +44 -21
  825. package/src/duckdb/src/include/duckdb/logging/log_manager.hpp +12 -4
  826. package/src/duckdb/src/include/duckdb/logging/log_storage.hpp +271 -50
  827. package/src/duckdb/src/include/duckdb/main/appender.hpp +37 -16
  828. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +18 -4
  829. package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +23 -6
  830. package/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp +92 -8
  831. package/src/duckdb/src/include/duckdb/main/client_config.hpp +11 -70
  832. package/src/duckdb/src/include/duckdb/main/client_context.hpp +28 -5
  833. package/src/duckdb/src/include/duckdb/main/client_data.hpp +21 -23
  834. package/src/duckdb/src/include/duckdb/main/client_properties.hpp +3 -19
  835. package/src/duckdb/src/include/duckdb/main/config.hpp +48 -111
  836. package/src/duckdb/src/include/duckdb/main/database.hpp +23 -27
  837. package/src/duckdb/src/include/duckdb/main/database_file_opener.hpp +1 -0
  838. package/src/duckdb/src/include/duckdb/main/database_file_path_manager.hpp +39 -0
  839. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +19 -21
  840. package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +3 -1
  841. package/src/duckdb/src/include/duckdb/main/db_instance_cache.hpp +8 -4
  842. package/src/duckdb/src/include/duckdb/main/error_manager.hpp +3 -1
  843. package/src/duckdb/src/include/duckdb/main/extension/extension_loader.hpp +120 -0
  844. package/src/duckdb/src/include/duckdb/main/extension.hpp +2 -2
  845. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +35 -0
  846. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +2 -0
  847. package/src/duckdb/src/include/duckdb/main/extension_manager.hpp +59 -0
  848. package/src/duckdb/src/include/duckdb/main/extension_util.hpp +6 -77
  849. package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +41 -23
  850. package/src/duckdb/src/include/duckdb/main/relation.hpp +1 -1
  851. package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +1 -0
  852. package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +18 -18
  853. package/src/duckdb/src/include/duckdb/main/setting_info.hpp +109 -0
  854. package/src/duckdb/src/include/duckdb/main/settings.hpp +168 -184
  855. package/src/duckdb/src/include/duckdb/main/valid_checker.hpp +5 -2
  856. package/src/duckdb/src/include/duckdb/optimizer/build_probe_side_optimizer.hpp +1 -1
  857. package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_analyzer.hpp +1 -1
  858. package/src/duckdb/src/include/duckdb/optimizer/compressed_materialization.hpp +4 -0
  859. package/src/duckdb/src/include/duckdb/optimizer/cte_inlining.hpp +50 -0
  860. package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +4 -1
  861. package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +3 -0
  862. package/src/duckdb/src/include/duckdb/optimizer/late_materialization.hpp +1 -1
  863. package/src/duckdb/src/include/duckdb/optimizer/rule/date_trunc_simplification.hpp +73 -0
  864. package/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp +1 -0
  865. package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +9 -3
  866. package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +1 -0
  867. package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +3 -1
  868. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +18 -8
  869. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +3 -4
  870. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +6 -4
  871. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +2 -0
  872. package/src/duckdb/src/include/duckdb/parser/parsed_expression_iterator.hpp +14 -0
  873. package/src/duckdb/src/include/duckdb/parser/parser.hpp +2 -0
  874. package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +2 -0
  875. package/src/duckdb/src/include/duckdb/parser/query_node/cte_node.hpp +2 -0
  876. package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -0
  877. package/src/duckdb/src/include/duckdb/parser/statement/merge_into_statement.hpp +72 -0
  878. package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +1 -4
  879. package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +1 -0
  880. package/src/duckdb/src/include/duckdb/parser/tableref/bound_ref_wrapper.hpp +38 -0
  881. package/src/duckdb/src/include/duckdb/parser/tableref/column_data_ref.hpp +4 -9
  882. package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +2 -0
  883. package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +1 -0
  884. package/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp +5 -1
  885. package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +4 -0
  886. package/src/duckdb/src/include/duckdb/parser/tokens.hpp +3 -0
  887. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +9 -2
  888. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +5 -0
  889. package/src/duckdb/src/include/duckdb/planner/binder.hpp +45 -8
  890. package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +2 -0
  891. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +1 -0
  892. package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +3 -0
  893. package/src/duckdb/src/include/duckdb/planner/constraints/bound_check_constraint.hpp +8 -0
  894. package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +4 -0
  895. package/src/duckdb/src/include/duckdb/planner/constraints/bound_not_null_constraint.hpp +4 -0
  896. package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +5 -0
  897. package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +2 -2
  898. package/src/duckdb/src/include/duckdb/planner/expression_binder/projection_binder.hpp +37 -0
  899. package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +3 -1
  900. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +3 -8
  901. package/src/duckdb/src/include/duckdb/planner/expression_iterator.hpp +18 -0
  902. package/src/duckdb/src/include/duckdb/planner/extension_callback.hpp +8 -0
  903. package/src/duckdb/src/include/duckdb/planner/logical_operator_deep_copy.hpp +67 -0
  904. package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +1 -0
  905. package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -0
  906. package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
  907. package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -1
  908. package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +2 -0
  909. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +28 -22
  910. package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +1 -1
  911. package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
  912. package/src/duckdb/src/include/duckdb/planner/operator/logical_merge_into.hpp +75 -0
  913. package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +2 -0
  914. package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -1
  915. package/src/duckdb/src/include/duckdb/planner/query_node/bound_cte_node.hpp +2 -0
  916. package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +26 -0
  917. package/src/duckdb/src/include/duckdb/storage/block.hpp +1 -1
  918. package/src/duckdb/src/include/duckdb/storage/block_manager.hpp +24 -8
  919. package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +3 -1
  920. package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +55 -36
  921. package/src/duckdb/src/include/duckdb/storage/caching_file_system.hpp +10 -4
  922. package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +19 -6
  923. package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_reader.hpp +1 -1
  924. package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +15 -8
  925. package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +6 -8
  926. package/src/duckdb/src/include/duckdb/storage/compression/alp/algorithm/alp.hpp +2 -1
  927. package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_fetch.hpp +1 -1
  928. package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +4 -2
  929. package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_fetch.hpp +1 -1
  930. package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp +1 -1
  931. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/packed_data.hpp +3 -1
  932. package/src/duckdb/src/include/duckdb/storage/compression/dict_fsst/compression.hpp +1 -1
  933. package/src/duckdb/src/include/duckdb/storage/compression/dict_fsst/decompression.hpp +1 -1
  934. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas.hpp +1 -1
  935. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
  936. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +7 -2
  937. package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +5 -0
  938. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +14 -9
  939. package/src/duckdb/src/include/duckdb/storage/external_file_cache.hpp +6 -5
  940. package/src/duckdb/src/include/duckdb/storage/in_memory_block_manager.hpp +7 -2
  941. package/src/duckdb/src/include/duckdb/storage/magic_bytes.hpp +2 -1
  942. package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +15 -0
  943. package/src/duckdb/src/include/duckdb/storage/metadata/metadata_reader.hpp +7 -0
  944. package/src/duckdb/src/include/duckdb/storage/metadata/metadata_writer.hpp +1 -0
  945. package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +10 -3
  946. package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +14 -3
  947. package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +65 -20
  948. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +6 -6
  949. package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +2 -2
  950. package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +4 -4
  951. package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +80 -20
  952. package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +43 -17
  953. package/src/duckdb/src/include/duckdb/storage/storage_options.hpp +21 -0
  954. package/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +1 -0
  955. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +2 -2
  956. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +7 -1
  957. package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +5 -2
  958. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +10 -7
  959. package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +3 -3
  960. package/src/duckdb/src/include/duckdb/storage/table/in_memory_checkpoint.hpp +93 -0
  961. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -0
  962. package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +1 -0
  963. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +17 -2
  964. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +11 -1
  965. package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +5 -0
  966. package/src/duckdb/src/include/duckdb/storage/table/row_id_column_data.hpp +68 -0
  967. package/src/duckdb/src/include/duckdb/storage/table/segment_lock.hpp +4 -0
  968. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +34 -14
  969. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +1 -0
  970. package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +1 -0
  971. package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +55 -46
  972. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +3 -0
  973. package/src/duckdb/src/include/duckdb/storage/temporary_file_manager.hpp +17 -6
  974. package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +2 -1
  975. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -0
  976. package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +1 -0
  977. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +3 -1
  978. package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +22 -1
  979. package/src/duckdb/src/include/duckdb/transaction/undo_buffer_allocator.hpp +2 -0
  980. package/src/duckdb/src/include/duckdb/verification/explain_statement_verifier.hpp +23 -0
  981. package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +14 -7
  982. package/src/duckdb/src/include/duckdb.h +537 -121
  983. package/src/duckdb/src/include/duckdb_extension.h +122 -14
  984. package/src/duckdb/src/logging/log_manager.cpp +59 -15
  985. package/src/duckdb/src/logging/log_storage.cpp +672 -128
  986. package/src/duckdb/src/main/appender.cpp +129 -88
  987. package/src/duckdb/src/main/attached_database.cpp +47 -52
  988. package/src/duckdb/src/main/capi/aggregate_function-c.cpp +18 -9
  989. package/src/duckdb/src/main/capi/appender-c.cpp +82 -28
  990. package/src/duckdb/src/main/capi/arrow-c.cpp +181 -17
  991. package/src/duckdb/src/main/capi/config-c.cpp +18 -3
  992. package/src/duckdb/src/main/capi/data_chunk-c.cpp +22 -10
  993. package/src/duckdb/src/main/capi/duckdb-c.cpp +64 -21
  994. package/src/duckdb/src/main/capi/duckdb_value-c.cpp +13 -7
  995. package/src/duckdb/src/main/capi/error_data-c.cpp +46 -0
  996. package/src/duckdb/src/main/capi/expression-c.cpp +57 -0
  997. package/src/duckdb/src/main/capi/helper-c.cpp +227 -39
  998. package/src/duckdb/src/main/capi/logical_types-c.cpp +48 -28
  999. package/src/duckdb/src/main/capi/prepared-c.cpp +68 -10
  1000. package/src/duckdb/src/main/capi/profiling_info-c.cpp +6 -4
  1001. package/src/duckdb/src/main/capi/result-c.cpp +16 -95
  1002. package/src/duckdb/src/main/capi/scalar_function-c.cpp +43 -1
  1003. package/src/duckdb/src/main/capi/table_function-c.cpp +9 -0
  1004. package/src/duckdb/src/main/client_config.cpp +21 -0
  1005. package/src/duckdb/src/main/client_context.cpp +153 -77
  1006. package/src/duckdb/src/main/client_context_file_opener.cpp +1 -0
  1007. package/src/duckdb/src/main/client_data.cpp +139 -1
  1008. package/src/duckdb/src/main/client_verify.cpp +14 -6
  1009. package/src/duckdb/src/main/config.cpp +214 -121
  1010. package/src/duckdb/src/main/database.cpp +31 -58
  1011. package/src/duckdb/src/main/database_file_path_manager.cpp +42 -0
  1012. package/src/duckdb/src/main/database_manager.cpp +134 -108
  1013. package/src/duckdb/src/main/database_path_and_type.cpp +4 -3
  1014. package/src/duckdb/src/main/db_instance_cache.cpp +64 -35
  1015. package/src/duckdb/src/main/error_manager.cpp +2 -1
  1016. package/src/duckdb/src/main/extension/extension_helper.cpp +3 -22
  1017. package/src/duckdb/src/main/extension/extension_install.cpp +6 -6
  1018. package/src/duckdb/src/main/extension/extension_load.cpp +24 -9
  1019. package/src/duckdb/src/main/extension/extension_loader.cpp +234 -0
  1020. package/src/duckdb/src/main/extension_manager.cpp +115 -0
  1021. package/src/duckdb/src/main/http/http_util.cpp +18 -5
  1022. package/src/duckdb/src/main/profiling_info.cpp +8 -2
  1023. package/src/duckdb/src/main/query_profiler.cpp +65 -30
  1024. package/src/duckdb/src/main/query_result.cpp +1 -1
  1025. package/src/duckdb/src/main/relation/query_relation.cpp +23 -0
  1026. package/src/duckdb/src/main/secret/secret_manager.cpp +8 -7
  1027. package/src/duckdb/src/main/settings/autogenerated_settings.cpp +50 -645
  1028. package/src/duckdb/src/main/settings/custom_settings.cpp +111 -152
  1029. package/src/duckdb/src/main/valid_checker.cpp +10 -4
  1030. package/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +7 -5
  1031. package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +7 -7
  1032. package/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp +11 -7
  1033. package/src/duckdb/src/optimizer/compressed_materialization.cpp +56 -39
  1034. package/src/duckdb/src/optimizer/cte_inlining.cpp +225 -0
  1035. package/src/duckdb/src/optimizer/empty_result_pullup.cpp +8 -1
  1036. package/src/duckdb/src/optimizer/filter_combiner.cpp +5 -7
  1037. package/src/duckdb/src/optimizer/filter_pushdown.cpp +3 -0
  1038. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +18 -2
  1039. package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +1 -0
  1040. package/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +4 -3
  1041. package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +11 -15
  1042. package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +40 -23
  1043. package/src/duckdb/src/optimizer/late_materialization.cpp +16 -23
  1044. package/src/duckdb/src/optimizer/optimizer.cpp +15 -0
  1045. package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +15 -20
  1046. package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +11 -13
  1047. package/src/duckdb/src/optimizer/pushdown/pushdown_outer_join.cpp +201 -0
  1048. package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +20 -26
  1049. package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +11 -14
  1050. package/src/duckdb/src/optimizer/remove_unused_columns.cpp +2 -1
  1051. package/src/duckdb/src/optimizer/rule/date_trunc_simplification.cpp +446 -0
  1052. package/src/duckdb/src/optimizer/rule/join_dependent_filter.cpp +3 -9
  1053. package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +1 -6
  1054. package/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp +3 -6
  1055. package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +33 -1
  1056. package/src/duckdb/src/parallel/event.cpp +1 -3
  1057. package/src/duckdb/src/parallel/executor.cpp +0 -7
  1058. package/src/duckdb/src/parallel/pipeline.cpp +2 -2
  1059. package/src/duckdb/src/parallel/pipeline_executor.cpp +2 -2
  1060. package/src/duckdb/src/parallel/task_scheduler.cpp +146 -34
  1061. package/src/duckdb/src/parallel/thread_context.cpp +2 -9
  1062. package/src/duckdb/src/parser/column_definition.cpp +3 -6
  1063. package/src/duckdb/src/parser/expression/window_expression.cpp +3 -0
  1064. package/src/duckdb/src/parser/parsed_data/attach_info.cpp +8 -35
  1065. package/src/duckdb/src/parser/parsed_data/copy_info.cpp +27 -7
  1066. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +8 -13
  1067. package/src/duckdb/src/parser/parsed_data/create_info.cpp +16 -0
  1068. package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +7 -17
  1069. package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +1 -14
  1070. package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +1 -12
  1071. package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +1 -13
  1072. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +22 -0
  1073. package/src/duckdb/src/parser/parser.cpp +5 -0
  1074. package/src/duckdb/src/parser/qualified_name.cpp +26 -0
  1075. package/src/duckdb/src/parser/query_node/cte_node.cpp +1 -0
  1076. package/src/duckdb/src/parser/query_node/select_node.cpp +1 -0
  1077. package/src/duckdb/src/parser/query_node.cpp +1 -0
  1078. package/src/duckdb/src/parser/statement/export_statement.cpp +1 -3
  1079. package/src/duckdb/src/parser/statement/merge_into_statement.cpp +167 -0
  1080. package/src/duckdb/src/parser/statement/update_statement.cpp +19 -16
  1081. package/src/duckdb/src/parser/tableref/bound_ref_wrapper.cpp +29 -0
  1082. package/src/duckdb/src/parser/tableref/column_data_ref.cpp +26 -1
  1083. package/src/duckdb/src/parser/tableref/joinref.cpp +3 -2
  1084. package/src/duckdb/src/parser/tableref/showref.cpp +14 -0
  1085. package/src/duckdb/src/parser/tableref/table_function.cpp +6 -1
  1086. package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +0 -1
  1087. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +6 -1
  1088. package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +8 -11
  1089. package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +3 -0
  1090. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +7 -5
  1091. package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +4 -4
  1092. package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +16 -80
  1093. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +27 -22
  1094. package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +0 -1
  1095. package/src/duckdb/src/parser/transform/statement/transform_explain.cpp +1 -2
  1096. package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +22 -14
  1097. package/src/duckdb/src/parser/transform/statement/transform_merge_into.cpp +111 -0
  1098. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -0
  1099. package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +1 -1
  1100. package/src/duckdb/src/parser/transform/statement/transform_show.cpp +22 -4
  1101. package/src/duckdb/src/parser/transform/tableref/transform_from.cpp +3 -1
  1102. package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +12 -6
  1103. package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +3 -3
  1104. package/src/duckdb/src/parser/transformer.cpp +8 -7
  1105. package/src/duckdb/src/planner/bind_context.cpp +19 -2
  1106. package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +13 -6
  1107. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +3 -0
  1108. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +18 -4
  1109. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +8 -25
  1110. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +31 -4
  1111. package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +2 -0
  1112. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +48 -11
  1113. package/src/duckdb/src/planner/binder/query_node/bind_cte_node.cpp +9 -1
  1114. package/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +4 -0
  1115. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +6 -6
  1116. package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +11 -26
  1117. package/src/duckdb/src/planner/binder/query_node/plan_cte_node.cpp +4 -3
  1118. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +10 -4
  1119. package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +15 -0
  1120. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +239 -58
  1121. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +157 -55
  1122. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +30 -25
  1123. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +2 -3
  1124. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +28 -3
  1125. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +36 -0
  1126. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +282 -322
  1127. package/src/duckdb/src/planner/binder/statement/bind_merge_into.cpp +335 -0
  1128. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +23 -14
  1129. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +37 -27
  1130. package/src/duckdb/src/planner/binder/tableref/bind_bound_table_ref.cpp +13 -0
  1131. package/src/duckdb/src/planner/binder/tableref/bind_column_data_ref.cpp +4 -1
  1132. package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +120 -36
  1133. package/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +30 -0
  1134. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +72 -1
  1135. package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +7 -12
  1136. package/src/duckdb/src/planner/binder/tableref/plan_table_function.cpp +15 -1
  1137. package/src/duckdb/src/planner/binder.cpp +42 -175
  1138. package/src/duckdb/src/planner/bound_result_modifier.cpp +8 -0
  1139. package/src/duckdb/src/planner/collation_binding.cpp +2 -1
  1140. package/src/duckdb/src/planner/expression.cpp +1 -1
  1141. package/src/duckdb/src/planner/expression_binder/order_binder.cpp +4 -2
  1142. package/src/duckdb/src/planner/expression_binder/projection_binder.cpp +46 -0
  1143. package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +8 -6
  1144. package/src/duckdb/src/planner/expression_iterator.cpp +31 -0
  1145. package/src/duckdb/src/planner/logical_operator_deep_copy.cpp +264 -0
  1146. package/src/duckdb/src/planner/logical_operator_visitor.cpp +18 -4
  1147. package/src/duckdb/src/planner/operator/logical_aggregate.cpp +2 -1
  1148. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +4 -2
  1149. package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +3 -0
  1150. package/src/duckdb/src/planner/operator/logical_get.cpp +7 -2
  1151. package/src/duckdb/src/planner/operator/logical_insert.cpp +5 -2
  1152. package/src/duckdb/src/planner/operator/logical_join.cpp +6 -7
  1153. package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +1 -0
  1154. package/src/duckdb/src/planner/operator/logical_merge_into.cpp +43 -0
  1155. package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +8 -0
  1156. package/src/duckdb/src/planner/planner.cpp +4 -2
  1157. package/src/duckdb/src/planner/pragma_handler.cpp +1 -1
  1158. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +76 -7
  1159. package/src/duckdb/src/planner/table_binding.cpp +6 -12
  1160. package/src/duckdb/src/storage/block.cpp +2 -1
  1161. package/src/duckdb/src/storage/buffer/block_handle.cpp +7 -4
  1162. package/src/duckdb/src/storage/buffer/block_manager.cpp +14 -6
  1163. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +2 -2
  1164. package/src/duckdb/src/storage/buffer_manager.cpp +45 -13
  1165. package/src/duckdb/src/storage/caching_file_system.cpp +20 -12
  1166. package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +26 -3
  1167. package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +3 -1
  1168. package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +56 -35
  1169. package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +1 -1
  1170. package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -11
  1171. package/src/duckdb/src/storage/compression/bitpacking.cpp +4 -1
  1172. package/src/duckdb/src/storage/compression/dict_fsst/compression.cpp +48 -25
  1173. package/src/duckdb/src/storage/compression/dict_fsst/decompression.cpp +10 -13
  1174. package/src/duckdb/src/storage/compression/dict_fsst.cpp +2 -2
  1175. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +10 -5
  1176. package/src/duckdb/src/storage/compression/fsst.cpp +3 -2
  1177. package/src/duckdb/src/storage/compression/rle.cpp +1 -1
  1178. package/src/duckdb/src/storage/compression/zstd.cpp +5 -6
  1179. package/src/duckdb/src/storage/data_table.cpp +167 -144
  1180. package/src/duckdb/src/storage/external_file_cache.cpp +6 -6
  1181. package/src/duckdb/src/storage/local_storage.cpp +132 -68
  1182. package/src/duckdb/src/storage/magic_bytes.cpp +3 -2
  1183. package/src/duckdb/src/storage/metadata/metadata_manager.cpp +88 -17
  1184. package/src/duckdb/src/storage/metadata/metadata_reader.cpp +26 -3
  1185. package/src/duckdb/src/storage/metadata/metadata_writer.cpp +7 -0
  1186. package/src/duckdb/src/storage/open_file_storage_extension.cpp +3 -3
  1187. package/src/duckdb/src/storage/optimistic_data_writer.cpp +5 -3
  1188. package/src/duckdb/src/storage/partial_block_manager.cpp +26 -5
  1189. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +72 -22
  1190. package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +9 -3
  1191. package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +2 -0
  1192. package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +12 -2
  1193. package/src/duckdb/src/storage/serialization/serialize_types.cpp +14 -0
  1194. package/src/duckdb/src/storage/single_file_block_manager.cpp +381 -86
  1195. package/src/duckdb/src/storage/standard_buffer_manager.cpp +86 -30
  1196. package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -3
  1197. package/src/duckdb/src/storage/statistics/string_stats.cpp +2 -2
  1198. package/src/duckdb/src/storage/statistics/struct_stats.cpp +1 -1
  1199. package/src/duckdb/src/storage/storage_info.cpp +13 -7
  1200. package/src/duckdb/src/storage/storage_manager.cpp +110 -35
  1201. package/src/duckdb/src/storage/table/array_column_data.cpp +4 -0
  1202. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +22 -15
  1203. package/src/duckdb/src/storage/table/column_data.cpp +53 -14
  1204. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +17 -17
  1205. package/src/duckdb/src/storage/table/column_segment.cpp +23 -21
  1206. package/src/duckdb/src/storage/table/in_memory_checkpoint.cpp +136 -0
  1207. package/src/duckdb/src/storage/table/list_column_data.cpp +6 -1
  1208. package/src/duckdb/src/storage/table/row_group.cpp +226 -154
  1209. package/src/duckdb/src/storage/table/row_group_collection.cpp +146 -47
  1210. package/src/duckdb/src/storage/table/row_id_column_data.cpp +173 -0
  1211. package/src/duckdb/src/storage/table/row_version_manager.cpp +1 -1
  1212. package/src/duckdb/src/storage/table/standard_column_data.cpp +14 -2
  1213. package/src/duckdb/src/storage/table/struct_column_data.cpp +15 -0
  1214. package/src/duckdb/src/storage/table/update_segment.cpp +111 -5
  1215. package/src/duckdb/src/storage/table_index_list.cpp +137 -73
  1216. package/src/duckdb/src/storage/temporary_file_manager.cpp +103 -28
  1217. package/src/duckdb/src/storage/wal_replay.cpp +158 -36
  1218. package/src/duckdb/src/storage/write_ahead_log.cpp +102 -17
  1219. package/src/duckdb/src/transaction/commit_state.cpp +2 -0
  1220. package/src/duckdb/src/transaction/duck_transaction.cpp +12 -2
  1221. package/src/duckdb/src/transaction/duck_transaction_manager.cpp +66 -35
  1222. package/src/duckdb/src/transaction/meta_transaction.cpp +85 -23
  1223. package/src/duckdb/src/transaction/rollback_state.cpp +7 -0
  1224. package/src/duckdb/src/transaction/transaction_context.cpp +3 -4
  1225. package/src/duckdb/src/transaction/undo_buffer.cpp +5 -4
  1226. package/src/duckdb/src/transaction/undo_buffer_allocator.cpp +1 -0
  1227. package/src/duckdb/src/transaction/wal_write_state.cpp +2 -0
  1228. package/src/duckdb/src/verification/explain_statement_verifier.cpp +16 -0
  1229. package/src/duckdb/src/verification/prepared_statement_verifier.cpp +1 -1
  1230. package/src/duckdb/src/verification/statement_verifier.cpp +10 -5
  1231. package/src/duckdb/third_party/brotli/common/shared_dictionary.cpp +4 -4
  1232. package/src/duckdb/third_party/fmt/include/fmt/core.h +6 -12
  1233. package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +5 -1
  1234. package/src/duckdb/third_party/fmt/include/fmt/format.h +34 -24
  1235. package/src/duckdb/third_party/fmt/include/fmt/printf.h +49 -21
  1236. package/src/duckdb/third_party/httplib/httplib.hpp +13 -5
  1237. package/src/duckdb/third_party/jaro_winkler/details/jaro_impl.hpp +4 -4
  1238. package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +3 -0
  1239. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +56 -1
  1240. package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +744 -733
  1241. package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +6 -1
  1242. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +19098 -18654
  1243. package/src/duckdb/third_party/mbedtls/include/des_alt.h +1 -1
  1244. package/src/duckdb/third_party/mbedtls/include/mbedtls/aes_alt.h +1 -1
  1245. package/src/duckdb/third_party/mbedtls/include/mbedtls/aria_alt.h +1 -1
  1246. package/src/duckdb/third_party/mbedtls/include/mbedtls/block_cipher.h +1 -1
  1247. package/src/duckdb/third_party/mbedtls/include/mbedtls/build_info.h +4 -4
  1248. package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia_alt.h +1 -1
  1249. package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm_alt.h +1 -1
  1250. package/src/duckdb/third_party/mbedtls/include/mbedtls/chacha20.h +1 -1
  1251. package/src/duckdb/third_party/mbedtls/include/mbedtls/chachapoly.h +1 -1
  1252. package/src/duckdb/third_party/mbedtls/include/mbedtls/cmac.h +1 -1
  1253. package/src/duckdb/third_party/mbedtls/include/mbedtls/config_psa.h +1 -1
  1254. package/src/duckdb/third_party/mbedtls/include/mbedtls/ecdsa.h +1 -1
  1255. package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm_alt.h +1 -1
  1256. package/src/duckdb/third_party/mbedtls/include/mbedtls/mbedtls_config.h +5 -1
  1257. package/src/duckdb/third_party/mbedtls/include/mbedtls/md5.h +1 -1
  1258. package/src/duckdb/third_party/mbedtls/include/mbedtls/nist_kw.h +1 -1
  1259. package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs12.h +1 -1
  1260. package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs5.h +1 -1
  1261. package/src/duckdb/third_party/mbedtls/include/mbedtls/psa_util.h +1 -1
  1262. package/src/duckdb/third_party/mbedtls/include/mbedtls/ripemd160.h +1 -1
  1263. package/src/duckdb/third_party/mbedtls/include/mbedtls/sha3.h +1 -1
  1264. package/src/duckdb/third_party/mbedtls/include/mbedtls/threading.h +1 -1
  1265. package/src/duckdb/third_party/mbedtls/include/mbedtls/timing.h +1 -1
  1266. package/src/duckdb/third_party/mbedtls/include/mbedtls_wrapper.hpp +16 -7
  1267. package/src/duckdb/third_party/mbedtls/include/platform_alt.h +1 -1
  1268. package/src/duckdb/third_party/mbedtls/include/psa/build_info.h +20 -0
  1269. package/src/duckdb/third_party/mbedtls/include/psa/crypto.h +1 -1
  1270. package/src/duckdb/third_party/mbedtls/include/psa/crypto_config.h +1 -1
  1271. package/src/duckdb/third_party/mbedtls/include/psa/crypto_se_driver.h +1 -0
  1272. package/src/duckdb/third_party/mbedtls/include/rsa_alt.h +1 -1
  1273. package/src/duckdb/third_party/mbedtls/include/sha1_alt.h +1 -1
  1274. package/src/duckdb/third_party/mbedtls/include/sha256_alt.h +1 -1
  1275. package/src/duckdb/third_party/mbedtls/include/sha512_alt.h +1 -1
  1276. package/src/duckdb/third_party/mbedtls/include/ssl_misc.h +1 -1
  1277. package/src/duckdb/third_party/mbedtls/library/aes.cpp +1 -1
  1278. package/src/duckdb/third_party/mbedtls/library/aesce.h +136 -1
  1279. package/src/duckdb/third_party/mbedtls/library/alignment.h +9 -9
  1280. package/src/duckdb/third_party/mbedtls/library/asn1parse.cpp +1 -1
  1281. package/src/duckdb/third_party/mbedtls/library/asn1write.cpp +6 -3
  1282. package/src/duckdb/third_party/mbedtls/library/base64.cpp +48 -24
  1283. package/src/duckdb/third_party/mbedtls/library/base64_internal.h +45 -1
  1284. package/src/duckdb/third_party/mbedtls/library/bignum.cpp +3 -3
  1285. package/src/duckdb/third_party/mbedtls/library/bignum_core.cpp +16 -14
  1286. package/src/duckdb/third_party/mbedtls/library/bignum_core.h +10 -18
  1287. package/src/duckdb/third_party/mbedtls/library/block_cipher_internal.h +99 -1
  1288. package/src/duckdb/third_party/mbedtls/library/check_crypto_config.h +141 -1
  1289. package/src/duckdb/third_party/mbedtls/library/cipher.cpp +18 -12
  1290. package/src/duckdb/third_party/mbedtls/library/cipher_invasive.h +1 -0
  1291. package/src/duckdb/third_party/mbedtls/library/cipher_wrap.cpp +110 -10
  1292. package/src/duckdb/third_party/mbedtls/library/cipher_wrap.h +1 -1
  1293. package/src/duckdb/third_party/mbedtls/library/common.h +20 -4
  1294. package/src/duckdb/third_party/mbedtls/library/constant_time.cpp +1 -1
  1295. package/src/duckdb/third_party/mbedtls/library/constant_time_impl.h +28 -43
  1296. package/src/duckdb/third_party/mbedtls/library/constant_time_internal.h +24 -24
  1297. package/src/duckdb/third_party/mbedtls/library/ctr.h +35 -1
  1298. package/src/duckdb/third_party/mbedtls/library/gcm.cpp +2 -2
  1299. package/src/duckdb/third_party/mbedtls/library/md.cpp +11 -11
  1300. package/src/duckdb/third_party/mbedtls/library/md_psa.h +1 -1
  1301. package/src/duckdb/third_party/mbedtls/library/oid.cpp +2 -2
  1302. package/src/duckdb/third_party/mbedtls/library/pem.cpp +5 -2
  1303. package/src/duckdb/third_party/mbedtls/library/pk.cpp +1 -5
  1304. package/src/duckdb/third_party/mbedtls/library/pk_internal.h +4 -4
  1305. package/src/duckdb/third_party/mbedtls/library/pk_wrap.cpp +16 -18
  1306. package/src/duckdb/third_party/mbedtls/library/pkwrite.h +121 -1
  1307. package/src/duckdb/third_party/mbedtls/library/psa_crypto_core.h +995 -1
  1308. package/src/duckdb/third_party/mbedtls/library/psa_util_internal.h +100 -1
  1309. package/src/duckdb/third_party/mbedtls/library/rsa.cpp +4 -4
  1310. package/src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp +114 -42
  1311. package/src/duckdb/third_party/parquet/parquet_types.cpp +2340 -769
  1312. package/src/duckdb/third_party/parquet/parquet_types.h +400 -4
  1313. package/src/duckdb/third_party/pdqsort/pdqsort.h +550 -0
  1314. package/src/duckdb/third_party/ska_sort/ska_sort.hpp +1494 -0
  1315. package/src/duckdb/third_party/snappy/snappy-stubs-internal.h +18 -18
  1316. package/src/duckdb/third_party/snappy/snappy.cc +6 -6
  1317. package/src/duckdb/third_party/thrift/thrift/protocol/TCompactProtocol.h +4 -4
  1318. package/src/duckdb/third_party/thrift/thrift/protocol/TCompactProtocol.tcc +36 -36
  1319. package/src/duckdb/third_party/utf8proc/include/utf8proc_wrapper.hpp +1 -1
  1320. package/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp +1 -1
  1321. package/src/duckdb/third_party/vergesort/detail/insertion_sort.h +56 -0
  1322. package/src/duckdb/third_party/vergesort/detail/is_sorted_until.h +51 -0
  1323. package/src/duckdb/third_party/vergesort/detail/iter_sort3.h +48 -0
  1324. package/src/duckdb/third_party/vergesort/detail/log2.h +41 -0
  1325. package/src/duckdb/third_party/vergesort/detail/prevnext.h +68 -0
  1326. package/src/duckdb/third_party/vergesort/detail/quicksort.h +138 -0
  1327. package/src/duckdb/third_party/vergesort/vergesort.h +352 -0
  1328. package/src/duckdb/ub_extension_core_functions_scalar_generic.cpp +2 -0
  1329. package/src/duckdb/ub_extension_core_functions_scalar_struct.cpp +2 -0
  1330. package/src/duckdb/ub_extension_parquet_reader.cpp +2 -0
  1331. package/src/duckdb/ub_extension_parquet_reader_variant.cpp +6 -0
  1332. package/src/duckdb/ub_src_common.cpp +8 -0
  1333. package/src/duckdb/ub_src_common_arrow_appender.cpp +2 -0
  1334. package/src/duckdb/ub_src_common_progress_bar.cpp +2 -0
  1335. package/src/duckdb/ub_src_common_sorting.cpp +8 -0
  1336. package/src/duckdb/ub_src_common_tree_renderer.cpp +2 -0
  1337. package/src/duckdb/ub_src_common_types.cpp +1 -1
  1338. package/src/duckdb/ub_src_common_types_row.cpp +2 -0
  1339. package/src/duckdb/ub_src_execution_index_art.cpp +11 -9
  1340. package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
  1341. package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
  1342. package/src/duckdb/ub_src_function.cpp +2 -0
  1343. package/src/duckdb/ub_src_function_cast.cpp +1 -1
  1344. package/src/duckdb/ub_src_function_cast_variant.cpp +6 -0
  1345. package/src/duckdb/ub_src_function_scalar_struct.cpp +2 -0
  1346. package/src/duckdb/ub_src_function_scalar_variant.cpp +6 -0
  1347. package/src/duckdb/ub_src_function_table.cpp +2 -0
  1348. package/src/duckdb/ub_src_function_table_system.cpp +4 -0
  1349. package/src/duckdb/ub_src_main.cpp +4 -0
  1350. package/src/duckdb/ub_src_main_capi.cpp +4 -0
  1351. package/src/duckdb/ub_src_optimizer.cpp +2 -0
  1352. package/src/duckdb/ub_src_optimizer_pushdown.cpp +2 -0
  1353. package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
  1354. package/src/duckdb/ub_src_parser_statement.cpp +2 -0
  1355. package/src/duckdb/ub_src_parser_tableref.cpp +2 -0
  1356. package/src/duckdb/ub_src_parser_transform_statement.cpp +2 -0
  1357. package/src/duckdb/ub_src_planner.cpp +2 -0
  1358. package/src/duckdb/ub_src_planner_binder_statement.cpp +2 -0
  1359. package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
  1360. package/src/duckdb/ub_src_planner_expression_binder.cpp +2 -0
  1361. package/src/duckdb/ub_src_planner_operator.cpp +2 -0
  1362. package/src/duckdb/ub_src_storage_table.cpp +4 -0
  1363. package/test/columns.test.ts +1 -1
  1364. package/test/exec.test.ts +3 -3
  1365. package/test/jsdoc.test.ts +2 -1
  1366. package/test/syntax_error.test.ts +1 -1
  1367. package/test/test_all_types.test.ts +1 -1
@@ -35,11 +35,7 @@
35
35
  #ifdef DUCKDB_STATIC_BUILD
36
36
  #define DUCKDB_EXTENSION_API
37
37
  #else
38
- #ifdef DUCKDB_BUILD_LOADABLE_EXTENSION
39
38
  #define DUCKDB_EXTENSION_API __declspec(dllexport)
40
- #else
41
- #define DUCKDB_EXTENSION_API
42
- #endif
43
39
  #endif
44
40
  #else
45
41
  #define DUCKDB_EXTENSION_API __attribute__((visibility("default")))
@@ -57,8 +53,10 @@ extern "C" {
57
53
  //===--------------------------------------------------------------------===//
58
54
  // Enums
59
55
  //===--------------------------------------------------------------------===//
60
- // WARNING: the numbers of these enums should not be changed, as changing the numbers breaks ABI compatibility
61
- // Always add enums at the END of the enum
56
+
57
+ //! WARNING: The numbers of these enums should not be changed, as changing the numbers breaks ABI compatibility.
58
+ //! Always add enums at the END of the enum
59
+
62
60
  //! An enum over DuckDB's internal types.
63
61
  typedef enum DUCKDB_TYPE {
64
62
  DUCKDB_TYPE_INVALID = 0,
@@ -128,19 +126,23 @@ typedef enum DUCKDB_TYPE {
128
126
  DUCKDB_TYPE_TIME_TZ = 30,
129
127
  // duckdb_timestamp (microseconds)
130
128
  DUCKDB_TYPE_TIMESTAMP_TZ = 31,
131
- // ANY type
129
+ // enum type, only useful as logical type
132
130
  DUCKDB_TYPE_ANY = 34,
133
- // duckdb_varint
134
- DUCKDB_TYPE_VARINT = 35,
135
- // SQLNULL type
131
+ // duckdb_bignum
132
+ DUCKDB_TYPE_BIGNUM = 35,
133
+ // enum type, only useful as logical type
136
134
  DUCKDB_TYPE_SQLNULL = 36,
137
- // STRING_LITERAL type
135
+ // enum type, only useful as logical type
138
136
  DUCKDB_TYPE_STRING_LITERAL = 37,
139
- // INTEGER_LITERAL type
137
+ // enum type, only useful as logical type
140
138
  DUCKDB_TYPE_INTEGER_LITERAL = 38,
139
+ // duckdb_time_ns (nanoseconds)
140
+ DUCKDB_TYPE_TIME_NS = 39,
141
141
  } duckdb_type;
142
+
142
143
  //! An enum over the returned state of different functions.
143
144
  typedef enum duckdb_state { DuckDBSuccess = 0, DuckDBError = 1 } duckdb_state;
145
+
144
146
  //! An enum over the pending state of a pending query result.
145
147
  typedef enum duckdb_pending_state {
146
148
  DUCKDB_PENDING_RESULT_READY = 0,
@@ -148,6 +150,7 @@ typedef enum duckdb_pending_state {
148
150
  DUCKDB_PENDING_ERROR = 2,
149
151
  DUCKDB_PENDING_NO_TASKS_AVAILABLE = 3
150
152
  } duckdb_pending_state;
153
+
151
154
  //! An enum over DuckDB's different result types.
152
155
  typedef enum duckdb_result_type {
153
156
  DUCKDB_RESULT_TYPE_INVALID = 0,
@@ -155,6 +158,7 @@ typedef enum duckdb_result_type {
155
158
  DUCKDB_RESULT_TYPE_NOTHING = 2,
156
159
  DUCKDB_RESULT_TYPE_QUERY_RESULT = 3,
157
160
  } duckdb_result_type;
161
+
158
162
  //! An enum over DuckDB's different statement types.
159
163
  typedef enum duckdb_statement_type {
160
164
  DUCKDB_STATEMENT_TYPE_INVALID = 0,
@@ -186,6 +190,7 @@ typedef enum duckdb_statement_type {
186
190
  DUCKDB_STATEMENT_TYPE_DETACH = 26,
187
191
  DUCKDB_STATEMENT_TYPE_MULTI = 27,
188
192
  } duckdb_statement_type;
193
+
189
194
  //! An enum over DuckDB's different error types.
190
195
  typedef enum duckdb_error_type {
191
196
  DUCKDB_ERROR_INVALID = 0,
@@ -232,6 +237,7 @@ typedef enum duckdb_error_type {
232
237
  DUCKDB_ERROR_SEQUENCE = 41,
233
238
  DUCKDB_INVALID_CONFIGURATION = 42
234
239
  } duckdb_error_type;
240
+
235
241
  //! An enum over DuckDB's different cast modes.
236
242
  typedef enum duckdb_cast_mode { DUCKDB_CAST_NORMAL = 0, DUCKDB_CAST_TRY = 1 } duckdb_cast_mode;
237
243
 
@@ -242,36 +248,42 @@ typedef enum duckdb_cast_mode { DUCKDB_CAST_NORMAL = 0, DUCKDB_CAST_TRY = 1 } du
242
248
  //! DuckDB's index type.
243
249
  typedef uint64_t idx_t;
244
250
 
245
- //! Type used for the selection vector
251
+ //! Type definition for the data pointers of selection vectors.
246
252
  typedef uint32_t sel_t;
247
253
 
248
- //! The callback that will be called to destroy data, e.g.,
249
- //! bind data (if any), init data (if any), extra data for replacement scans (if any)
254
+ //! The callback to destroy data, e.g.,
255
+ //! bind data (if any), init data (if any), extra data for replacement scans (if any), etc.
250
256
  typedef void (*duckdb_delete_callback_t)(void *data);
251
257
 
252
- //! Used for threading, contains a task state. Must be destroyed with `duckdb_destroy_task_state`.
258
+ //! The callback to copy data, e.g., bind data (if any).
259
+ typedef void *(*duckdb_copy_callback_t)(void *data);
260
+
261
+ //! Used for threading, contains a task state.
262
+ //! Must be destroyed with `duckdb_destroy_task_state`.
253
263
  typedef void *duckdb_task_state;
254
264
 
255
265
  //===--------------------------------------------------------------------===//
256
266
  // Types (no explicit freeing)
257
267
  //===--------------------------------------------------------------------===//
258
268
 
259
- //! Days are stored as days since 1970-01-01
260
- //! Use the duckdb_from_date/duckdb_to_date function to extract individual information
269
+ //! DATE is stored as days since 1970-01-01.
270
+ //! Use the `duckdb_from_date` and `duckdb_to_date` functions to extract individual information.
261
271
  typedef struct {
262
272
  int32_t days;
263
273
  } duckdb_date;
274
+
264
275
  typedef struct {
265
276
  int32_t year;
266
277
  int8_t month;
267
278
  int8_t day;
268
279
  } duckdb_date_struct;
269
280
 
270
- //! Time is stored as microseconds since 00:00:00
271
- //! Use the duckdb_from_time/duckdb_to_time function to extract individual information
281
+ //! TIME is stored as microseconds since 00:00:00.
282
+ //! Use the `duckdb_from_time` and `duckdb_to_time` functions to extract individual information.
272
283
  typedef struct {
273
284
  int64_t micros;
274
285
  } duckdb_time;
286
+
275
287
  typedef struct {
276
288
  int8_t hour;
277
289
  int8_t min;
@@ -279,67 +291,80 @@ typedef struct {
279
291
  int32_t micros;
280
292
  } duckdb_time_struct;
281
293
 
282
- //! TIME_TZ is stored as 40 bits for int64_t micros, and 24 bits for int32_t offset
294
+ //! TIME_NS is stored as nanoseconds since 00:00:00.
295
+ typedef struct {
296
+ int64_t nanos;
297
+ } duckdb_time_ns;
298
+
299
+ //! TIME_TZ is stored as 40 bits for the int64_t microseconds, and 24 bits for the int32_t offset.
300
+ //! Use the `duckdb_from_time_tz` function to extract individual information.
283
301
  typedef struct {
284
302
  uint64_t bits;
285
303
  } duckdb_time_tz;
304
+
286
305
  typedef struct {
287
306
  duckdb_time_struct time;
288
307
  int32_t offset;
289
308
  } duckdb_time_tz_struct;
290
309
 
291
- //! TIMESTAMP values are stored as microseconds since 1970-01-01.
292
- //! Use the duckdb_from_timestamp and duckdb_to_timestamp functions to extract individual information.
310
+ //! TIMESTAMP is stored as microseconds since 1970-01-01.
311
+ //! Use the `duckdb_from_timestamp` and `duckdb_to_timestamp` functions to extract individual information.
293
312
  typedef struct {
294
313
  int64_t micros;
295
314
  } duckdb_timestamp;
296
315
 
297
- //! TIMESTAMP_S values are stored as seconds since 1970-01-01.
316
+ typedef struct {
317
+ duckdb_date_struct date;
318
+ duckdb_time_struct time;
319
+ } duckdb_timestamp_struct;
320
+
321
+ //! TIMESTAMP_S is stored as seconds since 1970-01-01.
298
322
  typedef struct {
299
323
  int64_t seconds;
300
324
  } duckdb_timestamp_s;
301
325
 
302
- //! TIMESTAMP_MS values are stored as milliseconds since 1970-01-01.
326
+ //! TIMESTAMP_MS is stored as milliseconds since 1970-01-01.
303
327
  typedef struct {
304
328
  int64_t millis;
305
329
  } duckdb_timestamp_ms;
306
330
 
307
- //! TIMESTAMP_NS values are stored as nanoseconds since 1970-01-01.
331
+ //! TIMESTAMP_NS is stored as nanoseconds since 1970-01-01.
308
332
  typedef struct {
309
333
  int64_t nanos;
310
334
  } duckdb_timestamp_ns;
311
335
 
312
- typedef struct {
313
- duckdb_date_struct date;
314
- duckdb_time_struct time;
315
- } duckdb_timestamp_struct;
316
-
336
+ //! INTERVAL is stored in months, days, and micros.
317
337
  typedef struct {
318
338
  int32_t months;
319
339
  int32_t days;
320
340
  int64_t micros;
321
341
  } duckdb_interval;
322
342
 
323
- //! Hugeints are composed of a (lower, upper) component
324
- //! The value of the hugeint is upper * 2^64 + lower
325
- //! For easy usage, the functions duckdb_hugeint_to_double/duckdb_double_to_hugeint are recommended
343
+ //! HUGEINT is composed of a lower and upper component.
344
+ //! Its value is upper * 2^64 + lower.
345
+ //! For simplified usage, use `duckdb_hugeint_to_double` and `duckdb_double_to_hugeint`.
326
346
  typedef struct {
327
347
  uint64_t lower;
328
348
  int64_t upper;
329
349
  } duckdb_hugeint;
350
+
351
+ //! UHUGEINT is composed of a lower and upper component.
352
+ //! Its value is upper * 2^64 + lower.
353
+ //! For simplified usage, use `duckdb_uhugeint_to_double` and `duckdb_double_to_uhugeint`.
330
354
  typedef struct {
331
355
  uint64_t lower;
332
356
  uint64_t upper;
333
357
  } duckdb_uhugeint;
334
358
 
335
- //! Decimals are composed of a width and a scale, and are stored in a hugeint
359
+ //! DECIMAL is composed of a width and a scale.
360
+ //! Their value is stored in a HUGEINT.
336
361
  typedef struct {
337
362
  uint8_t width;
338
363
  uint8_t scale;
339
364
  duckdb_hugeint value;
340
365
  } duckdb_decimal;
341
366
 
342
- //! A type holding information about the query execution progress
367
+ //! A type holding information about the query execution progress.
343
368
  typedef struct {
344
369
  double percentage;
345
370
  uint64_t rows_processed;
@@ -347,7 +372,7 @@ typedef struct {
347
372
  } duckdb_query_progress_type;
348
373
 
349
374
  //! The internal representation of a VARCHAR (string_t). If the VARCHAR does not
350
- //! exceed 12 characters, then we inline it. Otherwise, we inline a prefix for faster
375
+ //! exceed 12 characters, then we inline it. Otherwise, we inline a four-byte prefix for faster
351
376
  //! string comparisons and store a pointer to the remaining characters. This is a non-
352
377
  //! owning structure, i.e., it does not have to be freed.
353
378
  typedef struct {
@@ -364,38 +389,39 @@ typedef struct {
364
389
  } value;
365
390
  } duckdb_string_t;
366
391
 
367
- //! The internal representation of a list metadata entry contains the list's offset in
368
- //! the child vector, and its length. The parent vector holds these metadata entries,
369
- //! whereas the child vector holds the data
392
+ //! DuckDB's LISTs are composed of a 'parent' vector holding metadata of each list,
393
+ //! and a child vector holding the entries of the lists.
394
+ //! The `duckdb_list_entry` struct contains the internal representation of a LIST metadata entry.
395
+ //! A metadata entry contains the length of the list, and its offset in the child vector.
370
396
  typedef struct {
371
397
  uint64_t offset;
372
398
  uint64_t length;
373
399
  } duckdb_list_entry;
374
400
 
375
401
  //! A column consists of a pointer to its internal data. Don't operate on this type directly.
376
- //! Instead, use functions such as duckdb_column_data, duckdb_nullmask_data,
377
- //! duckdb_column_type, and duckdb_column_name, which take the result and the column index
378
- //! as their parameters
402
+ //! Instead, use functions such as `duckdb_column_data`, `duckdb_nullmask_data`,
403
+ //! `duckdb_column_type`, and `duckdb_column_name`.
379
404
  typedef struct {
380
- // deprecated, use duckdb_column_data
405
+ // Deprecated, use `duckdb_column_data`.
381
406
  void *deprecated_data;
382
- // deprecated, use duckdb_nullmask_data
407
+ // Deprecated, use `duckdb_nullmask_data`.
383
408
  bool *deprecated_nullmask;
384
- // deprecated, use duckdb_column_type
409
+ // Deprecated, use `duckdb_column_type`.
385
410
  duckdb_type deprecated_type;
386
- // deprecated, use duckdb_column_name
411
+ // Deprecated, use `duckdb_column_name`.
387
412
  char *deprecated_name;
388
413
  void *internal_data;
389
414
  } duckdb_column;
390
415
 
391
- //! A vector to a specified column in a data chunk. Lives as long as the
392
- //! data chunk lives, i.e., must not be destroyed.
416
+ //! 1. A standalone vector that must be destroyed, or
417
+ //! 2. A vector to a column in a data chunk that lives as long as the data chunk lives.
393
418
  typedef struct _duckdb_vector {
394
419
  void *internal_ptr;
395
420
  } * duckdb_vector;
396
421
 
397
- //! A selection vector is a possibly duplicative vector of indices, which refer to values in a vector.
398
- //! The resulting vector is make up of the values at each index in the selection vector.
422
+ //! A selection vector is a vector of indices, which usually refer to values in a vector.
423
+ //! Can be used to slice vectors, changing their length and the order of their entries.
424
+ //! Standalone selection vectors must be destroyed.
399
425
  typedef struct _duckdb_selection_vector {
400
426
  void *internal_ptr;
401
427
  } * duckdb_selection_vector;
@@ -404,15 +430,15 @@ typedef struct _duckdb_selection_vector {
404
430
  // Types (explicit freeing/destroying)
405
431
  //===--------------------------------------------------------------------===//
406
432
 
407
- //! Strings are composed of a char pointer and a size. You must free string.data
408
- //! with `duckdb_free`.
433
+ //! Strings are composed of a `char` pointer and a size.
434
+ //! You must free `string.data` with `duckdb_free`.
409
435
  typedef struct {
410
436
  char *data;
411
437
  idx_t size;
412
438
  } duckdb_string;
413
439
 
414
- //! BLOBs are composed of a byte pointer and a size. You must free blob.data
415
- //! with `duckdb_free`.
440
+ //! BLOBs are composed of a byte pointer and a size.
441
+ //! You must free `blob.data` with `duckdb_free`.
416
442
  typedef struct {
417
443
  void *data;
418
444
  idx_t size;
@@ -421,34 +447,34 @@ typedef struct {
421
447
  //! BITs are composed of a byte pointer and a size.
422
448
  //! BIT byte data has 0 to 7 bits of padding.
423
449
  //! The first byte contains the number of padding bits.
424
- //! This number of bits of the second byte are set to 1, starting from the MSB.
450
+ //! The padding bits of the second byte are set to 1, starting from the MSB.
425
451
  //! You must free `data` with `duckdb_free`.
426
452
  typedef struct {
427
453
  uint8_t *data;
428
454
  idx_t size;
429
455
  } duckdb_bit;
430
456
 
431
- //! VARINTs are composed of a byte pointer, a size, and an is_negative bool.
457
+ //! BIGNUMs are composed of a byte pointer, a size, and an `is_negative` bool.
432
458
  //! The absolute value of the number is stored in `data` in little endian format.
433
459
  //! You must free `data` with `duckdb_free`.
434
460
  typedef struct {
435
461
  uint8_t *data;
436
462
  idx_t size;
437
463
  bool is_negative;
438
- } duckdb_varint;
464
+ } duckdb_bignum;
439
465
 
440
466
  //! A query result consists of a pointer to its internal data.
441
467
  //! Must be freed with 'duckdb_destroy_result'.
442
468
  typedef struct {
443
- // deprecated, use duckdb_column_count
469
+ // Deprecated, use `duckdb_column_count`.
444
470
  idx_t deprecated_column_count;
445
- // deprecated, use duckdb_row_count
471
+ // Deprecated, use `duckdb_row_count`.
446
472
  idx_t deprecated_row_count;
447
- // deprecated, use duckdb_rows_changed
473
+ // Deprecated, use `duckdb_rows_changed`.
448
474
  idx_t deprecated_rows_changed;
449
- // deprecated, use duckdb_column_*-family of functions
475
+ // Deprecated, use `duckdb_column_*`-family of functions.
450
476
  duckdb_column *deprecated_columns;
451
- // deprecated, use duckdb_result_error
477
+ // Deprecated, use `duckdb_result_error`.
452
478
  char *deprecated_error_message;
453
479
  void *internal_data;
454
480
  } duckdb_result;
@@ -496,52 +522,65 @@ typedef struct _duckdb_appender {
496
522
  void *internal_ptr;
497
523
  } * duckdb_appender;
498
524
 
499
- //! The table description allows querying info about the table.
525
+ //! The table description allows querying information about the table.
500
526
  //! Must be destroyed with `duckdb_table_description_destroy`.
501
527
  typedef struct _duckdb_table_description {
502
528
  void *internal_ptr;
503
529
  } * duckdb_table_description;
504
530
 
505
- //! Can be used to provide start-up options for the DuckDB instance.
531
+ //! The configuration can be used to provide start-up options for a database.
506
532
  //! Must be destroyed with `duckdb_destroy_config`.
507
533
  typedef struct _duckdb_config {
508
534
  void *internal_ptr;
509
535
  } * duckdb_config;
510
536
 
511
- //! Holds an internal logical type.
537
+ //! A logical type.
512
538
  //! Must be destroyed with `duckdb_destroy_logical_type`.
513
539
  typedef struct _duckdb_logical_type {
514
540
  void *internal_ptr;
515
541
  } * duckdb_logical_type;
516
542
 
517
- //! Holds extra information used when registering a custom logical type.
543
+ //! Holds extra information to register a custom logical type.
518
544
  //! Reserved for future use.
519
545
  typedef struct _duckdb_create_type_info {
520
546
  void *internal_ptr;
521
547
  } * duckdb_create_type_info;
522
548
 
523
- //! Contains a data chunk from a duckdb_result.
549
+ //! Contains a data chunk of a duckdb_result.
524
550
  //! Must be destroyed with `duckdb_destroy_data_chunk`.
525
551
  typedef struct _duckdb_data_chunk {
526
552
  void *internal_ptr;
527
553
  } * duckdb_data_chunk;
528
554
 
529
- //! Holds a DuckDB value, which wraps a type.
555
+ //! A value of a logical type.
530
556
  //! Must be destroyed with `duckdb_destroy_value`.
531
557
  typedef struct _duckdb_value {
532
558
  void *internal_ptr;
533
559
  } * duckdb_value;
534
560
 
535
- //! Holds a recursive tree that matches the query plan.
561
+ //! Holds a recursive tree containing profiling metrics.
562
+ //! The tree matches the query plan, and has a top-level node.
536
563
  typedef struct _duckdb_profiling_info {
537
564
  void *internal_ptr;
538
565
  } * duckdb_profiling_info;
539
566
 
567
+ //! Holds error data.
568
+ //! Must be destroyed with `duckdb_destroy_error_data`.
569
+ typedef struct _duckdb_error_data {
570
+ void *internal_ptr;
571
+ } * duckdb_error_data;
572
+
573
+ //! Holds a bound expression.
574
+ //! Must be destroyed with `duckdb_destroy_expression`.
575
+ typedef struct _duckdb_expression {
576
+ void *internal_ptr;
577
+ } * duckdb_expression;
578
+
540
579
  //===--------------------------------------------------------------------===//
541
- // C API Extension info
580
+ // C API extension information
542
581
  //===--------------------------------------------------------------------===//
543
582
 
544
- //! Holds state during the C API extension intialization process
583
+ //! Holds the state of the C API extension initialization process.
545
584
  typedef struct _duckdb_extension_info {
546
585
  void *internal_ptr;
547
586
  } * duckdb_extension_info;
@@ -576,15 +615,16 @@ typedef struct _duckdb_scalar_function_set {
576
615
  void *internal_ptr;
577
616
  } * duckdb_scalar_function_set;
578
617
 
579
- //! The bind function of the scalar function.
618
+ //! The bind function callback of the scalar function.
580
619
  typedef void (*duckdb_scalar_function_bind_t)(duckdb_bind_info info);
581
620
 
582
- //! The main function of the scalar function.
621
+ //! The function to execute the scalar function on an input chunk.
583
622
  typedef void (*duckdb_scalar_function_t)(duckdb_function_info info, duckdb_data_chunk input, duckdb_vector output);
584
623
 
585
624
  //===--------------------------------------------------------------------===//
586
625
  // Aggregate function types
587
626
  //===--------------------------------------------------------------------===//
627
+
588
628
  //! An aggregate function. Must be destroyed with `duckdb_destroy_aggregate_function`.
589
629
  typedef struct _duckdb_aggregate_function {
590
630
  void *internal_ptr;
@@ -595,24 +635,29 @@ typedef struct _duckdb_aggregate_function_set {
595
635
  void *internal_ptr;
596
636
  } * duckdb_aggregate_function_set;
597
637
 
598
- //! Aggregate state
638
+ //! The state of an aggregate function.
599
639
  typedef struct _duckdb_aggregate_state {
600
640
  void *internal_ptr;
601
641
  } * duckdb_aggregate_state;
602
642
 
603
- //! Returns the aggregate state size
643
+ //! A function to return the aggregate state's size.
604
644
  typedef idx_t (*duckdb_aggregate_state_size)(duckdb_function_info info);
605
- //! Initialize the aggregate state
645
+
646
+ //! A function to initialize an aggregate state.
606
647
  typedef void (*duckdb_aggregate_init_t)(duckdb_function_info info, duckdb_aggregate_state state);
607
- //! Destroy aggregate state (optional)
648
+
649
+ //! An optional function to destroy an aggregate state.
608
650
  typedef void (*duckdb_aggregate_destroy_t)(duckdb_aggregate_state *states, idx_t count);
609
- //! Update a set of aggregate states with new values
651
+
652
+ //! A function to update a set of aggregate states with new values.
610
653
  typedef void (*duckdb_aggregate_update_t)(duckdb_function_info info, duckdb_data_chunk input,
611
654
  duckdb_aggregate_state *states);
612
- //! Combine aggregate states
655
+
656
+ //! A function to combine aggregate states.
613
657
  typedef void (*duckdb_aggregate_combine_t)(duckdb_function_info info, duckdb_aggregate_state *source,
614
658
  duckdb_aggregate_state *target, idx_t count);
615
- //! Finalize aggregate states into a result vector
659
+
660
+ //! A function to finalize aggregate states into a result vector.
616
661
  typedef void (*duckdb_aggregate_finalize_t)(duckdb_function_info info, duckdb_aggregate_state *source,
617
662
  duckdb_vector result, idx_t count, idx_t offset);
618
663
 
@@ -625,7 +670,8 @@ typedef struct _duckdb_table_function {
625
670
  void *internal_ptr;
626
671
  } * duckdb_table_function;
627
672
 
628
- //! Additional function init info. When setting this info, it is necessary to pass a destroy-callback function.
673
+ //! Additional function initialization info.
674
+ //! When setting this info, it is necessary to pass a destroy-callback function.
629
675
  typedef struct _duckdb_init_info {
630
676
  void *internal_ptr;
631
677
  } * duckdb_init_info;
@@ -633,10 +679,10 @@ typedef struct _duckdb_init_info {
633
679
  //! The bind function of the table function.
634
680
  typedef void (*duckdb_table_function_bind_t)(duckdb_bind_info info);
635
681
 
636
- //! The (possibly thread-local) init function of the table function.
682
+ //! The possibly thread-local initialization function of the table function.
637
683
  typedef void (*duckdb_table_function_init_t)(duckdb_init_info info);
638
684
 
639
- //! The main function of the table function.
685
+ //! The function to generate an output chunk during table function execution.
640
686
  typedef void (*duckdb_table_function_t)(duckdb_function_info info, duckdb_data_chunk output);
641
687
 
642
688
  //===--------------------------------------------------------------------===//
@@ -648,6 +694,7 @@ typedef struct _duckdb_cast_function {
648
694
  void *internal_ptr;
649
695
  } * duckdb_cast_function;
650
696
 
697
+ //! The function to cast from an input vector to an output vector.
651
698
  typedef bool (*duckdb_cast_function_t)(duckdb_function_info info, idx_t count, duckdb_vector input,
652
699
  duckdb_vector output);
653
700
 
@@ -660,13 +707,21 @@ typedef struct _duckdb_replacement_scan_info {
660
707
  void *internal_ptr;
661
708
  } * duckdb_replacement_scan_info;
662
709
 
663
- //! A replacement scan function that can be added to a database.
710
+ //! A replacement scan function.
664
711
  typedef void (*duckdb_replacement_callback_t)(duckdb_replacement_scan_info info, const char *table_name, void *data);
665
712
 
666
713
  //===--------------------------------------------------------------------===//
667
714
  // Arrow-related types
668
715
  //===--------------------------------------------------------------------===//
669
716
 
717
+ //! Forward declare Arrow structs
718
+ //! It is important to notice that these structs are not defined by DuckDB but are actually Arrow external objects.
719
+ //! They're defined by the C Data Interface Arrow spec: https://arrow.apache.org/docs/format/CDataInterface.html
720
+
721
+ struct ArrowArray;
722
+
723
+ struct ArrowSchema;
724
+
670
725
  //! Holds an arrow query result. Must be destroyed with `duckdb_destroy_arrow`.
671
726
  typedef struct _duckdb_arrow {
672
727
  void *internal_ptr;
@@ -682,21 +737,36 @@ typedef struct _duckdb_arrow_schema {
682
737
  void *internal_ptr;
683
738
  } * duckdb_arrow_schema;
684
739
 
685
- //! Holds an arrow array. Remember to release the respective ArrowArray object.
740
+ //! Holds an arrow converted schema (i.e., duckdb::ArrowTableSchema).
741
+ //! In practice, this object holds the information necessary to do proper conversion between Arrow Types and DuckDB
742
+ //! Types. Check duckdb/function/table/arrow/arrow_duck_schema.hpp for more details! Must be destroyed with
743
+ //! `duckdb_destroy_arrow_converted_schema`
744
+ typedef struct _duckdb_arrow_converted_schema {
745
+ void *internal_ptr;
746
+ } * duckdb_arrow_converted_schema;
747
+
748
+ //! Holds an arrow array. Remember to release the respective ArrowSchema object.
686
749
  typedef struct _duckdb_arrow_array {
687
750
  void *internal_ptr;
688
751
  } * duckdb_arrow_array;
689
752
 
753
+ //! The arrow options used when transforming the DuckDB schema and datachunks into Arrow schema and arrays.
754
+ //! Used in `duckdb_to_arrow_schema` and `duckdb_data_chunk_to_arrow`
755
+ typedef struct _duckdb_arrow_options {
756
+ void *internal_ptr;
757
+ } * duckdb_arrow_options;
758
+
690
759
  //===--------------------------------------------------------------------===//
691
760
  // DuckDB extension access
692
761
  //===--------------------------------------------------------------------===//
693
- //! Passed to C API extension as parameter to the entrypoint
762
+
763
+ //! Passed to C API extension as a parameter to the entrypoint.
694
764
  struct duckdb_extension_access {
695
- //! Indicate that an error has occurred
765
+ //! Indicate that an error has occurred.
696
766
  void (*set_error)(duckdb_extension_info info, const char *error);
697
- //! Fetch the database from duckdb to register extensions to
767
+ //! Fetch the database on which to register the extension.
698
768
  duckdb_database *(*get_database)(duckdb_extension_info info);
699
- //! Fetch the API
769
+ //! Fetch the API struct pointer.
700
770
  const void *(*get_api)(duckdb_extension_info info, const char *version);
701
771
  };
702
772
 
@@ -819,6 +889,14 @@ Retrieves the client context of the connection.
819
889
  DUCKDB_C_API void duckdb_connection_get_client_context(duckdb_connection connection,
820
890
  duckdb_client_context *out_context);
821
891
 
892
+ /*!
893
+ Retrieves the arrow options of the connection.
894
+
895
+ * @param connection The connection.
896
+ */
897
+ DUCKDB_C_API void duckdb_connection_get_arrow_options(duckdb_connection connection,
898
+ duckdb_arrow_options *out_arrow_options);
899
+
822
900
  /*!
823
901
  Returns the connection id of the client context.
824
902
 
@@ -834,6 +912,13 @@ Destroys the client context and deallocates its memory.
834
912
  */
835
913
  DUCKDB_C_API void duckdb_destroy_client_context(duckdb_client_context *context);
836
914
 
915
+ /*!
916
+ Destroys the arrow options and deallocates its memory.
917
+
918
+ * @param arrow_options The arrow options to destroy.
919
+ */
920
+ DUCKDB_C_API void duckdb_destroy_arrow_options(duckdb_arrow_options *arrow_options);
921
+
837
922
  /*!
838
923
  Returns the version of the linked DuckDB, with a version postfix for dev versions
839
924
 
@@ -916,6 +1001,54 @@ Destroys the specified configuration object and de-allocates all memory allocate
916
1001
  */
917
1002
  DUCKDB_C_API void duckdb_destroy_config(duckdb_config *config);
918
1003
 
1004
+ //===--------------------------------------------------------------------===//
1005
+ // Error Data
1006
+ //===--------------------------------------------------------------------===//
1007
+
1008
+ // Functions that can throw DuckDB errors must return duckdb_error_data.
1009
+ // Please use this interface for all new functions, as it deprecates all previous error handling approaches.
1010
+
1011
+ /*!
1012
+ Creates duckdb_error_data.
1013
+ Must be destroyed with `duckdb_destroy_error_data`.
1014
+
1015
+ * @param type The error type.
1016
+ * @param message The error message.
1017
+ * @return The error data.
1018
+ */
1019
+ DUCKDB_C_API duckdb_error_data duckdb_create_error_data(duckdb_error_type type, const char *message);
1020
+
1021
+ /*!
1022
+ Destroys the error data and deallocates its memory.
1023
+
1024
+ * @param error_data The error data to destroy.
1025
+ */
1026
+ DUCKDB_C_API void duckdb_destroy_error_data(duckdb_error_data *error_data);
1027
+
1028
+ /*!
1029
+ Returns the duckdb_error_type of the error data.
1030
+
1031
+ * @param error_data The error data.
1032
+ * @return The error type.
1033
+ */
1034
+ DUCKDB_C_API duckdb_error_type duckdb_error_data_error_type(duckdb_error_data error_data);
1035
+
1036
+ /*!
1037
+ Returns the error message of the error data. Must not be freed.
1038
+
1039
+ * @param error_data The error data.
1040
+ * @return The error message.
1041
+ */
1042
+ DUCKDB_C_API const char *duckdb_error_data_message(duckdb_error_data error_data);
1043
+
1044
+ /*!
1045
+ Returns whether the error data contains an error or not.
1046
+
1047
+ * @param error_data The error data.
1048
+ * @return True, if the error data contains an exception, else false.
1049
+ */
1050
+ DUCKDB_C_API bool duckdb_error_data_has_error(duckdb_error_data error_data);
1051
+
919
1052
  //===--------------------------------------------------------------------===//
920
1053
  // Query Execution
921
1054
  //===--------------------------------------------------------------------===//
@@ -986,6 +1119,15 @@ Returns `NULL` if the column is out of range.
986
1119
  */
987
1120
  DUCKDB_C_API duckdb_logical_type duckdb_column_logical_type(duckdb_result *result, idx_t col);
988
1121
 
1122
+ /*!
1123
+ Returns the arrow options associated with the given result. These options are definitions of how the arrow arrays/schema
1124
+ should be produced.
1125
+ * @param result The result object to fetch arrow options from.
1126
+ * @return The arrow options associated with the given result. This must be destroyed with
1127
+ `duckdb_destroy_arrow_options`.
1128
+ */
1129
+ DUCKDB_C_API duckdb_arrow_options duckdb_result_get_arrow_options(duckdb_result *result);
1130
+
989
1131
  /*!
990
1132
  Returns the number of columns present in a the result object.
991
1133
 
@@ -1006,6 +1148,7 @@ Returns the number of rows present in the result object.
1006
1148
  DUCKDB_C_API idx_t duckdb_row_count(duckdb_result *result);
1007
1149
 
1008
1150
  #endif
1151
+
1009
1152
  /*!
1010
1153
  Returns the number of rows changed by the query stored in the result. This is relevant only for INSERT/UPDATE/DELETE
1011
1154
  queries. For other queries the rows_changed will be 0.
@@ -1061,6 +1204,7 @@ if (nullmask[row]) {
1061
1204
  DUCKDB_C_API bool *duckdb_nullmask_data(duckdb_result *result, idx_t col);
1062
1205
 
1063
1206
  #endif
1207
+
1064
1208
  /*!
1065
1209
  Returns the error message contained within the result. The error is only set if `duckdb_query` returns `DuckDBError`.
1066
1210
 
@@ -1127,6 +1271,7 @@ Returns the number of data chunks present in the result.
1127
1271
  DUCKDB_C_API idx_t duckdb_result_chunk_count(duckdb_result result);
1128
1272
 
1129
1273
  #endif
1274
+
1130
1275
  /*!
1131
1276
  Returns the return_type of the given result, or DUCKDB_RETURN_TYPE_INVALID on error
1132
1277
 
@@ -1326,6 +1471,7 @@ DUCKDB_C_API duckdb_blob duckdb_value_blob(duckdb_result *result, idx_t col, idx
1326
1471
  DUCKDB_C_API bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row);
1327
1472
 
1328
1473
  #endif
1474
+
1329
1475
  //===--------------------------------------------------------------------===//
1330
1476
  // Helpers
1331
1477
  //===--------------------------------------------------------------------===//
@@ -1658,6 +1804,53 @@ Returns the statement type of the statement to be executed
1658
1804
  */
1659
1805
  DUCKDB_C_API duckdb_statement_type duckdb_prepared_statement_type(duckdb_prepared_statement statement);
1660
1806
 
1807
+ /*!
1808
+ Returns the number of columns present in a the result of the prepared statement. If any of the column types are invalid,
1809
+ the result will be 1.
1810
+
1811
+ * @param prepared_statement The prepared statement.
1812
+ * @return The number of columns present in the result of the prepared statement.
1813
+ */
1814
+ DUCKDB_C_API idx_t duckdb_prepared_statement_column_count(duckdb_prepared_statement prepared_statement);
1815
+
1816
+ /*!
1817
+ Returns the name of the specified column of the result of the prepared_statement.
1818
+ The returned string should be freed using `duckdb_free`.
1819
+
1820
+ Returns `nullptr` if the column is out of range.
1821
+
1822
+ * @param prepared_statement The prepared statement.
1823
+ * @param col_idx The column index.
1824
+ * @return The column name of the specified column.
1825
+ */
1826
+ DUCKDB_C_API const char *duckdb_prepared_statement_column_name(duckdb_prepared_statement prepared_statement,
1827
+ idx_t col_idx);
1828
+
1829
+ /*!
1830
+ Returns the column type of the specified column of the result of the prepared_statement.
1831
+
1832
+ Returns `DUCKDB_TYPE_INVALID` if the column is out of range.
1833
+ The return type of this call should be destroyed with `duckdb_destroy_logical_type`.
1834
+
1835
+ * @param prepared_statement The prepared statement to fetch the column type from.
1836
+ * @param col_idx The column index.
1837
+ * @return The logical type of the specified column.
1838
+ */
1839
+ DUCKDB_C_API duckdb_logical_type
1840
+ duckdb_prepared_statement_column_logical_type(duckdb_prepared_statement prepared_statement, idx_t col_idx);
1841
+
1842
+ /*!
1843
+ Returns the column type of the specified column of the result of the prepared_statement.
1844
+
1845
+ Returns `DUCKDB_TYPE_INVALID` if the column is out of range.
1846
+
1847
+ * @param prepared_statement The prepared statement to fetch the column type from.
1848
+ * @param col_idx The column index.
1849
+ * @return The type of the specified column.
1850
+ */
1851
+ DUCKDB_C_API duckdb_type duckdb_prepared_statement_column_type(duckdb_prepared_statement prepared_statement,
1852
+ idx_t col_idx);
1853
+
1661
1854
  //===--------------------------------------------------------------------===//
1662
1855
  // Bind Values to Prepared Statements
1663
1856
  //===--------------------------------------------------------------------===//
@@ -1842,6 +2035,7 @@ DUCKDB_C_API duckdb_state duckdb_execute_prepared_streaming(duckdb_prepared_stat
1842
2035
  duckdb_result *out_result);
1843
2036
 
1844
2037
  #endif
2038
+
1845
2039
  //===--------------------------------------------------------------------===//
1846
2040
  // Extract Statements
1847
2041
  //===--------------------------------------------------------------------===//
@@ -1933,6 +2127,7 @@ DUCKDB_C_API duckdb_state duckdb_pending_prepared_streaming(duckdb_prepared_stat
1933
2127
  duckdb_pending_result *out_result);
1934
2128
 
1935
2129
  #endif
2130
+
1936
2131
  /*!
1937
2132
  Closes the pending result and de-allocates all memory allocated for the result.
1938
2133
 
@@ -2115,12 +2310,12 @@ Creates a value from a uhugeint
2115
2310
  DUCKDB_C_API duckdb_value duckdb_create_uhugeint(duckdb_uhugeint input);
2116
2311
 
2117
2312
  /*!
2118
- Creates a VARINT value from a duckdb_varint
2313
+ Creates a BIGNUM value from a duckdb_bignum
2119
2314
 
2120
- * @param input The duckdb_varint value
2315
+ * @param input The duckdb_bignum value
2121
2316
  * @return The value. This must be destroyed with `duckdb_destroy_value`.
2122
2317
  */
2123
- DUCKDB_C_API duckdb_value duckdb_create_varint(duckdb_varint input);
2318
+ DUCKDB_C_API duckdb_value duckdb_create_bignum(duckdb_bignum input);
2124
2319
 
2125
2320
  /*!
2126
2321
  Creates a DECIMAL value from a duckdb_decimal
@@ -2162,6 +2357,14 @@ Creates a value from a time
2162
2357
  */
2163
2358
  DUCKDB_C_API duckdb_value duckdb_create_time(duckdb_time input);
2164
2359
 
2360
+ /*!
2361
+ Creates a value from a time_ns
2362
+
2363
+ * @param input The time value
2364
+ * @return The value. This must be destroyed with `duckdb_destroy_value`.
2365
+ */
2366
+ DUCKDB_C_API duckdb_value duckdb_create_time_ns(duckdb_time_ns input);
2367
+
2165
2368
  /*!
2166
2369
  Creates a value from a time_tz.
2167
2370
  Not to be confused with `duckdb_create_time_tz`, which creates a duckdb_time_tz_t.
@@ -2333,13 +2536,13 @@ Returns the uhugeint value of the given value.
2333
2536
  DUCKDB_C_API duckdb_uhugeint duckdb_get_uhugeint(duckdb_value val);
2334
2537
 
2335
2538
  /*!
2336
- Returns the duckdb_varint value of the given value.
2539
+ Returns the duckdb_bignum value of the given value.
2337
2540
  The `data` field must be destroyed with `duckdb_free`.
2338
2541
 
2339
- * @param val A duckdb_value containing a VARINT
2340
- * @return A duckdb_varint. The `data` field must be destroyed with `duckdb_free`.
2542
+ * @param val A duckdb_value containing a BIGNUM
2543
+ * @return A duckdb_bignum. The `data` field must be destroyed with `duckdb_free`.
2341
2544
  */
2342
- DUCKDB_C_API duckdb_varint duckdb_get_varint(duckdb_value val);
2545
+ DUCKDB_C_API duckdb_bignum duckdb_get_bignum(duckdb_value val);
2343
2546
 
2344
2547
  /*!
2345
2548
  Returns the duckdb_decimal value of the given value.
@@ -2381,6 +2584,14 @@ Returns the time value of the given value.
2381
2584
  */
2382
2585
  DUCKDB_C_API duckdb_time duckdb_get_time(duckdb_value val);
2383
2586
 
2587
+ /*!
2588
+ Returns the time_ns value of the given value.
2589
+
2590
+ * @param val A duckdb_value containing a time_ns
2591
+ * @return A duckdb_time_ns, or MinValue<time_ns> if the value cannot be converted
2592
+ */
2593
+ DUCKDB_C_API duckdb_time_ns duckdb_get_time_ns(duckdb_value val);
2594
+
2384
2595
  /*!
2385
2596
  Returns the time_tz value of the given value.
2386
2597
 
@@ -2530,7 +2741,7 @@ Must be destroyed with `duckdb_destroy_value`.
2530
2741
 
2531
2742
  * @param union_type The union type
2532
2743
  * @param tag_index The index of the tag of the union
2533
- * @param value The value of the union
2744
+ * @param value The value of the union for that tag
2534
2745
  * @return The union value, or nullptr, if the parameters are invalid.
2535
2746
  */
2536
2747
  DUCKDB_C_API duckdb_value duckdb_create_union_value(duckdb_logical_type union_type, idx_t tag_index,
@@ -2988,14 +3199,18 @@ DUCKDB_C_API void duckdb_data_chunk_set_size(duckdb_data_chunk chunk, idx_t size
2988
3199
  //===--------------------------------------------------------------------===//
2989
3200
 
2990
3201
  /*!
2991
- Creates a flat vector.
3202
+ Creates a flat vector. Must be destroyed with `duckdb_destroy_vector`.
2992
3203
 
3204
+ * @param type The logical type of the vector.
3205
+ * @param capacity The capacity of the vector.
3206
+ * @return The vector.
2993
3207
  */
2994
3208
  DUCKDB_C_API duckdb_vector duckdb_create_vector(duckdb_logical_type type, idx_t capacity);
2995
3209
 
2996
3210
  /*!
2997
- Destroys the vector and de-allocates all memory allocated for that vector, if unused else where.
3211
+ Destroys the vector and de-allocates its memory.
2998
3212
 
3213
+ * @param vector A pointer to the vector.
2999
3214
  */
3000
3215
  DUCKDB_C_API void duckdb_destroy_vector(duckdb_vector *vector);
3001
3216
 
@@ -3113,7 +3328,6 @@ DUCKDB_C_API duckdb_state duckdb_list_vector_reserve(duckdb_vector vector, idx_t
3113
3328
 
3114
3329
  /*!
3115
3330
  Retrieves the child vector of a struct vector.
3116
-
3117
3331
  The resulting vector is valid as long as the parent vector is valid.
3118
3332
 
3119
3333
  * @param vector The vector
@@ -3124,7 +3338,6 @@ DUCKDB_C_API duckdb_vector duckdb_struct_vector_get_child(duckdb_vector vector,
3124
3338
 
3125
3339
  /*!
3126
3340
  Retrieves the child vector of an array vector.
3127
-
3128
3341
  The resulting vector is valid as long as the parent vector is valid.
3129
3342
  The resulting vector has the size of the parent vector multiplied by the array size.
3130
3343
 
@@ -3135,25 +3348,44 @@ DUCKDB_C_API duckdb_vector duckdb_array_vector_get_child(duckdb_vector vector);
3135
3348
 
3136
3349
  /*!
3137
3350
  Slice a vector with a selection vector.
3351
+ The length of the selection vector must be less than or equal to the length of the vector.
3352
+ Turns the vector into a dictionary vector.
3138
3353
 
3139
- The max value in the selection vector must be less than the length of the vector
3354
+ * @param vector The vector to slice.
3355
+ * @param sel The selection vector.
3356
+ * @param len The length of the selection vector.
3357
+ */
3358
+ DUCKDB_C_API void duckdb_slice_vector(duckdb_vector vector, duckdb_selection_vector sel, idx_t len);
3140
3359
 
3141
- The resulting vector happens to be a dictionary vector.
3360
+ /*!
3361
+ Copy the src vector to the dst with a selection vector that identifies which indices to copy.
3142
3362
 
3143
- * @param vector The vector which is to become a dictionary
3144
- * @param selection The selection vector
3145
- * @param len The length of the selection vector
3363
+ * @param src The vector to copy from.
3364
+ * @param dst The vector to copy to.
3365
+ * @param sel The selection vector. The length of the selection vector should not be more than the length of the src
3366
+ vector
3367
+ * @param src_count The number of entries from selection vector to copy. Think of this as the effective length of the
3368
+ selection vector starting from index 0
3369
+ * @param src_offset The offset in the selection vector to copy from (important: actual number of items copied =
3370
+ src_count - src_offset).
3371
+ * @param dst_offset The offset in the dst vector to start copying to.
3146
3372
  */
3147
- DUCKDB_C_API void duckdb_slice_vector(duckdb_vector vector, duckdb_selection_vector selection, idx_t len);
3373
+ DUCKDB_C_API void duckdb_vector_copy_sel(duckdb_vector src, duckdb_vector dst, duckdb_selection_vector sel,
3374
+ idx_t src_count, idx_t src_offset, idx_t dst_offset);
3148
3375
 
3149
3376
  /*!
3150
3377
  Copies the value from `value` to `vector`.
3378
+
3379
+ * @param vector The receiving vector.
3380
+ * @param value The value to copy into the vector.
3151
3381
  */
3152
3382
  DUCKDB_C_API void duckdb_vector_reference_value(duckdb_vector vector, duckdb_value value);
3153
3383
 
3154
3384
  /*!
3155
- References the `from` vector in the `to` vector, this makes take shared ownership of the values buffer
3385
+ Changes `to_vector` to reference `from_vector. After, the vectors share ownership of the data.
3156
3386
 
3387
+ * @param to_vector The receiving vector.
3388
+ * @param from_vector The vector to reference.
3157
3389
  */
3158
3390
  DUCKDB_C_API void duckdb_vector_reference_vector(duckdb_vector to_vector, duckdb_vector from_vector);
3159
3391
 
@@ -3286,15 +3518,16 @@ DUCKDB_C_API void duckdb_scalar_function_set_extra_info(duckdb_scalar_function s
3286
3518
  /*!
3287
3519
  Sets the (optional) bind function of the scalar function.
3288
3520
 
3289
- * @param scalar_function The scalar function
3290
- * @param bind The bind function
3521
+ * @param scalar_function The scalar function.
3522
+ * @param bind The bind function.
3291
3523
  */
3292
3524
  DUCKDB_C_API void duckdb_scalar_function_set_bind(duckdb_scalar_function scalar_function,
3293
3525
  duckdb_scalar_function_bind_t bind);
3294
3526
 
3295
3527
  /*!
3296
3528
  Sets the user-provided bind data in the bind object of the scalar function.
3297
- This object can be retrieved again during execution.
3529
+ The bind data object can be retrieved again during execution.
3530
+ In most case, you also need to set the copy-callback of your bind data via duckdb_scalar_function_set_bind_data_copy.
3298
3531
 
3299
3532
  * @param info The bind info of the scalar function.
3300
3533
  * @param bind_data The bind data object.
@@ -3303,11 +3536,19 @@ This object can be retrieved again during execution.
3303
3536
  DUCKDB_C_API void duckdb_scalar_function_set_bind_data(duckdb_bind_info info, void *bind_data,
3304
3537
  duckdb_delete_callback_t destroy);
3305
3538
 
3539
+ /*!
3540
+ Sets the copy-callback for the user-provided bind data in the bind object of the scalar function.
3541
+
3542
+ * @param info The bind info of the scalar function.
3543
+ * @param copy The callback to copy the bind data (if any).
3544
+ */
3545
+ DUCKDB_C_API void duckdb_scalar_function_set_bind_data_copy(duckdb_bind_info info, duckdb_copy_callback_t copy);
3546
+
3306
3547
  /*!
3307
3548
  Report that an error has occurred while calling bind on a scalar function.
3308
3549
 
3309
- * @param info The bind info object
3310
- * @param error The error message
3550
+ * @param info The bind info object.
3551
+ * @param error The error message.
3311
3552
  */
3312
3553
  DUCKDB_C_API void duckdb_scalar_function_bind_set_error(duckdb_bind_info info, const char *error);
3313
3554
 
@@ -3343,8 +3584,15 @@ Retrieves the extra info of the function as set in `duckdb_scalar_function_set_e
3343
3584
  DUCKDB_C_API void *duckdb_scalar_function_get_extra_info(duckdb_function_info info);
3344
3585
 
3345
3586
  /*!
3346
- Gets the scalar function's bind data set by `duckdb_scalar_function_set_bind_data`.
3587
+ Retrieves the extra info of the function as set in the bind info.
3588
+
3589
+ * @param info The info object.
3590
+ * @return The extra info.
3591
+ */
3592
+ DUCKDB_C_API void *duckdb_scalar_function_bind_get_extra_info(duckdb_bind_info info);
3347
3593
 
3594
+ /*!
3595
+ Gets the scalar function's bind data set by `duckdb_scalar_function_set_bind_data`.
3348
3596
  Note that the bind data is read-only.
3349
3597
 
3350
3598
  * @param info The function info.
@@ -3407,24 +3655,50 @@ If the set is incomplete or a function with this name already exists DuckDBError
3407
3655
  */
3408
3656
  DUCKDB_C_API duckdb_state duckdb_register_scalar_function_set(duckdb_connection con, duckdb_scalar_function_set set);
3409
3657
 
3658
+ /*!
3659
+ Returns the number of input arguments of the scalar function.
3660
+
3661
+ * @param info The bind info.
3662
+ * @return The number of input arguments.
3663
+ */
3664
+ DUCKDB_C_API idx_t duckdb_scalar_function_bind_get_argument_count(duckdb_bind_info info);
3665
+
3666
+ /*!
3667
+ Returns the input argument at index of the scalar function.
3668
+
3669
+ * @param info The bind info.
3670
+ * @param index The argument index.
3671
+ * @return The input argument at index. Must be destroyed with `duckdb_destroy_expression`.
3672
+ */
3673
+ DUCKDB_C_API duckdb_expression duckdb_scalar_function_bind_get_argument(duckdb_bind_info info, idx_t index);
3674
+
3410
3675
  //===--------------------------------------------------------------------===//
3411
3676
  // Selection Vector Interface
3412
3677
  //===--------------------------------------------------------------------===//
3413
3678
 
3414
3679
  /*!
3415
3680
  Creates a new selection vector of size `size`.
3681
+ Must be destroyed with `duckdb_destroy_selection_vector`.
3682
+
3683
+ * @param size The size of the selection vector.
3684
+ * @return The selection vector.
3416
3685
  */
3417
3686
  DUCKDB_C_API duckdb_selection_vector duckdb_create_selection_vector(idx_t size);
3418
3687
 
3419
3688
  /*!
3420
- Destroys a selection vector.
3689
+ Destroys the selection vector and de-allocates its memory.
3690
+
3691
+ * @param sel The selection vector.
3421
3692
  */
3422
- DUCKDB_C_API void duckdb_destroy_selection_vector(duckdb_selection_vector vector);
3693
+ DUCKDB_C_API void duckdb_destroy_selection_vector(duckdb_selection_vector sel);
3423
3694
 
3424
3695
  /*!
3425
3696
  Access the data pointer of a selection vector.
3697
+
3698
+ * @param sel The selection vector.
3699
+ * @return The data pointer.
3426
3700
  */
3427
- DUCKDB_C_API sel_t *duckdb_selection_vector_get_data_ptr(duckdb_selection_vector vector);
3701
+ DUCKDB_C_API sel_t *duckdb_selection_vector_get_data_ptr(duckdb_selection_vector sel);
3428
3702
 
3429
3703
  //===--------------------------------------------------------------------===//
3430
3704
  // Aggregate Functions
@@ -3713,6 +3987,14 @@ Retrieves the extra info of the function as set in `duckdb_table_function_set_ex
3713
3987
  */
3714
3988
  DUCKDB_C_API void *duckdb_bind_get_extra_info(duckdb_bind_info info);
3715
3989
 
3990
+ /*!
3991
+ Retrieves the client context of the bind info of a table function.
3992
+
3993
+ * @param info The bind info object of the table function.
3994
+ * @param out_context The client context of the bind info. Must be destroyed with `duckdb_destroy_client_context`.
3995
+ */
3996
+ DUCKDB_C_API void duckdb_table_function_get_client_context(duckdb_bind_info info, duckdb_client_context *out_context);
3997
+
3716
3998
  /*!
3717
3999
  Adds a result column to the output of the table function.
3718
4000
 
@@ -4032,6 +4314,25 @@ DUCKDB_C_API duckdb_state duckdb_appender_create_ext(duckdb_connection connectio
4032
4314
  const char *schema, const char *table,
4033
4315
  duckdb_appender *out_appender);
4034
4316
 
4317
+ /*!
4318
+ Creates an appender object that executes the given query with any data appended to it.
4319
+
4320
+ Note that the object must be destroyed with `duckdb_appender_destroy`.
4321
+
4322
+ * @param connection The connection context to create the appender in.
4323
+ * @param query The query to execute, can be an INSERT, DELETE, UPDATE or MERGE INTO statement.
4324
+ * @param column_count The number of columns to append.
4325
+ * @param types The types of the columns to append.
4326
+ * @param table_name (optionally) the table name used to refer to the appended data, defaults to "appended_data".
4327
+ * @param column_names (optionally) the list of column names, defaults to "col1", "col2", ...
4328
+ * @param out_appender The resulting appender object.
4329
+ * @return `DuckDBSuccess` on success or `DuckDBError` on failure.
4330
+ */
4331
+ DUCKDB_C_API duckdb_state duckdb_appender_create_query(duckdb_connection connection, const char *query,
4332
+ idx_t column_count, duckdb_logical_type *types,
4333
+ const char *table_name, const char **column_names,
4334
+ duckdb_appender *out_appender);
4335
+
4035
4336
  /*!
4036
4337
  Returns the number of columns that belong to the appender.
4037
4338
  If there is no active column list, then this equals the table's physical columns.
@@ -4053,8 +4354,12 @@ Note: The resulting type must be destroyed with `duckdb_destroy_logical_type`.
4053
4354
  */
4054
4355
  DUCKDB_C_API duckdb_logical_type duckdb_appender_column_type(duckdb_appender appender, idx_t col_idx);
4055
4356
 
4357
+ #ifndef DUCKDB_API_NO_DEPRECATED
4056
4358
  /*!
4057
- Returns the error message associated with the given appender.
4359
+ **DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
4360
+ Use duckdb_appender_error_data instead.
4361
+
4362
+ Returns the error message associated with the appender.
4058
4363
  If the appender has no error message, this returns `nullptr` instead.
4059
4364
 
4060
4365
  The error message should not be freed. It will be de-allocated when `duckdb_appender_destroy` is called.
@@ -4064,10 +4369,21 @@ The error message should not be freed. It will be de-allocated when `duckdb_appe
4064
4369
  */
4065
4370
  DUCKDB_C_API const char *duckdb_appender_error(duckdb_appender appender);
4066
4371
 
4372
+ #endif
4373
+
4374
+ /*!
4375
+ Returns the error data associated with the appender.
4376
+ Must be destroyed with duckdb_destroy_error_data.
4377
+
4378
+ * @param appender The appender to get the error data from.
4379
+ * @return The error data.
4380
+ */
4381
+ DUCKDB_C_API duckdb_error_data duckdb_appender_error_data(duckdb_appender appender);
4382
+
4067
4383
  /*!
4068
4384
  Flush the appender to the table, forcing the cache of the appender to be cleared. If flushing the data triggers a
4069
4385
  constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError.
4070
- It is not possible to append more values. Call duckdb_appender_error to obtain the error message followed by
4386
+ It is not possible to append more values. Call duckdb_appender_error_data to obtain the error data followed by
4071
4387
  duckdb_appender_destroy to destroy the invalidated appender.
4072
4388
 
4073
4389
  * @param appender The appender to flush.
@@ -4078,7 +4394,7 @@ DUCKDB_C_API duckdb_state duckdb_appender_flush(duckdb_appender appender);
4078
4394
  /*!
4079
4395
  Closes the appender by flushing all intermediate states and closing it for further appends. If flushing the data
4080
4396
  triggers a constraint violation or any other error, then all data is invalidated, and this function returns DuckDBError.
4081
- Call duckdb_appender_error to obtain the error message followed by duckdb_appender_destroy to destroy the invalidated
4397
+ Call duckdb_appender_error_data to obtain the error data followed by duckdb_appender_destroy to destroy the invalidated
4082
4398
  appender.
4083
4399
 
4084
4400
  * @param appender The appender to flush and close.
@@ -4343,6 +4659,66 @@ DUCKDB_C_API char *duckdb_table_description_get_column_name(duckdb_table_descrip
4343
4659
  // Arrow Interface
4344
4660
  //===--------------------------------------------------------------------===//
4345
4661
 
4662
+ /*!
4663
+ Transforms a DuckDB Schema into an Arrow Schema
4664
+
4665
+ * @param arrow_options The Arrow settings used to produce arrow.
4666
+ * @param types The DuckDB logical types for each column in the schema.
4667
+ * @param names The names for each column in the schema.
4668
+ * @param column_count The number of columns that exist in the schema.
4669
+ * @param out_schema The resulting arrow schema. Must be destroyed with `out_schema->release(out_schema)`.
4670
+ * @return The error data. Must be destroyed with `duckdb_destroy_error_data`.
4671
+ */
4672
+ DUCKDB_C_API duckdb_error_data duckdb_to_arrow_schema(duckdb_arrow_options arrow_options, duckdb_logical_type *types,
4673
+ const char **names, idx_t column_count,
4674
+ struct ArrowSchema *out_schema);
4675
+
4676
+ /*!
4677
+ Transforms a DuckDB data chunk into an Arrow array.
4678
+
4679
+ * @param arrow_options The Arrow settings used to produce arrow.
4680
+ * @param chunk The DuckDB data chunk to convert.
4681
+ * @param out_arrow_array The output Arrow structure that will hold the converted data. Must be released with
4682
+ `out_arrow_array->release(out_arrow_array)`
4683
+ * @return The error data. Must be destroyed with `duckdb_destroy_error_data`.
4684
+ */
4685
+ DUCKDB_C_API duckdb_error_data duckdb_data_chunk_to_arrow(duckdb_arrow_options arrow_options, duckdb_data_chunk chunk,
4686
+ struct ArrowArray *out_arrow_array);
4687
+
4688
+ /*!
4689
+ Transforms an Arrow Schema into a DuckDB Schema.
4690
+
4691
+ * @param connection The connection to get the transformation settings from.
4692
+ * @param schema The input Arrow schema. Must be released with `schema->release(schema)`.
4693
+ * @param out_types The Arrow converted schema with extra information about the arrow types. Must be destroyed with
4694
+ `duckdb_destroy_arrow_converted_schema`.
4695
+ * @return The error data. Must be destroyed with `duckdb_destroy_error_data`.
4696
+ */
4697
+ DUCKDB_C_API duckdb_error_data duckdb_schema_from_arrow(duckdb_connection connection, struct ArrowSchema *schema,
4698
+ duckdb_arrow_converted_schema *out_types);
4699
+
4700
+ /*!
4701
+ Transforms an Arrow array into a DuckDB data chunk. The data chunk will retain ownership of the underlying Arrow data.
4702
+
4703
+ * @param connection The connection to get the transformation settings from.
4704
+ * @param arrow_array The input Arrow array. Data ownership is passed on to DuckDB's DataChunk, the underlying object
4705
+ does not need to be released and won't have ownership of the data.
4706
+ * @param converted_schema The Arrow converted schema with extra information about the arrow types.
4707
+ * @param out_chunk The resulting DuckDB data chunk. Must be destroyed by duckdb_destroy_data_chunk.
4708
+ * @return The error data. Must be destroyed with `duckdb_destroy_error_data`.
4709
+ */
4710
+ DUCKDB_C_API duckdb_error_data duckdb_data_chunk_from_arrow(duckdb_connection connection,
4711
+ struct ArrowArray *arrow_array,
4712
+ duckdb_arrow_converted_schema converted_schema,
4713
+ duckdb_data_chunk *out_chunk);
4714
+
4715
+ /*!
4716
+ Destroys the arrow converted schema and de-allocates all memory allocated for that arrow converted schema.
4717
+
4718
+ * @param arrow_converted_schema The arrow converted schema to destroy.
4719
+ */
4720
+ DUCKDB_C_API void duckdb_destroy_arrow_converted_schema(duckdb_arrow_converted_schema *arrow_converted_schema);
4721
+
4346
4722
  #ifndef DUCKDB_API_NO_DEPRECATED
4347
4723
  /*!
4348
4724
  **DEPRECATION NOTICE**: This method is scheduled for removal in a future release.
@@ -4520,6 +4896,7 @@ DUCKDB_C_API duckdb_state duckdb_arrow_array_scan(duckdb_connection connection,
4520
4896
  duckdb_arrow_stream *out_stream);
4521
4897
 
4522
4898
  #endif
4899
+
4523
4900
  //===--------------------------------------------------------------------===//
4524
4901
  // Threading Information
4525
4902
  //===--------------------------------------------------------------------===//
@@ -4627,6 +5004,7 @@ It is not known beforehand how many chunks will be returned by this result.
4627
5004
  DUCKDB_C_API duckdb_data_chunk duckdb_stream_fetch_chunk(duckdb_result result);
4628
5005
 
4629
5006
  #endif
5007
+
4630
5008
  /*!
4631
5009
  Fetches a data chunk from a duckdb_result. This function should be called repeatedly until the result is exhausted.
4632
5010
 
@@ -4745,6 +5123,44 @@ Destroys the cast function object.
4745
5123
  */
4746
5124
  DUCKDB_C_API void duckdb_destroy_cast_function(duckdb_cast_function *cast_function);
4747
5125
 
5126
+ //===--------------------------------------------------------------------===//
5127
+ // Expression Interface
5128
+ //===--------------------------------------------------------------------===//
5129
+
5130
+ /*!
5131
+ Destroys the expression and de-allocates its memory.
5132
+
5133
+ * @param expr A pointer to the expression.
5134
+ */
5135
+ DUCKDB_C_API void duckdb_destroy_expression(duckdb_expression *expr);
5136
+
5137
+ /*!
5138
+ Returns the return type of an expression.
5139
+
5140
+ * @param expr The expression.
5141
+ * @return The return type. Must be destroyed with `duckdb_destroy_logical_type`.
5142
+ */
5143
+ DUCKDB_C_API duckdb_logical_type duckdb_expression_return_type(duckdb_expression expr);
5144
+
5145
+ /*!
5146
+ Returns whether the expression is foldable into a value or not.
5147
+
5148
+ * @param expr The expression.
5149
+ * @return True, if the expression is foldable, else false.
5150
+ */
5151
+ DUCKDB_C_API bool duckdb_expression_is_foldable(duckdb_expression expr);
5152
+
5153
+ /*!
5154
+ Folds an expression creating a folded value.
5155
+
5156
+ * @param context The client context.
5157
+ * @param expr The expression. Must be foldable.
5158
+ * @param out_value The folded value, if folding was successful. Must be destroyed with `duckdb_destroy_value`.
5159
+ * @return The error data. Must be destroyed with `duckdb_destroy_error_data`.
5160
+ */
5161
+ DUCKDB_C_API duckdb_error_data duckdb_expression_fold(duckdb_client_context context, duckdb_expression expr,
5162
+ duckdb_value *out_value);
5163
+
4748
5164
  #endif
4749
5165
 
4750
5166
  #ifdef __cplusplus