duckdb 0.7.2-dev2740.0 → 0.7.2-dev2867.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 (286) hide show
  1. package/binding.gyp +21 -13
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/icu/icu-datepart.cpp +51 -1
  4. package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
  5. package/src/duckdb/extension/json/include/json_functions.hpp +35 -37
  6. package/src/duckdb/extension/json/include/json_scan.hpp +1 -1
  7. package/src/duckdb/extension/json/include/json_transform.hpp +1 -1
  8. package/src/duckdb/extension/json/json-extension.cpp +10 -20
  9. package/src/duckdb/extension/json/json_functions/copy_json.cpp +2 -2
  10. package/src/duckdb/extension/json/json_functions/json_array_length.cpp +2 -3
  11. package/src/duckdb/extension/json/json_functions/json_contains.cpp +2 -2
  12. package/src/duckdb/extension/json/json_functions/json_create.cpp +20 -20
  13. package/src/duckdb/extension/json/json_functions/json_extract.cpp +4 -6
  14. package/src/duckdb/extension/json/json_functions/json_keys.cpp +2 -3
  15. package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -2
  16. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +8 -8
  17. package/src/duckdb/extension/json/json_functions/json_structure.cpp +2 -2
  18. package/src/duckdb/extension/json/json_functions/json_transform.cpp +4 -4
  19. package/src/duckdb/extension/json/json_functions/json_type.cpp +2 -3
  20. package/src/duckdb/extension/json/json_functions/json_valid.cpp +2 -2
  21. package/src/duckdb/extension/json/json_functions/read_json.cpp +6 -6
  22. package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +4 -4
  23. package/src/duckdb/extension/json/json_functions.cpp +6 -6
  24. package/src/duckdb/extension/parquet/parquet-extension.cpp +16 -28
  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/local_file_system.cpp +1 -3
  33. package/src/duckdb/src/common/multi_file_reader.cpp +11 -8
  34. package/src/duckdb/src/common/types/vector.cpp +136 -3
  35. package/src/duckdb/src/{function → core_functions}/aggregate/algebraic/avg.cpp +9 -12
  36. package/src/duckdb/src/core_functions/aggregate/algebraic/corr.cpp +13 -0
  37. package/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp +21 -0
  38. package/src/duckdb/src/core_functions/aggregate/algebraic/stddev.cpp +34 -0
  39. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/approx_count.cpp +3 -3
  40. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/arg_min_max.cpp +7 -23
  41. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bitagg.cpp +10 -10
  42. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bitstring_agg.cpp +4 -4
  43. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/bool.cpp +1 -17
  44. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/entropy.cpp +5 -4
  45. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/kurtosis.cpp +5 -6
  46. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/minmax.cpp +5 -5
  47. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/product.cpp +2 -11
  48. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/skew.cpp +5 -6
  49. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/string_agg.cpp +4 -6
  50. package/src/duckdb/src/{function → core_functions}/aggregate/distributive/sum.cpp +38 -46
  51. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/approximate_quantile.cpp +4 -5
  52. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/mode.cpp +4 -5
  53. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/quantile.cpp +31 -23
  54. package/src/duckdb/src/{function → core_functions}/aggregate/holistic/reservoir_quantile.cpp +4 -5
  55. package/src/duckdb/src/{function → core_functions}/aggregate/nested/histogram.cpp +4 -4
  56. package/src/duckdb/src/{function → core_functions}/aggregate/nested/list.cpp +6 -10
  57. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_avg.cpp +7 -11
  58. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_count.cpp +4 -4
  59. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_intercept.cpp +5 -8
  60. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_r2.cpp +5 -7
  61. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_slope.cpp +5 -7
  62. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_sxx_syy.cpp +8 -12
  63. package/src/duckdb/src/{function → core_functions}/aggregate/regression/regr_sxy.cpp +6 -8
  64. package/src/duckdb/src/core_functions/core_functions.cpp +50 -0
  65. package/src/duckdb/src/core_functions/function_list.cpp +352 -0
  66. package/src/duckdb/src/{function → core_functions}/scalar/bit/bitstring.cpp +12 -15
  67. package/src/duckdb/src/{function → core_functions}/scalar/blob/base64.cpp +6 -6
  68. package/src/duckdb/src/{function → core_functions}/scalar/blob/encode.cpp +7 -6
  69. package/src/duckdb/src/{function → core_functions}/scalar/date/age.cpp +3 -3
  70. package/src/duckdb/src/{function → core_functions}/scalar/date/current.cpp +8 -8
  71. package/src/duckdb/src/{function → core_functions}/scalar/date/date_diff.cpp +3 -6
  72. package/src/duckdb/src/{function → core_functions}/scalar/date/date_part.cpp +144 -148
  73. package/src/duckdb/src/{function → core_functions}/scalar/date/date_sub.cpp +3 -6
  74. package/src/duckdb/src/{function → core_functions}/scalar/date/date_trunc.cpp +3 -6
  75. package/src/duckdb/src/{function → core_functions}/scalar/date/epoch.cpp +7 -8
  76. package/src/duckdb/src/{function → core_functions}/scalar/date/make_date.cpp +14 -14
  77. package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +251 -0
  78. package/src/duckdb/src/{function → core_functions}/scalar/date/time_bucket.cpp +4 -5
  79. package/src/duckdb/src/{function → core_functions}/scalar/date/to_interval.cpp +39 -19
  80. package/src/duckdb/src/{function/scalar/enum/enum_functions_implementation.cpp → core_functions/scalar/enum/enum_functions.cpp} +18 -22
  81. package/src/duckdb/src/{function → core_functions}/scalar/generic/alias.cpp +4 -4
  82. package/src/duckdb/src/{function → core_functions}/scalar/generic/current_setting.cpp +4 -5
  83. package/src/duckdb/src/{function → core_functions}/scalar/generic/error.cpp +4 -4
  84. package/src/duckdb/src/{function → core_functions}/scalar/generic/hash.cpp +4 -4
  85. package/src/duckdb/src/{function → core_functions}/scalar/generic/least.cpp +8 -9
  86. package/src/duckdb/src/{function → core_functions}/scalar/generic/stats.cpp +4 -4
  87. package/src/duckdb/src/{function/scalar/system → core_functions/scalar/generic}/system_functions.cpp +24 -13
  88. package/src/duckdb/src/{function → core_functions}/scalar/generic/typeof.cpp +4 -4
  89. package/src/duckdb/src/{function → core_functions}/scalar/list/array_slice.cpp +3 -13
  90. package/src/duckdb/src/{function → core_functions}/scalar/list/flatten.cpp +5 -5
  91. package/src/duckdb/src/{function → core_functions}/scalar/list/list_aggregates.cpp +2 -13
  92. package/src/duckdb/src/{function → core_functions}/scalar/list/list_lambdas.cpp +9 -24
  93. package/src/duckdb/src/{function → core_functions}/scalar/list/list_sort.cpp +8 -22
  94. package/src/duckdb/src/{function → core_functions}/scalar/list/list_value.cpp +4 -5
  95. package/src/duckdb/src/{function → core_functions}/scalar/list/range.cpp +8 -6
  96. package/src/duckdb/src/{function → core_functions}/scalar/map/cardinality.cpp +5 -4
  97. package/src/duckdb/src/{function → core_functions}/scalar/map/map.cpp +6 -63
  98. package/src/duckdb/src/{function → core_functions}/scalar/map/map_entries.cpp +5 -4
  99. package/src/duckdb/src/{function → core_functions}/scalar/map/map_extract.cpp +22 -7
  100. package/src/duckdb/src/{function → core_functions}/scalar/map/map_from_entries.cpp +6 -5
  101. package/src/duckdb/src/{function → core_functions}/scalar/map/map_keys_values.cpp +8 -7
  102. package/src/duckdb/src/{function → core_functions}/scalar/math/numeric.cpp +110 -138
  103. package/src/duckdb/src/{function → core_functions}/scalar/operators/bitwise.cpp +19 -20
  104. package/src/duckdb/src/{function/scalar/math → core_functions/scalar/random}/random.cpp +5 -6
  105. package/src/duckdb/src/{function/scalar/math → core_functions/scalar/random}/setseed.cpp +3 -3
  106. package/src/duckdb/src/{function → core_functions}/scalar/string/ascii.cpp +4 -5
  107. package/src/duckdb/src/{function → core_functions}/scalar/string/bar.cpp +4 -4
  108. package/src/duckdb/src/{function → core_functions}/scalar/string/chr.cpp +5 -6
  109. package/src/duckdb/src/{function → core_functions}/scalar/string/damerau_levenshtein.cpp +4 -6
  110. package/src/duckdb/src/{function/scalar/string/mismatches.cpp → core_functions/scalar/string/hamming.cpp} +3 -12
  111. package/src/duckdb/src/{function → core_functions}/scalar/string/hex.cpp +15 -25
  112. package/src/duckdb/src/{function → core_functions}/scalar/string/instr.cpp +6 -13
  113. package/src/duckdb/src/{function → core_functions}/scalar/string/jaccard.cpp +3 -6
  114. package/src/duckdb/src/{function → core_functions}/scalar/string/jaro_winkler.cpp +7 -6
  115. package/src/duckdb/src/{function → core_functions}/scalar/string/left_right.cpp +18 -11
  116. package/src/duckdb/src/{function → core_functions}/scalar/string/levenshtein.cpp +3 -12
  117. package/src/duckdb/src/{function → core_functions}/scalar/string/md5.cpp +15 -21
  118. package/src/duckdb/src/{function → core_functions}/scalar/string/pad.cpp +7 -13
  119. package/src/duckdb/src/{function → core_functions}/scalar/string/printf.cpp +10 -10
  120. package/src/duckdb/src/{function → core_functions}/scalar/string/repeat.cpp +3 -6
  121. package/src/duckdb/src/{function → core_functions}/scalar/string/replace.cpp +4 -7
  122. package/src/duckdb/src/{function → core_functions}/scalar/string/reverse.cpp +3 -3
  123. package/src/duckdb/src/{function → core_functions}/scalar/string/starts_with.cpp +4 -8
  124. package/src/duckdb/src/{function → core_functions}/scalar/string/string_split.cpp +11 -11
  125. package/src/duckdb/src/{function → core_functions}/scalar/string/translate.cpp +4 -7
  126. package/src/duckdb/src/{function → core_functions}/scalar/string/trim.cpp +19 -14
  127. package/src/duckdb/src/core_functions/scalar/string/unicode.cpp +28 -0
  128. package/src/duckdb/src/{function → core_functions}/scalar/struct/struct_insert.cpp +4 -4
  129. package/src/duckdb/src/{function → core_functions}/scalar/struct/struct_pack.cpp +3 -4
  130. package/src/duckdb/src/{function → core_functions}/scalar/union/union_extract.cpp +4 -8
  131. package/src/duckdb/src/{function → core_functions}/scalar/union/union_tag.cpp +4 -8
  132. package/src/duckdb/src/{function → core_functions}/scalar/union/union_value.cpp +4 -59
  133. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +1 -1
  134. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1 -1
  135. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +1 -1
  136. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +11 -2
  137. package/src/duckdb/src/function/aggregate/distributive_functions.cpp +0 -17
  138. package/src/duckdb/src/function/cast/string_cast.cpp +1 -1
  139. package/src/duckdb/src/function/function.cpp +0 -8
  140. package/src/duckdb/src/function/function_set.cpp +25 -0
  141. package/src/duckdb/src/function/scalar/generic_functions.cpp +1 -9
  142. package/src/duckdb/src/function/scalar/nested_functions.cpp +0 -22
  143. package/src/duckdb/src/function/scalar/operators.cpp +0 -6
  144. package/src/duckdb/src/function/scalar/{date/strftime.cpp → strftime_format.cpp} +1 -249
  145. package/src/duckdb/src/function/scalar/string/length.cpp +0 -19
  146. package/src/duckdb/src/function/scalar/string_functions.cpp +0 -40
  147. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -0
  148. package/src/duckdb/src/function/table/arrow_conversion.cpp +1 -1
  149. package/src/duckdb/src/function/table/read_csv.cpp +7 -4
  150. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +27 -40
  151. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  152. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +3 -3
  153. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/function_entry.hpp +33 -0
  154. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
  155. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +2 -2
  156. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
  157. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
  158. package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +2 -0
  159. package/src/duckdb/src/include/duckdb/common/algorithm.hpp +1 -0
  160. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -4
  161. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +11 -1
  162. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/corr.hpp +3 -4
  163. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/covar.hpp +1 -1
  164. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/algebraic/stddev.hpp +1 -1
  165. package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic_functions.hpp +124 -0
  166. package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +229 -0
  167. package/src/duckdb/src/include/duckdb/core_functions/aggregate/holistic_functions.hpp +85 -0
  168. package/src/duckdb/src/include/duckdb/core_functions/aggregate/nested_functions.hpp +41 -0
  169. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/regression/regr_count.hpp +3 -4
  170. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/regression/regr_slope.hpp +2 -2
  171. package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression_functions.hpp +97 -0
  172. package/src/duckdb/src/include/duckdb/{function → core_functions}/aggregate/sum_helpers.hpp +1 -1
  173. package/src/duckdb/src/include/duckdb/{function/scalar/uuid_functions.hpp → core_functions/core_functions.hpp} +7 -5
  174. package/src/duckdb/src/include/duckdb/core_functions/function_list.hpp +33 -0
  175. package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +52 -0
  176. package/src/duckdb/src/include/duckdb/core_functions/scalar/blob_functions.hpp +58 -0
  177. package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +544 -0
  178. package/src/duckdb/src/include/duckdb/core_functions/scalar/enum_functions.hpp +61 -0
  179. package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +142 -0
  180. package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +220 -0
  181. package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +85 -0
  182. package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +394 -0
  183. package/src/duckdb/src/include/duckdb/core_functions/scalar/operators_functions.hpp +70 -0
  184. package/src/duckdb/src/include/duckdb/core_functions/scalar/random_functions.hpp +49 -0
  185. package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +439 -0
  186. package/src/duckdb/src/include/duckdb/core_functions/scalar/struct_functions.hpp +40 -0
  187. package/src/duckdb/src/include/duckdb/core_functions/scalar/union_functions.hpp +43 -0
  188. package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +1 -1
  189. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +1 -1
  190. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +4 -0
  191. package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +0 -85
  192. package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +0 -8
  193. package/src/duckdb/src/include/duckdb/function/function_set.hpp +7 -2
  194. package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +1 -36
  195. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +0 -120
  196. package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +0 -24
  197. package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +1 -97
  198. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -1
  199. package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
  200. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
  201. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +0 -2
  202. package/src/duckdb/src/include/duckdb/main/extension_util.hpp +48 -0
  203. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +6 -0
  204. package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +3 -0
  205. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +5 -1
  206. package/src/duckdb/src/main/attached_database.cpp +5 -3
  207. package/src/duckdb/src/main/database.cpp +34 -37
  208. package/src/duckdb/src/main/extension/extension_helper.cpp +1 -0
  209. package/src/duckdb/src/main/extension/extension_load.cpp +61 -38
  210. package/src/duckdb/src/main/extension/extension_util.cpp +90 -0
  211. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +1 -4
  212. package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -4
  213. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +43 -24
  214. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
  215. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +17 -28
  216. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +6 -7
  217. package/src/duckdb/third_party/fmt/format.cc +0 -5
  218. package/src/duckdb/third_party/fmt/include/fmt/core.h +10 -12
  219. package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +2 -33
  220. package/src/duckdb/third_party/fmt/include/fmt/format.h +61 -24
  221. package/src/duckdb/third_party/fmt/include/fmt/printf.h +15 -1
  222. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +1 -0
  223. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +10735 -10674
  224. package/src/duckdb/ub_src_common_enums.cpp +2 -0
  225. package/src/duckdb/ub_src_core_functions.cpp +4 -0
  226. package/src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp +8 -0
  227. package/src/duckdb/ub_src_core_functions_aggregate_distributive.cpp +24 -0
  228. package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +8 -0
  229. package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +4 -0
  230. package/src/duckdb/ub_src_core_functions_aggregate_regression.cpp +14 -0
  231. package/src/duckdb/ub_src_core_functions_scalar_bit.cpp +2 -0
  232. package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +4 -0
  233. package/src/duckdb/ub_src_core_functions_scalar_date.cpp +22 -0
  234. package/src/duckdb/ub_src_core_functions_scalar_enum.cpp +2 -0
  235. package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +16 -0
  236. package/src/duckdb/ub_src_core_functions_scalar_list.cpp +14 -0
  237. package/src/duckdb/ub_src_core_functions_scalar_map.cpp +12 -0
  238. package/src/duckdb/ub_src_core_functions_scalar_math.cpp +2 -0
  239. package/src/duckdb/ub_src_core_functions_scalar_operators.cpp +2 -0
  240. package/src/duckdb/ub_src_core_functions_scalar_random.cpp +4 -0
  241. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +44 -0
  242. package/src/duckdb/ub_src_core_functions_scalar_struct.cpp +4 -0
  243. package/src/duckdb/ub_src_core_functions_scalar_union.cpp +6 -0
  244. package/src/duckdb/ub_src_function_aggregate.cpp +0 -8
  245. package/src/duckdb/ub_src_function_aggregate_distributive.cpp +0 -24
  246. package/src/duckdb/ub_src_function_scalar.cpp +2 -8
  247. package/src/duckdb/ub_src_function_scalar_generic.cpp +0 -14
  248. package/src/duckdb/ub_src_function_scalar_list.cpp +0 -14
  249. package/src/duckdb/ub_src_function_scalar_operators.cpp +0 -2
  250. package/src/duckdb/ub_src_function_scalar_string.cpp +0 -42
  251. package/src/duckdb/ub_src_function_scalar_struct.cpp +0 -4
  252. package/src/duckdb/ub_src_function_scalar_system.cpp +0 -2
  253. package/src/duckdb/ub_src_main_extension.cpp +2 -0
  254. package/src/duckdb/src/function/aggregate/algebraic/corr.cpp +0 -14
  255. package/src/duckdb/src/function/aggregate/algebraic/covar.cpp +0 -25
  256. package/src/duckdb/src/function/aggregate/algebraic/stddev.cpp +0 -54
  257. package/src/duckdb/src/function/aggregate/algebraic_functions.cpp +0 -21
  258. package/src/duckdb/src/function/aggregate/holistic_functions.cpp +0 -12
  259. package/src/duckdb/src/function/aggregate/nested_functions.cpp +0 -10
  260. package/src/duckdb/src/function/aggregate/regression_functions.cpp +0 -21
  261. package/src/duckdb/src/function/scalar/date_functions.cpp +0 -22
  262. package/src/duckdb/src/function/scalar/enum_functions.cpp +0 -13
  263. package/src/duckdb/src/function/scalar/math_functions.cpp +0 -50
  264. package/src/duckdb/src/function/scalar/trigonometrics_functions.cpp +0 -18
  265. package/src/duckdb/src/include/duckdb/function/aggregate/algebraic_functions.hpp +0 -56
  266. package/src/duckdb/src/include/duckdb/function/aggregate/holistic_functions.hpp +0 -33
  267. package/src/duckdb/src/include/duckdb/function/aggregate/nested_functions.hpp +0 -26
  268. package/src/duckdb/src/include/duckdb/function/aggregate/regression_functions.hpp +0 -53
  269. package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +0 -32
  270. package/src/duckdb/src/include/duckdb/function/scalar/blob_functions.hpp +0 -24
  271. package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +0 -73
  272. package/src/duckdb/src/include/duckdb/function/scalar/enum_functions.hpp +0 -37
  273. package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +0 -137
  274. package/src/duckdb/src/include/duckdb/function/scalar/trigonometric_functions.hpp +0 -49
  275. package/src/duckdb/ub_src_function_aggregate_algebraic.cpp +0 -8
  276. package/src/duckdb/ub_src_function_aggregate_holistic.cpp +0 -8
  277. package/src/duckdb/ub_src_function_aggregate_nested.cpp +0 -4
  278. package/src/duckdb/ub_src_function_aggregate_regression.cpp +0 -14
  279. package/src/duckdb/ub_src_function_scalar_bit.cpp +0 -2
  280. package/src/duckdb/ub_src_function_scalar_blob.cpp +0 -4
  281. package/src/duckdb/ub_src_function_scalar_date.cpp +0 -22
  282. package/src/duckdb/ub_src_function_scalar_enum.cpp +0 -2
  283. package/src/duckdb/ub_src_function_scalar_map.cpp +0 -12
  284. package/src/duckdb/ub_src_function_scalar_math.cpp +0 -6
  285. package/src/duckdb/ub_src_function_scalar_union.cpp +0 -6
  286. /package/src/duckdb/src/include/duckdb/function/scalar/{strftime.hpp → strftime_format.hpp} +0 -0
