duckdb 0.8.1-dev96.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/binding.gyp +8 -8
  2. package/package.json +3 -1
  3. package/src/duckdb/extension/icu/icu-datepart.cpp +1 -1
  4. package/src/duckdb/extension/icu/icu-extension.cpp +1 -1
  5. package/src/duckdb/extension/icu/icu-makedate.cpp +5 -4
  6. package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
  7. package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp +0 -2
  8. package/src/duckdb/extension/json/buffered_json_reader.cpp +23 -14
  9. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +6 -6
  10. package/src/duckdb/extension/json/include/json_common.hpp +12 -2
  11. package/src/duckdb/extension/json/include/json_scan.hpp +5 -2
  12. package/src/duckdb/extension/json/json_functions/json_contains.cpp +5 -0
  13. package/src/duckdb/extension/json/json_functions/json_create.cpp +10 -10
  14. package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -2
  15. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +2 -2
  16. package/src/duckdb/extension/json/json_functions/json_structure.cpp +5 -3
  17. package/src/duckdb/extension/json/json_functions/json_transform.cpp +11 -11
  18. package/src/duckdb/extension/json/json_functions/read_json.cpp +2 -1
  19. package/src/duckdb/extension/json/json_functions.cpp +6 -3
  20. package/src/duckdb/extension/json/json_scan.cpp +43 -27
  21. package/src/duckdb/extension/parquet/column_reader.cpp +5 -1
  22. package/src/duckdb/extension/parquet/include/decode_utils.hpp +6 -0
  23. package/src/duckdb/extension/parquet/parquet-extension.cpp +26 -1
  24. package/src/duckdb/src/catalog/catalog.cpp +5 -17
  25. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +7 -1
  26. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +121 -0
  27. package/src/duckdb/src/catalog/catalog_search_path.cpp +49 -12
  28. package/src/duckdb/src/catalog/default/default_types.cpp +9 -84
  29. package/src/duckdb/src/common/adbc/adbc.cpp +118 -12
  30. package/src/duckdb/src/common/adbc/driver_manager.cpp +0 -20
  31. package/src/duckdb/src/common/arrow/arrow_converter.cpp +11 -12
  32. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +4 -3
  33. package/src/duckdb/src/common/exception.cpp +4 -1
  34. package/src/duckdb/src/common/exception_format_value.cpp +24 -15
  35. package/src/duckdb/src/common/multi_file_reader.cpp +3 -0
  36. package/src/duckdb/src/common/random_engine.cpp +1 -1
  37. package/src/duckdb/src/common/types/row/row_data_collection_scanner.cpp +5 -4
  38. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +44 -7
  39. package/src/duckdb/src/common/types/time.cpp +2 -8
  40. package/src/duckdb/src/common/types/timestamp.cpp +37 -1
  41. package/src/duckdb/src/common/types/value.cpp +1 -0
  42. package/src/duckdb/src/common/types.cpp +4 -0
  43. package/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp +30 -33
  44. package/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp +0 -4
  45. package/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp +30 -33
  46. package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +52 -65
  47. package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +48 -48
  48. package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +39 -40
  49. package/src/duckdb/src/core_functions/aggregate/distributive/bool.cpp +32 -32
  50. package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +34 -34
  51. package/src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp +30 -31
  52. package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +88 -100
  53. package/src/duckdb/src/core_functions/aggregate/distributive/product.cpp +17 -17
  54. package/src/duckdb/src/core_functions/aggregate/distributive/skew.cpp +25 -27
  55. package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +37 -38
  56. package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +22 -22
  57. package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +44 -80
  58. package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +49 -51
  59. package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +104 -122
  60. package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +57 -93
  61. package/src/duckdb/src/core_functions/aggregate/nested/histogram.cpp +22 -23
  62. package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +18 -19
  63. package/src/duckdb/src/core_functions/aggregate/regression/regr_avg.cpp +16 -18
  64. package/src/duckdb/src/core_functions/aggregate/regression/regr_intercept.cpp +22 -25
  65. package/src/duckdb/src/core_functions/aggregate/regression/regr_r2.cpp +19 -24
  66. package/src/duckdb/src/core_functions/aggregate/regression/regr_sxx_syy.cpp +18 -23
  67. package/src/duckdb/src/core_functions/aggregate/regression/regr_sxy.cpp +14 -18
  68. package/src/duckdb/src/core_functions/function_list.cpp +1 -0
  69. package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +1 -1
  70. package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +3 -0
  71. package/src/duckdb/src/core_functions/scalar/generic/system_functions.cpp +14 -0
  72. package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +1 -1
  73. package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +23 -6
  74. package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +1 -2
  75. package/src/duckdb/src/core_functions/scalar/map/map_concat.cpp +3 -0
  76. package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +3 -3
  77. package/src/duckdb/src/execution/index/art/art.cpp +80 -7
  78. package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +20 -1
  79. package/src/duckdb/src/execution/index/art/leaf.cpp +11 -11
  80. package/src/duckdb/src/execution/index/art/leaf_segment.cpp +10 -0
  81. package/src/duckdb/src/execution/index/art/node.cpp +48 -35
  82. package/src/duckdb/src/execution/index/art/node16.cpp +3 -0
  83. package/src/duckdb/src/execution/index/art/node256.cpp +1 -0
  84. package/src/duckdb/src/execution/index/art/node4.cpp +3 -0
  85. package/src/duckdb/src/execution/index/art/node48.cpp +2 -0
  86. package/src/duckdb/src/execution/index/art/prefix.cpp +2 -0
  87. package/src/duckdb/src/execution/join_hashtable.cpp +2 -0
  88. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +26 -9
  89. package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +5 -2
  90. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +5 -1
  91. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +3 -6
  92. package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +1 -0
  93. package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +8 -3
  94. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +0 -1
  95. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +29 -3
  96. package/src/duckdb/src/execution/reservoir_sample.cpp +18 -4
  97. package/src/duckdb/src/function/aggregate/distributive/count.cpp +159 -21
  98. package/src/duckdb/src/function/aggregate/distributive/first.cpp +67 -74
  99. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +7 -7
  100. package/src/duckdb/src/function/cast/list_casts.cpp +2 -4
  101. package/src/duckdb/src/function/pragma/pragma_queries.cpp +33 -23
  102. package/src/duckdb/src/function/scalar/list/list_extract.cpp +1 -1
  103. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +1 -1
  104. package/src/duckdb/src/function/scalar/string/regexp/regexp_util.cpp +6 -2
  105. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +2 -2
  106. package/src/duckdb/src/function/table/arrow.cpp +2 -2
  107. package/src/duckdb/src/function/table/checkpoint.cpp +3 -0
  108. package/src/duckdb/src/function/table/read_csv.cpp +15 -17
  109. package/src/duckdb/src/function/table/repeat.cpp +3 -0
  110. package/src/duckdb/src/function/table/repeat_row.cpp +8 -1
  111. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +4 -4
  112. package/src/duckdb/src/function/table/system/test_vector_types.cpp +81 -25
  113. package/src/duckdb/src/function/table/table_scan.cpp +2 -2
  114. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  115. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +0 -3
  116. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +2 -0
  117. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +11 -1
  118. package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +8 -2
  119. package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +97 -0
  120. package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
  121. package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +2 -3
  122. package/src/duckdb/src/include/duckdb/common/arrow/arrow_options.hpp +8 -1
  123. package/src/duckdb/src/include/duckdb/common/arrow/result_arrow_wrapper.hpp +0 -1
  124. package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +16 -22
  125. package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -0
  126. package/src/duckdb/src/include/duckdb/common/types/time.hpp +2 -0
  127. package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +4 -14
  128. package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +92 -57
  129. package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/corr.hpp +20 -24
  130. package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/covar.hpp +36 -39
  131. package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/stddev.hpp +57 -53
  132. package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_count.hpp +8 -9
  133. package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_slope.hpp +16 -18
  134. package/src/duckdb/src/include/duckdb/core_functions/aggregate/sum_helpers.hpp +7 -8
  135. package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +9 -0
  136. package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +2 -6
  137. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +16 -36
  138. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +10 -4
  139. package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +3 -0
  140. package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +1 -1
  141. package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +2 -0
  142. package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +13 -3
  143. package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +1 -0
  144. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +9 -30
  145. package/src/duckdb/src/include/duckdb/function/aggregate_state.hpp +95 -0
  146. package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -2
  147. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
  148. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -1
  149. package/src/duckdb/src/include/duckdb/function/table_function.hpp +3 -2
  150. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +4 -1
  151. package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +3 -1
  152. package/src/duckdb/src/include/duckdb/main/config.hpp +5 -0
  153. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +1 -0
  154. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +142 -136
  155. package/src/duckdb/src/include/duckdb/main/query_result.hpp +6 -0
  156. package/src/duckdb/src/include/duckdb/main/settings.hpp +19 -0
  157. package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +4 -0
  158. package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +12 -3
  159. package/src/duckdb/src/include/duckdb/parser/parser.hpp +2 -0
  160. package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +1 -1
  161. package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +2 -2
  162. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +0 -2
  163. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +1 -1
  164. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +3 -0
  165. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +1 -1
  166. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +5 -0
  167. package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +6 -2
  168. package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +4 -0
  169. package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +5 -1
  170. package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +5 -1
  171. package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +6 -2
  172. package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +4 -0
  173. package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/byte_reader.hpp +4 -0
  174. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
  175. package/src/duckdb/src/include/duckdb/storage/in_memory_block_manager.hpp +13 -13
  176. package/src/duckdb/src/include/duckdb/storage/index.hpp +4 -2
  177. package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +0 -6
  178. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +1 -1
  179. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -1
  180. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +2 -2
  181. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +2 -1
  182. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +2 -1
  183. package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -1
  184. package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +0 -2
  185. package/src/duckdb/src/main/attached_database.cpp +8 -0
  186. package/src/duckdb/src/main/capi/arrow-c.cpp +4 -4
  187. package/src/duckdb/src/main/capi/config-c.cpp +2 -5
  188. package/src/duckdb/src/main/client_context.cpp +4 -3
  189. package/src/duckdb/src/main/config.cpp +2 -0
  190. package/src/duckdb/src/main/database.cpp +1 -0
  191. package/src/duckdb/src/main/database_manager.cpp +21 -0
  192. package/src/duckdb/src/main/query_result.cpp +6 -2
  193. package/src/duckdb/src/main/settings/settings.cpp +41 -6
  194. package/src/duckdb/src/optimizer/unnest_rewriter.cpp +27 -16
  195. package/src/duckdb/src/parallel/executor.cpp +38 -14
  196. package/src/duckdb/src/parallel/meta_pipeline.cpp +17 -3
  197. package/src/duckdb/src/parser/column_definition.cpp +5 -8
  198. package/src/duckdb/src/parser/parsed_data/create_info.cpp +0 -3
  199. package/src/duckdb/src/parser/parser.cpp +95 -35
  200. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +1 -0
  201. package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +3 -0
  202. package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +0 -2
  203. package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +0 -3
  204. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
  205. package/src/duckdb/src/parser/transformer.cpp +0 -2
  206. package/src/duckdb/src/planner/bind_context.cpp +3 -4
  207. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +0 -2
  208. package/src/duckdb/src/planner/binder/expression/bind_positional_reference_expression.cpp +8 -3
  209. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +31 -15
  210. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +0 -27
  211. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +18 -1
  212. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +0 -25
  213. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +2 -114
  214. package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +6 -1
  215. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +5 -0
  216. package/src/duckdb/src/planner/bound_result_modifier.cpp +14 -0
  217. package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +6 -5
  218. package/src/duckdb/src/planner/expression/bound_default_expression.cpp +7 -1
  219. package/src/duckdb/src/planner/expression.cpp +3 -0
  220. package/src/duckdb/src/planner/expression_binder.cpp +3 -2
  221. package/src/duckdb/src/planner/operator/logical_distinct.cpp +5 -4
  222. package/src/duckdb/src/planner/operator/logical_pivot.cpp +14 -2
  223. package/src/duckdb/src/planner/planner.cpp +5 -15
  224. package/src/duckdb/src/storage/data_table.cpp +10 -8
  225. package/src/duckdb/src/storage/index.cpp +13 -0
  226. package/src/duckdb/src/storage/storage_manager.cpp +6 -0
  227. package/src/duckdb/src/storage/table/column_data.cpp +7 -3
  228. package/src/duckdb/src/storage/table/list_column_data.cpp +5 -4
  229. package/src/duckdb/src/storage/table/row_group.cpp +4 -3
  230. package/src/duckdb/src/storage/table/row_group_collection.cpp +6 -3
  231. package/src/duckdb/src/storage/table/standard_column_data.cpp +4 -3
  232. package/src/duckdb/src/storage/table/struct_column_data.cpp +4 -3
  233. package/src/duckdb/src/storage/wal_replay.cpp +4 -5
  234. package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +0 -1
  235. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +0 -14
  236. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +12828 -12956
  237. package/src/duckdb/third_party/zstd/compress/zstd_compress.cpp +3 -0
  238. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_cwksp.h +4 -0
  239. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +5 -5
  240. package/src/duckdb/ub_src_parser_transform_statement.cpp +0 -2
  241. package/test/extension.test.ts +11 -0
  242. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +0 -46
  243. package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +0 -27
