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
@@ -42,53 +42,53 @@ static AggregateFunction GetBitfieldUnaryAggregate(LogicalType type) {
42
42
 
43
43
  struct BitwiseOperation {
44
44
  template <class STATE>
45
- static void Initialize(STATE *state) {
45
+ static void Initialize(STATE &state) {
46
46
  // If there are no matching rows, returns a null value.
47
- state->is_set = false;
47
+ state.is_set = false;
48
48
  }
49
49
 
50
50
  template <class INPUT_TYPE, class STATE, class OP>
51
- static void Operation(STATE *state, AggregateInputData &, const INPUT_TYPE *input, ValidityMask &mask, idx_t idx) {
52
- if (!state->is_set) {
53
- OP::template Assign(state, input[idx]);
54
- state->is_set = true;
51
+ static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &) {
52
+ if (!state.is_set) {
53
+ OP::template Assign(state, input);
54
+ state.is_set = true;
55
55
  } else {
56
- OP::template Execute(state, input[idx]);
56
+ OP::template Execute(state, input);
57
57
  }
58
58
  }
59
59
 
60
60
  template <class INPUT_TYPE, class STATE, class OP>
61
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, const INPUT_TYPE *input,
62
- ValidityMask &mask, idx_t count) {
63
- OP::template Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
61
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
62
+ idx_t count) {
63
+ OP::template Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
64
64
  }
65
65
 
66
66
  template <class INPUT_TYPE, class STATE>
67
- static void Assign(STATE *state, INPUT_TYPE input) {
68
- state->value = input;
67
+ static void Assign(STATE &state, INPUT_TYPE input) {
68
+ state.value = input;
69
69
  }
70
70
 
71
71
  template <class STATE, class OP>
72
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
72
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
73
73
  if (!source.is_set) {
74
74
  // source is NULL, nothing to do.
75
75
  return;
76
76
  }
77
- if (!target->is_set) {
77
+ if (!target.is_set) {
78
78
  // target is NULL, use source value directly.
79
79
  OP::template Assign(target, source.value);
80
- target->is_set = true;
80
+ target.is_set = true;
81
81
  } else {
82
82
  OP::template Execute(target, source.value);
83
83
  }
84
84
  }
85
85
 
86
86
  template <class T, class STATE>
87
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
88
- if (!state->is_set) {
89
- mask.SetInvalid(idx);
87
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
88
+ if (!state.is_set) {
89
+ finalize_data.ReturnNull();
90
90
  } else {
91
- target[idx] = state->value;
91
+ target = state.value;
92
92
  }
93
93
  }
94
94
 
@@ -99,61 +99,61 @@ struct BitwiseOperation {
99
99
 
100
100
  struct BitAndOperation : public BitwiseOperation {
101
101
  template <class INPUT_TYPE, class STATE>
102
- static void Execute(STATE *state, INPUT_TYPE input) {
103
- state->value &= input;
102
+ static void Execute(STATE &state, INPUT_TYPE input) {
103
+ state.value &= input;
104
104
  }
105
105
  };
106
106
 
107
107
  struct BitOrOperation : public BitwiseOperation {
108
108
  template <class INPUT_TYPE, class STATE>
109
- static void Execute(STATE *state, INPUT_TYPE input) {
110
- state->value |= input;
109
+ static void Execute(STATE &state, INPUT_TYPE input) {
110
+ state.value |= input;
111
111
  }
112
112
  };
113
113
 
114
114
  struct BitXorOperation : public BitwiseOperation {
115
115
  template <class INPUT_TYPE, class STATE>
116
- static void Execute(STATE *state, INPUT_TYPE input) {
117
- state->value ^= input;
116
+ static void Execute(STATE &state, INPUT_TYPE input) {
117
+ state.value ^= input;
118
118
  }
119
119
 
120
120
  template <class INPUT_TYPE, class STATE, class OP>
121
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, const INPUT_TYPE *input,
122
- ValidityMask &mask, idx_t count) {
121
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
122
+ idx_t count) {
123
123
  for (idx_t i = 0; i < count; i++) {
124
- Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
124
+ Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
125
125
  }
126
126
  }
127
127
  };
128
128
 
129
129
  struct BitStringBitwiseOperation : public BitwiseOperation {
130
130
  template <class STATE>
131
- static void Destroy(AggregateInputData &aggr_input_data, STATE *state) {
132
- if (state->is_set && !state->value.IsInlined()) {
133
- delete[] state->value.GetData();
131
+ static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
132
+ if (state.is_set && !state.value.IsInlined()) {
133
+ delete[] state.value.GetData();
134
134
  }
135
135
  }
136
136
 
137
137
  template <class INPUT_TYPE, class STATE>
138
- static void Assign(STATE *state, INPUT_TYPE input) {
139
- D_ASSERT(state->is_set == false);
138
+ static void Assign(STATE &state, INPUT_TYPE input) {
139
+ D_ASSERT(state.is_set == false);
140
140
  if (input.IsInlined()) {
141
- state->value = input;
141
+ state.value = input;
142
142
  } else { // non-inlined string, need to allocate space for it
143
143
  auto len = input.GetSize();
144
144
  auto ptr = new char[len];
145
145
  memcpy(ptr, input.GetData(), len);
146
146
 
147
- state->value = string_t(ptr, len);
147
+ state.value = string_t(ptr, len);
148
148
  }
149
149
  }
150
150
 
151
151
  template <class T, class STATE>
152
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
153
- if (!state->is_set) {
154
- mask.SetInvalid(idx);
152
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
153
+ if (!state.is_set) {
154
+ finalize_data.ReturnNull();
155
155
  } else {
156
- target[idx] = StringVector::AddStringOrBlob(result, state->value);
156
+ target = finalize_data.ReturnString(state.value);
157
157
  }
158
158
  }
159
159
  };
@@ -161,30 +161,30 @@ struct BitStringBitwiseOperation : public BitwiseOperation {
161
161
  struct BitStringAndOperation : public BitStringBitwiseOperation {
162
162
 
163
163
  template <class INPUT_TYPE, class STATE>
164
- static void Execute(STATE *state, INPUT_TYPE input) {
165
- Bit::BitwiseAnd(input, state->value, state->value);
164
+ static void Execute(STATE &state, INPUT_TYPE input) {
165
+ Bit::BitwiseAnd(input, state.value, state.value);
166
166
  }
167
167
  };
168
168
 
169
169
  struct BitStringOrOperation : public BitStringBitwiseOperation {
170
170
 
171
171
  template <class INPUT_TYPE, class STATE>
172
- static void Execute(STATE *state, INPUT_TYPE input) {
173
- Bit::BitwiseOr(input, state->value, state->value);
172
+ static void Execute(STATE &state, INPUT_TYPE input) {
173
+ Bit::BitwiseOr(input, state.value, state.value);
174
174
  }
175
175
  };
176
176
 
177
177
  struct BitStringXorOperation : public BitStringBitwiseOperation {
178
178
  template <class INPUT_TYPE, class STATE>
179
- static void Execute(STATE *state, INPUT_TYPE input) {
180
- Bit::BitwiseXor(input, state->value, state->value);
179
+ static void Execute(STATE &state, INPUT_TYPE input) {
180
+ Bit::BitwiseXor(input, state.value, state.value);
181
181
  }
182
182
 
183
183
  template <class INPUT_TYPE, class STATE, class OP>
184
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, const INPUT_TYPE *input,
185
- ValidityMask &mask, idx_t count) {
184
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
185
+ idx_t count) {
186
186
  for (idx_t i = 0; i < count; i++) {
187
- Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
187
+ Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
188
188
  }
189
189
  }
190
190
  };
@@ -48,49 +48,48 @@ struct BitStringAggOperation {
48
48
  static constexpr const idx_t MAX_BIT_RANGE = 1000000000; // for now capped at 1 billion bits
49
49
 
50
50
  template <class STATE>
51
- static void Initialize(STATE *state) {
52
- state->is_set = false;
51
+ static void Initialize(STATE &state) {
52
+ state.is_set = false;
53
53
  }
54
54
 
55
55
  template <class INPUT_TYPE, class STATE, class OP>
56
- static void Operation(STATE *state, AggregateInputData &data, const INPUT_TYPE *input, ValidityMask &mask,
57
- idx_t idx) {
58
- auto &bind_agg_data = data.bind_data->template Cast<BitstringAggBindData>();
59
- if (!state->is_set) {
56
+ static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input) {
57
+ auto &bind_agg_data = unary_input.input.bind_data->template Cast<BitstringAggBindData>();
58
+ if (!state.is_set) {
60
59
  if (bind_agg_data.min.IsNull() || bind_agg_data.max.IsNull()) {
61
60
  throw BinderException(
62
61
  "Could not retrieve required statistics. Alternatively, try by providing the statistics "
63
62
  "explicitly: BITSTRING_AGG(col, min, max) ");
64
63
  }
65
- state->min = bind_agg_data.min.GetValue<INPUT_TYPE>();
66
- state->max = bind_agg_data.max.GetValue<INPUT_TYPE>();
64
+ state.min = bind_agg_data.min.GetValue<INPUT_TYPE>();
65
+ state.max = bind_agg_data.max.GetValue<INPUT_TYPE>();
67
66
  idx_t bit_range =
68
67
  GetRange(bind_agg_data.min.GetValue<INPUT_TYPE>(), bind_agg_data.max.GetValue<INPUT_TYPE>());
69
68
  if (bit_range > MAX_BIT_RANGE) {
70
69
  throw OutOfRangeException(
71
70
  "The range between min and max value (%s <-> %s) is too large for bitstring aggregation",
72
- NumericHelper::ToString(state->min), NumericHelper::ToString(state->max));
71
+ NumericHelper::ToString(state.min), NumericHelper::ToString(state.max));
73
72
  }
74
73
  idx_t len = Bit::ComputeBitstringLen(bit_range);
75
74
  auto target = len > string_t::INLINE_LENGTH ? string_t(new char[len], len) : string_t(len);
76
75
  Bit::SetEmptyBitString(target, bit_range);
77
76
 
78
- state->value = target;
79
- state->is_set = true;
77
+ state.value = target;
78
+ state.is_set = true;
80
79
  }
81
- if (input[idx] >= state->min && input[idx] <= state->max) {
82
- Execute(state, input[idx], bind_agg_data.min.GetValue<INPUT_TYPE>());
80
+ if (input >= state.min && input <= state.max) {
81
+ Execute(state, input, bind_agg_data.min.GetValue<INPUT_TYPE>());
83
82
  } else {
84
83
  throw OutOfRangeException("Value %s is outside of provided min and max range (%s <-> %s)",
85
- NumericHelper::ToString(input[idx]), NumericHelper::ToString(state->min),
86
- NumericHelper::ToString(state->max));
84
+ NumericHelper::ToString(input), NumericHelper::ToString(state.min),
85
+ NumericHelper::ToString(state.max));
87
86
  }
88
87
  }
89
88
 
90
89
  template <class INPUT_TYPE, class STATE, class OP>
91
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, const INPUT_TYPE *input,
92
- ValidityMask &mask, idx_t count) {
93
- OP::template Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
90
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
91
+ idx_t count) {
92
+ OP::template Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
94
93
  }
95
94
 
96
95
  template <class INPUT_TYPE>
@@ -108,51 +107,51 @@ struct BitStringAggOperation {
108
107
  }
109
108
 
110
109
  template <class INPUT_TYPE, class STATE>
111
- static void Execute(STATE *state, INPUT_TYPE input, INPUT_TYPE min) {
112
- Bit::SetBit(state->value, input - min, 1);
110
+ static void Execute(STATE &state, INPUT_TYPE input, INPUT_TYPE min) {
111
+ Bit::SetBit(state.value, input - min, 1);
113
112
  }
114
113
 
115
114
  template <class STATE, class OP>
116
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
115
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
117
116
  if (!source.is_set) {
118
117
  return;
119
118
  }
120
- if (!target->is_set) {
119
+ if (!target.is_set) {
121
120
  Assign(target, source.value);
122
- target->is_set = true;
123
- target->min = source.min;
124
- target->max = source.max;
121
+ target.is_set = true;
122
+ target.min = source.min;
123
+ target.max = source.max;
125
124
  } else {
126
- Bit::BitwiseOr(source.value, target->value, target->value);
125
+ Bit::BitwiseOr(source.value, target.value, target.value);
127
126
  }
128
127
  }
129
128
 
130
129
  template <class INPUT_TYPE, class STATE>
131
- static void Assign(STATE *state, INPUT_TYPE input) {
132
- D_ASSERT(state->is_set == false);
130
+ static void Assign(STATE &state, INPUT_TYPE input) {
131
+ D_ASSERT(state.is_set == false);
133
132
  if (input.IsInlined()) {
134
- state->value = input;
133
+ state.value = input;
135
134
  } else { // non-inlined string, need to allocate space for it
136
135
  auto len = input.GetSize();
137
136
  auto ptr = new char[len];
138
137
  memcpy(ptr, input.GetData(), len);
139
- state->value = string_t(ptr, len);
138
+ state.value = string_t(ptr, len);
140
139
  }
141
140
  }
142
141
 
143
142
  template <class T, class STATE>
144
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
145
- if (!state->is_set) {
146
- mask.SetInvalid(idx);
143
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
144
+ if (!state.is_set) {
145
+ finalize_data.ReturnNull();
147
146
  } else {
148
- target[idx] = StringVector::AddStringOrBlob(result, state->value);
147
+ target = StringVector::AddStringOrBlob(finalize_data.result, state.value);
149
148
  }
150
149
  }
151
150
 
152
151
  template <class STATE>
153
- static void Destroy(AggregateInputData &aggr_input_data, STATE *state) {
154
- if (state->is_set && !state->value.IsInlined()) {
155
- delete[] state->value.GetData();
152
+ static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
153
+ if (state.is_set && !state.value.IsInlined()) {
154
+ delete[] state.value.GetData();
156
155
  }
157
156
  }
158
157
 
@@ -162,10 +161,10 @@ struct BitStringAggOperation {
162
161
  };
163
162
 
164
163
  template <>
165
- void BitStringAggOperation::Execute(BitAggState<hugeint_t> *state, hugeint_t input, hugeint_t min) {
164
+ void BitStringAggOperation::Execute(BitAggState<hugeint_t> &state, hugeint_t input, hugeint_t min) {
166
165
  idx_t val;
167
166
  if (Hugeint::TryCast(input - min, val)) {
168
- Bit::SetBit(state->value, val, 1);
167
+ Bit::SetBit(state.value, val, 1);
169
168
  } else {
170
169
  throw OutOfRangeException("Range too large for bitstring aggregation");
171
170
  }
@@ -200,7 +199,7 @@ unique_ptr<BaseStatistics> BitstringPropagateStats(ClientContext &context, Bound
200
199
  unique_ptr<FunctionData> BindBitstringAgg(ClientContext &context, AggregateFunction &function,
201
200
  vector<unique_ptr<Expression>> &arguments) {
202
201
  if (arguments.size() == 3) {
203
- if (!arguments[1]->IsFoldable() && !arguments[2]->IsFoldable()) {
202
+ if (!arguments[1]->IsFoldable() || !arguments[2]->IsFoldable()) {
204
203
  throw BinderException("bitstring_agg requires a constant min and max argument");
205
204
  }
206
205
  auto min = ExpressionExecutor::EvaluateScalar(context, *arguments[1]);
@@ -13,37 +13,37 @@ struct BoolState {
13
13
 
14
14
  struct BoolAndFunFunction {
15
15
  template <class STATE>
16
- static void Initialize(STATE *state) {
17
- state->val = true;
18
- state->empty = true;
16
+ static void Initialize(STATE &state) {
17
+ state.val = true;
18
+ state.empty = true;
19
19
  }
20
20
 
21
21
  template <class STATE, class OP>
22
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
23
- target->val = target->val && source.val;
24
- target->empty = target->empty && source.empty;
22
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
23
+ target.val = target.val && source.val;
24
+ target.empty = target.empty && source.empty;
25
25
  }
26
26
 
27
27
  template <class T, class STATE>
28
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
29
- if (state->empty) {
30
- mask.SetInvalid(idx);
28
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
29
+ if (state.empty) {
30
+ finalize_data.ReturnNull();
31
31
  return;
32
32
  }
33
- target[idx] = state->val;
33
+ target = state.val;
34
34
  }
35
35
 
36
36
  template <class INPUT_TYPE, class STATE, class OP>
37
- static void Operation(STATE *state, AggregateInputData &, const INPUT_TYPE *input, ValidityMask &mask, idx_t idx) {
38
- state->empty = false;
39
- state->val = input[idx] && state->val;
37
+ static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input) {
38
+ state.empty = false;
39
+ state.val = input && state.val;
40
40
  }
41
41
 
42
42
  template <class INPUT_TYPE, class STATE, class OP>
43
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, const INPUT_TYPE *input,
44
- ValidityMask &mask, idx_t count) {
43
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
44
+ idx_t count) {
45
45
  for (idx_t i = 0; i < count; i++) {
46
- Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
46
+ Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
47
47
  }
48
48
  }
49
49
  static bool IgnoreNull() {
@@ -53,36 +53,36 @@ struct BoolAndFunFunction {
53
53
 
54
54
  struct BoolOrFunFunction {
55
55
  template <class STATE>
56
- static void Initialize(STATE *state) {
57
- state->val = false;
58
- state->empty = true;
56
+ static void Initialize(STATE &state) {
57
+ state.val = false;
58
+ state.empty = true;
59
59
  }
60
60
 
61
61
  template <class STATE, class OP>
62
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
63
- target->val = target->val || source.val;
64
- target->empty = target->empty && source.empty;
62
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
63
+ target.val = target.val || source.val;
64
+ target.empty = target.empty && source.empty;
65
65
  }
66
66
 
67
67
  template <class T, class STATE>
68
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
69
- if (state->empty) {
70
- mask.SetInvalid(idx);
68
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
69
+ if (state.empty) {
70
+ finalize_data.ReturnNull();
71
71
  return;
72
72
  }
73
- target[idx] = state->val;
73
+ target = state.val;
74
74
  }
75
75
  template <class INPUT_TYPE, class STATE, class OP>
76
- static void Operation(STATE *state, AggregateInputData &, const INPUT_TYPE *input, ValidityMask &mask, idx_t idx) {
77
- state->empty = false;
78
- state->val = input[idx] || state->val;
76
+ static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input) {
77
+ state.empty = false;
78
+ state.val = input || state.val;
79
79
  }
80
80
 
81
81
  template <class INPUT_TYPE, class STATE, class OP>
82
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, INPUT_TYPE *input,
83
- ValidityMask &mask, idx_t count) {
82
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
83
+ idx_t count) {
84
84
  for (idx_t i = 0; i < count; i++) {
85
- Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
85
+ Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
86
86
  }
87
87
  }
88
88
 
@@ -27,38 +27,38 @@ struct EntropyState {
27
27
 
28
28
  struct EntropyFunctionBase {
29
29
  template <class STATE>
30
- static void Initialize(STATE *state) {
31
- state->distinct = nullptr;
32
- state->count = 0;
30
+ static void Initialize(STATE &state) {
31
+ state.distinct = nullptr;
32
+ state.count = 0;
33
33
  }
34
34
 
35
35
  template <class STATE, class OP>
36
- static void Combine(const STATE &source, STATE *target, AggregateInputData &) {
36
+ static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
37
37
  if (!source.distinct) {
38
38
  return;
39
39
  }
40
- if (!target->distinct) {
41
- target->Assign(source);
40
+ if (!target.distinct) {
41
+ target.Assign(source);
42
42
  return;
43
43
  }
44
44
  for (auto &val : *source.distinct) {
45
45
  auto value = val.first;
46
- (*target->distinct)[value] += val.second;
46
+ (*target.distinct)[value] += val.second;
47
47
  }
48
- target->count += source.count;
48
+ target.count += source.count;
49
49
  }
50
50
 
51
51
  template <class T, class STATE>
52
- static void Finalize(Vector &result, AggregateInputData &, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
53
- double count = state->count;
54
- if (state->distinct) {
52
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
53
+ double count = state.count;
54
+ if (state.distinct) {
55
55
  double entropy = 0;
56
- for (auto &val : *state->distinct) {
56
+ for (auto &val : *state.distinct) {
57
57
  entropy += (val.second / count) * log2(count / val.second);
58
58
  }
59
- target[idx] = entropy;
59
+ target = entropy;
60
60
  } else {
61
- target[idx] = 0;
61
+ target = 0;
62
62
  }
63
63
  }
64
64
 
@@ -66,47 +66,47 @@ struct EntropyFunctionBase {
66
66
  return true;
67
67
  }
68
68
  template <class STATE>
69
- static void Destroy(AggregateInputData &aggr_input_data, STATE *state) {
70
- if (state->distinct) {
71
- delete state->distinct;
69
+ static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
70
+ if (state.distinct) {
71
+ delete state.distinct;
72
72
  }
73
73
  }
74
74
  };
75
75
 
76
76
  struct EntropyFunction : EntropyFunctionBase {
77
77
  template <class INPUT_TYPE, class STATE, class OP>
78
- static void Operation(STATE *state, AggregateInputData &, const INPUT_TYPE *input, ValidityMask &mask, idx_t idx) {
79
- if (!state->distinct) {
80
- state->distinct = new unordered_map<INPUT_TYPE, idx_t>();
78
+ static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input) {
79
+ if (!state.distinct) {
80
+ state.distinct = new unordered_map<INPUT_TYPE, idx_t>();
81
81
  }
82
- (*state->distinct)[input[idx]]++;
83
- state->count++;
82
+ (*state.distinct)[input]++;
83
+ state.count++;
84
84
  }
85
85
  template <class INPUT_TYPE, class STATE, class OP>
86
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, INPUT_TYPE *input,
87
- ValidityMask &mask, idx_t count) {
86
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
87
+ idx_t count) {
88
88
  for (idx_t i = 0; i < count; i++) {
89
- Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
89
+ Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
90
90
  }
91
91
  }
92
92
  };
93
93
 
94
94
  struct EntropyFunctionString : EntropyFunctionBase {
95
95
  template <class INPUT_TYPE, class STATE, class OP>
96
- static void Operation(STATE *state, AggregateInputData &, const INPUT_TYPE *input, ValidityMask &mask, idx_t idx) {
97
- if (!state->distinct) {
98
- state->distinct = new unordered_map<string, idx_t>();
96
+ static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input) {
97
+ if (!state.distinct) {
98
+ state.distinct = new unordered_map<string, idx_t>();
99
99
  }
100
- auto value = input[idx].GetString();
101
- (*state->distinct)[value]++;
102
- state->count++;
100
+ auto value = input.GetString();
101
+ (*state.distinct)[value]++;
102
+ state.count++;
103
103
  }
104
104
 
105
105
  template <class INPUT_TYPE, class STATE, class OP>
106
- static void ConstantOperation(STATE *state, AggregateInputData &aggr_input_data, const INPUT_TYPE *input,
107
- ValidityMask &mask, idx_t count) {
106
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &unary_input,
107
+ idx_t count) {
108
108
  for (idx_t i = 0; i < count; i++) {
109
- Operation<INPUT_TYPE, STATE, OP>(state, aggr_input_data, input, mask, 0);
109
+ Operation<INPUT_TYPE, STATE, OP>(state, input, unary_input);
110
110
  }
111
111
  }
112
112
  };