@@ -1,3 +1,4 @@
1
+ #include "duckdb/core_functions/scalar/date_functions.hpp"
1
2
  #include "duckdb/common/case_insensitive_map.hpp"
2
3
  #include "duckdb/common/enums/date_part_specifier.hpp"
3
4
  #include "duckdb/common/exception.hpp"
@@ -6,7 +7,6 @@
6
7
  #include "duckdb/common/types/timestamp.hpp"
7
8
  #include "duckdb/common/vector_operations/vector_operations.hpp"
8
9
  #include "duckdb/execution/expression_executor.hpp"
9
- #include "duckdb/function/scalar/date_functions.hpp"
10
10
  #include "duckdb/function/scalar/nested_functions.hpp"
11
11
  #include "duckdb/planner/expression/bound_function_expression.hpp"
12
12
 
@@ -14,82 +14,6 @@
14
14
 
15
15
  namespace duckdb {
16
16
 
17
- bool TryGetDatePartSpecifier(const string &specifier_p, DatePartSpecifier &result) {
18
- auto specifier = StringUtil::Lower(specifier_p);
19
- if (specifier == "year" || specifier == "yr" || specifier == "y" || specifier == "years" || specifier == "yrs") {
20
- result = DatePartSpecifier::YEAR;
21
- } else if (specifier == "month" || specifier == "mon" || specifier == "months" || specifier == "mons") {
22
- result = DatePartSpecifier::MONTH;
23
- } else if (specifier == "day" || specifier == "days" || specifier == "d" || specifier == "dayofmonth") {
24
- result = DatePartSpecifier::DAY;
25
- } else if (specifier == "decade" || specifier == "dec" || specifier == "decades" || specifier == "decs") {
26
- result = DatePartSpecifier::DECADE;
27
- } else if (specifier == "century" || specifier == "cent" || specifier == "centuries" || specifier == "c") {
28
- result = DatePartSpecifier::CENTURY;
29
- } else if (specifier == "millennium" || specifier == "mil" || specifier == "millenniums" ||
30
- specifier == "millennia" || specifier == "mils" || specifier == "millenium") {
31
- result = DatePartSpecifier::MILLENNIUM;
32
- } else if (specifier == "microseconds" || specifier == "microsecond" || specifier == "us" || specifier == "usec" ||
33
- specifier == "usecs" || specifier == "usecond" || specifier == "useconds") {
34
- result = DatePartSpecifier::MICROSECONDS;
35
- } else if (specifier == "milliseconds" || specifier == "millisecond" || specifier == "ms" || specifier == "msec" ||
36
- specifier == "msecs" || specifier == "msecond" || specifier == "mseconds") {
37
- result = DatePartSpecifier::MILLISECONDS;
38
- } else if (specifier == "second" || specifier == "sec" || specifier == "seconds" || specifier == "secs" ||
39
- specifier == "s") {
40
- result = DatePartSpecifier::SECOND;
41
- } else if (specifier == "minute" || specifier == "min" || specifier == "minutes" || specifier == "mins" ||
42
- specifier == "m") {
43
- result = DatePartSpecifier::MINUTE;
44
- } else if (specifier == "hour" || specifier == "hr" || specifier == "hours" || specifier == "hrs" ||
45
- specifier == "h") {
46
- result = DatePartSpecifier::HOUR;
47
- } else if (specifier == "epoch") {
48
- // seconds since 1970-01-01
49
- result = DatePartSpecifier::EPOCH;
50
- } else if (specifier == "dow" || specifier == "dayofweek" || specifier == "weekday") {
51
- // day of the week (Sunday = 0, Saturday = 6)
52
- result = DatePartSpecifier::DOW;
53
- } else if (specifier == "isodow") {
54
- // isodow (Monday = 1, Sunday = 7)
55
- result = DatePartSpecifier::ISODOW;
56
- } else if (specifier == "week" || specifier == "weeks" || specifier == "w" || specifier == "weekofyear") {
57
- // ISO week number
58
- result = DatePartSpecifier::WEEK;
59
- } else if (specifier == "doy" || specifier == "dayofyear") {
60
- // day of the year (1-365/366)
61
- result = DatePartSpecifier::DOY;
62
- } else if (specifier == "quarter" || specifier == "quarters") {
63
- // quarter of the year (1-4)
64
- result = DatePartSpecifier::QUARTER;
65
- } else if (specifier == "yearweek") {
66
- // Combined isoyear and isoweek YYYYWW
67
- result = DatePartSpecifier::YEARWEEK;
68
- } else if (specifier == "isoyear") {
69
- // ISO year (first week of the year may be in previous year)
70
- result = DatePartSpecifier::ISOYEAR;
71
- } else if (specifier == "era") {
72
- result = DatePartSpecifier::ERA;
73
- } else if (specifier == "timezone") {
74
- result = DatePartSpecifier::TIMEZONE;
75
- } else if (specifier == "timezone_hour") {
76
- result = DatePartSpecifier::TIMEZONE_HOUR;
77
- } else if (specifier == "timezone_minute") {
78
- result = DatePartSpecifier::TIMEZONE_MINUTE;
79
- } else {
80
- return false;
81
- }
82
- return true;
83
- }
84
-
85
- DatePartSpecifier GetDatePartSpecifier(const string &specifier) {
86
- DatePartSpecifier result;
87
- if (!TryGetDatePartSpecifier(specifier, result)) {
88
- throw ConversionException("extract specifier \"%s\" not recognized", specifier);
89
- }
90
- return result;
91
- }
92
-
93
17
  DatePartSpecifier GetDateTypePartSpecifier(const string &specifier, LogicalType &type) {
94
18
  const auto part = GetDatePartSpecifier(specifier);
95
19
  switch (type.id()) {
@@ -1204,31 +1128,31 @@ static void DatePartFunction(DataChunk &args, ExpressionState &state, Vector &re
1204
1128
  });
1205
1129
  }
1206
1130
 
1207
- void AddGenericDatePartOperator(BuiltinFunctions &set, const string &name, scalar_function_t date_func,
1208
- scalar_function_t ts_func, scalar_function_t interval_func,
1209
- function_statistics_t date_stats, function_statistics_t ts_stats) {
1210
- ScalarFunctionSet operator_set(name);
1131
+ ScalarFunctionSet GetGenericDatePartFunction(scalar_function_t date_func, scalar_function_t ts_func,
1132
+ scalar_function_t interval_func, function_statistics_t date_stats,
1133
+ function_statistics_t ts_stats) {
1134
+ ScalarFunctionSet operator_set;
1211
1135
  operator_set.AddFunction(
1212
1136
  ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, std::move(date_func), nullptr, nullptr, date_stats));
1213
1137
  operator_set.AddFunction(
1214
1138
  ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::BIGINT, std::move(ts_func), nullptr, nullptr, ts_stats));
1215
1139
  operator_set.AddFunction(ScalarFunction({LogicalType::INTERVAL}, LogicalType::BIGINT, std::move(interval_func)));
1216
- set.AddFunction(operator_set);
1140
+ return operator_set;
1217
1141
  }
