duckdb 0.7.2-dev2706.0 → 0.7.2-dev2820.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/binding.gyp +21 -13
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
  4. package/src/duckdb/extension/json/include/json_functions.hpp +35 -37
  5. package/src/duckdb/extension/json/include/json_scan.hpp +1 -1
  6. package/src/duckdb/extension/json/include/json_transform.hpp +1 -1
  7. package/src/duckdb/extension/json/json-extension.cpp +10 -20
  8. package/src/duckdb/extension/json/json_functions/copy_json.cpp +2 -2
  9. package/src/duckdb/extension/json/json_functions/json_array_length.cpp +2 -3
  10. package/src/duckdb/extension/json/json_functions/json_contains.cpp +2 -2
  11. package/src/duckdb/extension/json/json_functions/json_create.cpp +20 -20
  12. package/src/duckdb/extension/json/json_functions/json_extract.cpp +4 -6
  13. package/src/duckdb/extension/json/json_functions/json_keys.cpp +2 -3
  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 +8 -8
  16. package/src/duckdb/extension/json/json_functions/json_structure.cpp +2 -2
  17. package/src/duckdb/extension/json/json_functions/json_transform.cpp +4 -4
  18. package/src/duckdb/extension/json/json_functions/json_type.cpp +2 -3
  19. package/src/duckdb/extension/json/json_functions/json_valid.cpp +2 -2
  20. package/src/duckdb/extension/json/json_functions/read_json.cpp +6 -6
  21. package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +4 -4
  22. package/src/duckdb/extension/json/json_functions.cpp +6 -6
  23. package/src/duckdb/extension/parquet/parquet-extension.cpp +11 -24
  24. package/src/duckdb/extension/parquet/parquet_metadata.cpp +46 -20
  25. package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +1 -2
  26. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +1 -1
  27. package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +2 -2
  28. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +1 -2
  29. package/src/duckdb/src/catalog/catalog_transaction.cpp +4 -0
  30. package/src/duckdb/src/catalog/duck_catalog.cpp +8 -1
  31. package/src/duckdb/src/common/enums/date_part_specifier.cpp +82 -0
  32. package/src/duckdb/src/common/types/vector.cpp +136 -3
  33. package/src/duckdb/src/{function → core_functions}/aggregate/algebraic/avg.cpp +9 -12
  34. package/src/duckdb/src/core_functions/aggregate/algebraic/corr.cpp +13 -0
  35. package/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp +21 -0
  36. package/src/duckdb/src/core_functions/aggregate/algebraic/stddev.cpp +34 -0
  37. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/approx_count.cpp +3 -3
  38. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/arg_min_max.cpp +7 -23
  39. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bitagg.cpp +10 -10
  40. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bitstring_agg.cpp +4 -4
  41. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bool.cpp +1 -17
  42. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/entropy.cpp +5 -4
  43. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/kurtosis.cpp +5 -6
  44. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/minmax.cpp +5 -5
  45. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/product.cpp +2 -11
  46. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/skew.cpp +5 -6
  47. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/string_agg.cpp +4 -6
  48. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/sum.cpp +38 -46
  49. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/approximate_quantile.cpp +4 -5
  50. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/mode.cpp +4 -5
  51. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/quantile.cpp +31 -23
  52. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/reservoir_quantile.cpp +4 -5
  53. package/src/duckdb/src/{function → core_functions}/aggregate/nested/histogram.cpp +4 -4
  54. package/src/duckdb/src/{function → core_functions}/aggregate/nested/list.cpp +6 -10
  55. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_avg.cpp +7 -11
  56. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_count.cpp +4 -4
  57. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_intercept.cpp +5 -8
  58. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_r2.cpp +5 -7
  59. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_slope.cpp +5 -7
  60. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_sxx_syy.cpp +8 -12
  61. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_sxy.cpp +6 -8
  62. package/src/duckdb/src/core_functions/core_functions.cpp +50 -0
  63. package/src/duckdb/src/core_functions/function_list.cpp +352 -0
  64. package/src/duckdb/src/{function → core_functions}/scalar/bit/bitstring.cpp +12 -15
  65. package/src/duckdb/src/{function → core_functions}/scalar/blob/base64.cpp +6 -6
  66. package/src/duckdb/src/{function → core_functions}/scalar/blob/encode.cpp +7 -6
  67. package/src/duckdb/src/{function → core_functions}/scalar/date/age.cpp +3 -3
  68. package/src/duckdb/src/{function → core_functions}/scalar/date/current.cpp +8 -8
  69. package/src/duckdb/src/{function → core_functions}/scalar/date/date_diff.cpp +3 -6
  70. package/src/duckdb/src/{function → core_functions}/scalar/date/date_part.cpp +144 -148
  71. package/src/duckdb/src/{function → core_functions}/scalar/date/date_sub.cpp +3 -6
  72. package/src/duckdb/src/{function → core_functions}/scalar/date/date_trunc.cpp +3 -6
  73. package/src/duckdb/src/{function → core_functions}/scalar/date/epoch.cpp +7 -8
  74. package/src/duckdb/src/{function → core_functions}/scalar/date/make_date.cpp +14 -14
  75. package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +251 -0
  76. package/src/duckdb/src/{function → core_functions}/scalar/date/time_bucket.cpp +4 -5
  77. package/src/duckdb/src/{function → core_functions}/scalar/date/to_interval.cpp +39 -19
  78. package/src/duckdb/src/{function/scalar/enum/enum_functions_implementation.cpp → core_functions/scalar/enum/enum_functions.cpp} +18 -22
  79. package/src/duckdb/src/{function → core_functions}/scalar/generic/alias.cpp +4 -4
  80. package/src/duckdb/src/{function → core_functions}/scalar/generic/current_setting.cpp +4 -5
  81. package/src/duckdb/src/{function → core_functions}/scalar/generic/error.cpp +4 -4
  82. package/src/duckdb/src/{function → core_functions}/scalar/generic/hash.cpp +4 -4
  83. package/src/duckdb/src/{function → core_functions}/scalar/generic/least.cpp +8 -9
  84. package/src/duckdb/src/{function → core_functions}/scalar/generic/stats.cpp +4 -4
  85. package/src/duckdb/src/{function/scalar/system → core_functions/scalar/generic}/system_functions.cpp +24 -13
  86. package/src/duckdb/src/{function → core_functions}/scalar/generic/typeof.cpp +4 -4
  87. package/src/duckdb/src/{function → core_functions}/scalar/list/array_slice.cpp +3 -13
  88. package/src/duckdb/src/{function → core_functions}/scalar/list/flatten.cpp +5 -5
  89. package/src/duckdb/src/{function → core_functions}/scalar/list/list_aggregates.cpp +2 -13
  90. package/src/duckdb/src/{function → core_functions}/scalar/list/list_lambdas.cpp +9 -24
  91. package/src/duckdb/src/{function → core_functions}/scalar/list/list_sort.cpp +8 -22
  92. package/src/duckdb/src/{function → core_functions}/scalar/list/list_value.cpp +4 -5
  93. package/src/duckdb/src/{function → core_functions}/scalar/list/range.cpp +8 -6
  94. package/src/duckdb/src/{function → core_functions}/scalar/map/cardinality.cpp +5 -4
  95. package/src/duckdb/src/{function → core_functions}/scalar/map/map.cpp +6 -63
  96. package/src/duckdb/src/{function → core_functions}/scalar/map/map_entries.cpp +5 -4
  97. package/src/duckdb/src/{function → core_functions}/scalar/map/map_extract.cpp +22 -7
  98. package/src/duckdb/src/{function → core_functions}/scalar/map/map_from_entries.cpp +6 -5
  99. package/src/duckdb/src/{function → core_functions}/scalar/map/map_keys_values.cpp +8 -7
  100. package/src/duckdb/src/{function → core_functions}/scalar/math/numeric.cpp +110 -138
  101. package/src/duckdb/src/{function → core_functions}/scalar/operators/bitwise.cpp +19 -20
  102. package/src/duckdb/src/{function/scalar/math → core_functions/scalar/random}/random.cpp +5 -6
  103. package/src/duckdb/src/{function/scalar/math → core_functions/scalar/random}/setseed.cpp +3 -3
  104. package/src/duckdb/src/{function → core_functions}/scalar/string/ascii.cpp +4 -5
  105. package/src/duckdb/src/{function → core_functions}/scalar/string/bar.cpp +4 -4
  106. package/src/duckdb/src/{function → core_functions}/scalar/string/chr.cpp +5 -6
  107. package/src/duckdb/src/{function → core_functions}/scalar/string/damerau_levenshtein.cpp +4 -6
  108. package/src/duckdb/src/{function/scalar/string/mismatches.cpp → core_functions/scalar/string/hamming.cpp} +3 -12
  109. package/src/duckdb/src/{function → core_functions}/scalar/string/hex.cpp +15 -25
  110. package/src/duckdb/src/{function → core_functions}/scalar/string/instr.cpp +6 -13
  111. package/src/duckdb/src/{function → core_functions}/scalar/string/jaccard.cpp +3 -6
  112. package/src/duckdb/src/{function → core_functions}/scalar/string/jaro_winkler.cpp +7 -6
  113. package/src/duckdb/src/{function → core_functions}/scalar/string/left_right.cpp +18 -11
  114. package/src/duckdb/src/{function → core_functions}/scalar/string/levenshtein.cpp +3 -12
  115. package/src/duckdb/src/{function → core_functions}/scalar/string/md5.cpp +15 -21
  116. package/src/duckdb/src/{function → core_functions}/scalar/string/pad.cpp +7 -13
  117. package/src/duckdb/src/{function → core_functions}/scalar/string/printf.cpp +10 -10
  118. package/src/duckdb/src/{function → core_functions}/scalar/string/repeat.cpp +3 -6
  119. package/src/duckdb/src/{function → core_functions}/scalar/string/replace.cpp +4 -7
  120. package/src/duckdb/src/{function → core_functions}/scalar/string/reverse.cpp +3 -3
  121. package/src/duckdb/src/{function → core_functions}/scalar/string/starts_with.cpp +4 -8
  122. package/src/duckdb/src/{function → core_functions}/scalar/string/string_split.cpp +11 -11
  123. package/src/duckdb/src/{function → core_functions}/scalar/string/translate.cpp +4 -7
  124. package/src/duckdb/src/{function → core_functions}/scalar/string/trim.cpp +19 -14
  125. package/src/duckdb/src/core_functions/scalar/string/unicode.cpp +28 -0
  126. package/src/duckdb/src/{function → core_functions}/scalar/struct/struct_insert.cpp +4 -4
  127. package/src/duckdb/src/{function → core_functions}/scalar/struct/struct_pack.cpp +3 -4
  128. package/src/duckdb/src/{function → core_functions}/scalar/union/union_extract.cpp +4 -8
  129. package/src/duckdb/src/{function → core_functions}/scalar/union/union_tag.cpp +4 -8
  130. package/src/duckdb/src/{function → core_functions}/scalar/union/union_value.cpp +4 -59
  131. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +1 -1
  132. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1 -1
  133. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +1 -1
  134. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +19 -12
  135. package/src/duckdb/src/function/aggregate/distributive_functions.cpp +0 -17
  136. package/src/duckdb/src/function/cast/string_cast.cpp +1 -1
  137. package/src/duckdb/src/function/function.cpp +0 -8
  138. package/src/duckdb/src/function/function_set.cpp +25 -0
  139. package/src/duckdb/src/function/scalar/generic_functions.cpp +1 -9
  140. package/src/duckdb/src/function/scalar/nested_functions.cpp +0 -22
  141. package/src/duckdb/src/function/scalar/operators.cpp +0 -6
  142. package/src/duckdb/src/function/scalar/{date/strftime.cpp → strftime_format.cpp} +1 -249
  143. package/src/duckdb/src/function/scalar/string/length.cpp +0 -19
  144. package/src/duckdb/src/function/scalar/string_functions.cpp +0 -40
  145. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -0
  146. package/src/duckdb/src/function/table/arrow_conversion.cpp +1 -1
  147. package/src/duckdb/src/function/table/range.cpp +1 -0
  148. package/src/duckdb/src/function/table/repeat_row.cpp +60 -0
  149. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +27 -40
  150. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  151. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +3 -3
  152. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/function_entry.hpp +33 -0
  153. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
  154. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +2 -2
  155. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
  156. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
  157. package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +2 -0
  158. package/src/duckdb/src/include/duckdb/common/algorithm.hpp +1 -0
  159. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +11 -1
  160. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/corr.hpp +3 -4
  161. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/covar.hpp +1 -1
  162. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/stddev.hpp +1 -1
  163. package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic_functions.hpp +124 -0
  164. package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +229 -0
  165. package/src/duckdb/src/include/duckdb/core_functions/aggregate/holistic_functions.hpp +85 -0
  166. package/src/duckdb/src/include/duckdb/core_functions/aggregate/nested_functions.hpp +41 -0
  167. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/regression/regr_count.hpp +3 -4
  168. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/regression/regr_slope.hpp +2 -2
  169. package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression_functions.hpp +97 -0
  170. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/sum_helpers.hpp +1 -1
  171. package/src/duckdb/src/include/duckdb/{function/scalar/uuid_functions.hpp → core_functions/core_functions.hpp} +7 -5
  172. package/src/duckdb/src/include/duckdb/core_functions/function_list.hpp +33 -0
  173. package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +52 -0
  174. package/src/duckdb/src/include/duckdb/core_functions/scalar/blob_functions.hpp +58 -0
  175. package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +544 -0
  176. package/src/duckdb/src/include/duckdb/core_functions/scalar/enum_functions.hpp +61 -0
  177. package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +142 -0
  178. package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +220 -0
  179. package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +85 -0
  180. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +394 -0
  181. package/src/duckdb/src/include/duckdb/core_functions/scalar/operators_functions.hpp +70 -0
  182. package/src/duckdb/src/include/duckdb/core_functions/scalar/random_functions.hpp +49 -0
  183. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +439 -0
  184. package/src/duckdb/src/include/duckdb/core_functions/scalar/struct_functions.hpp +40 -0
  185. package/src/duckdb/src/include/duckdb/core_functions/scalar/union_functions.hpp +43 -0
  186. package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +1 -1
  187. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +1 -1
  188. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +4 -3
  189. package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +0 -85
  190. package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +0 -8
  191. package/src/duckdb/src/include/duckdb/function/function_set.hpp +7 -2
  192. package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +1 -36
  193. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +0 -120
  194. package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +0 -24
  195. package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +1 -97
  196. package/src/duckdb/src/include/duckdb/function/table/range.hpp +4 -0
  197. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -1
  198. package/src/duckdb/src/include/duckdb/main/extension_util.hpp +48 -0
  199. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +6 -0
  200. package/src/duckdb/src/main/extension/extension_helper.cpp +1 -0
  201. package/src/duckdb/src/main/extension/extension_load.cpp +48 -4
  202. package/src/duckdb/src/main/extension/extension_util.cpp +90 -0
  203. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +6 -7
  204. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +5 -4
  205. package/src/duckdb/ub_src_common_enums.cpp +2 -0
  206. package/src/duckdb/ub_src_core_functions.cpp +4 -0
  207. package/src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp +8 -0
  208. package/src/duckdb/ub_src_core_functions_aggregate_distributive.cpp +24 -0
  209. package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +8 -0
  210. package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +4 -0
  211. package/src/duckdb/ub_src_core_functions_aggregate_regression.cpp +14 -0
  212. package/src/duckdb/ub_src_core_functions_scalar_bit.cpp +2 -0
  213. package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +4 -0
  214. package/src/duckdb/ub_src_core_functions_scalar_date.cpp +22 -0
  215. package/src/duckdb/ub_src_core_functions_scalar_enum.cpp +2 -0
  216. package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +16 -0
  217. package/src/duckdb/ub_src_core_functions_scalar_list.cpp +14 -0
  218. package/src/duckdb/ub_src_core_functions_scalar_map.cpp +12 -0
  219. package/src/duckdb/ub_src_core_functions_scalar_math.cpp +2 -0
  220. package/src/duckdb/ub_src_core_functions_scalar_operators.cpp +2 -0
  221. package/src/duckdb/ub_src_core_functions_scalar_random.cpp +4 -0
  222. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +44 -0
  223. package/src/duckdb/ub_src_core_functions_scalar_struct.cpp +4 -0
  224. package/src/duckdb/ub_src_core_functions_scalar_union.cpp +6 -0
  225. package/src/duckdb/ub_src_function_aggregate.cpp +0 -8
  226. package/src/duckdb/ub_src_function_aggregate_distributive.cpp +0 -24
  227. package/src/duckdb/ub_src_function_scalar.cpp +2 -8
  228. package/src/duckdb/ub_src_function_scalar_generic.cpp +0 -14
  229. package/src/duckdb/ub_src_function_scalar_list.cpp +0 -14
  230. package/src/duckdb/ub_src_function_scalar_operators.cpp +0 -2
  231. package/src/duckdb/ub_src_function_scalar_string.cpp +0 -42
  232. package/src/duckdb/ub_src_function_scalar_struct.cpp +0 -4
  233. package/src/duckdb/ub_src_function_scalar_system.cpp +0 -2
  234. package/src/duckdb/ub_src_function_table.cpp +2 -0
  235. package/src/duckdb/ub_src_main_extension.cpp +2 -0
  236. package/src/duckdb/src/function/aggregate/algebraic/corr.cpp +0 -14
  237. package/src/duckdb/src/function/aggregate/algebraic/covar.cpp +0 -25
  238. package/src/duckdb/src/function/aggregate/algebraic/stddev.cpp +0 -54
  239. package/src/duckdb/src/function/aggregate/algebraic_functions.cpp +0 -21
  240. package/src/duckdb/src/function/aggregate/holistic_functions.cpp +0 -12
  241. package/src/duckdb/src/function/aggregate/nested_functions.cpp +0 -10
  242. package/src/duckdb/src/function/aggregate/regression_functions.cpp +0 -21
  243. package/src/duckdb/src/function/scalar/date_functions.cpp +0 -22
  244. package/src/duckdb/src/function/scalar/enum_functions.cpp +0 -13
  245. package/src/duckdb/src/function/scalar/math_functions.cpp +0 -50
  246. package/src/duckdb/src/function/scalar/trigonometrics_functions.cpp +0 -18
  247. package/src/duckdb/src/include/duckdb/function/aggregate/algebraic_functions.hpp +0 -56
  248. package/src/duckdb/src/include/duckdb/function/aggregate/holistic_functions.hpp +0 -33
  249. package/src/duckdb/src/include/duckdb/function/aggregate/nested_functions.hpp +0 -26
  250. package/src/duckdb/src/include/duckdb/function/aggregate/regression_functions.hpp +0 -53
  251. package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +0 -32
  252. package/src/duckdb/src/include/duckdb/function/scalar/blob_functions.hpp +0 -24
  253. package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +0 -73
  254. package/src/duckdb/src/include/duckdb/function/scalar/enum_functions.hpp +0 -37
  255. package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +0 -137
  256. package/src/duckdb/src/include/duckdb/function/scalar/trigonometric_functions.hpp +0 -49
  257. package/src/duckdb/ub_src_function_aggregate_algebraic.cpp +0 -8
  258. package/src/duckdb/ub_src_function_aggregate_holistic.cpp +0 -8
  259. package/src/duckdb/ub_src_function_aggregate_nested.cpp +0 -4
  260. package/src/duckdb/ub_src_function_aggregate_regression.cpp +0 -14
  261. package/src/duckdb/ub_src_function_scalar_bit.cpp +0 -2
  262. package/src/duckdb/ub_src_function_scalar_blob.cpp +0 -4
  263. package/src/duckdb/ub_src_function_scalar_date.cpp +0 -22
  264. package/src/duckdb/ub_src_function_scalar_enum.cpp +0 -2
  265. package/src/duckdb/ub_src_function_scalar_map.cpp +0 -12
  266. package/src/duckdb/ub_src_function_scalar_math.cpp +0 -6
  267. package/src/duckdb/ub_src_function_scalar_union.cpp +0 -6
  268. /package/src/duckdb/src/include/duckdb/function/scalar/{strftime.hpp → strftime_format.hpp} +0 -0
