duckdb 0.10.1-dev22.0 → 0.10.1-dev26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (700) hide show
  1. package/binding.gyp +4 -1
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-strptime.cpp +46 -4
  4. package/src/duckdb/extension/icu/icu-table-range.cpp +5 -0
  5. package/src/duckdb/extension/icu/icu-timezone.cpp +28 -4
  6. package/src/duckdb/extension/json/buffered_json_reader.cpp +6 -5
  7. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +3 -3
  8. package/src/duckdb/extension/json/include/json_transform.hpp +2 -0
  9. package/src/duckdb/extension/json/json_functions/json_create.cpp +6 -0
  10. package/src/duckdb/extension/json/json_functions/json_transform.cpp +8 -9
  11. package/src/duckdb/extension/json/json_functions.cpp +1 -2
  12. package/src/duckdb/extension/json/json_scan.cpp +1 -0
  13. package/src/duckdb/extension/parquet/column_reader.cpp +17 -1
  14. package/src/duckdb/extension/parquet/column_writer.cpp +151 -20
  15. package/src/duckdb/extension/parquet/include/column_writer.hpp +3 -4
  16. package/src/duckdb/extension/parquet/parquet_extension.cpp +14 -9
  17. package/src/duckdb/extension/parquet/parquet_timestamp.cpp +10 -0
  18. package/src/duckdb/extension/parquet/parquet_writer.cpp +4 -0
  19. package/src/duckdb/src/catalog/catalog.cpp +94 -10
  20. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +9 -5
  21. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +1 -0
  22. package/src/duckdb/src/catalog/catalog_entry/ub_duckdb_catalog_entries.cpp +16 -0
  23. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +28 -0
  24. package/src/duckdb/src/catalog/default/default_functions.cpp +3 -0
  25. package/src/duckdb/src/catalog/default/default_views.cpp +3 -3
  26. package/src/duckdb/src/catalog/default/ub_duckdb_catalog_default_entries.cpp +5 -0
  27. package/src/duckdb/src/catalog/dependency_catalog_set.cpp +1 -3
  28. package/src/duckdb/src/catalog/dependency_manager.cpp +2 -5
  29. package/src/duckdb/src/catalog/ub_duckdb_catalog.cpp +10 -0
  30. package/src/duckdb/src/common/adbc/adbc.cpp +1 -1
  31. package/src/duckdb/src/common/adbc/driver_manager.cpp +2 -1
  32. package/src/duckdb/src/common/adbc/nanoarrow/ub_duckdb_adbc_nanoarrow.cpp +5 -0
  33. package/src/duckdb/src/common/adbc/ub_duckdb_adbc.cpp +3 -0
  34. package/src/duckdb/src/common/allocator.cpp +34 -8
  35. package/src/duckdb/src/common/arrow/appender/fixed_size_list_data.cpp +39 -0
  36. package/src/duckdb/src/common/arrow/appender/ub_duckdb_common_arrow_appender.cpp +6 -0
  37. package/src/duckdb/src/common/arrow/appender/union_data.cpp +2 -1
  38. package/src/duckdb/src/common/arrow/arrow_appender.cpp +5 -5
  39. package/src/duckdb/src/common/arrow/arrow_converter.cpp +17 -0
  40. package/src/duckdb/src/common/arrow/ub_duckdb_common_arrow.cpp +4 -0
  41. package/src/duckdb/src/common/compressed_file_system.cpp +1 -0
  42. package/src/duckdb/src/common/crypto/ub_duckdb_common_crypto.cpp +2 -0
  43. package/src/duckdb/src/common/enum_util.cpp +153 -13
  44. package/src/duckdb/src/common/enums/logical_operator_type.cpp +0 -2
  45. package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -2
  46. package/src/duckdb/src/common/enums/ub_duckdb_common_enums.cpp +12 -0
  47. package/src/duckdb/src/common/exception/conversion_exception.cpp +23 -0
  48. package/src/duckdb/src/common/exception.cpp +7 -14
  49. package/src/duckdb/src/common/extra_type_info.cpp +6 -5
  50. package/src/duckdb/src/common/gzip_file_system.cpp +5 -4
  51. package/src/duckdb/src/common/local_file_system.cpp +85 -10
  52. package/src/duckdb/src/common/operator/cast_operators.cpp +413 -305
  53. package/src/duckdb/src/common/operator/ub_duckdb_common_operators.cpp +4 -0
  54. package/src/duckdb/src/common/progress_bar/ub_duckdb_progress_bar.cpp +3 -0
  55. package/src/duckdb/src/common/re2_regex.cpp +2 -1
  56. package/src/duckdb/src/common/row_operations/row_heap_scatter.cpp +2 -2
  57. package/src/duckdb/src/common/row_operations/row_matcher.cpp +1 -0
  58. package/src/duckdb/src/common/row_operations/row_scatter.cpp +2 -2
  59. package/src/duckdb/src/common/row_operations/ub_duckdb_row_operations.cpp +9 -0
  60. package/src/duckdb/src/common/serializer/binary_serializer.cpp +3 -3
  61. package/src/duckdb/src/common/serializer/ub_duckdb_common_serializer.cpp +7 -0
  62. package/src/duckdb/src/common/sort/partition_state.cpp +2 -3
  63. package/src/duckdb/src/common/sort/ub_duckdb_sort.cpp +7 -0
  64. package/src/duckdb/src/common/string_util.cpp +3 -3
  65. package/src/duckdb/src/common/types/bit.cpp +7 -6
  66. package/src/duckdb/src/common/types/blob.cpp +20 -9
  67. package/src/duckdb/src/common/types/column/column_data_allocator.cpp +8 -6
  68. package/src/duckdb/src/common/types/column/column_data_collection.cpp +11 -1
  69. package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +5 -0
  70. package/src/duckdb/src/common/types/column/partitioned_column_data.cpp +1 -1
  71. package/src/duckdb/src/common/types/column/ub_duckdb_common_types_column.cpp +6 -0
  72. package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
  73. package/src/duckdb/src/common/types/date.cpp +1 -1
  74. package/src/duckdb/src/common/types/hugeint.cpp +3 -2
  75. package/src/duckdb/src/common/types/interval.cpp +1 -1
  76. package/src/duckdb/src/common/types/list_segment.cpp +2 -1
  77. package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +3 -9
  78. package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +7 -7
  79. package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +10 -27
  80. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +168 -88
  81. package/src/duckdb/src/common/types/row/ub_duckdb_common_types_row.cpp +11 -0
  82. package/src/duckdb/src/common/types/selection_vector.cpp +1 -1
  83. package/src/duckdb/src/common/types/string_heap.cpp +5 -1
  84. package/src/duckdb/src/common/types/string_type.cpp +18 -4
  85. package/src/duckdb/src/common/types/time.cpp +4 -2
  86. package/src/duckdb/src/common/types/timestamp.cpp +32 -6
  87. package/src/duckdb/src/common/types/ub_duckdb_common_types.cpp +28 -0
  88. package/src/duckdb/src/common/types/uhugeint.cpp +3 -2
  89. package/src/duckdb/src/common/types/uuid.cpp +11 -0
  90. package/src/duckdb/src/common/types/validity_mask.cpp +4 -3
  91. package/src/duckdb/src/common/types/value.cpp +17 -6
  92. package/src/duckdb/src/common/types/vector.cpp +243 -68
  93. package/src/duckdb/src/common/types.cpp +7 -5
  94. package/src/duckdb/src/common/ub_duckdb_common.cpp +34 -0
  95. package/src/duckdb/src/common/value_operations/ub_duckdb_value_operations.cpp +2 -0
  96. package/src/duckdb/src/common/vector_operations/generators.cpp +2 -1
  97. package/src/duckdb/src/common/vector_operations/vector_cast.cpp +4 -4
  98. package/src/duckdb/src/common/vector_operations/vector_copy.cpp +2 -2
  99. package/src/duckdb/src/common/vector_operations/vector_hash.cpp +17 -6
  100. package/src/duckdb/src/core_functions/aggregate/algebraic/ub_duckdb_aggr_algebraic.cpp +5 -0
  101. package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +30 -6
  102. package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +1 -1
  103. package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +12 -5
  104. package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +2 -2
  105. package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +2 -1
  106. package/src/duckdb/src/core_functions/aggregate/distributive/ub_duckdb_aggr_distributive.cpp +13 -0
  107. package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +2 -1
  108. package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +2 -9
  109. package/src/duckdb/src/core_functions/aggregate/holistic/ub_duckdb_aggr_holistic.cpp +5 -0
  110. package/src/duckdb/src/core_functions/aggregate/nested/ub_duckdb_aggr_nested.cpp +3 -0
  111. package/src/duckdb/src/core_functions/aggregate/regression/ub_duckdb_aggr_regr.cpp +8 -0
  112. package/src/duckdb/src/core_functions/function_list.cpp +1 -0
  113. package/src/duckdb/src/core_functions/scalar/bit/bitstring.cpp +2 -2
  114. package/src/duckdb/src/core_functions/scalar/bit/ub_duckdb_func_bit.cpp +2 -0
  115. package/src/duckdb/src/core_functions/scalar/blob/ub_duckdb_func_blob.cpp +3 -0
  116. package/src/duckdb/src/core_functions/scalar/date/date_diff.cpp +8 -0
  117. package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +22 -3
  118. package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +29 -7
  119. package/src/duckdb/src/core_functions/scalar/date/to_interval.cpp +3 -1
  120. package/src/duckdb/src/core_functions/scalar/date/ub_duckdb_func_date.cpp +12 -0
  121. package/src/duckdb/src/core_functions/scalar/debug/ub_duckdb_func_debug.cpp +2 -0
  122. package/src/duckdb/src/core_functions/scalar/enum/ub_duckdb_func_enum.cpp +2 -0
  123. package/src/duckdb/src/core_functions/scalar/generic/ub_duckdb_func_generic.cpp +9 -0
  124. package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +12 -8
  125. package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +2 -1
  126. package/src/duckdb/src/core_functions/scalar/list/list_reduce.cpp +6 -5
  127. package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +5 -3
  128. package/src/duckdb/src/core_functions/scalar/list/list_value.cpp +28 -12
  129. package/src/duckdb/src/core_functions/scalar/list/ub_duckdb_func_list.cpp +11 -0
  130. package/src/duckdb/src/core_functions/scalar/map/map.cpp +129 -160
  131. package/src/duckdb/src/core_functions/scalar/map/ub_duckdb_func_map_nested.cpp +8 -0
  132. package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +19 -16
  133. package/src/duckdb/src/core_functions/scalar/math/ub_duckdb_func_math.cpp +1 -0
  134. package/src/duckdb/src/core_functions/scalar/operators/bitwise.cpp +4 -4
  135. package/src/duckdb/src/core_functions/scalar/operators/ub_duckdb_func_ops.cpp +1 -0
  136. package/src/duckdb/src/core_functions/scalar/random/ub_duckdb_func_random.cpp +3 -0
  137. package/src/duckdb/src/core_functions/scalar/string/hex.cpp +2 -1
  138. package/src/duckdb/src/core_functions/scalar/string/pad.cpp +2 -2
  139. package/src/duckdb/src/core_functions/scalar/string/repeat.cpp +1 -1
  140. package/src/duckdb/src/core_functions/scalar/string/replace.cpp +1 -1
  141. package/src/duckdb/src/core_functions/scalar/string/string_split.cpp +2 -1
  142. package/src/duckdb/src/core_functions/scalar/string/translate.cpp +1 -1
  143. package/src/duckdb/src/core_functions/scalar/string/ub_duckdb_func_string.cpp +26 -0
  144. package/src/duckdb/src/core_functions/scalar/struct/ub_duckdb_func_struct.cpp +3 -0
  145. package/src/duckdb/src/core_functions/scalar/union/ub_duckdb_func_union.cpp +4 -0
  146. package/src/duckdb/src/core_functions/ub_duckdb_core_functions.cpp +3 -0
  147. package/src/duckdb/src/execution/adaptive_filter.cpp +1 -1
  148. package/src/duckdb/src/execution/aggregate_hashtable.cpp +1 -1
  149. package/src/duckdb/src/execution/column_binding_resolver.cpp +7 -1
  150. package/src/duckdb/src/execution/expression_executor/execute_case.cpp +2 -2
  151. package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +2 -0
  152. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +2 -2
  153. package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +1 -1
  154. package/src/duckdb/src/execution/expression_executor/ub_duckdb_expression_executor.cpp +11 -0
  155. package/src/duckdb/src/execution/expression_executor.cpp +5 -2
  156. package/src/duckdb/src/execution/index/art/art.cpp +12 -6
  157. package/src/duckdb/src/execution/index/art/art_key.cpp +3 -3
  158. package/src/duckdb/src/execution/index/art/leaf.cpp +2 -2
  159. package/src/duckdb/src/execution/index/art/node16.cpp +2 -2
  160. package/src/duckdb/src/execution/index/art/node256.cpp +3 -3
  161. package/src/duckdb/src/execution/index/art/node48.cpp +5 -5
  162. package/src/duckdb/src/execution/index/art/prefix.cpp +1 -1
  163. package/src/duckdb/src/execution/index/art/ub_duckdb_art_index_execution.cpp +12 -0
  164. package/src/duckdb/src/execution/index/art/ub_duckdb_execution_index_art.cpp +11 -0
  165. package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +6 -5
  166. package/src/duckdb/src/execution/index/ub_duckdb_execution_index.cpp +3 -0
  167. package/src/duckdb/src/execution/nested_loop_join/ub_duckdb_nested_loop_join.cpp +3 -0
  168. package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +1 -1
  169. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +3 -4
  170. package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +0 -1
  171. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +3 -4
  172. package/src/duckdb/src/execution/operator/aggregate/ub_duckdb_operator_aggregate.cpp +9 -0
  173. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +1 -1
  174. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +8 -3
  175. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +1 -1
  176. package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +5 -5
  177. package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +2 -3
  178. package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +5 -1
  179. package/src/duckdb/src/execution/operator/csv_scanner/scanner/skip_scanner.cpp +2 -2
  180. package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +151 -79
  181. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +11 -6
  182. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +27 -6
  183. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +71 -18
  184. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +22 -11
  185. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +6 -4
  186. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +5 -3
  187. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/ub_duckdb_operator_csv_sniffer.cpp +7 -0
  188. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine.cpp +3 -3
  189. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +30 -5
  190. package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +6 -2
  191. package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +47 -46
  192. package/src/duckdb/src/execution/operator/csv_scanner/ub_duckdb_operator_csv_scanner.cpp +10 -0
  193. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +102 -54
  194. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +8 -1
  195. package/src/duckdb/src/execution/operator/filter/ub_duckdb_operator_filter.cpp +2 -0
  196. package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +54 -36
  197. package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +56 -32
  198. package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +9 -13
  199. package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +12 -0
  200. package/src/duckdb/src/execution/operator/helper/physical_verify_vector.cpp +221 -0
  201. package/src/duckdb/src/execution/operator/helper/ub_duckdb_operator_helper.cpp +18 -0
  202. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +1 -0
  203. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +23 -8
  204. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +8 -3
  205. package/src/duckdb/src/execution/operator/join/ub_duckdb_operator_join.cpp +16 -0
  206. package/src/duckdb/src/execution/operator/order/physical_order.cpp +2 -3
  207. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +2 -7
  208. package/src/duckdb/src/execution/operator/order/ub_duckdb_operator_order.cpp +3 -0
  209. package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +451 -55
  210. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +312 -150
  211. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +200 -75
  212. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +1 -0
  213. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +6 -5
  214. package/src/duckdb/src/execution/operator/persistent/ub_duckdb_operator_persistent.cpp +10 -0
  215. package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +3 -2
  216. package/src/duckdb/src/execution/operator/projection/ub_duckdb_operator_projection.cpp +5 -0
  217. package/src/duckdb/src/execution/operator/scan/ub_duckdb_operator_scan.cpp +7 -0
  218. package/src/duckdb/src/execution/operator/schema/ub_duckdb_operator_schema.cpp +12 -0
  219. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +25 -0
  220. package/src/duckdb/src/execution/operator/set/ub_duckdb_operator_set.cpp +4 -0
  221. package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +4 -4
  222. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +2 -2
  223. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +2 -2
  224. package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +7 -17
  225. package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +10 -0
  226. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +7 -0
  227. package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +45 -13
  228. package/src/duckdb/src/execution/physical_plan/ub_duckdb_physical_plan.cpp +44 -0
  229. package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -3
  230. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +13 -12
  231. package/src/duckdb/src/execution/ub_duckdb_execution.cpp +15 -0
  232. package/src/duckdb/src/execution/window_executor.cpp +71 -61
  233. package/src/duckdb/src/execution/window_segment_tree.cpp +6 -6
  234. package/src/duckdb/src/extension_forward_decl/icu.cpp +59 -0
  235. package/src/duckdb/src/function/aggregate/algebraic/ub_duckdb_aggr_algebraic.cpp +5 -0
  236. package/src/duckdb/src/function/aggregate/distributive/first.cpp +2 -2
  237. package/src/duckdb/src/function/aggregate/distributive/ub_duckdb_aggr_distr.cpp +3 -0
  238. package/src/duckdb/src/function/aggregate/holistic/ub_duckdb_aggr_holistic.cpp +5 -0
  239. package/src/duckdb/src/function/aggregate/nested/ub_duckdb_aggr_nested.cpp +3 -0
  240. package/src/duckdb/src/function/aggregate/regression/ub_duckdb_aggr_regr.cpp +8 -0
  241. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +3 -2
  242. package/src/duckdb/src/function/aggregate/ub_duckdb_func_aggr.cpp +3 -0
  243. package/src/duckdb/src/function/cast/array_casts.cpp +2 -4
  244. package/src/duckdb/src/function/cast/bit_cast.cpp +13 -13
  245. package/src/duckdb/src/function/cast/cast_function_set.cpp +2 -0
  246. package/src/duckdb/src/function/cast/decimal_cast.cpp +38 -44
  247. package/src/duckdb/src/function/cast/default_casts.cpp +5 -2
  248. package/src/duckdb/src/function/cast/enum_casts.cpp +5 -5
  249. package/src/duckdb/src/function/cast/list_casts.cpp +24 -14
  250. package/src/duckdb/src/function/cast/string_cast.cpp +48 -30
  251. package/src/duckdb/src/function/cast/struct_cast.cpp +2 -2
  252. package/src/duckdb/src/function/cast/time_casts.cpp +12 -0
  253. package/src/duckdb/src/function/cast/ub_duckdb_func_cast.cpp +17 -0
  254. package/src/duckdb/src/function/cast/union/ub_duckdb_union_cast.cpp +2 -0
  255. package/src/duckdb/src/function/cast/union_casts.cpp +13 -15
  256. package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +1 -1
  257. package/src/duckdb/src/function/cast_rules.cpp +2 -1
  258. package/src/duckdb/src/function/pragma/ub_duckdb_func_pragma.cpp +3 -0
  259. package/src/duckdb/src/function/scalar/bit/ub_duckdb_func_bit.cpp +2 -0
  260. package/src/duckdb/src/function/scalar/blob/ub_duckdb_func_blob.cpp +3 -0
  261. package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +7 -6
  262. package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +3 -3
  263. package/src/duckdb/src/function/scalar/compressed_materialization/ub_duckdb_func_compressed_materialization.cpp +3 -0
  264. package/src/duckdb/src/function/scalar/date/ub_duckdb_func_date.cpp +12 -0
  265. package/src/duckdb/src/function/scalar/enum/ub_duckdb_func_enum.cpp +2 -0
  266. package/src/duckdb/src/function/scalar/generic/ub_duckdb_func_generic.cpp +8 -0
  267. package/src/duckdb/src/function/scalar/generic/ub_duckdb_func_generic_main.cpp +2 -0
  268. package/src/duckdb/src/function/scalar/list/list_resize.cpp +3 -1
  269. package/src/duckdb/src/function/scalar/list/list_zip.cpp +3 -4
  270. package/src/duckdb/src/function/scalar/list/ub_duckdb_func_list.cpp +11 -0
  271. package/src/duckdb/src/function/scalar/list/ub_duckdb_func_list_nested.cpp +5 -0
  272. package/src/duckdb/src/function/scalar/map/ub_duckdb_func_map_nested.cpp +7 -0
  273. package/src/duckdb/src/function/scalar/math/ub_duckdb_func_math.cpp +4 -0
  274. package/src/duckdb/src/function/scalar/nested_functions.cpp +7 -3
  275. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +1 -1
  276. package/src/duckdb/src/function/scalar/operators/multiply.cpp +4 -2
  277. package/src/duckdb/src/function/scalar/operators/subtract.cpp +9 -3
  278. package/src/duckdb/src/function/scalar/operators/ub_duckdb_func_ops.cpp +6 -0
  279. package/src/duckdb/src/function/scalar/operators/ub_duckdb_func_ops_main.cpp +5 -0
  280. package/src/duckdb/src/function/scalar/sequence/ub_duckdb_func_seq.cpp +2 -0
  281. package/src/duckdb/src/function/scalar/strftime_format.cpp +21 -20
  282. package/src/duckdb/src/function/scalar/string/like.cpp +14 -3
  283. package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +4 -2
  284. package/src/duckdb/src/function/scalar/string/regexp/ub_duckdb_func_string_regexp.cpp +3 -0
  285. package/src/duckdb/src/function/scalar/string/regexp.cpp +6 -4
  286. package/src/duckdb/src/function/scalar/string/suffix.cpp +1 -1
  287. package/src/duckdb/src/function/scalar/string/ub_duckdb_func_string.cpp +31 -0
  288. package/src/duckdb/src/function/scalar/string/ub_duckdb_func_string_main.cpp +12 -0
  289. package/src/duckdb/src/function/scalar/struct/ub_duckdb_func_struct.cpp +4 -0
  290. package/src/duckdb/src/function/scalar/struct/ub_duckdb_func_struct_main.cpp +2 -0
  291. package/src/duckdb/src/function/scalar/system/ub_duckdb_func_system.cpp +2 -0
  292. package/src/duckdb/src/function/scalar/ub_duckdb_func_scalar.cpp +9 -0
  293. package/src/duckdb/src/function/scalar/union/ub_duckdb_func_union.cpp +4 -0
  294. package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +28 -2
  295. package/src/duckdb/src/function/table/arrow/ub_duckdb_arrow_conversion.cpp +2 -0
  296. package/src/duckdb/src/function/table/arrow.cpp +23 -6
  297. package/src/duckdb/src/function/table/arrow_conversion.cpp +75 -33
  298. package/src/duckdb/src/function/table/copy_csv.cpp +8 -3
  299. package/src/duckdb/src/function/table/range.cpp +5 -0
  300. package/src/duckdb/src/function/table/read_csv.cpp +9 -8
  301. package/src/duckdb/src/function/table/read_file.cpp +1 -1
  302. package/src/duckdb/src/function/table/sniff_csv.cpp +5 -5
  303. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +6 -2
  304. package/src/duckdb/src/function/table/system/duckdb_secrets.cpp +5 -1
  305. package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +3 -1
  306. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +13 -1
  307. package/src/duckdb/src/function/table/system/test_all_types.cpp +64 -0
  308. package/src/duckdb/src/function/table/system/ub_duckdb_table_func_system.cpp +23 -0
  309. package/src/duckdb/src/function/table/ub_duckdb_func_table.cpp +16 -0
  310. package/src/duckdb/src/function/table/version/pragma_version.cpp +11 -2
  311. package/src/duckdb/src/function/table/version/ub_duckdb_func_table_version.cpp +2 -0
  312. package/src/duckdb/src/function/ub_duckdb_function.cpp +14 -0
  313. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +11 -1
  314. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -0
  315. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +1 -1
  316. package/src/duckdb/src/include/duckdb/common/allocator.hpp +8 -11
  317. package/src/duckdb/src/include/duckdb/common/arrow/appender/enum_data.hpp +2 -2
  318. package/src/duckdb/src/include/duckdb/common/arrow/appender/fixed_size_list_data.hpp +14 -0
  319. package/src/duckdb/src/include/duckdb/common/arrow/appender/list.hpp +1 -0
  320. package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +1 -1
  321. package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +2 -2
  322. package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +2 -2
  323. package/src/duckdb/src/include/duckdb/common/bswap.hpp +6 -2
  324. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
  325. package/src/duckdb/src/include/duckdb/common/enums/catalog_lookup_behavior.hpp +21 -0
  326. package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +0 -1
  327. package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -1
  328. package/src/duckdb/src/include/duckdb/common/enums/prepared_statement_mode.hpp +20 -0
  329. package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +2 -0
  330. package/src/duckdb/src/include/duckdb/common/exception/conversion_exception.hpp +6 -0
  331. package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +4 -0
  332. package/src/duckdb/src/include/duckdb/common/exception.hpp +2 -0
  333. package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +3 -3
  334. package/src/duckdb/src/include/duckdb/common/file_opener.hpp +6 -5
  335. package/src/duckdb/src/include/duckdb/common/file_system.hpp +4 -2
  336. package/src/duckdb/src/include/duckdb/common/helper.hpp +7 -0
  337. package/src/duckdb/src/include/duckdb/common/limits.hpp +2 -2
  338. package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +3 -0
  339. package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +64 -0
  340. package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +34 -33
  341. package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +150 -124
  342. package/src/duckdb/src/include/duckdb/common/operator/integer_cast_operator.hpp +5 -5
  343. package/src/duckdb/src/include/duckdb/common/radix.hpp +1 -1
  344. package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +1 -1
  345. package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +4 -4
  346. package/src/duckdb/src/include/duckdb/common/types/bit.hpp +1 -1
  347. package/src/duckdb/src/include/duckdb/common/types/blob.hpp +4 -1
  348. package/src/duckdb/src/include/duckdb/common/types/cast_helpers.hpp +15 -13
  349. package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +5 -0
  350. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +2 -0
  351. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +3 -0
  352. package/src/duckdb/src/include/duckdb/common/types/column/partitioned_column_data.hpp +1 -1
  353. package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +1 -1
  354. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +4 -1
  355. package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +2 -1
  356. package/src/duckdb/src/include/duckdb/common/types/string_heap.hpp +2 -0
  357. package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +11 -4
  358. package/src/duckdb/src/include/duckdb/common/types/time.hpp +1 -1
  359. package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +7 -2
  360. package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +3 -0
  361. package/src/duckdb/src/include/duckdb/common/types/value.hpp +7 -0
  362. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +40 -7
  363. package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +1 -1
  364. package/src/duckdb/src/include/duckdb/common/types.hpp +1 -1
  365. package/src/duckdb/src/include/duckdb/common/vector_operations/general_cast.hpp +12 -4
  366. package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +6 -6
  367. package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +3 -2
  368. package/src/duckdb/src/include/duckdb/common/windows_undefs.hpp +4 -0
  369. package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_count.hpp +1 -1
  370. package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +9 -0
  371. package/src/duckdb/src/include/duckdb/execution/column_binding_resolver.hpp +2 -1
  372. package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -0
  373. package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -1
  374. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +262 -0
  375. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/column_count_scanner.hpp +70 -0
  376. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer.hpp +103 -0
  377. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +74 -0
  378. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_casting.hpp +154 -0
  379. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +130 -0
  380. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +60 -0
  381. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +70 -0
  382. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +155 -0
  383. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +166 -0
  384. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_sniffer.hpp +191 -0
  385. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +30 -0
  386. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +99 -0
  387. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine_cache.hpp +91 -0
  388. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +80 -0
  389. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/quote_rules.hpp +21 -0
  390. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner_boundary.hpp +93 -0
  391. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/skip_scanner.hpp +60 -0
  392. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine_options.hpp +35 -0
  393. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +200 -0
  394. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +13 -10
  395. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +5 -11
  396. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +4 -6
  397. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_verify_vector.hpp +51 -0
  398. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +3 -0
  399. package/src/duckdb/src/include/duckdb/execution/operator/persistent/batch_memory_manager.hpp +165 -0
  400. package/src/duckdb/src/include/duckdb/execution/operator/persistent/batch_task_manager.hpp +48 -0
  401. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +10 -17
  402. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +4 -0
  403. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -0
  404. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +10 -6
  405. package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +0 -2
  406. package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +2 -1
  407. package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +1 -1
  408. package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +1 -0
  409. package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +14 -5
  410. package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +27 -43
  411. package/src/duckdb/src/include/duckdb/function/compression_function.hpp +4 -4
  412. package/src/duckdb/src/include/duckdb/function/copy_function.hpp +3 -3
  413. package/src/duckdb/src/include/duckdb/function/function.hpp +1 -1
  414. package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +1 -0
  415. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
  416. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +1 -1
  417. package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +10 -4
  418. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +8 -6
  419. package/src/duckdb/src/include/duckdb/function/table_function.hpp +3 -3
  420. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +3 -0
  421. package/src/duckdb/src/include/duckdb/main/capi/cast/from_decimal.hpp +6 -4
  422. package/src/duckdb/src/include/duckdb/main/capi/cast/to_decimal.hpp +17 -10
  423. package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
  424. package/src/duckdb/src/include/duckdb/main/client_context.hpp +17 -3
  425. package/src/duckdb/src/include/duckdb/main/client_context_file_opener.hpp +2 -2
  426. package/src/duckdb/src/include/duckdb/main/client_context_state.hpp +20 -0
  427. package/src/duckdb/src/include/duckdb/main/client_data.hpp +1 -1
  428. package/src/duckdb/src/include/duckdb/main/database.hpp +3 -2
  429. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +2 -1
  430. package/src/duckdb/src/include/duckdb/main/extension/generated_extension_loader.hpp +1 -1
  431. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +230 -199
  432. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +18 -0
  433. package/src/duckdb/src/include/duckdb/main/relation/read_csv_relation.hpp +1 -1
  434. package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +2 -0
  435. package/src/duckdb/src/include/duckdb/main/relation.hpp +1 -1
  436. package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +4 -0
  437. package/src/duckdb/src/include/duckdb/main/settings.hpp +54 -10
  438. package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_manager.hpp +2 -1
  439. package/src/duckdb/src/include/duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp +2 -0
  440. package/src/duckdb/src/include/duckdb/parallel/concurrentqueue.hpp +21 -5
  441. package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
  442. package/src/duckdb/src/include/duckdb/parallel/executor_task.hpp +37 -0
  443. package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +1 -1
  444. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +1 -1
  445. package/src/duckdb/src/include/duckdb/parallel/task.hpp +0 -20
  446. package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +4 -2
  447. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +10 -0
  448. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +2 -1
  449. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +0 -24
  450. package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_column_info.hpp +46 -0
  451. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +2 -0
  452. package/src/duckdb/src/include/duckdb/parser/parsed_data/extra_drop_info.hpp +1 -1
  453. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +3 -2
  454. package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +3 -3
  455. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +3 -3
  456. package/src/duckdb/src/include/duckdb/planner/binder.hpp +11 -4
  457. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +59 -23
  458. package/src/duckdb/src/include/duckdb/planner/expression.hpp +1 -0
  459. package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +2 -2
  460. package/src/duckdb/src/include/duckdb/planner/expression_iterator.hpp +11 -3
  461. package/src/duckdb/src/include/duckdb/planner/extension_callback.hpp +6 -0
  462. package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +0 -1
  463. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -1
  464. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +5 -9
  465. package/src/duckdb/src/include/duckdb/planner/subquery/rewrite_correlated_expressions.hpp +0 -15
  466. package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +5 -0
  467. package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +40 -5
  468. package/src/duckdb/src/include/duckdb/storage/compression/alp/algorithm/alp.hpp +1 -1
  469. package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +5 -1
  470. package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +4 -4
  471. package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_utils.hpp +2 -1
  472. package/src/duckdb/src/include/duckdb/storage/compression/alprd/algorithm/alprd.hpp +10 -8
  473. package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +5 -1
  474. package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +3 -3
  475. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/bit_reader.hpp +11 -10
  476. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/bit_utils.hpp +3 -1
  477. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp128.hpp +1 -1
  478. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/leading_zero_buffer.hpp +5 -3
  479. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +2 -1
  480. package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +1 -1
  481. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +3 -1
  482. package/src/duckdb/src/include/duckdb/storage/index.hpp +1 -1
  483. package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +1 -1
  484. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +3 -0
  485. package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -1
  486. package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +0 -2
  487. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +1 -1
  488. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +5 -3
  489. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
  490. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +5 -0
  491. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +9 -2
  492. package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +2 -6
  493. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +3 -3
  494. package/src/duckdb/src/include/duckdb/storage/temporary_file_manager.hpp +169 -0
  495. package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +11 -1
  496. package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -1
  497. package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +1 -1
  498. package/src/duckdb/src/include/duckdb.h +119 -67
  499. package/src/duckdb/src/main/appender.cpp +2 -1
  500. package/src/duckdb/src/main/attached_database.cpp +49 -27
  501. package/src/duckdb/src/main/capi/appender-c.cpp +1 -1
  502. package/src/duckdb/src/main/capi/cast/ub_duckdb_main_capi_cast.cpp +3 -0
  503. package/src/duckdb/src/main/capi/cast/utils-c.cpp +1 -1
  504. package/src/duckdb/src/main/capi/data_chunk-c.cpp +9 -1
  505. package/src/duckdb/src/main/capi/datetime-c.cpp +14 -8
  506. package/src/duckdb/src/main/capi/duckdb_value-c.cpp +29 -2
  507. package/src/duckdb/src/main/capi/helper-c.cpp +2 -0
  508. package/src/duckdb/src/main/capi/hugeint-c.cpp +2 -1
  509. package/src/duckdb/src/main/capi/logical_types-c.cpp +35 -1
  510. package/src/duckdb/src/main/capi/result-c.cpp +9 -0
  511. package/src/duckdb/src/main/capi/ub_duckdb_main_capi.cpp +19 -0
  512. package/src/duckdb/src/main/chunk_scan_state/ub_duckdb_main_chunk_scan_state.cpp +2 -0
  513. package/src/duckdb/src/main/client_context.cpp +133 -33
  514. package/src/duckdb/src/main/client_context_file_opener.cpp +8 -7
  515. package/src/duckdb/src/main/config.cpp +2 -0
  516. package/src/duckdb/src/main/connection_manager.cpp +8 -0
  517. package/src/duckdb/src/main/database.cpp +13 -4
  518. package/src/duckdb/src/main/database_manager.cpp +10 -1
  519. package/src/duckdb/src/main/extension/extension_helper.cpp +8 -5
  520. package/src/duckdb/src/main/extension/extension_install.cpp +1 -1
  521. package/src/duckdb/src/main/extension/ub_duckdb_main_extension.cpp +6 -0
  522. package/src/duckdb/src/main/prepared_statement_data.cpp +23 -6
  523. package/src/duckdb/src/main/query_profiler.cpp +9 -7
  524. package/src/duckdb/src/main/relation/read_csv_relation.cpp +17 -12
  525. package/src/duckdb/src/main/relation/ub_duckdb_main_relation.cpp +26 -0
  526. package/src/duckdb/src/main/relation/value_relation.cpp +2 -0
  527. package/src/duckdb/src/main/secret/secret.cpp +1 -1
  528. package/src/duckdb/src/main/secret/secret_manager.cpp +41 -8
  529. package/src/duckdb/src/main/secret/secret_storage.cpp +8 -2
  530. package/src/duckdb/src/main/settings/settings.cpp +42 -2
  531. package/src/duckdb/src/main/settings/ub_duckdb_main_settings.cpp +2 -0
  532. package/src/duckdb/src/main/ub_duckdb_main.cpp +25 -0
  533. package/src/duckdb/src/optimizer/compressed_materialization/ub_duckdb_optimizer_compressed_materialization.cpp +4 -0
  534. package/src/duckdb/src/optimizer/filter_combiner.cpp +20 -14
  535. package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +5 -1
  536. package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +23 -11
  537. package/src/duckdb/src/optimizer/join_order/ub_duckdb_optimizer_join_order.cpp +12 -0
  538. package/src/duckdb/src/optimizer/matcher/ub_duckdb_optimizer_matcher.cpp +2 -0
  539. package/src/duckdb/src/optimizer/pullup/ub_duckdb_optimizer_pullup.cpp +6 -0
  540. package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +1 -1
  541. package/src/duckdb/src/optimizer/pushdown/ub_duckdb_optimizer_pushdown.cpp +12 -0
  542. package/src/duckdb/src/optimizer/remove_unused_columns.cpp +7 -6
  543. package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +8 -6
  544. package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +1 -1
  545. package/src/duckdb/src/optimizer/rule/ub_duckdb_optimizer_rules.cpp +16 -0
  546. package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +71 -1
  547. package/src/duckdb/src/optimizer/statistics/expression/ub_duckdb_optimizer_statistics_expr.cpp +11 -0
  548. package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +1 -1
  549. package/src/duckdb/src/optimizer/statistics/operator/propagate_limit.cpp +5 -1
  550. package/src/duckdb/src/optimizer/statistics/operator/ub_duckdb_optimizer_statistics_op.cpp +11 -0
  551. package/src/duckdb/src/optimizer/topn_optimizer.cpp +12 -11
  552. package/src/duckdb/src/optimizer/ub_duckdb_optimizer.cpp +20 -0
  553. package/src/duckdb/src/parallel/executor.cpp +8 -19
  554. package/src/duckdb/src/parallel/executor_task.cpp +6 -2
  555. package/src/duckdb/src/parallel/pipeline.cpp +12 -6
  556. package/src/duckdb/src/parallel/pipeline_executor.cpp +1 -1
  557. package/src/duckdb/src/parallel/pipeline_finish_event.cpp +2 -2
  558. package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -2
  559. package/src/duckdb/src/parallel/task_scheduler.cpp +15 -8
  560. package/src/duckdb/src/parallel/ub_duckdb_parallel.cpp +15 -0
  561. package/src/duckdb/src/parser/constraints/ub_duckdb_constraints.cpp +5 -0
  562. package/src/duckdb/src/parser/expression/ub_duckdb_expression.cpp +18 -0
  563. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +0 -18
  564. package/src/duckdb/src/parser/parsed_data/comment_on_column_info.cpp +44 -0
  565. package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +1 -0
  566. package/src/duckdb/src/parser/parsed_data/extra_drop_info.cpp +2 -0
  567. package/src/duckdb/src/parser/parsed_data/ub_duckdb_parsed_data.cpp +24 -0
  568. package/src/duckdb/src/parser/parser.cpp +1 -1
  569. package/src/duckdb/src/parser/query_error_context.cpp +15 -1
  570. package/src/duckdb/src/parser/query_node/ub_duckdb_query_node.cpp +5 -0
  571. package/src/duckdb/src/parser/statement/export_statement.cpp +2 -1
  572. package/src/duckdb/src/parser/statement/relation_statement.cpp +2 -2
  573. package/src/duckdb/src/parser/statement/ub_duckdb_statement.cpp +25 -0
  574. package/src/duckdb/src/parser/tableref/pivotref.cpp +3 -3
  575. package/src/duckdb/src/parser/tableref/showref.cpp +2 -0
  576. package/src/duckdb/src/parser/tableref/ub_duckdb_parser_tableref.cpp +8 -0
  577. package/src/duckdb/src/parser/transform/constraint/ub_duckdb_transformer_constraint.cpp +2 -0
  578. package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +1 -1
  579. package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +10 -2
  580. package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +7 -7
  581. package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +2 -1
  582. package/src/duckdb/src/parser/transform/expression/ub_duckdb_transformer_expression.cpp +20 -0
  583. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +2 -2
  584. package/src/duckdb/src/parser/transform/helpers/ub_duckdb_transformer_helpers.cpp +8 -0
  585. package/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp +3 -8
  586. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +3 -1
  587. package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +2 -3
  588. package/src/duckdb/src/parser/transform/statement/ub_duckdb_transformer_statement.cpp +37 -0
  589. package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +16 -0
  590. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +49 -32
  591. package/src/duckdb/src/parser/transform/tableref/ub_duckdb_transformer_tableref.cpp +8 -0
  592. package/src/duckdb/src/parser/ub_duckdb_parser.cpp +15 -0
  593. package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +11 -4
  594. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +4 -1
  595. package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +71 -5
  596. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +35 -1
  597. package/src/duckdb/src/planner/binder/expression/ub_duckdb_bind_expression.cpp +20 -0
  598. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +55 -51
  599. package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +1 -11
  600. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +2 -2
  601. package/src/duckdb/src/planner/binder/query_node/ub_duckdb_bind_query_node.cpp +12 -0
  602. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +12 -6
  603. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +1 -1
  604. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +8 -2
  605. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +6 -3
  606. package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +13 -2
  607. package/src/duckdb/src/planner/binder/statement/ub_duckdb_bind_statement.cpp +26 -0
  608. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +15 -4
  609. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +9 -2
  610. package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +93 -45
  611. package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +6 -1
  612. package/src/duckdb/src/planner/binder/tableref/ub_duckdb_bind_tableref.cpp +17 -0
  613. package/src/duckdb/src/planner/binder.cpp +22 -23
  614. package/src/duckdb/src/planner/bound_result_modifier.cpp +67 -4
  615. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +5 -1
  616. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +3 -0
  617. package/src/duckdb/src/planner/expression/ub_duckdb_planner_expression.cpp +19 -0
  618. package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +14 -9
  619. package/src/duckdb/src/planner/expression_binder/having_binder.cpp +17 -9
  620. package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +61 -37
  621. package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +8 -4
  622. package/src/duckdb/src/planner/expression_binder/ub_duckdb_expression_binders.cpp +20 -0
  623. package/src/duckdb/src/planner/expression_binder/where_binder.cpp +3 -2
  624. package/src/duckdb/src/planner/expression_iterator.cpp +73 -52
  625. package/src/duckdb/src/planner/filter/ub_duckdb_planner_filter.cpp +4 -0
  626. package/src/duckdb/src/planner/logical_operator_visitor.cpp +4 -14
  627. package/src/duckdb/src/planner/operator/logical_limit.cpp +14 -6
  628. package/src/duckdb/src/planner/operator/ub_duckdb_planner_operator.cpp +43 -0
  629. package/src/duckdb/src/planner/parsed_data/ub_duckdb_planner_parsed_data.cpp +2 -0
  630. package/src/duckdb/src/planner/planner.cpp +3 -0
  631. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +46 -18
  632. package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +39 -33
  633. package/src/duckdb/src/planner/subquery/ub_duckdb_planner_subquery.cpp +4 -0
  634. package/src/duckdb/src/planner/ub_duckdb_planner.cpp +15 -0
  635. package/src/duckdb/src/storage/arena_allocator.cpp +9 -0
  636. package/src/duckdb/src/storage/buffer/block_handle.cpp +7 -2
  637. package/src/duckdb/src/storage/buffer/block_manager.cpp +7 -3
  638. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +121 -24
  639. package/src/duckdb/src/storage/buffer/ub_duckdb_storage_buffer.cpp +6 -0
  640. package/src/duckdb/src/storage/checkpoint/ub_duckdb_storage_checkpoint.cpp +5 -0
  641. package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +4 -4
  642. package/src/duckdb/src/storage/compression/chimp/ub_duckdb_storage_compression_chimp.cpp +6 -0
  643. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +6 -5
  644. package/src/duckdb/src/storage/compression/fsst.cpp +3 -2
  645. package/src/duckdb/src/storage/compression/rle.cpp +1 -1
  646. package/src/duckdb/src/storage/compression/string_uncompressed.cpp +4 -4
  647. package/src/duckdb/src/storage/compression/ub_duckdb_storage_compression.cpp +12 -0
  648. package/src/duckdb/src/storage/data_table.cpp +6 -3
  649. package/src/duckdb/src/storage/local_storage.cpp +5 -2
  650. package/src/duckdb/src/storage/metadata/metadata_manager.cpp +4 -4
  651. package/src/duckdb/src/storage/metadata/metadata_reader.cpp +1 -1
  652. package/src/duckdb/src/storage/metadata/metadata_writer.cpp +1 -1
  653. package/src/duckdb/src/storage/metadata/ub_duckdb_storage_metadata.cpp +4 -0
  654. package/src/duckdb/src/storage/partial_block_manager.cpp +1 -1
  655. package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +2 -0
  656. package/src/duckdb/src/storage/serialization/serialize_expression.cpp +3 -0
  657. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +5 -29
  658. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +22 -4
  659. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +12 -32
  660. package/src/duckdb/src/storage/serialization/ub_duckdb_storage_serialization.cpp +16 -0
  661. package/src/duckdb/src/storage/standard_buffer_manager.cpp +29 -397
  662. package/src/duckdb/src/storage/statistics/string_stats.cpp +1 -1
  663. package/src/duckdb/src/storage/statistics/ub_duckdb_storage_statistics.cpp +10 -0
  664. package/src/duckdb/src/storage/storage_info.cpp +1 -1
  665. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +3 -3
  666. package/src/duckdb/src/storage/table/column_data.cpp +7 -16
  667. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +4 -1
  668. package/src/duckdb/src/storage/table/column_segment.cpp +68 -78
  669. package/src/duckdb/src/storage/table/list_column_data.cpp +1 -0
  670. package/src/duckdb/src/storage/table/row_group.cpp +17 -7
  671. package/src/duckdb/src/storage/table/row_group_collection.cpp +28 -27
  672. package/src/duckdb/src/storage/table/ub_duckdb_storage_table.cpp +17 -0
  673. package/src/duckdb/src/storage/table/update_segment.cpp +7 -7
  674. package/src/duckdb/src/storage/temporary_file_manager.cpp +334 -0
  675. package/src/duckdb/src/storage/ub_duckdb_storage.cpp +20 -0
  676. package/src/duckdb/src/storage/write_ahead_log.cpp +3 -2
  677. package/src/duckdb/src/transaction/commit_state.cpp +4 -2
  678. package/src/duckdb/src/transaction/duck_transaction_manager.cpp +32 -17
  679. package/src/duckdb/src/transaction/meta_transaction.cpp +24 -0
  680. package/src/duckdb/src/transaction/transaction_context.cpp +0 -9
  681. package/src/duckdb/src/transaction/ub_duckdb_transaction.cpp +11 -0
  682. package/src/duckdb/src/transaction/undo_buffer.cpp +1 -1
  683. package/src/duckdb/third_party/jaro_winkler/details/common.hpp +1 -1
  684. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +2 -0
  685. package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +1032 -551
  686. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +24122 -24304
  687. package/src/duckdb/third_party/mbedtls/include/mbedtls/mbedtls_config.h +0 -3
  688. package/src/duckdb/third_party/mbedtls/library/entropy_poll.cpp +32 -4
  689. package/src/duckdb/third_party/miniz/miniz_wrapper.hpp +4 -4
  690. package/src/duckdb/third_party/tdigest/t_digest.hpp +3 -3
  691. package/src/duckdb/ub_src_common_arrow_appender.cpp +2 -0
  692. package/src/duckdb/ub_src_common_exception.cpp +2 -0
  693. package/src/duckdb/ub_src_execution_operator_helper.cpp +2 -0
  694. package/src/duckdb/ub_src_execution_operator_persistent.cpp +0 -2
  695. package/src/duckdb/ub_src_execution_physical_plan.cpp +0 -2
  696. package/src/duckdb/ub_src_parser_parsed_data.cpp +1 -1
  697. package/src/duckdb/ub_src_planner_operator.cpp +0 -2
  698. package/src/duckdb/ub_src_storage.cpp +2 -0
  699. package/test/columns.test.ts +1 -1
  700. package/test/test_all_types.test.ts +1 -1