1218
1142
 
1219
1143
  template <class OP>
1220
- static void AddDatePartOperator(BuiltinFunctions &set, string name) {
1221
- AddGenericDatePartOperator(set, name, DatePart::UnaryFunction<date_t, int64_t, OP>,
1222
- DatePart::UnaryFunction<timestamp_t, int64_t, OP>,
1223
- ScalarFunction::UnaryFunction<interval_t, int64_t, OP>,
1224
- OP::template PropagateStatistics<date_t>, OP::template PropagateStatistics<timestamp_t>);
1225
- }
1226
-
1227
- void AddGenericTimePartOperator(BuiltinFunctions &set, const string &name, scalar_function_t date_func,
1228
- scalar_function_t ts_func, scalar_function_t interval_func, scalar_function_t time_func,
1229
- function_statistics_t date_stats, function_statistics_t ts_stats,
1230
- function_statistics_t time_stats) {
1231
- ScalarFunctionSet operator_set(name);
1144
+ static ScalarFunctionSet GetDatePartFunction() {
1145
+ return GetGenericDatePartFunction(
1146
+ DatePart::UnaryFunction<date_t, int64_t, OP>, DatePart::UnaryFunction<timestamp_t, int64_t, OP>,
1147
+ ScalarFunction::UnaryFunction<interval_t, int64_t, OP>, OP::template PropagateStatistics<date_t>,
1148
+ OP::template PropagateStatistics<timestamp_t>);
1149
+ }
1150
+
1151
+ ScalarFunctionSet GetGenericTimePartFunction(scalar_function_t date_func, scalar_function_t ts_func,
1152
+ scalar_function_t interval_func, scalar_function_t time_func,
1153
+ function_statistics_t date_stats, function_statistics_t ts_stats,
1154
+ function_statistics_t time_stats) {
1155
+ ScalarFunctionSet operator_set;
1232
1156
  operator_set.AddFunction(
1233
1157
  ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, std::move(date_func), nullptr, nullptr, date_stats));
1234
1158
  operator_set.AddFunction(
@@ -1236,13 +1160,13 @@ void AddGenericTimePartOperator(BuiltinFunctions &set, const string &name, scala
1236
1160
  operator_set.AddFunction(ScalarFunction({LogicalType::INTERVAL}, LogicalType::BIGINT, std::move(interval_func)));
1237
1161
  operator_set.AddFunction(
1238
1162
  ScalarFunction({LogicalType::TIME}, LogicalType::BIGINT, std::move(time_func), nullptr, nullptr, time_stats));
1239
- set.AddFunction(operator_set);
1163
+ return operator_set;
1240
1164
  }
1241
1165
 
1242
1166
  template <class OP>
1243
- static void AddTimePartOperator(BuiltinFunctions &set, string name) {
1244
- AddGenericTimePartOperator(
1245
- set, name, DatePart::UnaryFunction<date_t, int64_t, OP>, DatePart::UnaryFunction<timestamp_t, int64_t, OP>,
1167
+ static ScalarFunctionSet GetTimePartFunction() {
1168
+ return GetGenericTimePartFunction(
1169
+ DatePart::UnaryFunction<date_t, int64_t, OP>, DatePart::UnaryFunction<timestamp_t, int64_t, OP>,
1246
1170
  ScalarFunction::UnaryFunction<interval_t, int64_t, OP>, ScalarFunction::UnaryFunction<dtime_t, int64_t, OP>,
1247
1171
  OP::template PropagateStatistics<date_t>, OP::template PropagateStatistics<timestamp_t>,
1248
1172
  OP::template PropagateStatistics<dtime_t>);
@@ -1470,68 +1394,142 @@ struct StructDatePart {
1470
1394
  }
1471
1395
  };
1472
1396
 
1473
- void DatePartFun::RegisterFunction(BuiltinFunctions &set) {
1474
- // register the individual operators
1475
- AddGenericDatePartOperator(set, "year", LastYearFunction<date_t>, LastYearFunction<timestamp_t>,
1476
- ScalarFunction::UnaryFunction<interval_t, int64_t, DatePart::YearOperator>,
1477
- DatePart::YearOperator::PropagateStatistics<date_t>,
1478
- DatePart::YearOperator::PropagateStatistics<timestamp_t>);
1479
- AddDatePartOperator<DatePart::MonthOperator>(set, "month");
1480
- AddDatePartOperator<DatePart::DayOperator>(set, "day");
1481
- AddDatePartOperator<DatePart::DecadeOperator>(set, "decade");
1482
- AddDatePartOperator<DatePart::CenturyOperator>(set, "century");
1483
- AddDatePartOperator<DatePart::MillenniumOperator>(set, "millennium");
1484
- AddDatePartOperator<DatePart::QuarterOperator>(set, "quarter");
1485
- AddDatePartOperator<DatePart::DayOfWeekOperator>(set, "dayofweek");
1486
- AddDatePartOperator<DatePart::ISODayOfWeekOperator>(set, "isodow");
1487
- AddDatePartOperator<DatePart::DayOfYearOperator>(set, "dayofyear");
1488
- AddDatePartOperator<DatePart::WeekOperator>(set, "week");
1489
- AddDatePartOperator<DatePart::ISOYearOperator>(set, "isoyear");
1490
- AddDatePartOperator<DatePart::EraOperator>(set, "era");
1491
- AddDatePartOperator<DatePart::TimezoneOperator>(set, "timezone");
1492
- AddDatePartOperator<DatePart::TimezoneHourOperator>(set, "timezone_hour");
1493
- AddDatePartOperator<DatePart::TimezoneMinuteOperator>(set, "timezone_minute");
1494
- AddTimePartOperator<DatePart::EpochOperator>(set, "epoch");
1495
- AddTimePartOperator<DatePart::MicrosecondsOperator>(set, "microsecond");
1496
- AddTimePartOperator<DatePart::MillisecondsOperator>(set, "millisecond");
1497
- AddTimePartOperator<DatePart::SecondsOperator>(set, "second");
1498
- AddTimePartOperator<DatePart::MinutesOperator>(set, "minute");
1499
- AddTimePartOperator<DatePart::HoursOperator>(set, "hour");
1500
-
1501
- // register combinations
1502
- AddDatePartOperator<DatePart::YearWeekOperator>(set, "yearweek");
1503
-
1504
- // register various aliases
1505
- AddDatePartOperator<DatePart::DayOperator>(set, "dayofmonth");
1506
- AddDatePartOperator<DatePart::DayOfWeekOperator>(set, "weekday");
1507
- AddDatePartOperator<DatePart::WeekOperator>(set, "weekofyear"); // Note that WeekOperator is ISO-8601, not US
1508
-
1509
- // register the last_day function
1510
- ScalarFunctionSet last_day("last_day");
1397
+ ScalarFunctionSet YearFun::GetFunctions() {
1398
+ return GetGenericDatePartFunction(LastYearFunction<date_t>, LastYearFunction<timestamp_t>,
1399
+ ScalarFunction::UnaryFunction<interval_t, int64_t, DatePart::YearOperator>,
1400
+ DatePart::YearOperator::PropagateStatistics<date_t>,
1401
+ DatePart::YearOperator::PropagateStatistics<timestamp_t>);
1402
+ }
1403
+
1404
+ ScalarFunctionSet MonthFun::GetFunctions() {
1405
+ return GetDatePartFunction<DatePart::MonthOperator>();
1406
+ }
1407
+
1408
+ ScalarFunctionSet DayFun::GetFunctions() {
1409
+ return GetDatePartFunction<DatePart::DayOperator>();
1410
+ }
1411
+
1412
+ ScalarFunctionSet DecadeFun::GetFunctions() {
1413
+ return GetDatePartFunction<DatePart::DecadeOperator>();
1414
+ }
1415
+
1416
+ ScalarFunctionSet CenturyFun::GetFunctions() {
1417
+ return GetDatePartFunction<DatePart::CenturyOperator>();
1418
+ }
1419
+
1420
+ ScalarFunctionSet MillenniumFun::GetFunctions() {
1421
+ return GetDatePartFunction<DatePart::MillenniumOperator>();
1422
+ }
1423
+
1424
+ ScalarFunctionSet QuarterFun::GetFunctions() {
1425
+ return GetDatePartFunction<DatePart::QuarterOperator>();
1426
+ }
1427
+
1428
+ ScalarFunctionSet DayOfWeekFun::GetFunctions() {
1429
+ return GetDatePartFunction<DatePart::DayOfWeekOperator>();
1430
+ }
1431
+
1432
+ ScalarFunctionSet ISODayOfWeekFun::GetFunctions() {
1433
+ return GetDatePartFunction<DatePart::ISODayOfWeekOperator>();
1434
+ }
1435
+
1436
+ ScalarFunctionSet DayOfYearFun::GetFunctions() {
1437
+ return GetDatePartFunction<DatePart::DayOfYearOperator>();
1438
+ }
1439
+
1440
+ ScalarFunctionSet WeekFun::GetFunctions() {
1441
+ return GetDatePartFunction<DatePart::WeekOperator>();
1442
+ }
1443
+
1444
+ ScalarFunctionSet ISOYearFun::GetFunctions() {
1445
+ return GetDatePartFunction<DatePart::ISOYearOperator>();
1446
+ }
1447
+
1448
+ ScalarFunctionSet EraFun::GetFunctions() {
1449
+ return GetDatePartFunction<DatePart::EraOperator>();
1450
+ }
1451
+
1452
+ ScalarFunctionSet TimezoneFun::GetFunctions() {
1453
+ return GetDatePartFunction<DatePart::TimezoneOperator>();
1454
+ }
1455
+
1456
+ ScalarFunctionSet TimezoneHourFun::GetFunctions() {
1457
+ return GetDatePartFunction<DatePart::TimezoneHourOperator>();
1458
+ }
1459
+
1460
+ ScalarFunctionSet TimezoneMinuteFun::GetFunctions() {
1461
+ return GetDatePartFunction<DatePart::TimezoneMinuteOperator>();
1462
+ }
1463
+
1464
+ ScalarFunctionSet EpochFun::GetFunctions() {
1465
+ return GetTimePartFunction<DatePart::EpochOperator>();
1466
+ }
1467
+
1468
+ ScalarFunctionSet MicrosecondsFun::GetFunctions() {
1469
+ return GetTimePartFunction<DatePart::MicrosecondsOperator>();
1470
+ }
1471
+
1472
+ ScalarFunctionSet MillisecondsFun::GetFunctions() {
1473
+ return GetTimePartFunction<DatePart::MillisecondsOperator>();
1474
+ }
1475
+
1476
+ ScalarFunctionSet SecondsFun::GetFunctions() {
1477
+ return GetTimePartFunction<DatePart::SecondsOperator>();
1478
+ }
1479
+
1480
+ ScalarFunctionSet MinutesFun::GetFunctions() {
1481
+ return GetTimePartFunction<DatePart::MinutesOperator>();
1482
+ }
1483
+
1484
+ ScalarFunctionSet HoursFun::GetFunctions() {
1485
+ return GetTimePartFunction<DatePart::HoursOperator>();
1486
+ }
1487
+
1488
+ ScalarFunctionSet YearWeekFun::GetFunctions() {
1489
+ return GetDatePartFunction<DatePart::YearWeekOperator>();
1490
+ }
1491
+
1492
+ ScalarFunctionSet DayOfMonthFun::GetFunctions() {
1493
+ return GetDatePartFunction<DatePart::DayOperator>();
1494
+ }
1495
+
1496
+ ScalarFunctionSet WeekDayFun::GetFunctions() {
1497
+ return GetDatePartFunction<DatePart::DayOfWeekOperator>();
1498
+ }
1499
+
1500
+ ScalarFunctionSet WeekOfYearFun::GetFunctions() {
1501
+ return GetDatePartFunction<DatePart::WeekOperator>();
1502
+ }
1503
+
1504
+ ScalarFunctionSet LastDayFun::GetFunctions() {
1505
+ ScalarFunctionSet last_day;
1511
1506
  last_day.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::DATE,
1512
1507
  DatePart::UnaryFunction<date_t, date_t, LastDayOperator>));
1513
1508
  last_day.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::DATE,
1514
1509
  DatePart::UnaryFunction<timestamp_t, date_t, LastDayOperator>));
1515
- set.AddFunction(last_day);
1510
+ return last_day;
1511
+ }
1516
1512
 
1517
- // register the monthname function
1518
- ScalarFunctionSet monthname("monthname");
1513
+ ScalarFunctionSet MonthNameFun::GetFunctions() {
1514
+ ScalarFunctionSet monthname;
1519
1515
  monthname.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::VARCHAR,
1520
1516
  DatePart::UnaryFunction<date_t, string_t, MonthNameOperator>));