@@ -92,21 +92,13 @@ void BuiltinFunctions::Initialize() {
92
92
  RegisterTableFunctions();
93
93
  RegisterArrowFunctions();
94
94
 
95
- RegisterAlgebraicAggregates();
96
95
  RegisterDistributiveAggregates();
97
- RegisterNestedAggregates();
98
- RegisterHolisticAggregates();
99
- RegisterRegressiveAggregates();
100
96
 
101
- RegisterDateFunctions();
102
- RegisterEnumFunctions();
103
97
  RegisterGenericFunctions();
104
- RegisterMathFunctions();
105
98
  RegisterOperators();
106
99
  RegisterSequenceFunctions();
107
100
  RegisterStringFunctions();
108
101
  RegisterNestedFunctions();
109
- RegisterTrigonometricsFunctions();
110
102
 
111
103
  RegisterPragmaFunctions();
112
104
 
@@ -3,9 +3,16 @@
3
3
 
4
4
  namespace duckdb {
5
5
 
6
+ ScalarFunctionSet::ScalarFunctionSet() : FunctionSet("") {
7
+ }
8
+
6
9
  ScalarFunctionSet::ScalarFunctionSet(string name) : FunctionSet(std::move(name)) {
7
10
  }
8
11
 
12
+ ScalarFunctionSet::ScalarFunctionSet(ScalarFunction fun) : FunctionSet(std::move(fun.name)) {
13
+ functions.push_back(std::move(fun));
14
+ }
15
+
9
16
  ScalarFunction ScalarFunctionSet::GetFunctionByArguments(ClientContext &context, const vector<LogicalType> &arguments) {
10
17
  string error;
11
18
  FunctionBinder binder(context);
@@ -17,9 +24,16 @@ ScalarFunction ScalarFunctionSet::GetFunctionByArguments(ClientContext &context,
17
24
  return GetFunctionByOffset(index);
18
25
  }
19
26
 
27
+ AggregateFunctionSet::AggregateFunctionSet() : FunctionSet("") {
28
+ }
29
+
20
30
  AggregateFunctionSet::AggregateFunctionSet(string name) : FunctionSet(std::move(name)) {
21
31
  }
22
32
 
33
+ AggregateFunctionSet::AggregateFunctionSet(AggregateFunction fun) : FunctionSet(std::move(fun.name)) {
34
+ functions.push_back(std::move(fun));
35
+ }
36
+
23
37
  AggregateFunction AggregateFunctionSet::GetFunctionByArguments(ClientContext &context,
24
38
  const vector<LogicalType> &arguments) {
25
39
  string error;
@@ -53,6 +67,10 @@ AggregateFunction AggregateFunctionSet::GetFunctionByArguments(ClientContext &co
53
67
  TableFunctionSet::TableFunctionSet(string name) : FunctionSet(std::move(name)) {
54
68
  }
55
69
 
70
+ TableFunctionSet::TableFunctionSet(TableFunction fun) : FunctionSet(std::move(fun.name)) {
71
+ functions.push_back(std::move(fun));
72
+ }
73
+
56
74
  TableFunction TableFunctionSet::GetFunctionByArguments(ClientContext &context, const vector<LogicalType> &arguments) {
57
75
  string error;
58
76
  FunctionBinder binder(context);
@@ -64,4 +82,11 @@ TableFunction TableFunctionSet::GetFunctionByArguments(ClientContext &context, c
64
82
  return GetFunctionByOffset(index);
65
83
  }
66
84
 
85
+ PragmaFunctionSet::PragmaFunctionSet(string name) : FunctionSet(std::move(name)) {
86
+ }
87
+
88
+ PragmaFunctionSet::PragmaFunctionSet(PragmaFunction fun) : FunctionSet(std::move(fun.name)) {
89
+ functions.push_back(std::move(fun));
90
+ }
91
+
67
92
  } // namespace duckdb
@@ -3,16 +3,8 @@
3
3
  namespace duckdb {
4
4
 
5
5
  void BuiltinFunctions::RegisterGenericFunctions() {
6
- Register<AliasFun>();
7
- Register<HashFun>();
8
- Register<LeastFun>();
9
- Register<GreatestFun>();
10
- Register<StatsFun>();
11
- Register<TypeOfFun>();
12
6
  Register<ConstantOrNull>();
13
- Register<CurrentSettingFun>();
14
- Register<SystemFun>();
15
- Register<ErrorFun>();
7
+ Register<ExportAggregateFunction>();
16
8
  }
17
9
 
18
10
  } // namespace duckdb
@@ -3,33 +3,11 @@
3
3
  namespace duckdb {
4
4
 
5
5
  void BuiltinFunctions::RegisterNestedFunctions() {
6
- Register<ArraySliceFun>();
7
- Register<StructPackFun>();
8
6
  Register<StructExtractFun>();
9
- Register<StructInsertFun>();
10
- Register<ListTransformFun>();
11
- Register<ListFilterFun>();
12
7
  Register<ListConcatFun>();
13
8
  Register<ListContainsFun>();
14
9
  Register<ListPositionFun>();
15
- Register<ListAggregateFun>();
16
- Register<ListDistinctFun>();
17
- Register<ListUniqueFun>();
18
- Register<ListValueFun>();
19
10
  Register<ListExtractFun>();
20
- Register<ListSortFun>();
21
- Register<ListRangeFun>();
22
- Register<ListFlattenFun>();
23
- Register<MapFun>();
24
- Register<MapFromEntriesFun>();
25
- Register<MapEntriesFun>();
26
- Register<MapValuesFun>();
27
- Register<MapKeysFun>();
28
- Register<MapExtractFun>();
29
- Register<UnionValueFun>();
30
- Register<UnionExtractFun>();
31
- Register<UnionTagFun>();
32
- Register<CardinalityFun>();
33
11
  }
34
12
 
35
13
  } // namespace duckdb
@@ -9,12 +9,6 @@ void BuiltinFunctions::RegisterOperators() {
9
9
  Register<MultiplyFun>();
10
10
  Register<DivideFun>();
11
11
  Register<ModFun>();
12
- Register<LeftShiftFun>();
13
- Register<RightShiftFun>();
14
- Register<BitwiseAndFun>();
15
- Register<BitwiseOrFun>();
16
- Register<BitwiseXorFun>();
17
- Register<BitwiseNotFun>();
18
12
  }
19
13
 
20
14
  } // namespace duckdb
@@ -1,19 +1,10 @@
1
- #include "duckdb/function/scalar/strftime.hpp"
2
-
1
+ #include "duckdb/function/scalar/strftime_format.hpp"
3
2
  #include "duckdb/common/string_util.hpp"
4
3
  #include "duckdb/common/to_string.hpp"
5
4
  #include "duckdb/common/types/cast_helpers.hpp"
6
5
  #include "duckdb/common/types/date.hpp"
7
6
  #include "duckdb/common/types/time.hpp"
8
7
  #include "duckdb/common/types/timestamp.hpp"
9
- #include "duckdb/common/vector_operations/unary_executor.hpp"
10
- #include "duckdb/execution/expression_executor.hpp"
11
- #include "duckdb/function/scalar/date_functions.hpp"
12
- #include "duckdb/planner/expression/bound_function_expression.hpp"
13
- #include "duckdb/planner/expression/bound_parameter_expression.hpp"
14
-
15
- #include <cctype>
16
- #include <utility>
17
8
 
18
9
  namespace duckdb {
19
10
 
@@ -594,49 +585,6 @@ string StrTimeFormat::ParseFormatSpecifier(const string &format_string, StrTimeF
594
585
  return string();
595
586
  }
596
587
 
597
- struct StrfTimeBindData : public FunctionData {
598
- explicit StrfTimeBindData(StrfTimeFormat format_p, string format_string_p, bool is_null)
599
- : format(std::move(format_p)), format_string(std::move(format_string_p)), is_null(is_null) {
600
- }
601
-
602
- StrfTimeFormat format;
603
- string format_string;
604
- bool is_null;
605
-
606
- unique_ptr<FunctionData> Copy() const override {
607
- return make_uniq<StrfTimeBindData>(format, format_string, is_null);
608
- }
609
-
610
- bool Equals(const FunctionData &other_p) const override {
611
- auto &other = (const StrfTimeBindData &)other_p;
612
- return format_string == other.format_string;
613
- }
614
- };
615
-
616
- template <bool REVERSED>
617
- static unique_ptr<FunctionData> StrfTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
618
- vector<unique_ptr<Expression>> &arguments) {
619
- auto format_idx = REVERSED ? 0 : 1;
620
- auto &format_arg = arguments[format_idx];
621
- if (format_arg->HasParameter()) {
622
- throw ParameterNotResolvedException();
623
- }
624
- if (!format_arg->IsFoldable()) {
625
- throw InvalidInputException("strftime format must be a constant");
626
- }
627
- Value options_str = ExpressionExecutor::EvaluateScalar(context, *format_arg);
628
- auto format_string = options_str.GetValue<string>();
629
- StrfTimeFormat format;
630
- bool is_null = options_str.IsNull();
631
- if (!is_null) {
632
- string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
633
- if (!error.empty()) {
634
- throw InvalidInputException("Failed to parse format specifier %s: %s", format_string, error);
635
- }
636
- }
637
- return make_uniq<StrfTimeBindData>(format, format_string, is_null);
638
- }
639
-
640
588
  void StrfTimeFormat::ConvertDateVector(Vector &input, Vector &result, idx_t count) {
641
589
  D_ASSERT(input.GetType().id() == LogicalTypeId::DATE);
642
590
  D_ASSERT(result.GetType().id() == LogicalTypeId::VARCHAR);
@@ -656,19 +604,6 @@ void StrfTimeFormat::ConvertDateVector(Vector &input, Vector &result, idx_t coun
656
604
  });
657
605
  }
658
606
 
659
- template <bool REVERSED>
660
- static void StrfTimeFunctionDate(DataChunk &args, ExpressionState &state, Vector &result) {
661
- auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
662
- auto &info = func_expr.bind_info->Cast<StrfTimeBindData>();
663
-
664
- if (info.is_null) {
665
- result.SetVectorType(VectorType::CONSTANT_VECTOR);
666
- ConstantVector::SetNull(result, true);
667
- return;
668
- }
669
- info.format.ConvertDateVector(args.data[REVERSED ? 1 : 0], result, args.size());
670
- }
671
-
672
607
  void StrfTimeFormat::ConvertTimestampVector(Vector &input, Vector &result, idx_t count) {
673
608
  D_ASSERT(input.GetType().id() == LogicalTypeId::TIMESTAMP || input.GetType().id() == LogicalTypeId::TIMESTAMP_TZ);
674
609
  D_ASSERT(result.GetType().id() == LogicalTypeId::VARCHAR);
@@ -690,37 +625,6 @@ void StrfTimeFormat::ConvertTimestampVector(Vector &input, Vector &result, idx_t
690
625
  });
691
626
  }
692
627
 
693
- template <bool REVERSED>
694
- static void StrfTimeFunctionTimestamp(DataChunk &args, ExpressionState &state, Vector &result) {
695
- auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
696
- auto &info = func_expr.bind_info->Cast<StrfTimeBindData>();
697
-
698
- if (info.is_null) {
699
- result.SetVectorType(VectorType::CONSTANT_VECTOR);
700
- ConstantVector::SetNull(result, true);
701
- return;
702
- }
703
- info.format.ConvertTimestampVector(args.data[REVERSED ? 1 : 0], result, args.size());
704
- }
705
-
706
- void StrfTimeFun::RegisterFunction(BuiltinFunctions &set) {
707
- ScalarFunctionSet strftime("strftime");
708
-
709
- strftime.AddFunction(ScalarFunction({LogicalType::DATE, LogicalType::VARCHAR}, LogicalType::VARCHAR,
710
- StrfTimeFunctionDate<false>, StrfTimeBindFunction<false>));
711
-
712
- strftime.AddFunction(ScalarFunction({LogicalType::TIMESTAMP, LogicalType::VARCHAR}, LogicalType::VARCHAR,
713
- StrfTimeFunctionTimestamp<false>, StrfTimeBindFunction<false>));
714
-
715
- strftime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::VARCHAR,
716
- StrfTimeFunctionDate<true>, StrfTimeBindFunction<true>));
717
-
718
- strftime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::VARCHAR,
719
- StrfTimeFunctionTimestamp<true>, StrfTimeBindFunction<true>));
720
-
721
- set.AddFunction(strftime);
722
- }
723
-
724
628
  void StrpTimeFormat::AddFormatSpecifier(string preceding_literal, StrTimeSpecifier specifier) {
725
629
  numeric_width.push_back(NumericSpecifierWidth(specifier));
726
630
  StrTimeFormat::AddFormatSpecifier(std::move(preceding_literal), specifier);
@@ -1187,79 +1091,6 @@ bool StrpTimeFormat::Parse(string_t str, ParseResult &result) {
1187
1091
  return true;
1188
1092
  }
1189
1093
 
1190
- struct StrpTimeBindData : public FunctionData {
1191
- StrpTimeBindData(const StrpTimeFormat &format, const string &format_string)
1192
- : formats(1, format), format_strings(1, format_string) {
1193
- }
1194
-
1195
- StrpTimeBindData(vector<StrpTimeFormat> formats_p, vector<string> format_strings_p)
1196
- : formats(std::move(formats_p)), format_strings(std::move(format_strings_p)) {
1197
- }
1198
-
1199
- vector<StrpTimeFormat> formats;
1200
- vector<string> format_strings;
1201
-
1202
- unique_ptr<FunctionData> Copy() const override {
1203
- return make_uniq<StrpTimeBindData>(formats, format_strings);
1204
- }
1205
-
1206
- bool Equals(const FunctionData &other_p) const override {
1207
- auto &other = (const StrpTimeBindData &)other_p;
1208
- return format_strings == other.format_strings;
1209
- }
1210
- };
1211
-
1212
- static unique_ptr<FunctionData> StrpTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
1213
- vector<unique_ptr<Expression>> &arguments) {
1214
- if (arguments[1]->HasParameter()) {
1215
- throw ParameterNotResolvedException();
1216
- }
1217
- if (!arguments[1]->IsFoldable()) {
1218
- throw InvalidInputException("strptime format must be a constant");
1219
- }
1220
- Value format_value = ExpressionExecutor::EvaluateScalar(context, *arguments[1]);
1221
- string format_string;
1222
- StrpTimeFormat format;
1223
- if (format_value.IsNull()) {
1224
- return make_uniq<StrpTimeBindData>(format, format_string);
1225
- } else if (format_value.type().id() == LogicalTypeId::VARCHAR) {
1226
- format_string = format_value.ToString();
1227
- format.format_specifier = format_string;
1228
- string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
1229
- if (!error.empty()) {
1230
- throw InvalidInputException("Failed to parse format specifier %s: %s", format_string, error);
1231
- }
1232
- if (format.HasFormatSpecifier(StrTimeSpecifier::UTC_OFFSET)) {
1233
- bound_function.return_type = LogicalType::TIMESTAMP_TZ;
1234
- }
1235
- return make_uniq<StrpTimeBindData>(format, format_string);
1236
- } else if (format_value.type() == LogicalType::LIST(LogicalType::VARCHAR)) {
1237
- const auto &children = ListValue::GetChildren(format_value);
1238
- if (children.empty()) {
1239
- throw InvalidInputException("strptime format list must not be empty");
1240
- }
1241
- vector<string> format_strings;
1242
- vector<StrpTimeFormat> formats;
1243
- for (const auto &child : children) {
1244
- format_string = child.ToString();
1245
- format.format_specifier = format_string;
1246
- string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
1247
- if (!error.empty()) {
1248
- throw InvalidInputException("Failed to parse format specifier %s: %s", format_string, error);
1249
- }
1250
- // If any format has UTC offsets, then we have to produce TSTZ
1251
- if (format.HasFormatSpecifier(StrTimeSpecifier::UTC_OFFSET)) {
1252
- bound_function.return_type = LogicalType::TIMESTAMP_TZ;
1253
- }
1254
- format_strings.emplace_back(format_string);
1255
- formats.emplace_back(format);
1256
- }
1257
- return make_uniq<StrpTimeBindData>(formats, format_strings);
1258
- } else {
1259
- throw InvalidInputException("strptime format must be a string");
1260
- }
1261
- }
1262
-
1263
1094
  StrpTimeFormat::ParseResult StrpTimeFormat::Parse(const string &format_string, const string &text) {
1264
1095
  StrpTimeFormat format;
1265
1096
  format.format_specifier = format_string;
@@ -1348,83 +1179,4 @@ timestamp_t StrpTimeFormat::ParseTimestamp(string_t input) {
1348
1179
  return result.ToTimestamp();
1349
1180
  }
1350
1181
 
1351
- struct StrpTimeFunction {
1352
-
1353
- static void Parse(DataChunk &args, ExpressionState &state, Vector &result) {
1354
- auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
1355
- auto &info = func_expr.bind_info->Cast<StrpTimeBindData>();
1356
-
1357
- if (ConstantVector::IsNull(args.data[1])) {
1358
- result.SetVectorType(VectorType::CONSTANT_VECTOR);
1359
- ConstantVector::SetNull(result, true);
1360
- return;
1361
- }
1362
- UnaryExecutor::Execute<string_t, timestamp_t>(args.data[0], result, args.size(), [&](string_t input) {
1363
- StrpTimeFormat::ParseResult result;
1364
- for (auto &format : info.formats) {
1365
- if (format.Parse(input, result)) {
1366
- return result.ToTimestamp();
1367
- }
1368
- }
1369
- throw InvalidInputException(result.FormatError(input, info.formats[0].format_specifier));
1370
- });
1371
- }
1372
-
1373
- static void TryParse(DataChunk &args, ExpressionState &state, Vector &result) {
1374
- auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
1375
- auto &info = func_expr.bind_info->Cast<StrpTimeBindData>();
1376
-
1377
- if (ConstantVector::IsNull(args.data[1])) {
1378
- result.SetVectorType(VectorType::CONSTANT_VECTOR);
1379
- ConstantVector::SetNull(result, true);
1380
- return;
1381
- }
1382
-
1383
- UnaryExecutor::ExecuteWithNulls<string_t, timestamp_t>(
1384
- args.data[0], result, args.size(), [&](string_t input, ValidityMask &mask, idx_t idx) {
1385
- timestamp_t result;
1386
- string error;
1387
- for (auto &format : info.formats) {
1388
- if (format.TryParseTimestamp(input, result, error)) {
1389
- return result;
1390
- }
1391
- }
1392
-
1393
- mask.SetInvalid(idx);
1394
- return timestamp_t();
1395
- });
1396
- }
1397
- };
1398
-
1399
- void StrpTimeFun::RegisterFunction(BuiltinFunctions &set) {
1400
- ScalarFunctionSet strptime("strptime");
1401
-
1402
- const auto list_type = LogicalType::LIST(LogicalType::VARCHAR);
1403
- auto fun = ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::TIMESTAMP,
1404
- StrpTimeFunction::Parse, StrpTimeBindFunction);
1405
- fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
1406
- strptime.AddFunction(fun);
1407
-
1408
- fun = ScalarFunction({LogicalType::VARCHAR, list_type}, LogicalType::TIMESTAMP, StrpTimeFunction::Parse,
1409
- StrpTimeBindFunction);
1410
- fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
1411
- strptime.AddFunction(fun);
1412
-
1413
- set.AddFunction(strptime);
1414
-
1415
- ScalarFunctionSet try_strptime("try_strptime");
1416
-
1417
- fun = ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::TIMESTAMP,
1418
- StrpTimeFunction::TryParse, StrpTimeBindFunction);
1419
- fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
1420
- try_strptime.AddFunction(fun);
1421
-
1422
- fun = ScalarFunction({LogicalType::VARCHAR, list_type}, LogicalType::TIMESTAMP, StrpTimeFunction::TryParse,
1423
- StrpTimeBindFunction);
1424
- fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
1425
- try_strptime.AddFunction(fun);
1426
-
1427
- set.AddFunction(try_strptime);
1428
- }
1429
-
1430
1182
  } // namespace duckdb