@@ -25,11 +25,12 @@ public:
25
25
  vector<uint16_t> definition_levels;
26
26
  vector<uint16_t> repetition_levels;
27
27
  vector<bool> is_empty;
28
+ idx_t null_count = 0;
28
29
 
29
30
  public:
30
31
  template <class TARGET>
31
32
  TARGET &Cast() {
32
- D_ASSERT(dynamic_cast<TARGET *>(this));
33
+ DynamicCastCheck<TARGET>(this);
33
34
  return reinterpret_cast<TARGET &>(*this);
34
35
  }
35
36
  template <class TARGET>
@@ -51,7 +52,7 @@ public:
51
52
  public:
52
53
  template <class TARGET>
53
54
  TARGET &Cast() {
54
- D_ASSERT(dynamic_cast<TARGET *>(this));
55
+ DynamicCastCheck<TARGET>(this);
55
56
  return reinterpret_cast<TARGET &>(*this);
56
57
  }
57
58
  template <class TARGET>
@@ -74,8 +75,6 @@ public:
74
75
  idx_t max_repeat;
75
76
  idx_t max_define;
76
77
  bool can_have_nulls;
77
- // collected stats
78
- idx_t null_count;
79
78
 
80
79
  public:
81
80
  //! Create the column writer for a specific type recursively