1521
1517
  monthname.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::VARCHAR,
1522
1518
  DatePart::UnaryFunction<timestamp_t, string_t, MonthNameOperator>));
1523
- set.AddFunction(monthname);
1519
+ return monthname;
1520
+ }
1524
1521
 
1525
- // register the dayname function
1526
- ScalarFunctionSet dayname("dayname");
1522
+ ScalarFunctionSet DayNameFun::GetFunctions() {
1523
+ ScalarFunctionSet dayname;
1527
1524
  dayname.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::VARCHAR,
1528
1525
  DatePart::UnaryFunction<date_t, string_t, DayNameOperator>));
1529
1526
  dayname.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::VARCHAR,
1530
1527
  DatePart::UnaryFunction<timestamp_t, string_t, DayNameOperator>));
1531
- set.AddFunction(dayname);
1528
+ return dayname;
1529
+ }
1532
1530
 
1533
- // finally the actual date_part function
1534
- ScalarFunctionSet date_part("date_part");
1531
+ ScalarFunctionSet DatePartFun::GetFunctions() {
1532
+ ScalarFunctionSet date_part;
1535
1533
  date_part.AddFunction(
1536
1534
  ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::BIGINT, DatePartFunction<date_t>));
1537
1535
  date_part.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::BIGINT,