@@ -138,23 +138,4 @@ void LengthFun::RegisterFunction(BuiltinFunctions &set) {
138
138
  set.AddFunction(octet_length);
139
139
  }
140
140
 
141
- struct UnicodeOperator {
142
- template <class TA, class TR>
143
- static inline TR Operation(const TA &input) {
144
- auto str = reinterpret_cast<const utf8proc_uint8_t *>(input.GetData());
145
- auto len = input.GetSize();
146
- utf8proc_int32_t codepoint;
147
- (void)utf8proc_iterate(str, len, &codepoint);
148
- return codepoint;
149
- }
150
- };
151
-
152
- void UnicodeFun::RegisterFunction(BuiltinFunctions &set) {
153
- ScalarFunction unicode("unicode", {LogicalType::VARCHAR}, LogicalType::INTEGER,
154
- ScalarFunction::UnaryFunction<string_t, int32_t, UnicodeOperator>);
155
- set.AddFunction(unicode);
156
- unicode.name = "ord";
157
- set.AddFunction(unicode);
158
- }
159
-
160
141
  } // namespace duckdb
@@ -1,61 +1,21 @@
1
1
  #include "duckdb/function/scalar/string_functions.hpp"
2
- #include "duckdb/function/scalar/blob_functions.hpp"
3
- #include "duckdb/function/scalar/uuid_functions.hpp"
4
- #include "duckdb/function/scalar/bit_functions.hpp"
5
2
 