@@ -194,9 +194,7 @@ dtime_t Time::FromTime(int32_t hour, int32_t minute, int32_t second, int32_t mic
194
194
  return dtime_t(result);
195
195
  }
196
196
 
197
- // LCOV_EXCL_START
198
- #ifdef DEBUG
199
- static bool AssertValidTime(int32_t hour, int32_t minute, int32_t second, int32_t microseconds) {
197
+ bool Time::IsValidTime(int32_t hour, int32_t minute, int32_t second, int32_t microseconds) {
200
198
  if (hour < 0 || hour >= 24) {
201
199
  return false;
202
200
  }
@@ -211,8 +209,6 @@ static bool AssertValidTime(int32_t hour, int32_t minute, int32_t second, int32_
211
209
  }
212
210
  return true;
213
211
  }
214
- #endif
215
- // LCOV_EXCL_STOP
216
212
 
217
213
  void Time::Convert(dtime_t dtime, int32_t &hour, int32_t &min, int32_t &sec, int32_t &micros) {
218
214
  int64_t time = dtime.micros;
@@ -223,9 +219,7 @@ void Time::Convert(dtime_t dtime, int32_t &hour, int32_t &min, int32_t &sec, int
223
219
  sec = int32_t(time / Interval::MICROS_PER_SEC);
224
220
  time -= int64_t(sec) * Interval::MICROS_PER_SEC;
225
221
  micros = int32_t(time);
226
- #ifdef DEBUG
227
- D_ASSERT(AssertValidTime(hour, min, sec, micros));
228
- #endif
222
+ D_ASSERT(Time::IsValidTime(hour, min, sec, micros));
229
223
  }
230
224
 
231
225
  dtime_t Time::FromTimeMs(int64_t time_ms) {
@@ -8,6 +8,7 @@
8
8
  #include "duckdb/common/chrono.hpp"
9
9
  #include "duckdb/common/operator/add.hpp"
10
10
  #include "duckdb/common/operator/multiply.hpp"
11
+ #include "duckdb/common/operator/subtract.hpp"
11
12
  #include "duckdb/common/limits.hpp"
12
13
  #include <ctime>
13
14
 
@@ -21,6 +22,38 @@ static_assert(sizeof(timestamp_t) == sizeof(int64_t), "timestamp_t was padded");
21
22
  // Z is optional
22
23
  // ISO 8601
23
24
 
25
+ // arithmetic operators
26
+ timestamp_t timestamp_t::operator+(const double &value) const {
27
+ timestamp_t result;
28
+ if (!TryAddOperator::Operation(this->value, int64_t(value), result.value)) {
29
+ throw OutOfRangeException("Overflow in timestamp addition");
30
+ }
31
+ return result;
32
+ }
33
+
34
+ int64_t timestamp_t::operator-(const timestamp_t &other) const {
35
+ int64_t result;
36
+ if (!TrySubtractOperator::Operation(value, int64_t(other.value), result)) {
37
+ throw OutOfRangeException("Overflow in timestamp subtraction");
38
+ }
39
+ return result;
40
+ }
41
+
42
+ // in-place operators
43
+ timestamp_t &timestamp_t::operator+=(const int64_t &delta) {
44
+ if (!TryAddOperator::Operation(value, delta, value)) {
45
+ throw OutOfRangeException("Overflow in timestamp increment");
46
+ }
47
+ return *this;
48
+ }
49
+
50
+ timestamp_t &timestamp_t::operator-=(const int64_t &delta) {
51
+ if (!TrySubtractOperator::Operation(value, delta, value)) {
52
+ throw OutOfRangeException("Overflow in timestamp decrement");
53
+ }
54
+ return *this;
55
+ }
56
+
24
57
  bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, bool &has_offset, string_t &tz) {
25
58
  idx_t pos;
26
59
  date_t date;
@@ -59,7 +92,10 @@ bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &r
59
92
  pos++;
60
93
  has_offset = true;
61
94
  } else if (Timestamp::TryParseUTCOffset(str, pos, len, hour_offset, minute_offset)) {
62
- result -= hour_offset * Interval::MICROS_PER_HOUR + minute_offset * Interval::MICROS_PER_MINUTE;
95
+ const int64_t delta = hour_offset * Interval::MICROS_PER_HOUR + minute_offset * Interval::MICROS_PER_MINUTE;
96
+ if (!TrySubtractOperator::Operation(result.value, delta, result.value)) {
97
+ return false;
98
+ }
63
99
  has_offset = true;
64
100
  } else {
65
101
  // Parse a time zone: / [A-Za-z0-9/_]+/
@@ -1319,6 +1319,7 @@ string Value::ToSQLString() const {
1319
1319
  case LogicalTypeId::BLOB:
1320
1320
  return "'" + ToString() + "'::" + type_.ToString();
1321
1321
  case LogicalTypeId::VARCHAR:
1322
+ case LogicalTypeId::ENUM:
1322
1323
  return "'" + StringUtil::Replace(ToString(), "'", "''") + "'";
1323
1324
  case LogicalTypeId::STRUCT: {
1324
1325
  string ret = "{";
@@ -559,6 +559,10 @@ bool LogicalType::GetDecimalProperties(uint8_t &width, uint8_t &scale) const {
559
559
  scale = DecimalType::GetScale(*this);
560
560
  break;
561
561
  default:
562
+ // Nonsense values to ensure initialization
563
+ width = 255u;
564
+ scale = 255u;
565
+ // FIXME(carlo): This should be probably a throw, requires checkign the various call-sites
562
566
  return false;
563
567
  }
564
568
  return true;
@@ -59,21 +59,21 @@ public:
59
59
 
60
60
  struct AverageSetOperation {
61
61
  template <class STATE>
62
- static void Initialize(STATE *state) {
63
- state->Initialize();
62
+ static void Initialize(STATE &state) {
63
+ state.Initialize();
64
64
  }
65
65
  template <class STATE>
66
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
67
- target->Combine(source);
66
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
67
+ target.Combine(source);
68
68
  }
69
69
  template <class STATE>
70
- static void AddValues(STATE *state, idx_t count) {
71
- state->count += count;
70
+ static void AddValues(STATE &state, idx_t count) {
71
+ state.count += count;
72
72
  }
73
73
  };
74
74
 
75
75
  template <class T>
76
- static T GetAverageDivident(uint64_t count, FunctionData *bind_data) {
76
+ static T GetAverageDivident(uint64_t count, optional_ptr<FunctionData> bind_data) {
77
77
  T divident = T(count);
78
78
  if (bind_data) {
79
79
  auto &avg_bind_data = bind_data->Cast<AverageDecimalBindData>();
@@ -84,61 +84,58 @@ static T GetAverageDivident(uint64_t count, FunctionData *bind_data) {
84
84
 
85
85
  struct IntegerAverageOperation : public BaseSumOperation<AverageSetOperation, RegularAdd> {
86
86
  template <class T, class STATE>
87
- static void Finalize(Vector &result, AggregateInputData &aggr_input_data, STATE *state, T *target,
88
- ValidityMask &mask, idx_t idx) {
89
- if (state->count == 0) {
90
- mask.SetInvalid(idx);
87
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
88
+ if (state.count == 0) {
89
+ finalize_data.ReturnNull();
91
90
  } else {
92
- double divident = GetAverageDivident<double>(state->count, aggr_input_data.bind_data);
93
- target[idx] = double(state->value) / divident;
91
+ double divident = GetAverageDivident<double>(state.count, finalize_data.input.bind_data);
92
+ target = double(state.value) / divident;
94
93
  }
95
94
  }
96
95
  };
97
96
 
98
97
  struct IntegerAverageOperationHugeint : public BaseSumOperation<AverageSetOperation, HugeintAdd> {
99
98
  template <class T, class STATE>
100
- static void Finalize(Vector &result, AggregateInputData &aggr_input_data, STATE *state, T *target,
101
- ValidityMask &mask, idx_t idx) {
102
- if (state->count == 0) {
103
- mask.SetInvalid(idx);
99
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
100
+ if (state.count == 0) {
101
+ finalize_data.ReturnNull();
104
102
  } else {
105
- long double divident = GetAverageDivident<long double>(state->count, aggr_input_data.bind_data);
106
- target[idx] = Hugeint::Cast<long double>(state->value) / divident;
103
+ long double divident = GetAverageDivident<long double>(state.count, finalize_data.input.bind_data);
104
+ target = Hugeint::Cast<long double>(state.value) / divident;
107
105
  }
108
106
  }
109
107
  };
110
108
 
111
109
  struct HugeintAverageOperation : public BaseSumOperation<AverageSetOperation, RegularAdd> {
112
110
  template <class T, class STATE>
113
- static void Finalize(Vector &result, AggregateInputData &aggr_input_data, STATE *state, T *target,
114
- ValidityMask &mask, idx_t idx) {
115
- if (state->count == 0) {
116
- mask.SetInvalid(idx);
111
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
112
+ if (state.count == 0) {
113
+ finalize_data.ReturnNull();
117
114
  } else {
118
- long double divident = GetAverageDivident<long double>(state->count, aggr_input_data.bind_data);
119
- target[idx] = Hugeint::Cast<long double>(state->value) / divident;
115
+ long double divident = GetAverageDivident<long double>(state.count, finalize_data.input.bind_data);
116
+ target = Hugeint::Cast<long double>(state.value) / divident;
120
117
  }
121
118
  }
122
119
  };
123
120
 
124
121
  struct NumericAverageOperation : public BaseSumOperation<AverageSetOperation, RegularAdd> {
125
122
  template <class T, class STATE>
126
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
127
- if (state->count == 0) {
128
- mask.SetInvalid(idx);
123
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
124
+ if (state.count == 0) {
125
+ finalize_data.ReturnNull();
129
126
  } else {
130
- target[idx] = (state->value / state->count);
127
+ target = state.value / state.count;
131
128
  }
132
129
  }
133
130
  };
134
131
 
135
132
  struct KahanAverageOperation : public BaseSumOperation<AverageSetOperation, KahanAdd> {
136
133
  template <class T, class STATE>
137
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
138
- if (state->count == 0) {
139
- mask.SetInvalid(idx);
134
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
135
+ if (state.count == 0) {
136
+ finalize_data.ReturnNull();
140
137
  } else {
141
- target[idx] = (state->value / state->count) + (state->err / state->count);
138
+ target = (state.value / state.count) + (state.err / state.count);
142
139
  }
143
140
  }
144
141
  };
@@ -1,10 +1,6 @@
1
1
  #include "duckdb/core_functions/aggregate/algebraic_functions.hpp"
2
- #include "duckdb/common/exception.hpp"
3
2
  #include "duckdb/common/types/null_value.hpp"
4
- #include "duckdb/common/vector_operations/vector_operations.hpp"
5
- #include "duckdb/function/function_set.hpp"
6
3
  #include "duckdb/core_functions/aggregate/algebraic/covar.hpp"
7
- #include <cmath>
8
4
 
9
5
  namespace duckdb {
10
6
 
@@ -2,7 +2,6 @@
2
2
  #include "duckdb/common/exception.hpp"
3
3
  #include "duckdb/common/types/hash.hpp"
4
4
  #include "duckdb/common/types/hyperloglog.hpp"
5
- #include "duckdb/common/vector_operations/vector_operations.hpp"
6
5
  #include "duckdb/function/function_set.hpp"
7
6
  #include "duckdb/planner/expression/bound_aggregate_expression.hpp"
8
7
 
@@ -16,52 +15,50 @@ struct ApproxDistinctCountState {
16
15
  delete log;
17
16
  }
18
17
  }
19
- void Resize(idx_t count) {
20
- indices.resize(count);
21
- counts.resize(count);
22
- }
23
18
 
24
19
  HyperLogLog *log;
25
- vector<uint64_t> indices;
26
- vector<uint8_t> counts;
27
20
  };
28
21
 
29
22
  struct ApproxCountDistinctFunction {
30
23
  template <class STATE>
31
- static void Initialize(STATE *state) {
32
- new (state) STATE;
24
+ static void Initialize(STATE &state) {
25
+ state.log = nullptr;
33
26
  }
34
27
 
35
28
  template <class STATE, class OP>
36
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
29
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
37
30
  if (!source.log) {
38
31
  return;
39
32
  }
40
- if (!target->log) {
41
- target->log = new HyperLogLog();
33
+ if (!target.log) {
34
+ target.log = new HyperLogLog();
42
35
  }
43
- D_ASSERT(target->log);
36
+ D_ASSERT(target.log);
44
37
  D_ASSERT(source.log);
45
- auto new_log = target->log->MergePointer(*source.log);
46
- delete target->log;
47
- target->log = new_log;
38
+ auto new_log = target.log->MergePointer(*source.log);
39
+ delete target.log;
40
+ target.log = new_log;
48
41
  }
49
42
 
50
43
  template <class T, class STATE>
51
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
52
- if (state->log) {
53
- target[idx] = state->log->Count();
44
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
45
+ if (state.log) {
46
+ target = state.log->Count();
54
47
  } else {
55
- target[idx] = 0;
48
+ target = 0;
56
49
  }
57
50
  }
58
51
 
59
52
  static bool IgnoreNull() {
60
53
  return true;
61
54
  }
55
+
62
56
  template <class STATE>
63
- static void Destroy(AggregateInputData &aggr_input_data, STATE *state) {
64
- state->~STATE();
57
+ static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
58
+ if (state.log) {
59
+ delete state.log;
60
+ state.log = nullptr;
61
+ }
65
62
  }
66
63
  };
67
64
 
@@ -77,10 +74,11 @@ static void ApproxCountDistinctSimpleUpdateFunction(Vector inputs[], AggregateIn
77
74
  UnifiedVectorFormat vdata;
78
75
  inputs[0].ToUnifiedFormat(count, vdata);
79
76
 
80
- agg_state->Resize(count);
81
- auto indices = agg_state->indices.data();
82
- auto counts = agg_state->counts.data();
83
-
77
+ if (count > STANDARD_VECTOR_SIZE) {
78
+ throw InternalException("ApproxCountDistinct - count must be at most vector size");
79
+ }
80
+ uint64_t indices[STANDARD_VECTOR_SIZE];
81
+ uint8_t counts[STANDARD_VECTOR_SIZE];
84
82
  HyperLogLog::ProcessEntries(vdata, inputs[0].GetType(), indices, counts, count);
85
83
  agg_state->log->AddToLog(vdata, count, indices, counts);
86
84
  }
@@ -93,23 +91,21 @@ static void ApproxCountDistinctUpdateFunction(Vector inputs[], AggregateInputDat
93
91
  state_vector.ToUnifiedFormat(count, sdata);
94
92
  auto states = UnifiedVectorFormat::GetDataNoConst<ApproxDistinctCountState *>(sdata);
95
93
 
96
- uint64_t *indices = nullptr;
97
- uint8_t *counts = nullptr;
98
94
  for (idx_t i = 0; i < count; i++) {
99
95
  auto agg_state = states[sdata.sel->get_index(i)];
100
96
  if (!agg_state->log) {
101
97
  agg_state->log = new HyperLogLog();
102
98
  }
103
- if (i == 0) {
104
- agg_state->Resize(count);
105
- indices = agg_state->indices.data();
106
- counts = agg_state->counts.data();
107
- }
108
99
  }
109
100
 
110
101
  UnifiedVectorFormat vdata;
111
102
  inputs[0].ToUnifiedFormat(count, vdata);
112
103
 
104
+ if (count > STANDARD_VECTOR_SIZE) {
105
+ throw InternalException("ApproxCountDistinct - count must be at most vector size");
106
+ }
107
+ uint64_t indices[STANDARD_VECTOR_SIZE];
108
+ uint8_t counts[STANDARD_VECTOR_SIZE];
113
109
  HyperLogLog::ProcessEntries(vdata, inputs[0].GetType(), indices, counts, count);
114
110
  HyperLogLog::AddToLogs(vdata, count, indices, counts, reinterpret_cast<HyperLogLog ***>(states), sdata.sel);
115
111
  }
@@ -142,6 +138,7 @@ AggregateFunctionSet ApproxCountDistinctFun::GetFunctions() {
142
138
  approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::VARCHAR));
143
139
  approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::TIMESTAMP));
144
140
  approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::TIMESTAMP_TZ));
141
+ approx_count.AddFunction(GetApproxCountDistinctFunction(LogicalType::BLOB));
145
142
  return approx_count;
146
143
  }
147
144
 
@@ -25,8 +25,8 @@ struct ArgMinMaxStateBase {
25
25
  }
26
26
 
27
27
  template <typename T>
28
- static inline void ReadValue(Vector &result, T &arg, T *target, idx_t idx) {
29
- target[idx] = arg;
28
+ static inline void ReadValue(Vector &result, T &arg, T &target) {
29
+ target = arg;
30
30
  }
31
31
 
32
32
  bool is_initialized;
@@ -69,8 +69,8 @@ void ArgMinMaxStateBase::AssignValue(string_t &target, string_t new_value, bool
69
69
  }
70
70
 
71
71
  template <>
72
- void ArgMinMaxStateBase::ReadValue(Vector &result, string_t &arg, string_t *target, idx_t idx) {
73
- target[idx] = StringVector::AddStringOrBlob(result, arg);
72
+ void ArgMinMaxStateBase::ReadValue(Vector &result, string_t &arg, string_t &target) {
73
+ target = StringVector::AddStringOrBlob(result, arg);
74
74
  }
75
75
 
76
76
  template <class A, class B>
@@ -97,54 +97,54 @@ struct ArgMinMaxState : public ArgMinMaxStateBase {
97
97
 
98
98
  template <class COMPARATOR>
99
99
  struct ArgMinMaxBase {
100
+
100
101
  template <class STATE>
101
- static void Destroy(AggregateInputData &aggr_input_data, STATE *state) {
102
- state->~STATE();
102
+ static void Initialize(STATE &state) {
103
+ new (&state) STATE;
103
104
  }
104
105
 
105
106
  template <class STATE>
106
- static void Initialize(STATE *state) {
107
- new (state) STATE;
107
+ static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
108
+ state.~STATE();
108
109
  }
109
110
 
110
111
  template <class A_TYPE, class B_TYPE, class STATE, class OP>
111
- static void Operation(STATE *state, AggregateInputData &, const A_TYPE *x_data, const B_TYPE *y_data,
112
- ValidityMask &amask, ValidityMask &bmask, idx_t xidx, idx_t yidx) {
113
- if (!state->is_initialized) {
114
- STATE::template AssignValue<A_TYPE>(state->arg, x_data[xidx], false);
115
- STATE::template AssignValue<B_TYPE>(state->value, y_data[yidx], false);
116
- state->is_initialized = true;
112
+ static void Operation(STATE &state, const A_TYPE &x, const B_TYPE &y, AggregateBinaryInput &) {
113
+ if (!state.is_initialized) {
114
+ STATE::template AssignValue<A_TYPE>(state.arg, x, false);
115
+ STATE::template AssignValue<B_TYPE>(state.value, y, false);
116
+ state.is_initialized = true;
117
117
  } else {
118
- OP::template Execute<A_TYPE, B_TYPE, STATE>(state, x_data[xidx], y_data[yidx]);
118
+ OP::template Execute<A_TYPE, B_TYPE, STATE>(state, x, y);
119
119
  }
120
120
  }
121
121
 
122
122
  template <class A_TYPE, class B_TYPE, class STATE>
123
- static void Execute(STATE *state, A_TYPE x_data, B_TYPE y_data) {
124
- if (COMPARATOR::Operation(y_data, state->value)) {
125
- STATE::template AssignValue<A_TYPE>(state->arg, x_data, true);
126
- STATE::template AssignValue<B_TYPE>(state->value, y_data, true);
123
+ static void Execute(STATE &state, A_TYPE x_data, B_TYPE y_data) {
124
+ if (COMPARATOR::Operation(y_data, state.value)) {
125
+ STATE::template AssignValue<A_TYPE>(state.arg, x_data, true);
126
+ STATE::template AssignValue<B_TYPE>(state.value, y_data, true);
127
127
  }
128
128
  }
129
129
 
130
130
  template <class STATE, class OP>
131
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
131
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
132
132
  if (!source.is_initialized) {
133
133
  return;
134
134
  }
135
- if (!target->is_initialized || COMPARATOR::Operation(source.value, target->value)) {
136
- STATE::template AssignValue(target->arg, source.arg, target->is_initialized);
137
- STATE::template AssignValue(target->value, source.value, target->is_initialized);
138
- target->is_initialized = true;
135
+ if (!target.is_initialized || COMPARATOR::Operation(source.value, target.value)) {
136
+ STATE::template AssignValue(target.arg, source.arg, target.is_initialized);
137
+ STATE::template AssignValue(target.value, source.value, target.is_initialized);
138
+ target.is_initialized = true;
139
139
  }
140
140
  }
141
141
 
142
142
  template <class T, class STATE>
143
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
144
- if (!state->is_initialized) {
145
- mask.SetInvalid(idx);
143
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
144
+ if (!state.is_initialized) {
145
+ finalize_data.ReturnNull();
146
146
  } else {
147
- STATE::template ReadValue(result, state->arg, target, idx);
147
+ STATE::template ReadValue(finalize_data.result, state.arg, target);
148
148
  }
149
149
  }
150
150
 
@@ -156,14 +156,14 @@ struct ArgMinMaxBase {
156
156
  template <typename COMPARATOR>
157
157
  struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR> {
158
158
  template <class STATE>
159
- static void AssignVector(STATE *state, Vector &arg, const idx_t idx) {
160
- if (!state->is_initialized) {
161
- state->arg = new Vector(arg.GetType());
162
- state->arg->SetVectorType(VectorType::CONSTANT_VECTOR);
159
+ static void AssignVector(STATE &state, Vector &arg, const idx_t idx) {
160
+ if (!state.is_initialized) {
161
+ state.arg = new Vector(arg.GetType());
162
+ state.arg->SetVectorType(VectorType::CONSTANT_VECTOR);
163
163
  }
164
164
  sel_t selv = idx;
165
165
  SelectionVector sel(&selv);
166
- VectorOperations::Copy(arg, *state->arg, sel, 1, 0, 0);
166
+ VectorOperations::Copy(arg, *state.arg, sel, 1, 0, 0);
167
167
  }
168
168
 
169
169
  template <class STATE>
@@ -190,49 +190,37 @@ struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR> {
190
190
  const auto bval = bys[bidx];
191
191
 
192
192
  const auto sidx = sdata.sel->get_index(i);
193
- auto state = states[sidx];
194
- if (!state->is_initialized) {
195
- STATE::template AssignValue<BY_TYPE>(state->value, bval, false);
193
+ auto &state = *states[sidx];
194
+ if (!state.is_initialized) {
195
+ STATE::template AssignValue<BY_TYPE>(state.value, bval, false);
196
196
  AssignVector(state, arg, i);
197
- state->is_initialized = true;
197
+ state.is_initialized = true;
198
198
 
199
- } else if (COMPARATOR::template Operation<BY_TYPE>(bval, state->value)) {
200
- STATE::template AssignValue<BY_TYPE>(state->value, bval, true);
199
+ } else if (COMPARATOR::template Operation<BY_TYPE>(bval, state.value)) {
200
+ STATE::template AssignValue<BY_TYPE>(state.value, bval, true);
201
201
  AssignVector(state, arg, i);
202
202
  }
203
203
  }
204
204
  }
205
205
 
206
206
  template <class STATE, class OP>
207
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
207
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
208
208
  if (!source.is_initialized) {
209
209
  return;
210
210
  }
211
- if (!target->is_initialized || COMPARATOR::Operation(source.value, target->value)) {
212
- STATE::template AssignValue(target->value, source.value, target->is_initialized);
211
+ if (!target.is_initialized || COMPARATOR::Operation(source.value, target.value)) {
212
+ STATE::template AssignValue(target.value, source.value, target.is_initialized);
213
213
  AssignVector(target, *source.arg, 0);
214
- target->is_initialized = true;
214
+ target.is_initialized = true;
215
215
  }
216
216
  }
217
217
 
218
- template <class T, class STATE>
219
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
220
- if (!state->is_initialized) {
221
- // we need to use SetNull here
222
- // since for STRUCT columns only setting the validity mask of the struct is incorrect
223
- // as for a struct column, we need to also set ALL child columns to NULL
224
- switch (result.GetVectorType()) {
225
- case VectorType::FLAT_VECTOR:
226
- FlatVector::SetNull(result, idx, true);
227
- break;
228
- case VectorType::CONSTANT_VECTOR:
229
- ConstantVector::SetNull(result, true);
230
- break;
231
- default:
232
- throw InternalException("Invalid result vector type for nested arg_min/max");
233
- }
218
+ template <class STATE>
219
+ static void Finalize(STATE &state, AggregateFinalizeData &finalize_data) {
220
+ if (!state.is_initialized) {
221
+ finalize_data.ReturnNull();
234
222
  } else {
235
- VectorOperations::Copy(*state->arg, result, 1, 0, idx);
223
+ VectorOperations::Copy(*state.arg, finalize_data.result, 1, 0, finalize_data.result_idx);
236
224
  }
237
225
  }
238
226
 
@@ -247,11 +235,10 @@ struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR> {
247
235
  template <class OP, class ARG_TYPE, class BY_TYPE>
248
236
  AggregateFunction GetVectorArgMinMaxFunctionInternal(const LogicalType &by_type, const LogicalType &type) {
249
237
  using STATE = ArgMinMaxState<ARG_TYPE, BY_TYPE>;
250
- return AggregateFunction({type, by_type}, type, AggregateFunction::StateSize<STATE>,
251
- AggregateFunction::StateInitialize<STATE, OP>, OP::template Update<STATE>,
252
- AggregateFunction::StateCombine<STATE, OP>,
253
- AggregateFunction::StateFinalize<STATE, void, OP>, nullptr, OP::Bind,
254
- AggregateFunction::StateDestroy<STATE, OP>);
238
+ return AggregateFunction(
239
+ {type, by_type}, type, AggregateFunction::StateSize<STATE>, AggregateFunction::StateInitialize<STATE, OP>,
240
+ OP::template Update<STATE>, AggregateFunction::StateCombine<STATE, OP>,
241
+ AggregateFunction::StateVoidFinalize<STATE, OP>, nullptr, OP::Bind, AggregateFunction::StateDestroy<STATE, OP>);
255
242
  }
256
243
 
257
244
  template <class OP, class ARG_TYPE>