@@ -1547,9 +1545,7 @@ void DatePartFun::RegisterFunction(BuiltinFunctions &set) {
1547
1545
  date_part.AddFunction(StructDatePart::GetFunction<dtime_t>(LogicalType::TIME));
1548
1546
  date_part.AddFunction(StructDatePart::GetFunction<interval_t>(LogicalType::INTERVAL));
1549
1547
 
1550
- set.AddFunction(date_part);
1551
- date_part.name = "datepart";
1552
- set.AddFunction(date_part);
1548
+ return date_part;
1553
1549
  }
1554
1550
 
1555
1551
  } // namespace duckdb
@@ -1,4 +1,4 @@
1
- #include "duckdb/function/scalar/date_functions.hpp"
1
+ #include "duckdb/core_functions/scalar/date_functions.hpp"
2
2
  #include "duckdb/common/enums/date_part_specifier.hpp"
3
3
  #include "duckdb/common/exception.hpp"
4
4
  #include "duckdb/common/operator/subtract.hpp"
@@ -438,7 +438,7 @@ static void DateSubFunction(DataChunk &args, ExpressionState &state, Vector &res
438
438
  }
439
439
  }
440
440
 
441
- void DateSubFun::RegisterFunction(BuiltinFunctions &set) {
441
+ ScalarFunctionSet DateSubFun::GetFunctions() {
442
442
  ScalarFunctionSet date_sub("date_sub");
443
443
  date_sub.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE, LogicalType::DATE},
444
444
  LogicalType::BIGINT, DateSubFunction<date_t>));