6
3
  namespace duckdb {
7
4
 
8
5
  void BuiltinFunctions::RegisterStringFunctions() {
9
- Register<ReverseFun>();
10
6
  Register<LowerFun>();
11
7
  Register<UpperFun>();
12
8
  Register<StripAccentsFun>();
13
9
  Register<ConcatFun>();
14
- Register<StartsWithFun>();
15
10
  Register<ContainsFun>();
16
11
  Register<LengthFun>();
17
12
  Register<LikeFun>();
18
13
  Register<LikeEscapeFun>();
19
- Register<LpadFun>();
20
- Register<LeftFun>();
21
- Register<MD5Fun>();
22
- Register<RightFun>();
23
- Register<PrintfFun>();
24
14
  Register<RegexpFun>();
25
15
  Register<SubstringFun>();
26
- Register<InstrFun>();
27
16
  Register<PrefixFun>();
28
- Register<RepeatFun>();
29
- Register<ReplaceFun>();
30
- Register<RpadFun>();
31
- Register<TranslateFun>();
32
17
  Register<SuffixFun>();
33
- Register<TrimFun>();
34
- Register<UnicodeFun>();
35
18
  Register<NFCNormalizeFun>();
36
- Register<StringSplitFun>();
37
- Register<BarFun>();
38
- Register<ASCII>();
39
- Register<CHR>();
40
- Register<MismatchesFun>();
41
- Register<LevenshteinFun>();
42
- Register<DamerauLevenshteinFun>();
43
- Register<JaccardFun>();
44
- Register<JaroWinklerFun>();
45
-
46
- // blob functions
47
- Register<Base64Fun>();
48
- Register<EncodeFun>();
49
- Register<HexFun>();
50
-
51
- // bit functions
52
- Register<GetBitFun>();
53
- Register<SetBitFun>();
54
- Register<BitPositionFun>();
55
- Register<BitStringFun>();
56
-
57
- // uuid functions
58
- Register<UUIDFun>();
59
19
  }
60
20
 
61
21
  } // namespace duckdb