@@ -47,7 +47,6 @@ struct ParquetReadBindData : public TableFunctionData {
47
47
  shared_ptr<ParquetReader> initial_reader;
48
48
  vector<string> files;
49
49
  atomic<idx_t> chunk_count;
50
- atomic<idx_t> cur_file;
51
50
  vector<string> names;
52
51
  vector<LogicalType> types;
53
52
 
@@ -96,7 +95,7 @@ struct ParquetReadGlobalState : public GlobalTableFunctionState {
96
95
  bool error_opening_file = false;
97
96
 
98
97
  //! Index of file currently up for scanning
99
- idx_t file_index;
98
+ atomic<idx_t> file_index;
100
99
  //! Index of row group within file currently up for scanning
101
100
  idx_t row_group_index;
102
101
  //! Batch index of the next row group to be scanned
@@ -389,10 +388,15 @@ public:
389
388
  // missing metadata entry in cache, no usable stats
390
389
  return nullptr;
391
390
  }
392
- auto handle = fs.OpenFile(file_name, FileFlags::FILE_FLAGS_READ);
393
- // we need to check if the metadata cache entries are current
394
- if (fs.GetLastModifiedTime(*handle) >= metadata->read_time) {
395
- // missing or invalid metadata entry in cache, no usable stats overall
391
+ if (!fs.IsRemoteFile(file_name)) {
392
+ auto handle = fs.OpenFile(file_name, FileFlags::FILE_FLAGS_READ);
393
+ // we need to check if the metadata cache entries are current
394
+ if (fs.GetLastModifiedTime(*handle) >= metadata->read_time) {
395
+ // missing or invalid metadata entry in cache, no usable stats overall
396
+ return nullptr;
397
+ }
398
+ } else {
399
+ // for remote files we just avoid reading stats entirely
396
400
  return nullptr;
397
401
  }
398
402
  ParquetReader reader(context, bind_data.parquet_options, metadata);
@@ -484,15 +488,16 @@ public:
484
488
  static double ParquetProgress(ClientContext &context, const FunctionData *bind_data_p,
485
489
  const GlobalTableFunctionState *global_state) {
486
490
  auto &bind_data = bind_data_p->Cast<ParquetReadBindData>();
491
+ auto &gstate = global_state->Cast<ParquetReadGlobalState>();
487
492
  if (bind_data.files.empty()) {
488
493
  return 100.0;
489
494
  }
490
495
  if (bind_data.initial_file_cardinality == 0) {
491
- return (100.0 * (bind_data.cur_file + 1)) / bind_data.files.size();
496
+ return (100.0 * (gstate.file_index + 1)) / bind_data.files.size();
492
497
  }
493
- auto percentage = std::min(
498
+ auto percentage = MinValue<double>(
494
499
  100.0, (bind_data.chunk_count * STANDARD_VECTOR_SIZE * 100.0 / bind_data.initial_file_cardinality));
495
- return (percentage + 100.0 * bind_data.cur_file) / bind_data.files.size();
500
+ return (percentage + 100.0 * gstate.file_index) / bind_data.files.size();
496
501
  }
497
502
 
498
503
  static unique_ptr<LocalTableFunctionState>
@@ -43,10 +43,20 @@ Int96 TimestampToImpalaTimestamp(timestamp_t &ts) {
43
43
  timestamp_t ParquetTimestampMicrosToTimestamp(const int64_t &raw_ts) {
44
44
  return Timestamp::FromEpochMicroSeconds(raw_ts);
45
45
  }
46
+
46
47
  timestamp_t ParquetTimestampMsToTimestamp(const int64_t &raw_ts) {
48
+ timestamp_t input(raw_ts);
49
+ if (!Timestamp::IsFinite(input)) {
50
+ return input;
51
+ }
47
52
  return Timestamp::FromEpochMs(raw_ts);
48
53
  }
54
+
49
55
  timestamp_t ParquetTimestampNsToTimestamp(const int64_t &raw_ts) {
56
+ timestamp_t input(raw_ts);
57
+ if (!Timestamp::IsFinite(input)) {
58
+ return input;
59
+ }
50
60
  return Timestamp::FromEpochNanoSeconds(raw_ts);
51
61
  }
52
62
 
@@ -170,6 +170,10 @@ CopyTypeSupport ParquetWriter::TypeIsSupported(const LogicalType &type) {
170
170
  auto &child_type = ListType::GetChildType(type);
171
171
  return TypeIsSupported(child_type);
172
172
  }
173
+ if (id == LogicalTypeId::ARRAY) {
174
+ auto &child_type = ArrayType::GetChildType(type);
175
+ return TypeIsSupported(child_type);
176
+ }
173
177
  if (id == LogicalTypeId::UNION) {
174
178
  auto count = UnionType::GetMemberCount(type);
175
179
  for (idx_t i = 0; i < count; i++) {
@@ -469,14 +469,52 @@ void Catalog::AutoloadExtensionByConfigName(ClientContext &context, const string
469
469
  throw Catalog::UnrecognizedConfigurationError(context, configuration_name);
470
470
  }
471
471
 
472
+ static bool IsAutoloadableFunction(CatalogType type) {
473
+ return (type == CatalogType::TABLE_FUNCTION_ENTRY || type == CatalogType::SCALAR_FUNCTION_ENTRY ||
474
+ type == CatalogType::AGGREGATE_FUNCTION_ENTRY || type == CatalogType::PRAGMA_FUNCTION_ENTRY);
475
+ }
476
+
477
+ static bool CompareCatalogTypes(CatalogType type_a, CatalogType type_b) {
478
+ if (type_a == type_b) {
479
+ // Types are same
480
+ return true;
481
+ }
482
+ if (!IsAutoloadableFunction(type_a)) {
483
+ D_ASSERT(IsAutoloadableFunction(type_b));
484
+ // Make sure that `type_a` is an autoloadable function
485
+ return CompareCatalogTypes(type_b, type_a);
486
+ }
487
+ if (type_a == CatalogType::TABLE_FUNCTION_ENTRY) {
488
+ // These are all table functions
489
+ return type_b == CatalogType::TABLE_MACRO_ENTRY || type_b == CatalogType::PRAGMA_FUNCTION_ENTRY;
490
+ } else if (type_a == CatalogType::SCALAR_FUNCTION_ENTRY) {
491
+ // These are all scalar functions
492
+ return type_b == CatalogType::MACRO_ENTRY;
493
+ } else if (type_a == CatalogType::PRAGMA_FUNCTION_ENTRY) {
494
+ // These are all table functions
495
+ return type_b == CatalogType::TABLE_MACRO_ENTRY || type_b == CatalogType::TABLE_FUNCTION_ENTRY;
496
+ }
497
+ return false;
498
+ }
499
+
472
500
  bool Catalog::AutoLoadExtensionByCatalogEntry(DatabaseInstance &db, CatalogType type, const string &entry_name) {
473
501
  #ifndef DUCKDB_DISABLE_EXTENSION_LOAD
474
502
  auto &dbconfig = DBConfig::GetConfig(db);
475
503
  if (dbconfig.options.autoload_known_extensions) {
476
504
  string extension_name;
477
- if (type == CatalogType::TABLE_FUNCTION_ENTRY || type == CatalogType::SCALAR_FUNCTION_ENTRY ||
478
- type == CatalogType::AGGREGATE_FUNCTION_ENTRY || type == CatalogType::PRAGMA_FUNCTION_ENTRY) {
479
- extension_name = ExtensionHelper::FindExtensionInEntries(entry_name, EXTENSION_FUNCTIONS);
505
+ if (IsAutoloadableFunction(type)) {
506
+ auto lookup_result = ExtensionHelper::FindExtensionInFunctionEntries(entry_name, EXTENSION_FUNCTIONS);
507
+ if (lookup_result.empty()) {
508
+ return false;
509
+ }
510
+ for (auto &function : lookup_result) {
511
+ auto function_type = function.second;
512
+ // FIXME: what if there are two functions with the same name, from different extensions?
513
+ if (CompareCatalogTypes(type, function_type)) {
514
+ extension_name = function.first;
515
+ break;
516
+ }
517
+ }
480
518
  } else if (type == CatalogType::COPY_FUNCTION_ENTRY) {
481
519
  extension_name = ExtensionHelper::FindExtensionInEntries(entry_name, EXTENSION_COPY_FUNCTIONS);
482
520
  } else if (type == CatalogType::TYPE_ENTRY) {
@@ -533,7 +571,42 @@ CatalogException Catalog::CreateMissingEntryException(ClientContext &context, co
533
571
  string extension_name;
534
572
  if (type == CatalogType::TABLE_FUNCTION_ENTRY || type == CatalogType::SCALAR_FUNCTION_ENTRY ||
535
573
  type == CatalogType::AGGREGATE_FUNCTION_ENTRY || type == CatalogType::PRAGMA_FUNCTION_ENTRY) {
536
- extension_name = ExtensionHelper::FindExtensionInEntries(entry_name, EXTENSION_FUNCTIONS);
574
+ auto lookup_result = ExtensionHelper::FindExtensionInFunctionEntries(entry_name, EXTENSION_FUNCTIONS);
575
+ do {
576
+ if (lookup_result.empty()) {
577
+ break;
578
+ }
579
+ vector<string> other_types;
580
+ string extension_for_error;
581
+ for (auto &function : lookup_result) {
582
+ auto function_type = function.second;
583
+ if (CompareCatalogTypes(type, function_type)) {
584
+ extension_name = function.first;
585
+ break;
586
+ }
587
+ extension_for_error = function.first;
588
+ other_types.push_back(CatalogTypeToString(function_type));
589
+ }
590
+ if (!extension_name.empty()) {
591
+ break;
592
+ }
593
+ if (other_types.size() == 1) {
594
+ auto &function_type = other_types[0];
595
+ auto error =
596
+ CatalogException("%s with name \"%s\" is not in the catalog, a function by this name exists "
597
+ "in the %s extension, but it's of a different type, namely %s",
598
+ CatalogTypeToString(type), entry_name, extension_for_error, function_type);
599
+ return error;
600
+ } else {
601
+ D_ASSERT(!other_types.empty());
602
+ auto list_of_types = StringUtil::Join(other_types, ", ");
603
+ auto error =
604
+ CatalogException("%s with name \"%s\" is not in the catalog, functions with this name exist "
605
+ "in the %s extension, but they are of different types, namely %s",
606
+ CatalogTypeToString(type), entry_name, extension_for_error, list_of_types);
607
+ return error;
608
+ }
609
+ } while (false);
537
610
  } else if (type == CatalogType::TYPE_ENTRY) {
538
611
  extension_name = ExtensionHelper::FindExtensionInEntries(entry_name, EXTENSION_TYPES);
539
612
  } else if (type == CatalogType::COPY_FUNCTION_ENTRY) {
@@ -657,17 +730,28 @@ CatalogEntryLookup Catalog::TryLookupEntry(ClientContext &context, CatalogType t
657
730
  QueryErrorContext error_context) {
658
731
  auto entries = GetCatalogEntries(context, catalog, schema);
659
732
  vector<CatalogLookup> lookups;
733
+ vector<CatalogLookup> final_lookups;
660
734
  lookups.reserve(entries.size());
661
735
  for (auto &entry : entries) {
736
+ optional_ptr<Catalog> catalog_entry;
662
737
  if (if_not_found == OnEntryNotFound::RETURN_NULL) {
663
- auto catalog_entry = Catalog::GetCatalogEntry(context, entry.catalog);
664
- if (!catalog_entry) {
665
- return {nullptr, nullptr, ErrorData()};
666
- }
667
- lookups.emplace_back(*catalog_entry, entry.schema);
738
+ catalog_entry = Catalog::GetCatalogEntry(context, entry.catalog);
668
739
  } else {
669
- lookups.emplace_back(Catalog::GetCatalog(context, entry.catalog), entry.schema);
740
+ catalog_entry = &Catalog::GetCatalog(context, entry.catalog);
741
+ }
742
+ if (!catalog_entry) {
743
+ return {nullptr, nullptr, ErrorData()};
670
744
  }
745
+ D_ASSERT(catalog_entry);
746
+ auto lookup_behavior = catalog_entry->CatalogTypeLookupRule(type);
747
+ if (lookup_behavior == CatalogLookupBehavior::STANDARD) {
748
+ lookups.emplace_back(*catalog_entry, entry.schema);
749
+ } else if (lookup_behavior == CatalogLookupBehavior::LOWER_PRIORITY) {
750
+ final_lookups.emplace_back(*catalog_entry, entry.schema);
751
+ }
752
+ }
753
+ for (auto &lookup : final_lookups) {
754
+ lookups.emplace_back(std::move(lookup));
671
755
  }
672
756
  return Catalog::TryLookupEntry(context, lookups, type, name, if_not_found, error_context);
673
757
  }
@@ -22,6 +22,7 @@
22
22
  #include "duckdb/storage/storage_manager.hpp"
23
23
  #include "duckdb/storage/table_storage_info.hpp"
24
24
  #include "duckdb/common/exception/transaction_exception.hpp"
25
+ #include "duckdb/parser/parsed_data/comment_on_column_info.hpp"
25
26
 
26
27
  namespace duckdb {
27
28
 
@@ -160,6 +161,13 @@ unique_ptr<BaseStatistics> DuckTableEntry::GetStatistics(ClientContext &context,
160
161
 
161
162
  unique_ptr<CatalogEntry> DuckTableEntry::AlterEntry(ClientContext &context, AlterInfo &info) {
162
163
  D_ASSERT(!internal);
164
+
165
+ // Column comments have a special alter type
166
+ if (info.type == AlterType::SET_COLUMN_COMMENT) {
167
+ auto &comment_on_column_info = info.Cast<SetColumnCommentInfo>();
168
+ return SetColumnComment(context, comment_on_column_info);
169
+ }
170
+
163
171
  if (info.type != AlterType::ALTER_TABLE) {
164
172
  throw CatalogException("Can only modify table with ALTER TABLE statement");
165
173
  }
@@ -208,10 +216,6 @@ unique_ptr<CatalogEntry> DuckTableEntry::AlterEntry(ClientContext &context, Alte
208
216
  auto &drop_not_null_info = table_info.Cast<DropNotNullInfo>();
209
217
  return DropNotNull(context, drop_not_null_info);
210
218
  }
211
- case AlterTableType::SET_COLUMN_COMMENT: {
212
- auto &column_comment_info = table_info.Cast<SetColumnCommentInfo>();
213
- return SetColumnComment(context, column_comment_info);
214
- }
215
219
  default:
216
220
  throw InternalException("Unrecognized alter table type!");
217
221
  }
@@ -673,7 +677,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::SetColumnComment(ClientContext &context
673
677
  for (auto &col : columns.Logical()) {
674
678
  auto copy = col.Copy();
675
679
  if (default_idx == col.Logical()) {
676
- copy.SetComment(info.comment);
680
+ copy.SetComment(info.comment_value);
677
681
  }
678
682
  create_info->columns.AddColumn(std::move(copy));
679
683
  }
@@ -217,6 +217,7 @@ static void BindExtraColumns(TableCatalogEntry &table, LogicalGet &get, LogicalP
217
217
  static bool TypeSupportsRegularUpdate(const LogicalType &type) {
218
218
  switch (type.id()) {
219
219
  case LogicalTypeId::LIST:
220
+ case LogicalTypeId::ARRAY:
220
221
  case LogicalTypeId::MAP:
221
222
  case LogicalTypeId::UNION:
222
223
  // lists and maps and unions don't support updates directly
@@ -0,0 +1,16 @@
1
+ // Unity Build generated by CMake
2
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp>
3
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp>
4
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp>
5
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp>
6
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp>
7
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp>
8
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp>
9
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp>
10
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp>
11
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp>
12
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp>
13
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/column_dependency_manager.cpp>
14
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp>
15
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp>
16
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp>
@@ -2,8 +2,10 @@
2
2
 
3
3
  #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
4
4
  #include "duckdb/common/exception.hpp"
5
+ #include "duckdb/common/exception/binder_exception.hpp"
5
6
  #include "duckdb/parser/parsed_data/alter_table_info.hpp"
6
7
  #include "duckdb/parser/parsed_data/create_view_info.hpp"
8
+ #include "duckdb/parser/parsed_data/comment_on_column_info.hpp"
7
9
  #include "duckdb/common/limits.hpp"
8
10
 
9
11
  #include <algorithm>
@@ -19,6 +21,7 @@ void ViewCatalogEntry::Initialize(CreateViewInfo &info) {
19
21
  this->sql = info.sql;
20
22
  this->internal = info.internal;
21
23
  this->comment = info.comment;
24
+ this->column_comments = info.column_comments;
22
25
  }
23
26
 
24
27
  ViewCatalogEntry::ViewCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateViewInfo &info)
@@ -37,11 +40,36 @@ unique_ptr<CreateInfo> ViewCatalogEntry::GetInfo() const {
37
40
  result->types = types;
38
41
  result->temporary = temporary;
39
42
  result->comment = comment;
43
+ result->column_comments = column_comments;
40
44
  return std::move(result);
41
45
  }
42
46
 
43
47
  unique_ptr<CatalogEntry> ViewCatalogEntry::AlterEntry(ClientContext &context, AlterInfo &info) {
44
48
  D_ASSERT(!internal);
49
+
50
+ // Column comments have a special alter type
51
+ if (info.type == AlterType::SET_COLUMN_COMMENT) {
52
+ auto &comment_on_column_info = info.Cast<SetColumnCommentInfo>();
53
+ auto copied_view = Copy(context);
54
+
55
+ for (idx_t i = 0; i < names.size(); i++) {
56
+ const auto &col_name = names[i];
57
+ if (col_name == comment_on_column_info.column_name) {
58
+ auto &copied_view_entry = copied_view->Cast<ViewCatalogEntry>();
59
+
60
+ // If vector is empty, we need to initialize it on setting here
61
+ if (copied_view_entry.column_comments.empty()) {
62
+ copied_view_entry.column_comments = vector<Value>(copied_view_entry.types.size());
63
+ }
64
+
65
+ copied_view_entry.column_comments[i] = comment_on_column_info.comment_value;
66
+ return copied_view;
67
+ }
68
+ }
69
+ throw BinderException("View \"%s\" does not have a column with name \"%s\"", name,
70
+ comment_on_column_info.column_name);
71
+ }
72
+
45
73
  if (info.type != AlterType::ALTER_VIEW) {
46
74
  throw CatalogException("Can only modify view with ALTER VIEW statement");
47
75
  }
@@ -162,6 +162,9 @@ static DefaultMacro internal_macros[] = {
162
162
  // date functions
163
163
  {DEFAULT_SCHEMA, "date_add", {"date", "interval", nullptr}, "date + interval"},
164
164
 
165
+ // regexp functions
166
+ {DEFAULT_SCHEMA, "regexp_split_to_table", {"text", "pattern", nullptr}, "unnest(string_split_regex(text, pattern))"},
167
+
165
168
  // storage helper functions
166
169
  {DEFAULT_SCHEMA, "get_block_size", {"db_name"}, "(SELECT block_size FROM pragma_database_size() WHERE database_name = db_name)"},
167
170
 
@@ -46,11 +46,11 @@ static DefaultView internal_views[] = {
46
46
  {"pg_catalog", "pg_tablespace", "SELECT 0 oid, 'pg_default' spcname, 0 spcowner, NULL spcacl, NULL spcoptions"},
47
47
  {"pg_catalog", "pg_type", "SELECT type_oid oid, format_pg_type(type_name) typname, schema_oid typnamespace, 0 typowner, type_size typlen, false typbyval, CASE WHEN logical_type='ENUM' THEN 'e' else 'b' end typtype, CASE WHEN type_category='NUMERIC' THEN 'N' WHEN type_category='STRING' THEN 'S' WHEN type_category='DATETIME' THEN 'D' WHEN type_category='BOOLEAN' THEN 'B' WHEN type_category='COMPOSITE' THEN 'C' WHEN type_category='USER' THEN 'U' ELSE 'X' END typcategory, false typispreferred, true typisdefined, NULL typdelim, NULL typrelid, NULL typsubscript, NULL typelem, NULL typarray, NULL typinput, NULL typoutput, NULL typreceive, NULL typsend, NULL typmodin, NULL typmodout, NULL typanalyze, 'd' typalign, 'p' typstorage, NULL typnotnull, NULL typbasetype, NULL typtypmod, NULL typndims, NULL typcollation, NULL typdefaultbin, NULL typdefault, NULL typacl FROM duckdb_types() WHERE type_size IS NOT NULL;"},
48
48
  {"pg_catalog", "pg_views", "SELECT schema_name schemaname, view_name viewname, 'duckdb' viewowner, sql definition FROM duckdb_views()"},
49
- {"information_schema", "columns", "SELECT database_name table_catalog, schema_name table_schema, table_name, column_name, column_index ordinal_position, column_default, CASE WHEN is_nullable THEN 'YES' ELSE 'NO' END is_nullable, data_type, character_maximum_length, NULL character_octet_length, numeric_precision, numeric_precision_radix, numeric_scale, NULL datetime_precision, NULL interval_type, NULL interval_precision, NULL character_set_catalog, NULL character_set_schema, NULL character_set_name, NULL collation_catalog, NULL collation_schema, NULL collation_name, NULL domain_catalog, NULL domain_schema, NULL domain_name, NULL udt_catalog, NULL udt_schema, NULL udt_name, NULL scope_catalog, NULL scope_schema, NULL scope_name, NULL maximum_cardinality, NULL dtd_identifier, NULL is_self_referencing, NULL is_identity, NULL identity_generation, NULL identity_start, NULL identity_increment, NULL identity_maximum, NULL identity_minimum, NULL identity_cycle, NULL is_generated, NULL generation_expression, NULL is_updatable FROM duckdb_columns;"},
49
+ {"information_schema", "columns", "SELECT database_name table_catalog, schema_name table_schema, table_name, column_name, column_index ordinal_position, column_default, CASE WHEN is_nullable THEN 'YES' ELSE 'NO' END is_nullable, data_type, character_maximum_length, NULL character_octet_length, numeric_precision, numeric_precision_radix, numeric_scale, NULL datetime_precision, NULL interval_type, NULL interval_precision, NULL character_set_catalog, NULL character_set_schema, NULL character_set_name, NULL collation_catalog, NULL collation_schema, NULL collation_name, NULL domain_catalog, NULL domain_schema, NULL domain_name, NULL udt_catalog, NULL udt_schema, NULL udt_name, NULL scope_catalog, NULL scope_schema, NULL scope_name, NULL maximum_cardinality, NULL dtd_identifier, NULL is_self_referencing, NULL is_identity, NULL identity_generation, NULL identity_start, NULL identity_increment, NULL identity_maximum, NULL identity_minimum, NULL identity_cycle, NULL is_generated, NULL generation_expression, NULL is_updatable, comment AS COLUMN_COMMENT FROM duckdb_columns;"},
50
50
  {"information_schema", "schemata", "SELECT database_name catalog_name, schema_name, 'duckdb' schema_owner, NULL default_character_set_catalog, NULL default_character_set_schema, NULL default_character_set_name, sql sql_path FROM duckdb_schemas()"},
51
- {"information_schema", "tables", "SELECT database_name table_catalog, schema_name table_schema, table_name, CASE WHEN temporary THEN 'LOCAL TEMPORARY' ELSE 'BASE TABLE' END table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'YES' is_insertable_into, 'NO' is_typed, CASE WHEN temporary THEN 'PRESERVE' ELSE NULL END commit_action FROM duckdb_tables() UNION ALL SELECT database_name table_catalog, schema_name table_schema, view_name table_name, 'VIEW' table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'NO' is_insertable_into, 'NO' is_typed, NULL commit_action FROM duckdb_views;"},
51
+ {"information_schema", "tables", "SELECT database_name table_catalog, schema_name table_schema, table_name, CASE WHEN temporary THEN 'LOCAL TEMPORARY' ELSE 'BASE TABLE' END table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'YES' is_insertable_into, 'NO' is_typed, CASE WHEN temporary THEN 'PRESERVE' ELSE NULL END commit_action, comment AS TABLE_COMMENT FROM duckdb_tables() UNION ALL SELECT database_name table_catalog, schema_name table_schema, view_name table_name, 'VIEW' table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'NO' is_insertable_into, 'NO' is_typed, NULL commit_action, comment AS TABLE_COMMENT FROM duckdb_views;"},
52
52
  {"information_schema", "character_sets", "SELECT NULL character_set_catalog, NULL character_set_schema, 'UTF8' character_set_name, 'UCS' character_repertoire, 'UTF8' form_of_use, current_database() default_collate_catalog, 'pg_catalog' default_collate_schema, 'ucs_basic' default_collate_name;"},
53
- {"information_schema", "referential_constraints", "SELECT f.database_name constraint_catalog, f.schema_name constraint_schema, concat(f.source, '_', f.target, '_', f.target_column, '_fkey') constraint_name, current_database() unique_constraint_catalog, c.schema_name unique_constraint_schema, concat(c.table_name, '_', f.target_column, '_', CASE WHEN c.constraint_type == 'UNIQUE' THEN 'key' ELSE 'pkey' END) unique_constraint_name, 'NONE' match_option, 'NO ACTION' update_rule, 'NO ACTION' delete_rule FROM duckdb_constraints() c JOIN (SELECT *, name_extract['source'] source, name_extract['target'] target, name_extract['target_column'] target_column FROM (SELECT *, regexp_extract(constraint_text, 'FOREIGN KEY \\(([a-zA-Z_0-9]+)\\) REFERENCES ([a-zA-Z_0-9]+)\\(([a-zA-Z_0-9]+)\\)', ['source', 'target', 'target_column']) name_extract FROM duckdb_constraints() WHERE constraint_type = 'FOREIGN KEY')) f ON name_extract['target'] = c.table_name AND (c.constraint_type = 'UNIQUE' OR c.constraint_type = 'PRIMARY KEY')"},
53
+ {"information_schema", "referential_constraints", "SELECT f.database_name constraint_catalog, f.schema_name constraint_schema, concat(f.source, '_', f.target, '_', f.target_column, '_fkey') constraint_name, current_database() unique_constraint_catalog, c.schema_name unique_constraint_schema, concat(c.table_name, '_', f.target_column, '_', CASE WHEN c.constraint_type == 'UNIQUE' THEN 'key' ELSE 'pkey' END) unique_constraint_name, 'NONE' match_option, 'NO ACTION' update_rule, 'NO ACTION' delete_rule FROM duckdb_constraints() c JOIN (SELECT *, name_extract['source'] as source, name_extract['target'] as target, name_extract['target_column'] as target_column FROM (SELECT *, regexp_extract(constraint_text, 'FOREIGN KEY \\(([a-zA-Z_0-9]+)\\) REFERENCES ([a-zA-Z_0-9]+)\\(([a-zA-Z_0-9]+)\\)', ['source', 'target', 'target_column']) name_extract FROM duckdb_constraints() WHERE constraint_type = 'FOREIGN KEY')) f ON name_extract['target'] = c.table_name AND (c.constraint_type = 'UNIQUE' OR c.constraint_type = 'PRIMARY KEY')"},
54
54
  {"information_schema", "key_column_usage", "SELECT current_database() constraint_catalog, schema_name constraint_schema, concat(table_name, '_', constraint_column_names[1], CASE constraint_type WHEN 'FOREIGN KEY' THEN '_fkey' WHEN 'PRIMARY KEY' THEN '_pkey' ELSE '_key' END) constraint_name, current_database() table_catalog, schema_name table_schema, table_name, constraint_column_names[1] column_name, 1 ordinal_position, CASE constraint_type WHEN 'FOREIGN KEY' THEN 1 ELSE NULL END position_in_unique_constraint FROM duckdb_constraints() WHERE constraint_type = 'FOREIGN KEY' OR constraint_type = 'PRIMARY KEY' OR constraint_type = 'UNIQUE';"},
55
55
  {"information_schema", "table_constraints", "SELECT current_database() constraint_catalog, schema_name constraint_schema, concat(table_name, '_', CASE WHEN length(constraint_column_names) > 1 THEN NULL ELSE constraint_column_names[1] || '_' END, CASE constraint_type WHEN 'FOREIGN KEY' THEN 'fkey' WHEN 'PRIMARY KEY' THEN 'pkey' WHEN 'UNIQUE' THEN 'key' WHEN 'CHECK' THEN 'check' WHEN 'NOT NULL' THEN 'not_null' END) constraint_name, current_database() table_catalog, schema_name table_schema, table_name, CASE constraint_type WHEN 'NOT NULL' THEN 'CHECK' ELSE constraint_type END constraint_type, 'NO' is_deferrable, 'NO' initially_deferred, 'YES' enforced, 'YES' nulls_distinct FROM duckdb_constraints() WHERE constraint_type = 'PRIMARY KEY' OR constraint_type = 'FOREIGN KEY' OR constraint_type = 'UNIQUE' OR constraint_type = 'CHECK' OR constraint_type = 'NOT NULL';"},
56
56
  {nullptr, nullptr, nullptr}};
@@ -0,0 +1,5 @@
1
+ // Unity Build generated by CMake
2
+ #include </Users/carlo/duckdb/src/catalog/default/default_functions.cpp>
3
+ #include </Users/carlo/duckdb/src/catalog/default/default_schemas.cpp>
4
+ #include </Users/carlo/duckdb/src/catalog/default/default_types.cpp>
5
+ #include </Users/carlo/duckdb/src/catalog/default/default_views.cpp>
@@ -11,9 +11,7 @@ MangledDependencyName DependencyCatalogSet::ApplyPrefix(const MangledEntryName &
11
11
  bool DependencyCatalogSet::CreateEntry(CatalogTransaction transaction, const MangledEntryName &name,
12
12
  unique_ptr<CatalogEntry> value) {
13
13
  auto new_name = ApplyPrefix(name);
14
-
15
- static const DependencyList EMPTY_DEPENDENCIES;
16
- return set.CreateEntry(transaction, new_name.name, std::move(value), EMPTY_DEPENDENCIES);
14
+ return set.CreateEntry(transaction, new_name.name, std::move(value), DependencyList());
17
15
  }
18
16
 
19
17
  CatalogSet::EntryLookup DependencyCatalogSet::GetEntryDetailed(CatalogTransaction transaction,
@@ -27,19 +27,16 @@ static void AssertMangledName(const string &mangled_name, idx_t expected_null_by
27
27
  }
28
28
 
29
29
  MangledEntryName::MangledEntryName(const CatalogEntryInfo &info) {
30
- static const auto NULL_BYTE = string(1, '\0');
31
-
32
30
  auto &type = info.type;
33
31
  auto &schema = info.schema;
34
32
  auto &name = info.name;
35
33
 
36
- this->name = CatalogTypeToString(type) + NULL_BYTE + schema + NULL_BYTE + name;
34
+ this->name = CatalogTypeToString(type) + '\0' + schema + '\0' + name;
37
35
  AssertMangledName(this->name, 2);
38
36
  }
39
37
 
40
38
  MangledDependencyName::MangledDependencyName(const MangledEntryName &from, const MangledEntryName &to) {
41
- static const auto NULL_BYTE = string(1, '\0');
42
- this->name = from.name + NULL_BYTE + to.name;
39
+ this->name = from.name + '\0' + to.name;
43
40
  AssertMangledName(this->name, 5);
44
41
  }
45
42
 
@@ -0,0 +1,10 @@
1
+ // Unity Build generated by CMake
2
+ #include </Users/carlo/duckdb/src/catalog/catalog_entry.cpp>
3
+ #include </Users/carlo/duckdb/src/catalog/catalog.cpp>
4
+ #include </Users/carlo/duckdb/src/catalog/catalog_search_path.cpp>
5
+ #include </Users/carlo/duckdb/src/catalog/catalog_set.cpp>
6
+ #include </Users/carlo/duckdb/src/catalog/catalog_transaction.cpp>
7
+ #include </Users/carlo/duckdb/src/catalog/duck_catalog.cpp>
8
+ #include </Users/carlo/duckdb/src/catalog/dependency_list.cpp>
9
+ #include </Users/carlo/duckdb/src/catalog/dependency_manager.cpp>
10
+ #include </Users/carlo/duckdb/src/catalog/similar_catalog_entry.cpp>
@@ -437,7 +437,7 @@ AdbcStatusCode ConnectionGetInfo(struct AdbcConnection *connection, const uint32
437
437
  duckdb::string results = "";
438
438
 
439
439
  for (size_t i = 0; i < length; i++) {
440
- uint32_t code = info_codes ? info_codes[i] : i;
440
+ auto code = duckdb::NumericCast<uint32_t>(info_codes ? info_codes[i] : i);
441
441
  auto info_code = ConvertToInfoCode(code);
442
442
  switch (info_code) {
443
443
  case AdbcInfoCode::VENDOR_NAME: {
@@ -21,6 +21,7 @@
21
21
  // specific language governing permissions and limitations
22
22
  // under the License.
23
23
 
24
+ #include "duckdb/common/numeric_utils.hpp"
24
25
  #include "duckdb/common/adbc/driver_manager.h"
25
26
  #include "duckdb/common/adbc/adbc.h"
26
27
  #include "duckdb/common/adbc/adbc.hpp"
@@ -513,7 +514,7 @@ std::string AdbcDriverManagerDefaultEntrypoint(const std::string &driver) {
513
514
  // if pos == npos this is the entire filename
514
515
  std::string token = filename.substr(prev, pos - prev);
515
516
  // capitalize first letter
516
- token[0] = std::toupper(static_cast<unsigned char>(token[0]));
517
+ token[0] = duckdb::NumericCast<char>(std::toupper(static_cast<unsigned char>(token[0])));
517
518
 
518
519
  entrypoint += token;
519
520
 
@@ -0,0 +1,5 @@
1
+ // Unity Build generated by CMake
2
+ #include </Users/carlo/duckdb/src/common/adbc/nanoarrow/metadata.cpp>
3
+ #include </Users/carlo/duckdb/src/common/adbc/nanoarrow/schema.cpp>
4
+ #include </Users/carlo/duckdb/src/common/adbc/nanoarrow/allocator.cpp>
5
+ #include </Users/carlo/duckdb/src/common/adbc/nanoarrow/single_batch_array_stream.cpp>
@@ -0,0 +1,3 @@
1
+ // Unity Build generated by CMake
2
+ #include </Users/carlo/duckdb/src/common/adbc/adbc.cpp>
3
+ #include </Users/carlo/duckdb/src/common/adbc/driver_manager.cpp>
@@ -3,6 +3,7 @@
3
3
  #include "duckdb/common/assert.hpp"
4
4
  #include "duckdb/common/atomic.hpp"
5
5
  #include "duckdb/common/exception.hpp"
6
+ #include "duckdb/common/helper.hpp"
6
7
 
7
8
  #include <cstdint>
8
9
 
@@ -95,15 +96,9 @@ PrivateAllocatorData::~PrivateAllocatorData() {
95
96
  //===--------------------------------------------------------------------===//
96
97
  // Allocator
97
98
  //===--------------------------------------------------------------------===//
98
- #ifdef USE_JEMALLOC
99
- Allocator::Allocator()
100
- : Allocator(JemallocExtension::Allocate, JemallocExtension::Free, JemallocExtension::Reallocate, nullptr) {
101
- }
102
- #else
103
99
  Allocator::Allocator()
104
100
  : Allocator(Allocator::DefaultAllocate, Allocator::DefaultFree, Allocator::DefaultReallocate, nullptr) {
105
101
  }
106
- #endif
107
102
 
108
103
  Allocator::Allocator(allocate_function_ptr_t allocate_function_p, free_function_ptr_t free_function_p,
109
104
  reallocate_function_ptr_t reallocate_function_p, unique_ptr<PrivateAllocatorData> private_data_p)
@@ -136,7 +131,7 @@ data_ptr_t Allocator::AllocateData(idx_t size) {
136
131
  private_data->debug_info->AllocateData(result, size);
137
132
  #endif
138
133
  if (!result) {
139
- throw OutOfMemoryException("Failed to allocate block of %llu bytes", size);
134
+ throw OutOfMemoryException("Failed to allocate block of %llu bytes (bad allocation)", size);
140
135
  }
141
136
  return result;
142
137
  }
@@ -169,11 +164,36 @@ data_ptr_t Allocator::ReallocateData(data_ptr_t pointer, idx_t old_size, idx_t s
169
164
  private_data->debug_info->ReallocateData(pointer, new_pointer, old_size, size);
170
165
  #endif
171
166
  if (!new_pointer) {
172
- throw OutOfMemoryException("Failed to re-allocate block of %llu bytes", size);
167
+ throw OutOfMemoryException("Failed to re-allocate block of %llu bytes (bad allocation)", size);
173
168
  }
174
169
  return new_pointer;
175
170
  }
176
171
 
172
+ data_ptr_t Allocator::DefaultAllocate(PrivateAllocatorData *private_data, idx_t size) {
173
+ #ifdef USE_JEMALLOC
174
+ return JemallocExtension::Allocate(private_data, size);
175
+ #else
176
+ return data_ptr_cast(malloc(size));
177
+ #endif
178
+ }
179
+
180
+ void Allocator::DefaultFree(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size) {
181
+ #ifdef USE_JEMALLOC
182
+ JemallocExtension::Free(private_data, pointer, size);
183
+ #else
184
+ free(pointer);
185
+ #endif
186
+ }
187
+
188
+ data_ptr_t Allocator::DefaultReallocate(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t old_size,
189
+ idx_t size) {
190
+ #ifdef USE_JEMALLOC
191
+ return JemallocExtension::Reallocate(private_data, pointer, old_size, size);
192
+ #else
193
+ return data_ptr_cast(realloc(pointer, size));
194
+ #endif
195
+ }
196
+
177
197
  shared_ptr<Allocator> &Allocator::DefaultAllocatorReference() {
178
198
  static shared_ptr<Allocator> DEFAULT_ALLOCATOR = make_shared<Allocator>();
179
199
  return DEFAULT_ALLOCATOR;
@@ -189,6 +209,12 @@ void Allocator::ThreadFlush(idx_t threshold) {
189
209
  #endif
190
210
  }
191
211
 
212
+ void Allocator::FlushAll() {
213
+ #ifdef USE_JEMALLOC
214
+ JemallocExtension::FlushAll();
215
+ #endif
216
+ }
217
+
192
218
  //===--------------------------------------------------------------------===//
193
219
  // Debug Info (extended)
194
220
  //===--------------------------------------------------------------------===//
@@ -0,0 +1,39 @@
1
+ #include "duckdb/common/arrow/arrow_appender.hpp"
2
+ #include "duckdb/common/arrow/appender/fixed_size_list_data.hpp"
3
+
4
+ namespace duckdb {
5
+
6
+ //===--------------------------------------------------------------------===//
7
+ // Arrays
8
+ //===--------------------------------------------------------------------===//
9
+ void ArrowFixedSizeListData::Initialize(ArrowAppendData &result, const LogicalType &type, idx_t capacity) {
10
+ auto &child_type = ArrayType::GetChildType(type);
11
+ auto array_size = ArrayType::GetSize(type);
12
+ auto child_buffer = ArrowAppender::InitializeChild(child_type, capacity * array_size, result.options);
13
+ result.child_data.push_back(std::move(child_buffer));
14
+ }
15
+
16
+ void ArrowFixedSizeListData::Append(ArrowAppendData &append_data, Vector &input, idx_t from, idx_t to,
17
+ idx_t input_size) {
18
+ UnifiedVectorFormat format;
19
+ input.ToUnifiedFormat(input_size, format);
20
+ idx_t size = to - from;
21
+ AppendValidity(append_data, format, from, to);
22
+
23
+ auto array_size = ArrayType::GetSize(input.GetType());
24
+ auto &child_vector = ArrayVector::GetEntry(input);
25
+ auto &child_data = *append_data.child_data[0];
26
+ child_data.append_vector(child_data, child_vector, from * array_size, to * array_size, size * array_size);
27
+ append_data.row_count += size;
28
+ }
29
+
30
+ void ArrowFixedSizeListData::Finalize(ArrowAppendData &append_data, const LogicalType &type, ArrowArray *result) {
31
+ result->n_buffers = 1;
32
+ auto &child_type = ArrayType::GetChildType(type);
33
+ ArrowAppender::AddChildren(append_data, 1);
34
+ result->children = append_data.child_pointers.data();
35
+ result->n_children = 1;
36
+ append_data.child_arrays[0] = *ArrowAppender::FinalizeChild(child_type, std::move(append_data.child_data[0]));
37
+ }
38
+
39
+ } // namespace duckdb