@@ -446,10 +446,7 @@ void DateSubFun::RegisterFunction(BuiltinFunctions &set) {
446
446
  LogicalType::BIGINT, DateSubFunction<timestamp_t>));
447
447
  date_sub.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIME, LogicalType::TIME},
448
448
  LogicalType::BIGINT, DateSubFunction<dtime_t>));
449
- set.AddFunction(date_sub);
450
-
451
- date_sub.name = "datesub";
452
- set.AddFunction(date_sub);
449
+ return date_sub;
453
450
  }
454
451
 
455
452
  } // namespace duckdb
@@ -1,4 +1,4 @@
1
- #include "duckdb/function/scalar/date_functions.hpp"
1
+ #include "duckdb/core_functions/scalar/date_functions.hpp"
2
2
  #include "duckdb/common/enums/date_part_specifier.hpp"
3
3
  #include "duckdb/common/exception.hpp"
4
4
  #include "duckdb/common/operator/cast_operators.hpp"
@@ -6,7 +6,6 @@
6
6
  #include "duckdb/common/types/time.hpp"
7
7
  #include "duckdb/common/types/timestamp.hpp"
8
8
  #include "duckdb/common/types/value.hpp"
9
- #include "duckdb/common/string_util.hpp"
10
9
  #include "duckdb/execution/expression_executor.hpp"