@@ -347,4 +347,9 @@ ScalarFunction ExportAggregateFunction::GetCombine() {
347
347
  return result;
348
348
  }
349
349
 
350
+ void ExportAggregateFunction::RegisterFunction(BuiltinFunctions &set) {
351
+ set.AddFunction(ExportAggregateFunction::GetCombine());
352
+ set.AddFunction(ExportAggregateFunction::GetFinalize());
353
+ }
354
+
350
355
  } // namespace duckdb
@@ -225,7 +225,7 @@ static void ArrowToDuckDBBlob(Vector &vector, ArrowArray &array, ArrowScanLocalS
225
225
  }
226
226
 
227
227
  static void ArrowToDuckDBMapVerify(Vector &vector, idx_t count) {
228
- auto valid_check = CheckMapValidity(vector, count);
228
+ auto valid_check = MapVector::CheckMapValidity(vector, count);
229
229
  switch (valid_check) {
230
230
  case MapInvalidReason::VALID:
231
231
  break;
@@ -273,6 +273,7 @@ void BuiltinFunctions::RegisterTableFunctions() {
273
273
  RepeatTableFunction::RegisterFunction(*this);
274
274
  SummaryTableFunction::RegisterFunction(*this);
275
275
  UnnestTableFunction::RegisterFunction(*this);
276
+ RepeatRowTableFunction::RegisterFunction(*this);
276
277
  }
277
278
 
278
279
  } // namespace duckdb
@@ -0,0 +1,60 @@
1
+ #include "duckdb/function/table/range.hpp"
2
+ #include "duckdb/common/algorithm.hpp"
3
+
4
+ namespace duckdb {
5
+
6
+ struct RepeatRowFunctionData : public TableFunctionData {
7
+ RepeatRowFunctionData(vector<Value> values, idx_t target_count)
8
+ : values(std::move(values)), target_count(target_count) {
9
+ }
10
+
11
+ const vector<Value> values;
12
+ idx_t target_count;
13
+ };
14
+
15
+ struct RepeatRowOperatorData : public GlobalTableFunctionState {
16
+ RepeatRowOperatorData() : current_count(0) {
17
+ }
18
+ idx_t current_count;
19
+ };
20
+
21
+ static unique_ptr<FunctionData> RepeatRowBind(ClientContext &context, TableFunctionBindInput &input,
22
+ vector<LogicalType> &return_types, vector<string> &names) {
23
+ auto &inputs = input.inputs;
24
+ for (idx_t input_idx = 0; input_idx < inputs.size(); input_idx++) {
25
+ return_types.push_back(inputs[input_idx].type());
26
+ names.push_back("column" + std::to_string(input_idx));
27
+ }
28
+ return make_uniq<RepeatRowFunctionData>(inputs, input.named_parameters["num_rows"].GetValue<int64_t>());
29
+ }
30
+
31
+ static unique_ptr<GlobalTableFunctionState> RepeatRowInit(ClientContext &context, TableFunctionInitInput &input) {
32
+ return make_uniq<RepeatRowOperatorData>();
33
+ }
34
+
35
+ static void RepeatRowFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
36
+ auto &bind_data = (const RepeatRowFunctionData &)*data_p.bind_data;
37
+ auto &state = data_p.global_state->Cast<RepeatRowOperatorData>();
38
+
39
+ idx_t remaining = MinValue<idx_t>(bind_data.target_count - state.current_count, STANDARD_VECTOR_SIZE);
40
+ for (idx_t val_idx = 0; val_idx < bind_data.values.size(); val_idx++) {
41
+ output.data[val_idx].Reference(bind_data.values[val_idx]);
42
+ }
43
+ output.SetCardinality(remaining);
44
+ state.current_count += remaining;
45
+ }
46
+
47
+ static unique_ptr<NodeStatistics> RepeatRowCardinality(ClientContext &context, const FunctionData *bind_data_p) {
48
+ auto &bind_data = (const RepeatRowFunctionData &)*bind_data_p;
49
+ return make_uniq<NodeStatistics>(bind_data.target_count, bind_data.target_count);
50
+ }
51
+
52
+ void RepeatRowTableFunction::RegisterFunction(BuiltinFunctions &set) {
53
+ TableFunction repeat_row("repeat_row", {}, RepeatRowFunction, RepeatRowBind, RepeatRowInit);
54
+ repeat_row.varargs = LogicalType::ANY;
55
+ repeat_row.named_parameters["num_rows"] = LogicalType::BIGINT;
56
+ repeat_row.cardinality = RepeatRowCardinality;
57
+ set.AddFunction(repeat_row);
58
+ }
59
+
60
+ } // namespace duckdb