11
10
 
12
11
  namespace duckdb {
@@ -717,7 +716,7 @@ static unique_ptr<FunctionData> DateTruncBind(ClientContext &context, ScalarFunc
717
716
  return nullptr;
718
717
  }
719
718
 
720
- void DateTruncFun::RegisterFunction(BuiltinFunctions &set) {
719
+ ScalarFunctionSet DateTruncFun::GetFunctions() {
721
720
  ScalarFunctionSet date_trunc("date_trunc");
722
721
  date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::TIMESTAMP,
723
722
  DateTruncFunction<timestamp_t, timestamp_t>, DateTruncBind));
@@ -725,9 +724,7 @@ void DateTruncFun::RegisterFunction(BuiltinFunctions &set) {
725
724
  DateTruncFunction<date_t, timestamp_t>, DateTruncBind));
726
725
  date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::INTERVAL}, LogicalType::INTERVAL,
727
726
  DateTruncFunction<interval_t, interval_t>));
728
- set.AddFunction(date_trunc);
729
- date_trunc.name = "datetrunc";
730
- set.AddFunction(date_trunc);
727
+ return date_trunc;
731
728
  }
732
729
 
733
730
  } // namespace duckdb
@@ -1,4 +1,4 @@
1
- #include "duckdb/function/scalar/date_functions.hpp"
1
+ #include "duckdb/core_functions/scalar/date_functions.hpp"
2
2
  #include "duckdb/common/types/time.hpp"
3
3
  #include "duckdb/common/types/date.hpp"
4
4
  #include "duckdb/common/types/timestamp.hpp"
@@ -33,14 +33,13 @@ static void EpochMillisFunction(DataChunk &input, ExpressionState &state, Vector
33
33
  UnaryExecutor::Execute<int64_t, timestamp_t, EpochMillisOperator>(input.data[0], result, input.size());
34
34
  }
35
35
 
36
- void EpochFun::RegisterFunction(BuiltinFunctions &set) {
37
- ScalarFunctionSet epoch("epoch_ms");
38
- epoch.AddFunction(ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochMillisFunction));
39
- set.AddFunction(epoch);
36
+ ScalarFunction EpochMsFun::GetFunction() {
37
+ return ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochMillisFunction);
38
+ }
39
+
40
+ ScalarFunction ToTimestampFun::GetFunction() {
40
41
  // to_timestamp is an alias from Postgres that converts the time in seconds to a timestamp
41
- ScalarFunctionSet to_timestamp("to_timestamp");
42
- to_timestamp.AddFunction(ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochSecFunction));
43
- set.AddFunction(to_timestamp);
42
+ return ScalarFunction({LogicalType::BIGINT}, LogicalType::TIMESTAMP, EpochSecFunction);
44
43
  }
45
44
 
46
45
  } // namespace duckdb
@@ -1,4 +1,4 @@
1
- #include "duckdb/function/scalar/date_functions.hpp"
1
+ #include "duckdb/core_functions/scalar/date_functions.hpp"
2
2
  #include "duckdb/common/types/date.hpp"
3
3
  #include "duckdb/common/types/time.hpp"
4
4
  #include "duckdb/common/types/timestamp.hpp"
@@ -79,7 +79,7 @@ static void ExecuteMakeTimestamp(DataChunk &input, ExpressionState &state, Vecto
79
79
  SenaryExecutor::Execute<T, T, T, T, T, double, timestamp_t>(input, result, func);
80
80
  }
81
81
 
82
- void MakeDateFun::RegisterFunction(BuiltinFunctions &set) {
82
+ ScalarFunctionSet MakeDateFun::GetFunctions() {
83
83
  ScalarFunctionSet make_date("make_date");
84
84
  make_date.AddFunction(ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT},
85
85
  LogicalType::DATE, ExecuteMakeDate<int64_t>));
@@ -88,18 +88,18 @@ void MakeDateFun::RegisterFunction(BuiltinFunctions &set) {
88
88
  {"year", LogicalType::BIGINT}, {"month", LogicalType::BIGINT}, {"day", LogicalType::BIGINT}};
89
89
  make_date.AddFunction(
90
90
  ScalarFunction({LogicalType::STRUCT(make_date_children)}, LogicalType::DATE, ExecuteStructMakeDate<int64_t>));
91
- set.AddFunction(make_date);
92
-
93
- ScalarFunctionSet make_time("make_time");
94
- make_time.AddFunction(ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::DOUBLE},
95
- LogicalType::TIME, ExecuteMakeTime<int64_t>));
96
- set.AddFunction(make_time);
97
-
98
- ScalarFunctionSet make_timestamp("make_timestamp");
99
- make_timestamp.AddFunction(ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT,
100
- LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::DOUBLE},
101
- LogicalType::TIMESTAMP, ExecuteMakeTimestamp<int64_t>));
102
- set.AddFunction(make_timestamp);
91
+ return make_date;
92
+ }
93
+
94
+ ScalarFunction MakeTimeFun::GetFunction() {
95
+ return ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::DOUBLE}, LogicalType::TIME,
96
+ ExecuteMakeTime<int64_t>);
97
+ }
98
+
99
+ ScalarFunction MakeTimestampFun::GetFunction() {
100
+ return ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT,
101
+ LogicalType::BIGINT, LogicalType::DOUBLE},
102
+ LogicalType::TIMESTAMP, ExecuteMakeTimestamp<int64_t>);
103
103
  }
104
104
 
105
105
  } // namespace duckdb