duckdb 1.1.4-dev2.0 → 1.1.4-dev9.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 (1747) hide show
  1. package/.github/workflows/NodeJS.yml +5 -54
  2. package/binding.gyp +73 -52
  3. package/package.json +1 -1
  4. package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/avg.cpp +2 -2
  5. package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/corr.cpp +4 -4
  6. package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/covar.cpp +2 -2
  7. package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/stddev.cpp +2 -2
  8. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/approx_count.cpp +1 -1
  9. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/arg_min_max.cpp +66 -18
  10. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/bitagg.cpp +1 -1
  11. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/bitstring_agg.cpp +5 -7
  12. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/bool.cpp +3 -1
  13. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/kurtosis.cpp +1 -1
  14. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/product.cpp +1 -1
  15. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/skew.cpp +2 -2
  16. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/string_agg.cpp +1 -1
  17. package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/sum.cpp +13 -2
  18. package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/approx_top_k.cpp +3 -3
  19. package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/approximate_quantile.cpp +51 -15
  20. package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/mad.cpp +25 -10
  21. package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/mode.cpp +215 -71
  22. package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/quantile.cpp +58 -31
  23. package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/reservoir_quantile.cpp +2 -2
  24. package/src/duckdb/{src → extension}/core_functions/aggregate/nested/binned_histogram.cpp +9 -4
  25. package/src/duckdb/{src → extension}/core_functions/aggregate/nested/histogram.cpp +4 -2
  26. package/src/duckdb/{src → extension}/core_functions/aggregate/nested/list.cpp +1 -1
  27. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_avg.cpp +1 -1
  28. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_count.cpp +2 -2
  29. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_intercept.cpp +6 -2
  30. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_r2.cpp +2 -2
  31. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_slope.cpp +2 -2
  32. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_sxx_syy.cpp +2 -2
  33. package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_sxy.cpp +3 -3
  34. package/src/duckdb/extension/core_functions/core_functions_extension.cpp +85 -0
  35. package/src/duckdb/{src → extension}/core_functions/function_list.cpp +30 -51
  36. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic/corr.hpp +3 -7
  37. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic_functions.hpp +1 -1
  38. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/distributive_functions.hpp +16 -21
  39. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/histogram_helpers.hpp +1 -1
  40. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/holistic_functions.hpp +1 -1
  41. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/nested_functions.hpp +1 -1
  42. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/quantile_helpers.hpp +2 -2
  43. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/quantile_sort_tree.hpp +140 -58
  44. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/quantile_state.hpp +50 -43
  45. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/regression/regr_count.hpp +2 -2
  46. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/regression/regr_slope.hpp +3 -7
  47. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/regression_functions.hpp +1 -1
  48. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/array_functions.hpp +1 -1
  49. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/bit_functions.hpp +1 -1
  50. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/blob_functions.hpp +1 -10
  51. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/date_functions.hpp +22 -55
  52. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/debug_functions.hpp +1 -1
  53. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/enum_functions.hpp +1 -1
  54. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/generic_functions.hpp +1 -10
  55. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/list_functions.hpp +4 -4
  56. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/map_functions.hpp +1 -10
  57. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/math_functions.hpp +1 -1
  58. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/operators_functions.hpp +1 -1
  59. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/random_functions.hpp +1 -1
  60. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/string_functions.hpp +10 -103
  61. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/struct_functions.hpp +1 -19
  62. package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/union_functions.hpp +1 -1
  63. package/src/duckdb/extension/core_functions/include/core_functions_extension.hpp +22 -0
  64. package/src/duckdb/{src → extension}/core_functions/lambda_functions.cpp +1 -1
  65. package/src/duckdb/{src → extension}/core_functions/scalar/array/array_functions.cpp +11 -4
  66. package/src/duckdb/{src → extension}/core_functions/scalar/array/array_value.cpp +2 -2
  67. package/src/duckdb/{src → extension}/core_functions/scalar/bit/bitstring.cpp +12 -5
  68. package/src/duckdb/{src → extension}/core_functions/scalar/blob/base64.cpp +4 -2
  69. package/src/duckdb/{src → extension}/core_functions/scalar/blob/encode.cpp +4 -2
  70. package/src/duckdb/{src → extension}/core_functions/scalar/date/age.cpp +9 -3
  71. package/src/duckdb/extension/core_functions/scalar/date/current.cpp +29 -0
  72. package/src/duckdb/{src → extension}/core_functions/scalar/date/date_diff.cpp +1 -1
  73. package/src/duckdb/{src → extension}/core_functions/scalar/date/date_part.cpp +42 -9
  74. package/src/duckdb/{src → extension}/core_functions/scalar/date/date_sub.cpp +1 -1
  75. package/src/duckdb/{src → extension}/core_functions/scalar/date/date_trunc.cpp +4 -1
  76. package/src/duckdb/{src → extension}/core_functions/scalar/date/epoch.cpp +19 -3
  77. package/src/duckdb/{src → extension}/core_functions/scalar/date/make_date.cpp +40 -5
  78. package/src/duckdb/{src → extension}/core_functions/scalar/date/time_bucket.cpp +4 -1
  79. package/src/duckdb/{src → extension}/core_functions/scalar/date/to_interval.cpp +54 -28
  80. package/src/duckdb/{src → extension}/core_functions/scalar/debug/vector_type.cpp +1 -1
  81. package/src/duckdb/{src → extension}/core_functions/scalar/enum/enum_functions.cpp +2 -7
  82. package/src/duckdb/{src → extension}/core_functions/scalar/generic/alias.cpp +2 -2
  83. package/src/duckdb/{src/function → extension/core_functions}/scalar/generic/binning.cpp +4 -3
  84. package/src/duckdb/{src → extension}/core_functions/scalar/generic/can_implicitly_cast.cpp +1 -1
  85. package/src/duckdb/{src → extension}/core_functions/scalar/generic/current_setting.cpp +1 -1
  86. package/src/duckdb/{src → extension}/core_functions/scalar/generic/hash.cpp +1 -1
  87. package/src/duckdb/{src → extension}/core_functions/scalar/generic/least.cpp +30 -10
  88. package/src/duckdb/{src → extension}/core_functions/scalar/generic/stats.cpp +1 -1
  89. package/src/duckdb/{src → extension}/core_functions/scalar/generic/system_functions.cpp +1 -1
  90. package/src/duckdb/{src → extension}/core_functions/scalar/generic/typeof.cpp +1 -1
  91. package/src/duckdb/{src → extension}/core_functions/scalar/list/array_slice.cpp +93 -88
  92. package/src/duckdb/{src → extension}/core_functions/scalar/list/flatten.cpp +1 -1
  93. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_aggregates.cpp +7 -3
  94. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_distance.cpp +8 -2
  95. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_filter.cpp +3 -3
  96. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_has_any_or_all.cpp +3 -3
  97. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_reduce.cpp +5 -5
  98. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_sort.cpp +1 -1
  99. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_transform.cpp +3 -3
  100. package/src/duckdb/{src → extension}/core_functions/scalar/list/list_value.cpp +3 -3
  101. package/src/duckdb/{src → extension}/core_functions/scalar/list/range.cpp +7 -1
  102. package/src/duckdb/{src → extension}/core_functions/scalar/map/cardinality.cpp +1 -1
  103. package/src/duckdb/{src → extension}/core_functions/scalar/map/map.cpp +5 -4
  104. package/src/duckdb/{src → extension}/core_functions/scalar/map/map_concat.cpp +1 -1
  105. package/src/duckdb/{src → extension}/core_functions/scalar/map/map_entries.cpp +1 -1
  106. package/src/duckdb/{src → extension}/core_functions/scalar/map/map_extract.cpp +13 -25
  107. package/src/duckdb/{src → extension}/core_functions/scalar/map/map_from_entries.cpp +2 -1
  108. package/src/duckdb/{src → extension}/core_functions/scalar/map/map_keys_values.cpp +11 -9
  109. package/src/duckdb/{src → extension}/core_functions/scalar/math/numeric.cpp +83 -37
  110. package/src/duckdb/{src → extension}/core_functions/scalar/operators/bitwise.cpp +19 -1
  111. package/src/duckdb/{src → extension}/core_functions/scalar/random/random.cpp +4 -3
  112. package/src/duckdb/{src → extension}/core_functions/scalar/random/setseed.cpp +2 -1
  113. package/src/duckdb/{src → extension}/core_functions/scalar/string/ascii.cpp +1 -1
  114. package/src/duckdb/{src → extension}/core_functions/scalar/string/bar.cpp +6 -4
  115. package/src/duckdb/{src → extension}/core_functions/scalar/string/chr.cpp +1 -1
  116. package/src/duckdb/{src → extension}/core_functions/scalar/string/damerau_levenshtein.cpp +1 -1
  117. package/src/duckdb/{src → extension}/core_functions/scalar/string/format_bytes.cpp +1 -1
  118. package/src/duckdb/{src → extension}/core_functions/scalar/string/hamming.cpp +1 -1
  119. package/src/duckdb/{src → extension}/core_functions/scalar/string/hex.cpp +7 -3
  120. package/src/duckdb/{src → extension}/core_functions/scalar/string/instr.cpp +4 -4
  121. package/src/duckdb/{src → extension}/core_functions/scalar/string/jaccard.cpp +1 -1
  122. package/src/duckdb/extension/core_functions/scalar/string/jaro_winkler.cpp +112 -0
  123. package/src/duckdb/{src → extension}/core_functions/scalar/string/left_right.cpp +6 -6
  124. package/src/duckdb/{src → extension}/core_functions/scalar/string/levenshtein.cpp +1 -1
  125. package/src/duckdb/{src → extension}/core_functions/scalar/string/pad.cpp +9 -5
  126. package/src/duckdb/{src → extension}/core_functions/scalar/string/parse_path.cpp +4 -4
  127. package/src/duckdb/{src → extension}/core_functions/scalar/string/printf.cpp +3 -1
  128. package/src/duckdb/{src → extension}/core_functions/scalar/string/repeat.cpp +4 -1
  129. package/src/duckdb/{src → extension}/core_functions/scalar/string/replace.cpp +1 -1
  130. package/src/duckdb/{src → extension}/core_functions/scalar/string/reverse.cpp +1 -1
  131. package/src/duckdb/{src → extension}/core_functions/scalar/string/starts_with.cpp +5 -3
  132. package/src/duckdb/{src → extension}/core_functions/scalar/string/to_base.cpp +1 -1
  133. package/src/duckdb/{src → extension}/core_functions/scalar/string/translate.cpp +1 -1
  134. package/src/duckdb/{src → extension}/core_functions/scalar/string/trim.cpp +1 -1
  135. package/src/duckdb/{src → extension}/core_functions/scalar/string/unicode.cpp +1 -1
  136. package/src/duckdb/{src → extension}/core_functions/scalar/string/url_encode.cpp +1 -1
  137. package/src/duckdb/{src → extension}/core_functions/scalar/struct/struct_insert.cpp +25 -31
  138. package/src/duckdb/{src → extension}/core_functions/scalar/union/union_extract.cpp +1 -1
  139. package/src/duckdb/{src → extension}/core_functions/scalar/union/union_tag.cpp +1 -1
  140. package/src/duckdb/{src → extension}/core_functions/scalar/union/union_value.cpp +3 -3
  141. package/src/duckdb/extension/icu/icu-dateadd.cpp +16 -11
  142. package/src/duckdb/extension/icu/icu-datefunc.cpp +2 -2
  143. package/src/duckdb/extension/icu/icu-datepart.cpp +8 -5
  144. package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
  145. package/src/duckdb/extension/icu/icu-datetrunc.cpp +8 -1
  146. package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
  147. package/src/duckdb/extension/icu/icu-makedate.cpp +18 -7
  148. package/src/duckdb/extension/icu/icu-strptime.cpp +9 -3
  149. package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
  150. package/src/duckdb/extension/icu/icu-timebucket.cpp +4 -1
  151. package/src/duckdb/extension/icu/icu-timezone.cpp +67 -1
  152. package/src/duckdb/extension/icu/icu_extension.cpp +60 -5
  153. package/src/duckdb/extension/icu/include/icu-datefunc.hpp +2 -1
  154. package/src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp +1 -1
  155. package/src/duckdb/extension/icu/third_party/icu/common/dtintrv.cpp +1 -1
  156. package/src/duckdb/extension/icu/third_party/icu/common/filteredbrk.cpp +1 -1
  157. package/src/duckdb/extension/icu/third_party/icu/common/locid.cpp +1 -1
  158. package/src/duckdb/extension/icu/third_party/icu/common/lsr.cpp +1 -1
  159. package/src/duckdb/extension/icu/third_party/icu/common/lsr.h +2 -2
  160. package/src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp +2 -2
  161. package/src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp +1 -1
  162. package/src/duckdb/extension/icu/third_party/icu/common/rbbinode.h +1 -1
  163. package/src/duckdb/extension/icu/third_party/icu/common/schriter.cpp +1 -1
  164. package/src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp +8 -8
  165. package/src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp +1 -1
  166. package/src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp +1 -1
  167. package/src/duckdb/extension/icu/third_party/icu/common/unicode/brkiter.h +2 -2
  168. package/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestriebuilder.h +1 -1
  169. package/src/duckdb/extension/icu/third_party/icu/common/unicode/chariter.h +3 -3
  170. package/src/duckdb/extension/icu/third_party/icu/common/unicode/dtintrv.h +3 -3
  171. package/src/duckdb/extension/icu/third_party/icu/common/unicode/locid.h +3 -3
  172. package/src/duckdb/extension/icu/third_party/icu/common/unicode/messagepattern.h +4 -4
  173. package/src/duckdb/extension/icu/third_party/icu/common/unicode/normlzr.h +3 -3
  174. package/src/duckdb/extension/icu/third_party/icu/common/unicode/parsepos.h +4 -4
  175. package/src/duckdb/extension/icu/third_party/icu/common/unicode/rbbi.h +2 -2
  176. package/src/duckdb/extension/icu/third_party/icu/common/unicode/schriter.h +1 -1
  177. package/src/duckdb/extension/icu/third_party/icu/common/unicode/strenum.h +2 -2
  178. package/src/duckdb/extension/icu/third_party/icu/common/unicode/stringpiece.h +1 -1
  179. package/src/duckdb/extension/icu/third_party/icu/common/unicode/stringtriebuilder.h +9 -9
  180. package/src/duckdb/extension/icu/third_party/icu/common/unicode/ucharstriebuilder.h +1 -1
  181. package/src/duckdb/extension/icu/third_party/icu/common/unicode/uchriter.h +1 -1
  182. package/src/duckdb/extension/icu/third_party/icu/common/unicode/uniset.h +3 -3
  183. package/src/duckdb/extension/icu/third_party/icu/common/unicode/unistr.h +12 -12
  184. package/src/duckdb/extension/icu/third_party/icu/common/unicode/uobject.h +2 -2
  185. package/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.h +4 -4
  186. package/src/duckdb/extension/icu/third_party/icu/common/uniset.cpp +1 -1
  187. package/src/duckdb/extension/icu/third_party/icu/common/ustr_titlecase_brkiter.cpp +1 -1
  188. package/src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp +2 -2
  189. package/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp +1 -1
  190. package/src/duckdb/extension/icu/third_party/icu/common/uvector.h +3 -3
  191. package/src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp +1 -1
  192. package/src/duckdb/extension/icu/third_party/icu/common/uvectr32.h +3 -3
  193. package/src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp +1 -1
  194. package/src/duckdb/extension/icu/third_party/icu/common/uvectr64.h +3 -3
  195. package/src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp +2 -2
  196. package/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +1 -1
  197. package/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp +1 -1
  198. package/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp +2 -2
  199. package/src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp +2 -2
  200. package/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp +1 -1
  201. package/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.h +2 -2
  202. package/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp +1 -1
  203. package/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.h +2 -2
  204. package/src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp +1 -1
  205. package/src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp +2 -2
  206. package/src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp +1 -1
  207. package/src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp +1 -1
  208. package/src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp +1 -1
  209. package/src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp +1 -1
  210. package/src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp +1 -1
  211. package/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp +2 -2
  212. package/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen_impl.h +4 -4
  213. package/src/duckdb/extension/icu/third_party/icu/i18n/dtrule.cpp +2 -2
  214. package/src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp +1 -1
  215. package/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp +1 -1
  216. package/src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp +1 -1
  217. package/src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp +1 -1
  218. package/src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp +1 -1
  219. package/src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp +1 -1
  220. package/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp +2 -2
  221. package/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp +1 -1
  222. package/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.h +2 -2
  223. package/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp +1 -1
  224. package/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.h +2 -2
  225. package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp +9 -9
  226. package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.h +2 -2
  227. package/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp +1 -1
  228. package/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.h +1 -1
  229. package/src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp +1 -1
  230. package/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp +1 -1
  231. package/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.h +1 -1
  232. package/src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp +2 -2
  233. package/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp +1 -1
  234. package/src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp +4 -4
  235. package/src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp +2 -2
  236. package/src/duckdb/extension/icu/third_party/icu/i18n/region.cpp +2 -2
  237. package/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp +1 -1
  238. package/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.h +1 -1
  239. package/src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp +1 -1
  240. package/src/duckdb/extension/icu/third_party/icu/i18n/selfmt.cpp +2 -2
  241. package/src/duckdb/extension/icu/third_party/icu/i18n/simpletz.cpp +1 -1
  242. package/src/duckdb/extension/icu/third_party/icu/i18n/smpdtfmt.cpp +1 -1
  243. package/src/duckdb/extension/icu/third_party/icu/i18n/sortkey.cpp +1 -1
  244. package/src/duckdb/extension/icu/third_party/icu/i18n/timezone.cpp +1 -1
  245. package/src/duckdb/extension/icu/third_party/icu/i18n/tmutamt.cpp +1 -1
  246. package/src/duckdb/extension/icu/third_party/icu/i18n/tzfmt.cpp +1 -1
  247. package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp +1 -1
  248. package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.h +2 -2
  249. package/src/duckdb/extension/icu/third_party/icu/i18n/tznames.cpp +3 -3
  250. package/src/duckdb/extension/icu/third_party/icu/i18n/tznames_impl.cpp +2 -2
  251. package/src/duckdb/extension/icu/third_party/icu/i18n/tznames_impl.h +2 -2
  252. package/src/duckdb/extension/icu/third_party/icu/i18n/tzrule.cpp +8 -8
  253. package/src/duckdb/extension/icu/third_party/icu/i18n/tztrans.cpp +2 -2
  254. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/alphaindex.h +2 -2
  255. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/calendar.h +2 -2
  256. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/choicfmt.h +1 -1
  257. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coleitr.h +2 -2
  258. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coll.h +2 -2
  259. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/currpinf.h +3 -3
  260. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/datefmt.h +1 -1
  261. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dcfmtsym.h +2 -2
  262. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/decimfmt.h +1 -1
  263. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtfmtsym.h +2 -2
  264. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtitvfmt.h +3 -3
  265. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtitvinf.h +3 -3
  266. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtptngen.h +2 -2
  267. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtrule.h +2 -2
  268. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/fieldpos.h +4 -4
  269. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/fmtable.h +2 -2
  270. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/format.h +2 -2
  271. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/fpositer.h +2 -2
  272. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/measfmt.h +1 -1
  273. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/measunit.h +2 -2
  274. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/measure.h +1 -1
  275. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/msgfmt.h +2 -2
  276. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/numfmt.h +1 -1
  277. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/plurfmt.h +2 -2
  278. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/plurrule.h +2 -2
  279. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/rbnf.h +1 -1
  280. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/rbtz.h +2 -2
  281. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/region.h +2 -2
  282. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/search.h +2 -2
  283. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/selfmt.h +2 -2
  284. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/simpletz.h +1 -1
  285. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/smpdtfmt.h +1 -1
  286. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/sortkey.h +3 -3
  287. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/stsearch.h +1 -1
  288. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tblcoll.h +1 -1
  289. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/timezone.h +2 -2
  290. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tmutamt.h +3 -3
  291. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tmutfmt.h +2 -2
  292. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tzfmt.h +1 -1
  293. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tznames.h +2 -2
  294. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tzrule.h +8 -8
  295. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tztrans.h +2 -2
  296. package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/vtzone.h +2 -2
  297. package/src/duckdb/extension/icu/third_party/icu/i18n/utf16collationiterator.cpp +2 -2
  298. package/src/duckdb/extension/icu/third_party/icu/i18n/utf16collationiterator.h +2 -2
  299. package/src/duckdb/extension/icu/third_party/icu/i18n/vtzone.cpp +2 -2
  300. package/src/duckdb/extension/json/buffered_json_reader.cpp +6 -1
  301. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +2 -0
  302. package/src/duckdb/extension/json/include/json_common.hpp +14 -10
  303. package/src/duckdb/extension/json/include/json_scan.hpp +48 -7
  304. package/src/duckdb/extension/json/include/json_structure.hpp +2 -1
  305. package/src/duckdb/extension/json/include/json_transform.hpp +5 -2
  306. package/src/duckdb/extension/json/json_functions/copy_json.cpp +1 -1
  307. package/src/duckdb/extension/json/json_functions/json_create.cpp +57 -20
  308. package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +7 -6
  309. package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +6 -5
  310. package/src/duckdb/extension/json/json_functions/json_structure.cpp +20 -17
  311. package/src/duckdb/extension/json/json_functions/json_transform.cpp +48 -17
  312. package/src/duckdb/extension/json/json_functions/read_json.cpp +83 -34
  313. package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +3 -3
  314. package/src/duckdb/extension/json/json_functions.cpp +14 -16
  315. package/src/duckdb/extension/json/json_scan.cpp +36 -16
  316. package/src/duckdb/extension/json/json_serializer.cpp +1 -1
  317. package/src/duckdb/extension/json/serialize_json.cpp +2 -2
  318. package/src/duckdb/extension/parquet/column_reader.cpp +136 -116
  319. package/src/duckdb/extension/parquet/column_writer.cpp +870 -604
  320. package/src/duckdb/extension/parquet/geo_parquet.cpp +4 -5
  321. package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +0 -4
  322. package/src/duckdb/extension/parquet/include/column_reader.hpp +24 -19
  323. package/src/duckdb/extension/parquet/include/column_writer.hpp +7 -5
  324. package/src/duckdb/extension/parquet/include/decode_utils.hpp +138 -18
  325. package/src/duckdb/extension/parquet/include/geo_parquet.hpp +4 -3
  326. package/src/duckdb/extension/parquet/include/null_column_reader.hpp +1 -14
  327. package/src/duckdb/extension/parquet/include/parquet_bss_encoder.hpp +45 -0
  328. package/src/duckdb/extension/parquet/include/parquet_crypto.hpp +1 -1
  329. package/src/duckdb/extension/parquet/include/parquet_dbp_decoder.hpp +101 -90
  330. package/src/duckdb/extension/parquet/include/parquet_dbp_encoder.hpp +179 -0
  331. package/src/duckdb/extension/parquet/include/parquet_decimal_utils.hpp +2 -3
  332. package/src/duckdb/extension/parquet/include/parquet_dlba_encoder.hpp +48 -0
  333. package/src/duckdb/extension/parquet/include/parquet_extension.hpp +8 -0
  334. package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +2 -2
  335. package/src/duckdb/extension/parquet/include/parquet_metadata.hpp +5 -0
  336. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +22 -18
  337. package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -5
  338. package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +87 -3
  339. package/src/duckdb/extension/parquet/include/parquet_writer.hpp +30 -16
  340. package/src/duckdb/extension/parquet/include/resizable_buffer.hpp +1 -0
  341. package/src/duckdb/extension/parquet/include/string_column_reader.hpp +0 -8
  342. package/src/duckdb/extension/parquet/include/struct_column_reader.hpp +1 -1
  343. package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +1 -42
  344. package/src/duckdb/extension/parquet/include/thrift_tools.hpp +13 -1
  345. package/src/duckdb/extension/parquet/include/zstd_file_system.hpp +4 -0
  346. package/src/duckdb/extension/parquet/parquet_extension.cpp +240 -197
  347. package/src/duckdb/extension/parquet/parquet_metadata.cpp +138 -6
  348. package/src/duckdb/extension/parquet/parquet_reader.cpp +155 -79
  349. package/src/duckdb/extension/parquet/parquet_statistics.cpp +258 -38
  350. package/src/duckdb/extension/parquet/parquet_timestamp.cpp +17 -3
  351. package/src/duckdb/extension/parquet/parquet_writer.cpp +65 -34
  352. package/src/duckdb/extension/parquet/serialize_parquet.cpp +4 -0
  353. package/src/duckdb/extension/parquet/zstd_file_system.cpp +13 -0
  354. package/src/duckdb/src/catalog/catalog.cpp +272 -97
  355. package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +9 -4
  356. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +8 -0
  357. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +145 -95
  358. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +9 -3
  359. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +15 -0
  360. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +40 -24
  361. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +1 -1
  362. package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +2 -2
  363. package/src/duckdb/src/catalog/catalog_entry.cpp +3 -0
  364. package/src/duckdb/src/catalog/catalog_entry_retriever.cpp +60 -5
  365. package/src/duckdb/src/catalog/catalog_search_path.cpp +27 -14
  366. package/src/duckdb/src/catalog/catalog_set.cpp +75 -31
  367. package/src/duckdb/src/catalog/default/default_functions.cpp +13 -8
  368. package/src/duckdb/src/catalog/default/default_views.cpp +1 -0
  369. package/src/duckdb/src/catalog/dependency_manager.cpp +133 -5
  370. package/src/duckdb/src/catalog/duck_catalog.cpp +17 -9
  371. package/src/duckdb/src/common/adbc/adbc.cpp +18 -0
  372. package/src/duckdb/src/common/allocator.cpp +3 -1
  373. package/src/duckdb/src/common/arrow/arrow_appender.cpp +30 -9
  374. package/src/duckdb/src/common/arrow/arrow_converter.cpp +63 -82
  375. package/src/duckdb/src/common/arrow/arrow_merge_event.cpp +4 -3
  376. package/src/duckdb/src/common/arrow/arrow_type_extension.cpp +361 -0
  377. package/src/duckdb/src/common/arrow/arrow_util.cpp +10 -6
  378. package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +6 -2
  379. package/src/duckdb/src/common/arrow/physical_arrow_collector.cpp +2 -1
  380. package/src/duckdb/src/common/arrow/schema_metadata.cpp +27 -14
  381. package/src/duckdb/src/common/assert.cpp +1 -2
  382. package/src/duckdb/src/common/bind_helpers.cpp +1 -1
  383. package/src/duckdb/src/common/box_renderer.cpp +316 -26
  384. package/src/duckdb/src/common/cgroups.cpp +7 -1
  385. package/src/duckdb/src/common/compressed_file_system.cpp +1 -1
  386. package/src/duckdb/src/common/enum_util.cpp +2865 -6882
  387. package/src/duckdb/src/common/enums/compression_type.cpp +12 -0
  388. package/src/duckdb/src/common/enums/metric_type.cpp +24 -0
  389. package/src/duckdb/src/common/enums/optimizer_type.cpp +4 -0
  390. package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
  391. package/src/duckdb/src/common/error_data.cpp +23 -6
  392. package/src/duckdb/src/common/exception/binder_exception.cpp +1 -1
  393. package/src/duckdb/src/common/exception.cpp +20 -28
  394. package/src/duckdb/src/common/extra_type_info.cpp +85 -20
  395. package/src/duckdb/src/common/file_buffer.cpp +5 -2
  396. package/src/duckdb/src/common/file_system.cpp +8 -3
  397. package/src/duckdb/src/common/fsst.cpp +3 -3
  398. package/src/duckdb/src/common/hive_partitioning.cpp +1 -1
  399. package/src/duckdb/src/common/local_file_system.cpp +169 -60
  400. package/src/duckdb/src/common/multi_file_list.cpp +4 -1
  401. package/src/duckdb/src/common/multi_file_reader.cpp +240 -63
  402. package/src/duckdb/src/common/opener_file_system.cpp +37 -0
  403. package/src/duckdb/src/common/operator/cast_operators.cpp +77 -11
  404. package/src/duckdb/src/common/operator/string_cast.cpp +6 -2
  405. package/src/duckdb/src/common/pipe_file_system.cpp +4 -4
  406. package/src/duckdb/src/common/progress_bar/progress_bar.cpp +25 -14
  407. package/src/duckdb/src/common/radix_partitioning.cpp +17 -16
  408. package/src/duckdb/src/common/random_engine.cpp +39 -3
  409. package/src/duckdb/src/common/render_tree.cpp +3 -19
  410. package/src/duckdb/src/common/row_operations/row_external.cpp +1 -1
  411. package/src/duckdb/src/common/row_operations/row_gather.cpp +2 -58
  412. package/src/duckdb/src/common/row_operations/row_matcher.cpp +2 -2
  413. package/src/duckdb/src/common/row_operations/row_radix_scatter.cpp +2 -0
  414. package/src/duckdb/src/common/row_operations/row_scatter.cpp +20 -19
  415. package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +1 -1
  416. package/src/duckdb/src/common/serializer/memory_stream.cpp +36 -0
  417. package/src/duckdb/src/common/sort/comparators.cpp +7 -7
  418. package/src/duckdb/src/common/sort/partition_state.cpp +2 -2
  419. package/src/duckdb/src/common/stacktrace.cpp +127 -0
  420. package/src/duckdb/src/common/string_util.cpp +157 -32
  421. package/src/duckdb/src/common/tree_renderer/text_tree_renderer.cpp +15 -3
  422. package/src/duckdb/src/common/types/column/column_data_allocator.cpp +4 -0
  423. package/src/duckdb/src/common/types/column/column_data_collection.cpp +71 -8
  424. package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +27 -6
  425. package/src/duckdb/src/common/types/conflict_manager.cpp +21 -7
  426. package/src/duckdb/src/common/types/date.cpp +39 -25
  427. package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +4 -11
  428. package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +21 -7
  429. package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +10 -1
  430. package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +17 -17
  431. package/src/duckdb/src/common/types/timestamp.cpp +70 -33
  432. package/src/duckdb/src/common/types/uuid.cpp +11 -0
  433. package/src/duckdb/src/common/types/validity_mask.cpp +16 -5
  434. package/src/duckdb/src/common/types/value.cpp +357 -199
  435. package/src/duckdb/src/common/types/varint.cpp +64 -18
  436. package/src/duckdb/src/common/types/vector.cpp +78 -38
  437. package/src/duckdb/src/common/types.cpp +199 -92
  438. package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +2 -1
  439. package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +32 -5
  440. package/src/duckdb/src/common/vector_operations/vector_hash.cpp +3 -1
  441. package/src/duckdb/src/execution/adaptive_filter.cpp +6 -2
  442. package/src/duckdb/src/execution/aggregate_hashtable.cpp +410 -111
  443. package/src/duckdb/src/execution/column_binding_resolver.cpp +2 -2
  444. package/src/duckdb/src/execution/expression_executor/execute_between.cpp +6 -0
  445. package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +4 -3
  446. package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +2 -2
  447. package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +2 -2
  448. package/src/duckdb/src/execution/expression_executor/execute_function.cpp +1 -0
  449. package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +5 -4
  450. package/src/duckdb/src/execution/expression_executor.cpp +5 -3
  451. package/src/duckdb/src/execution/index/art/art.cpp +208 -72
  452. package/src/duckdb/src/execution/index/art/base_leaf.cpp +1 -1
  453. package/src/duckdb/src/execution/index/art/leaf.cpp +12 -7
  454. package/src/duckdb/src/execution/index/art/node.cpp +2 -1
  455. package/src/duckdb/src/execution/index/art/node256_leaf.cpp +6 -6
  456. package/src/duckdb/src/execution/index/art/plan_art.cpp +50 -55
  457. package/src/duckdb/src/execution/index/art/prefix.cpp +7 -13
  458. package/src/duckdb/src/execution/index/bound_index.cpp +30 -5
  459. package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +3 -5
  460. package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +14 -9
  461. package/src/duckdb/src/execution/join_hashtable.cpp +254 -158
  462. package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +1 -1
  463. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +7 -7
  464. package/src/duckdb/src/execution/operator/aggregate/physical_partitioned_aggregate.cpp +226 -0
  465. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +3 -3
  466. package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +3 -3
  467. package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +77 -70
  468. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +114 -50
  469. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +2 -2
  470. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +19 -10
  471. package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +22 -15
  472. package/src/duckdb/src/execution/operator/csv_scanner/encode/csv_encoder.cpp +95 -0
  473. package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +6 -1
  474. package/src/duckdb/src/execution/operator/csv_scanner/scanner/csv_schema.cpp +75 -2
  475. package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +40 -12
  476. package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +395 -163
  477. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +20 -23
  478. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +115 -49
  479. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +66 -12
  480. package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +20 -23
  481. package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +220 -46
  482. package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +43 -32
  483. package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +54 -119
  484. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +184 -20
  485. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +83 -21
  486. package/src/duckdb/src/execution/operator/csv_scanner/util/csv_validator.cpp +63 -0
  487. package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +7 -4
  488. package/src/duckdb/src/execution/operator/helper/physical_set.cpp +1 -1
  489. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +3 -2
  490. package/src/duckdb/src/execution/operator/helper/physical_verify_vector.cpp +9 -1
  491. package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +132 -15
  492. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +64 -55
  493. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +284 -154
  494. package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +40 -55
  495. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +0 -1
  496. package/src/duckdb/src/execution/operator/order/physical_order.cpp +7 -3
  497. package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +298 -227
  498. package/src/duckdb/src/execution/operator/persistent/csv_rejects_table.cpp +5 -2
  499. package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +3 -4
  500. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +32 -19
  501. package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +1 -0
  502. package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +6 -0
  503. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +58 -19
  504. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +11 -27
  505. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +308 -119
  506. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +105 -55
  507. package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +6 -2
  508. package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +1 -1
  509. package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +15 -6
  510. package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +92 -50
  511. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +0 -1
  512. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +8 -4
  513. package/src/duckdb/src/execution/operator/schema/physical_create_art_index.cpp +54 -22
  514. package/src/duckdb/src/execution/operator/set/physical_union.cpp +5 -1
  515. package/src/duckdb/src/execution/physical_operator.cpp +15 -9
  516. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +101 -12
  517. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +11 -140
  518. package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +11 -13
  519. package/src/duckdb/src/execution/physical_plan/plan_cte.cpp +1 -1
  520. package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
  521. package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +1 -1
  522. package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +6 -5
  523. package/src/duckdb/src/execution/physical_plan/plan_export.cpp +0 -4
  524. package/src/duckdb/src/execution/physical_plan/plan_filter.cpp +1 -1
  525. package/src/duckdb/src/execution/physical_plan/plan_get.cpp +16 -13
  526. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
  527. package/src/duckdb/src/execution/physical_plan/plan_order.cpp +7 -7
  528. package/src/duckdb/src/execution/physical_plan/plan_prepare.cpp +2 -2
  529. package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +1 -1
  530. package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +8 -3
  531. package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +1 -2
  532. package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +1 -2
  533. package/src/duckdb/src/execution/physical_plan/plan_top_n.cpp +3 -2
  534. package/src/duckdb/src/execution/physical_plan_generator.cpp +0 -22
  535. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +136 -116
  536. package/src/duckdb/src/execution/sample/base_reservoir_sample.cpp +136 -0
  537. package/src/duckdb/src/execution/sample/reservoir_sample.cpp +930 -0
  538. package/src/duckdb/src/function/aggregate/distributive/count.cpp +6 -12
  539. package/src/duckdb/src/function/aggregate/distributive/{first.cpp → first_last_any.cpp} +37 -18
  540. package/src/duckdb/src/{core_functions → function}/aggregate/distributive/minmax.cpp +19 -12
  541. package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +72 -13
  542. package/src/duckdb/src/function/built_in_functions.cpp +85 -2
  543. package/src/duckdb/src/function/cast/decimal_cast.cpp +1 -1
  544. package/src/duckdb/src/function/cast/string_cast.cpp +1 -1
  545. package/src/duckdb/src/function/cast/struct_cast.cpp +81 -49
  546. package/src/duckdb/src/function/cast/union/from_struct.cpp +7 -5
  547. package/src/duckdb/src/function/compression_config.cpp +6 -0
  548. package/src/duckdb/src/function/encoding_function.cpp +134 -0
  549. package/src/duckdb/src/function/function.cpp +8 -13
  550. package/src/duckdb/src/function/function_binder.cpp +100 -21
  551. package/src/duckdb/src/function/function_list.cpp +178 -0
  552. package/src/duckdb/src/function/macro_function.cpp +4 -4
  553. package/src/duckdb/src/function/pragma/pragma_functions.cpp +0 -2
  554. package/src/duckdb/src/function/pragma/pragma_queries.cpp +0 -4
  555. package/src/duckdb/src/{core_functions/core_functions.cpp → function/register_function_list.cpp} +12 -8
  556. package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +62 -23
  557. package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +33 -16
  558. package/src/duckdb/src/function/scalar/compressed_materialization_utils.cpp +21 -0
  559. package/src/duckdb/src/{core_functions/scalar/blob → function/scalar}/create_sort_key.cpp +86 -23
  560. package/src/duckdb/src/{core_functions → function}/scalar/date/strftime.cpp +6 -4
  561. package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +5 -7
  562. package/src/duckdb/src/{core_functions → function}/scalar/generic/error.cpp +3 -1
  563. package/src/duckdb/src/function/scalar/generic/getvariable.cpp +2 -2
  564. package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +1 -7
  565. package/src/duckdb/src/function/scalar/list/list_extract.cpp +27 -21
  566. package/src/duckdb/src/function/scalar/list/list_resize.cpp +8 -12
  567. package/src/duckdb/src/function/scalar/list/list_select.cpp +1 -4
  568. package/src/duckdb/src/function/scalar/list/list_zip.cpp +6 -6
  569. package/src/duckdb/src/{core_functions → function}/scalar/map/map_contains.cpp +2 -2
  570. package/src/duckdb/src/function/scalar/nested_functions.cpp +0 -11
  571. package/src/duckdb/src/function/scalar/{operators → operator}/add.cpp +2 -1
  572. package/src/duckdb/src/function/scalar/{operators → operator}/arithmetic.cpp +195 -127
  573. package/src/duckdb/src/function/scalar/sequence/nextval.cpp +30 -21
  574. package/src/duckdb/src/function/scalar/strftime_format.cpp +10 -0
  575. package/src/duckdb/src/function/scalar/string/caseconvert.cpp +11 -41
  576. package/src/duckdb/src/function/scalar/string/concat.cpp +22 -20
  577. package/src/duckdb/src/function/scalar/string/concat_ws.cpp +2 -2
  578. package/src/duckdb/src/function/scalar/string/contains.cpp +16 -19
  579. package/src/duckdb/src/function/scalar/string/length.cpp +38 -24
  580. package/src/duckdb/src/function/scalar/string/like.cpp +80 -47
  581. package/src/duckdb/src/{core_functions → function}/scalar/string/md5.cpp +2 -2
  582. package/src/duckdb/src/function/scalar/string/nfc_normalize.cpp +2 -6
  583. package/src/duckdb/src/function/scalar/string/prefix.cpp +0 -4
  584. package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +2 -1
  585. package/src/duckdb/src/function/scalar/string/regexp.cpp +17 -7
  586. package/src/duckdb/src/{core_functions → function}/scalar/string/regexp_escape.cpp +2 -2
  587. package/src/duckdb/src/{core_functions → function}/scalar/string/sha1.cpp +1 -1
  588. package/src/duckdb/src/{core_functions → function}/scalar/string/sha256.cpp +1 -1
  589. package/src/duckdb/src/{core_functions → function}/scalar/string/string_split.cpp +4 -5
  590. package/src/duckdb/src/function/scalar/string/strip_accents.cpp +3 -6
  591. package/src/duckdb/src/function/scalar/string/substring.cpp +14 -13
  592. package/src/duckdb/src/function/scalar/string/suffix.cpp +0 -4
  593. package/src/duckdb/src/function/scalar/struct/struct_concat.cpp +115 -0
  594. package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +35 -31
  595. package/src/duckdb/src/{core_functions → function}/scalar/struct/struct_pack.cpp +7 -7
  596. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -8
  597. package/src/duckdb/src/function/scalar/system/write_log.cpp +170 -0
  598. package/src/duckdb/src/function/scalar_function.cpp +5 -5
  599. package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +3 -2
  600. package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +287 -1
  601. package/src/duckdb/src/function/table/arrow/arrow_type_info.cpp +6 -6
  602. package/src/duckdb/src/function/table/arrow.cpp +32 -352
  603. package/src/duckdb/src/function/table/arrow_conversion.cpp +43 -7
  604. package/src/duckdb/src/function/table/copy_csv.cpp +38 -23
  605. package/src/duckdb/src/function/table/glob.cpp +1 -1
  606. package/src/duckdb/src/function/table/query_function.cpp +12 -7
  607. package/src/duckdb/src/function/table/read_csv.cpp +114 -46
  608. package/src/duckdb/src/function/table/read_file.cpp +26 -6
  609. package/src/duckdb/src/function/table/sniff_csv.cpp +25 -5
  610. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +1 -1
  611. package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +1 -1
  612. package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +6 -7
  613. package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +1 -1
  614. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +141 -16
  615. package/src/duckdb/src/function/table/system/duckdb_log.cpp +64 -0
  616. package/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp +65 -0
  617. package/src/duckdb/src/function/table/system/duckdb_memory.cpp +0 -1
  618. package/src/duckdb/src/function/table/system/duckdb_settings.cpp +1 -1
  619. package/src/duckdb/src/function/table/system/duckdb_tables.cpp +1 -13
  620. package/src/duckdb/src/function/table/system/duckdb_types.cpp +1 -1
  621. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +17 -0
  622. package/src/duckdb/src/function/table/system/pragma_table_info.cpp +6 -0
  623. package/src/duckdb/src/function/table/system/pragma_table_sample.cpp +95 -0
  624. package/src/duckdb/src/function/table/system/test_all_types.cpp +56 -46
  625. package/src/duckdb/src/function/table/system_functions.cpp +3 -0
  626. package/src/duckdb/src/function/table/table_scan.cpp +487 -289
  627. package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
  628. package/src/duckdb/src/function/table_function.cpp +10 -6
  629. package/src/duckdb/src/function/window/window_aggregate_function.cpp +248 -0
  630. package/src/duckdb/src/function/window/window_aggregate_states.cpp +48 -0
  631. package/src/duckdb/src/function/window/window_aggregator.cpp +88 -0
  632. package/src/duckdb/src/function/window/window_boundaries_state.cpp +854 -0
  633. package/src/duckdb/src/function/window/window_collection.cpp +146 -0
  634. package/src/duckdb/src/function/window/window_constant_aggregator.cpp +357 -0
  635. package/src/duckdb/src/function/window/window_custom_aggregator.cpp +146 -0
  636. package/src/duckdb/src/function/window/window_distinct_aggregator.cpp +758 -0
  637. package/src/duckdb/src/function/window/window_executor.cpp +99 -0
  638. package/src/duckdb/src/function/window/window_index_tree.cpp +63 -0
  639. package/src/duckdb/src/function/window/window_merge_sort_tree.cpp +275 -0
  640. package/src/duckdb/src/function/window/window_naive_aggregator.cpp +361 -0
  641. package/src/duckdb/src/function/window/window_rank_function.cpp +288 -0
  642. package/src/duckdb/src/function/window/window_rownumber_function.cpp +191 -0
  643. package/src/duckdb/src/function/window/window_segment_tree.cpp +594 -0
  644. package/src/duckdb/src/function/window/window_shared_expressions.cpp +50 -0
  645. package/src/duckdb/src/function/window/window_token_tree.cpp +142 -0
  646. package/src/duckdb/src/function/window/window_value_function.cpp +566 -0
  647. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +74 -17
  648. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
  649. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +2 -0
  650. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +9 -0
  651. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/function_entry.hpp +4 -10
  652. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
  653. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
  654. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -0
  655. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +18 -3
  656. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +1 -1
  657. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +2 -1
  658. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +5 -2
  659. package/src/duckdb/src/include/duckdb/catalog/catalog_entry_retriever.hpp +21 -18
  660. package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +3 -2
  661. package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +10 -2
  662. package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +11 -0
  663. package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -4
  664. package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
  665. package/src/duckdb/src/include/duckdb/common/array_ptr.hpp +8 -0
  666. package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +4 -1
  667. package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +3 -1
  668. package/src/duckdb/src/include/duckdb/common/arrow/appender/list_view_data.hpp +3 -1
  669. package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +2 -1
  670. package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +7 -3
  671. package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +26 -3
  672. package/src/duckdb/src/include/duckdb/common/arrow/arrow_query_result.hpp +1 -1
  673. package/src/duckdb/src/include/duckdb/common/arrow/arrow_type_extension.hpp +144 -0
  674. package/src/duckdb/src/include/duckdb/common/arrow/arrow_util.hpp +5 -2
  675. package/src/duckdb/src/include/duckdb/common/arrow/result_arrow_wrapper.hpp +2 -0
  676. package/src/duckdb/src/include/duckdb/common/arrow/schema_metadata.hpp +11 -4
  677. package/src/duckdb/src/include/duckdb/common/assert.hpp +12 -1
  678. package/src/duckdb/src/include/duckdb/common/atomic_ptr.hpp +102 -0
  679. package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +65 -6
  680. package/src/duckdb/src/include/duckdb/common/chrono.hpp +1 -0
  681. package/src/duckdb/src/include/duckdb/common/column_index.hpp +72 -0
  682. package/src/duckdb/src/include/duckdb/common/enum_util.hpp +120 -0
  683. package/src/duckdb/src/include/duckdb/{core_functions/core_functions.hpp → common/enums/collation_type.hpp} +2 -7
  684. package/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp +5 -2
  685. package/src/duckdb/src/include/duckdb/common/enums/function_errors.hpp +18 -0
  686. package/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp +3 -2
  687. package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +7 -2
  688. package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +4 -0
  689. package/src/duckdb/src/include/duckdb/common/enums/order_preservation_type.hpp +1 -1
  690. package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
  691. package/src/duckdb/src/include/duckdb/common/enums/profiler_format.hpp +1 -1
  692. package/src/duckdb/src/include/duckdb/{core_functions/aggregate → common/enums}/quantile_enum.hpp +3 -1
  693. package/src/duckdb/src/include/duckdb/common/enums/scan_vector_type.hpp +2 -0
  694. package/src/duckdb/src/include/duckdb/common/error_data.hpp +1 -0
  695. package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +4 -0
  696. package/src/duckdb/src/include/duckdb/common/exception.hpp +1 -1
  697. package/src/duckdb/src/include/duckdb/common/extension_type_info.hpp +37 -0
  698. package/src/duckdb/src/include/duckdb/common/extra_operator_info.hpp +7 -2
  699. package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +9 -3
  700. package/src/duckdb/src/include/duckdb/common/fast_mem.hpp +6 -6
  701. package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +19 -10
  702. package/src/duckdb/src/include/duckdb/common/file_opener.hpp +2 -0
  703. package/src/duckdb/src/include/duckdb/common/file_system.hpp +6 -1
  704. package/src/duckdb/src/include/duckdb/common/fsst.hpp +2 -2
  705. package/src/duckdb/src/include/duckdb/common/helper.hpp +6 -0
  706. package/src/duckdb/src/include/duckdb/common/hugeint.hpp +10 -0
  707. package/src/duckdb/src/include/duckdb/common/insertion_order_preserving_map.hpp +12 -2
  708. package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +3 -0
  709. package/src/duckdb/src/include/duckdb/common/multi_file_list.hpp +2 -1
  710. package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +147 -27
  711. package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +4 -0
  712. package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +2 -7
  713. package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +16 -5
  714. package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +16 -0
  715. package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +4 -0
  716. package/src/duckdb/src/include/duckdb/common/platform.hpp +34 -3
  717. package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +10 -13
  718. package/src/duckdb/src/include/duckdb/common/random_engine.hpp +8 -3
  719. package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +0 -2
  720. package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +1 -1
  721. package/src/duckdb/src/include/duckdb/common/serializer/memory_stream.hpp +7 -0
  722. package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +1 -0
  723. package/src/duckdb/src/include/duckdb/common/serializer/serializer.hpp +1 -0
  724. package/src/duckdb/src/include/duckdb/common/stacktrace.hpp +25 -0
  725. package/src/duckdb/src/include/duckdb/common/string_util.hpp +30 -2
  726. package/src/duckdb/src/include/duckdb/common/tree_renderer/graphviz_tree_renderer.hpp +1 -1
  727. package/src/duckdb/src/include/duckdb/common/tree_renderer/html_tree_renderer.hpp +1 -1
  728. package/src/duckdb/src/include/duckdb/common/tree_renderer/json_tree_renderer.hpp +1 -1
  729. package/src/duckdb/src/include/duckdb/common/tree_renderer/text_tree_renderer.hpp +3 -2
  730. package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +2 -0
  731. package/src/duckdb/src/include/duckdb/common/type_util.hpp +8 -0
  732. package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +8 -0
  733. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +13 -2
  734. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +2 -1
  735. package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +21 -4
  736. package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +4 -1
  737. package/src/duckdb/src/include/duckdb/common/types/date.hpp +9 -4
  738. package/src/duckdb/src/include/duckdb/common/types/date_lookup_cache.hpp +1 -1
  739. package/src/duckdb/src/include/duckdb/common/types/interval.hpp +58 -10
  740. package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +0 -4
  741. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +4 -0
  742. package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +4 -0
  743. package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +10 -0
  744. package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +43 -16
  745. package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +3 -1
  746. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +63 -21
  747. package/src/duckdb/src/include/duckdb/common/types/value.hpp +62 -16
  748. package/src/duckdb/src/include/duckdb/common/types/varint.hpp +13 -0
  749. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +34 -7
  750. package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +15 -0
  751. package/src/duckdb/src/include/duckdb/common/types.hpp +12 -7
  752. package/src/duckdb/src/include/duckdb/common/uhugeint.hpp +10 -0
  753. package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +12 -13
  754. package/src/duckdb/src/include/duckdb/common/vector_operations/binary_executor.hpp +27 -0
  755. package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +111 -4
  756. package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +0 -1
  757. package/src/duckdb/src/include/duckdb/execution/adaptive_filter.hpp +2 -0
  758. package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +48 -10
  759. package/src/duckdb/src/include/duckdb/execution/executor.hpp +2 -1
  760. package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +0 -1
  761. package/src/duckdb/src/include/duckdb/execution/ht_entry.hpp +25 -27
  762. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +28 -18
  763. package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +1 -0
  764. package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +2 -2
  765. package/src/duckdb/src/include/duckdb/execution/index/bound_index.hpp +23 -16
  766. package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +4 -0
  767. package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +2 -2
  768. package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +25 -16
  769. package/src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp +15 -10
  770. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +1 -1
  771. package/src/duckdb/src/include/duckdb/execution/operator/{persistent/physical_fixed_batch_copy.hpp → aggregate/physical_partitioned_aggregate.hpp} +25 -27
  772. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +1 -2
  773. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +5 -4
  774. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/ungrouped_aggregate_state.hpp +21 -1
  775. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +38 -9
  776. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer.hpp +8 -9
  777. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +7 -1
  778. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +29 -23
  779. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +15 -13
  780. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +13 -5
  781. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +2 -1
  782. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +24 -10
  783. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_schema.hpp +36 -1
  784. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +21 -13
  785. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +52 -22
  786. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine_cache.hpp +6 -6
  787. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_validator.hpp +58 -0
  788. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/encode/csv_encoder.hpp +62 -0
  789. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +6 -3
  790. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner_boundary.hpp +16 -6
  791. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +9 -4
  792. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine_options.hpp +8 -4
  793. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +55 -10
  794. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +2 -2
  795. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_batch_collector.hpp +2 -2
  796. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -2
  797. package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +1 -1
  798. package/src/duckdb/src/include/duckdb/execution/operator/join/join_filter_pushdown.hpp +28 -7
  799. package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +6 -9
  800. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +17 -16
  801. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +1 -1
  802. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +7 -3
  803. package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +5 -1
  804. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +2 -2
  805. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
  806. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +55 -4
  807. package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -0
  808. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +2 -2
  809. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +2 -1
  810. package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +10 -9
  811. package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_art_index.hpp +16 -13
  812. package/src/duckdb/src/include/duckdb/execution/operator/set/physical_cte.hpp +0 -4
  813. package/src/duckdb/src/include/duckdb/execution/partition_info.hpp +79 -0
  814. package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +20 -9
  815. package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +1 -11
  816. package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +0 -2
  817. package/src/duckdb/src/include/duckdb/execution/progress_data.hpp +58 -0
  818. package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +2 -1
  819. package/src/duckdb/src/include/duckdb/execution/reservoir_sample.hpp +160 -31
  820. package/src/duckdb/src/include/duckdb/function/aggregate/distributive_function_utils.hpp +31 -0
  821. package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +61 -10
  822. package/src/duckdb/src/include/duckdb/{core_functions → function}/aggregate/minmax_n_helpers.hpp +1 -1
  823. package/src/duckdb/src/include/duckdb/{core_functions → function}/aggregate/sort_key_helpers.hpp +2 -2
  824. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +47 -27
  825. package/src/duckdb/src/include/duckdb/function/aggregate_state.hpp +2 -0
  826. package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +3 -10
  827. package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +13 -6
  828. package/src/duckdb/src/include/duckdb/function/compression/compression.hpp +15 -0
  829. package/src/duckdb/src/include/duckdb/function/compression_function.hpp +29 -6
  830. package/src/duckdb/src/include/duckdb/{core_functions → function}/create_sort_key.hpp +4 -1
  831. package/src/duckdb/src/include/duckdb/function/encoding_function.hpp +78 -0
  832. package/src/duckdb/src/include/duckdb/function/function.hpp +22 -1
  833. package/src/duckdb/src/include/duckdb/function/function_binder.hpp +3 -0
  834. package/src/duckdb/src/include/duckdb/function/function_list.hpp +39 -0
  835. package/src/duckdb/src/include/duckdb/function/function_set.hpp +13 -7
  836. package/src/duckdb/src/include/duckdb/{core_functions → function}/lambda_functions.hpp +1 -1
  837. package/src/duckdb/src/include/duckdb/function/partition_stats.hpp +36 -0
  838. package/src/duckdb/src/include/duckdb/function/register_function_list_helper.hpp +69 -0
  839. package/src/duckdb/src/include/duckdb/function/scalar/compressed_materialization_functions.hpp +154 -23
  840. package/src/duckdb/src/include/duckdb/function/scalar/compressed_materialization_utils.hpp +45 -0
  841. package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +45 -0
  842. package/src/duckdb/src/include/duckdb/function/scalar/generic_common.hpp +36 -0
  843. package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +32 -23
  844. package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +1 -1
  845. package/src/duckdb/src/include/duckdb/function/scalar/list_functions.hpp +156 -0
  846. package/src/duckdb/src/include/duckdb/function/scalar/map_functions.hpp +27 -0
  847. package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +4 -45
  848. package/src/duckdb/src/include/duckdb/function/scalar/operator_functions.hpp +102 -0
  849. package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +2 -16
  850. package/src/duckdb/src/include/duckdb/function/scalar/sequence_functions.hpp +16 -25
  851. package/src/duckdb/src/include/duckdb/function/scalar/sequence_utils.hpp +38 -0
  852. package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +1 -0
  853. package/src/duckdb/src/include/duckdb/function/scalar/string_common.hpp +49 -0
  854. package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +401 -76
  855. package/src/duckdb/src/include/duckdb/function/scalar/struct_functions.hpp +63 -0
  856. package/src/duckdb/src/include/duckdb/function/scalar/struct_utils.hpp +33 -0
  857. package/src/duckdb/src/include/duckdb/function/scalar/system_functions.hpp +45 -0
  858. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +17 -8
  859. package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +59 -6
  860. package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_type_info.hpp +12 -9
  861. package/src/duckdb/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp +2 -0
  862. package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +18 -13
  863. package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +7 -4
  864. package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +14 -0
  865. package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +15 -10
  866. package/src/duckdb/src/include/duckdb/function/table_function.hpp +94 -18
  867. package/src/duckdb/src/include/duckdb/{core_functions → function}/to_interval.hpp +1 -1
  868. package/src/duckdb/src/include/duckdb/function/window/window_aggregate_function.hpp +44 -0
  869. package/src/duckdb/src/include/duckdb/function/window/window_aggregate_states.hpp +56 -0
  870. package/src/duckdb/src/include/duckdb/function/window/window_aggregator.hpp +194 -0
  871. package/src/duckdb/src/include/duckdb/function/window/window_boundaries_state.hpp +153 -0
  872. package/src/duckdb/src/include/duckdb/function/window/window_collection.hpp +146 -0
  873. package/src/duckdb/src/include/duckdb/function/window/window_constant_aggregator.hpp +38 -0
  874. package/src/duckdb/src/include/duckdb/function/window/window_custom_aggregator.hpp +32 -0
  875. package/src/duckdb/src/include/duckdb/function/window/window_distinct_aggregator.hpp +39 -0
  876. package/src/duckdb/src/include/duckdb/function/window/window_executor.hpp +122 -0
  877. package/src/duckdb/src/include/duckdb/function/window/window_index_tree.hpp +42 -0
  878. package/src/duckdb/src/include/duckdb/function/window/window_merge_sort_tree.hpp +108 -0
  879. package/src/duckdb/src/include/duckdb/function/window/window_naive_aggregator.hpp +33 -0
  880. package/src/duckdb/src/include/duckdb/function/window/window_rank_function.hpp +63 -0
  881. package/src/duckdb/src/include/duckdb/function/window/window_rownumber_function.hpp +43 -0
  882. package/src/duckdb/src/include/duckdb/function/window/window_segment_tree.hpp +31 -0
  883. package/src/duckdb/src/include/duckdb/function/window/window_shared_expressions.hpp +76 -0
  884. package/src/duckdb/src/include/duckdb/function/window/window_token_tree.hpp +46 -0
  885. package/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp +79 -0
  886. package/src/duckdb/src/include/duckdb/logging/http_logger.hpp +2 -0
  887. package/src/duckdb/src/include/duckdb/logging/log_manager.hpp +81 -0
  888. package/src/duckdb/src/include/duckdb/logging/log_storage.hpp +127 -0
  889. package/src/duckdb/src/include/duckdb/logging/logger.hpp +287 -0
  890. package/src/duckdb/src/include/duckdb/logging/logging.hpp +83 -0
  891. package/src/duckdb/src/include/duckdb/main/appender.hpp +41 -18
  892. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +6 -3
  893. package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +7 -2
  894. package/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp +317 -231
  895. package/src/duckdb/src/include/duckdb/main/client_config.hpp +17 -1
  896. package/src/duckdb/src/include/duckdb/main/client_context.hpp +28 -6
  897. package/src/duckdb/src/include/duckdb/main/client_context_file_opener.hpp +1 -0
  898. package/src/duckdb/src/include/duckdb/main/client_context_wrapper.hpp +5 -0
  899. package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -2
  900. package/src/duckdb/src/include/duckdb/main/client_properties.hpp +8 -3
  901. package/src/duckdb/src/include/duckdb/main/config.hpp +52 -8
  902. package/src/duckdb/src/include/duckdb/main/connection.hpp +18 -3
  903. package/src/duckdb/src/include/duckdb/main/database.hpp +8 -7
  904. package/src/duckdb/src/include/duckdb/main/database_file_opener.hpp +5 -1
  905. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
  906. package/src/duckdb/src/include/duckdb/main/db_instance_cache.hpp +1 -0
  907. package/src/duckdb/src/include/duckdb/main/extension.hpp +8 -2
  908. package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +548 -9
  909. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +18 -0
  910. package/src/duckdb/src/include/duckdb/main/extension_util.hpp +12 -7
  911. package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +3 -3
  912. package/src/duckdb/src/include/duckdb/main/profiling_info.hpp +2 -2
  913. package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +8 -4
  914. package/src/duckdb/src/include/duckdb/main/relation/create_table_relation.hpp +3 -1
  915. package/src/duckdb/src/include/duckdb/main/relation/delete_relation.hpp +2 -2
  916. package/src/duckdb/src/include/duckdb/main/relation/subquery_relation.hpp +1 -4
  917. package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +3 -1
  918. package/src/duckdb/src/include/duckdb/main/relation/table_relation.hpp +3 -0
  919. package/src/duckdb/src/include/duckdb/main/relation/update_relation.hpp +3 -2
  920. package/src/duckdb/src/include/duckdb/main/relation/value_relation.hpp +7 -0
  921. package/src/duckdb/src/include/duckdb/main/relation/view_relation.hpp +1 -0
  922. package/src/duckdb/src/include/duckdb/main/relation/write_parquet_relation.hpp +1 -1
  923. package/src/duckdb/src/include/duckdb/main/relation.hpp +45 -9
  924. package/src/duckdb/src/include/duckdb/main/secret/secret_storage.hpp +20 -22
  925. package/src/duckdb/src/include/duckdb/main/settings.hpp +613 -378
  926. package/src/duckdb/src/include/duckdb/main/table_description.hpp +14 -4
  927. package/src/duckdb/src/include/duckdb/optimizer/build_probe_side_optimizer.hpp +1 -3
  928. package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_analyzer.hpp +14 -7
  929. package/src/duckdb/src/include/duckdb/optimizer/common_aggregate_optimizer.hpp +2 -2
  930. package/src/duckdb/src/include/duckdb/optimizer/empty_result_pullup.hpp +27 -0
  931. package/src/duckdb/src/include/duckdb/optimizer/expression_heuristics.hpp +1 -1
  932. package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +6 -1
  933. package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +2 -0
  934. package/src/duckdb/src/include/duckdb/optimizer/in_clause_rewriter.hpp +3 -0
  935. package/src/duckdb/src/include/duckdb/optimizer/join_filter_pushdown_optimizer.hpp +5 -0
  936. package/src/duckdb/src/include/duckdb/optimizer/join_order/plan_enumerator.hpp +2 -0
  937. package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp +2 -2
  938. package/src/duckdb/src/include/duckdb/optimizer/late_materialization.hpp +45 -0
  939. package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +23 -0
  940. package/src/duckdb/src/include/duckdb/optimizer/matcher/type_matcher.hpp +18 -0
  941. package/src/duckdb/src/include/duckdb/optimizer/optimizer.hpp +9 -0
  942. package/src/duckdb/src/include/duckdb/optimizer/remove_unused_columns.hpp +33 -11
  943. package/src/duckdb/src/include/duckdb/optimizer/rule/distinct_aggregate_optimizer.hpp +34 -0
  944. package/src/duckdb/src/include/duckdb/optimizer/sampling_pushdown.hpp +25 -0
  945. package/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +3 -1
  946. package/src/duckdb/src/include/duckdb/optimizer/sum_rewriter.hpp +37 -0
  947. package/src/duckdb/src/include/duckdb/optimizer/topn_optimizer.hpp +4 -0
  948. package/src/duckdb/src/include/duckdb/parallel/event.hpp +3 -0
  949. package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +1 -1
  950. package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +26 -8
  951. package/src/duckdb/src/include/duckdb/parallel/thread_context.hpp +3 -0
  952. package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +51 -3
  953. package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +28 -44
  954. package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +3 -0
  955. package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +2 -2
  956. package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
  957. package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +2 -2
  958. package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +6 -6
  959. package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +11 -1
  960. package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +12 -0
  961. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +1 -0
  962. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_scalar_function_info.hpp +3 -2
  963. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +22 -1
  964. package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +3 -4
  965. package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_column_info.hpp +1 -1
  966. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +16 -12
  967. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +3 -3
  968. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +5 -5
  969. package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +12 -3
  970. package/src/duckdb/src/include/duckdb/parser/parser.hpp +3 -0
  971. package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +17 -57
  972. package/src/duckdb/src/include/duckdb/parser/qualified_name_set.hpp +19 -3
  973. package/src/duckdb/src/include/duckdb/parser/simplified_token.hpp +2 -1
  974. package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +12 -9
  975. package/src/duckdb/src/include/duckdb/parser/tokens.hpp +1 -1
  976. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -2
  977. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +45 -28
  978. package/src/duckdb/src/include/duckdb/planner/binder.hpp +23 -11
  979. package/src/duckdb/src/include/duckdb/planner/binding_alias.hpp +44 -0
  980. package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +1 -0
  981. package/src/duckdb/src/include/duckdb/planner/collation_binding.hpp +4 -3
  982. package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +11 -10
  983. package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +2 -0
  984. package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +1 -0
  985. package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +4 -4
  986. package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +6 -0
  987. package/src/duckdb/src/include/duckdb/planner/expression.hpp +2 -0
  988. package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +2 -0
  989. package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +9 -4
  990. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +8 -2
  991. package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +1 -2
  992. package/src/duckdb/src/include/duckdb/planner/filter/dynamic_filter.hpp +48 -0
  993. package/src/duckdb/src/include/duckdb/planner/filter/in_filter.hpp +37 -0
  994. package/src/duckdb/src/include/duckdb/planner/filter/optional_filter.hpp +35 -0
  995. package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +4 -0
  996. package/src/duckdb/src/include/duckdb/planner/logical_operator_visitor.hpp +3 -0
  997. package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +2 -0
  998. package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +9 -9
  999. package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +4 -0
  1000. package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +16 -7
  1001. package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +2 -0
  1002. package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +4 -0
  1003. package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +5 -1
  1004. package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +5 -3
  1005. package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +14 -6
  1006. package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +12 -8
  1007. package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +1 -0
  1008. package/src/duckdb/src/include/duckdb/storage/block_manager.hpp +3 -0
  1009. package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +82 -26
  1010. package/src/duckdb/src/include/duckdb/storage/buffer/buffer_handle.hpp +1 -1
  1011. package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +10 -3
  1012. package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +2 -1
  1013. package/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +4 -13
  1014. package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +14 -15
  1015. package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_constants.hpp +1 -1
  1016. package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +13 -15
  1017. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +1 -1
  1018. package/src/duckdb/src/include/duckdb/storage/compression/dictionary/analyze.hpp +46 -0
  1019. package/src/duckdb/src/include/duckdb/storage/compression/dictionary/common.hpp +60 -0
  1020. package/src/duckdb/src/include/duckdb/storage/compression/dictionary/compression.hpp +61 -0
  1021. package/src/duckdb/src/include/duckdb/storage/compression/dictionary/decompression.hpp +50 -0
  1022. package/src/duckdb/src/include/duckdb/storage/compression/empty_validity.hpp +100 -0
  1023. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +1 -1
  1024. package/src/duckdb/src/include/duckdb/storage/compression/roaring/appender.hpp +150 -0
  1025. package/src/duckdb/src/include/duckdb/storage/compression/roaring/roaring.hpp +618 -0
  1026. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +53 -31
  1027. package/src/duckdb/src/include/duckdb/storage/index.hpp +2 -3
  1028. package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +0 -1
  1029. package/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp +4 -1
  1030. package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +3 -3
  1031. package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +1 -1
  1032. package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +5 -4
  1033. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +16 -1
  1034. package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +2 -1
  1035. package/src/duckdb/src/include/duckdb/storage/storage_index.hpp +70 -0
  1036. package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +5 -7
  1037. package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +4 -3
  1038. package/src/duckdb/src/include/duckdb/storage/storage_options.hpp +23 -0
  1039. package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +34 -6
  1040. package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +2 -0
  1041. package/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +2 -2
  1042. package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +2 -1
  1043. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +39 -10
  1044. package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +56 -14
  1045. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +35 -29
  1046. package/src/duckdb/src/include/duckdb/storage/table/delete_state.hpp +1 -1
  1047. package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
  1048. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +7 -1
  1049. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +19 -6
  1050. package/src/duckdb/src/include/duckdb/storage/table/row_version_manager.hpp +2 -1
  1051. package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +29 -6
  1052. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +10 -10
  1053. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +5 -0
  1054. package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +26 -19
  1055. package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +8 -1
  1056. package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +16 -14
  1057. package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +2 -0
  1058. package/src/duckdb/src/include/duckdb/storage/table_io_manager.hpp +3 -0
  1059. package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +1 -0
  1060. package/src/duckdb/src/include/duckdb/storage/temporary_file_manager.hpp +228 -61
  1061. package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +14 -10
  1062. package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +3 -1
  1063. package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -2
  1064. package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +1 -0
  1065. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +19 -17
  1066. package/src/duckdb/src/include/duckdb/transaction/rollback_state.hpp +5 -2
  1067. package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +1 -2
  1068. package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +13 -8
  1069. package/src/duckdb/src/include/duckdb/transaction/undo_buffer_allocator.hpp +79 -0
  1070. package/src/duckdb/src/include/duckdb/transaction/update_info.hpp +43 -13
  1071. package/src/duckdb/src/include/duckdb/transaction/wal_write_state.hpp +4 -1
  1072. package/src/duckdb/src/include/duckdb/verification/copied_statement_verifier.hpp +4 -2
  1073. package/src/duckdb/src/include/duckdb/verification/deserialized_statement_verifier.hpp +4 -2
  1074. package/src/duckdb/src/include/duckdb/verification/external_statement_verifier.hpp +4 -2
  1075. package/src/duckdb/src/include/duckdb/verification/fetch_row_verifier.hpp +4 -2
  1076. package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +4 -2
  1077. package/src/duckdb/src/include/duckdb/verification/parsed_statement_verifier.hpp +4 -2
  1078. package/src/duckdb/src/include/duckdb/verification/prepared_statement_verifier.hpp +7 -3
  1079. package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +11 -5
  1080. package/src/duckdb/src/include/duckdb/verification/unoptimized_statement_verifier.hpp +4 -2
  1081. package/src/duckdb/src/include/duckdb.h +424 -41
  1082. package/src/duckdb/src/include/duckdb_extension.h +301 -195
  1083. package/src/duckdb/src/logging/log_manager.cpp +157 -0
  1084. package/src/duckdb/src/logging/log_storage.cpp +209 -0
  1085. package/src/duckdb/src/logging/logger.cpp +211 -0
  1086. package/src/duckdb/src/logging/logging.cpp +42 -0
  1087. package/src/duckdb/src/main/appender.cpp +187 -45
  1088. package/src/duckdb/src/main/attached_database.cpp +16 -8
  1089. package/src/duckdb/src/main/capi/appender-c.cpp +47 -4
  1090. package/src/duckdb/src/main/capi/arrow-c.cpp +9 -4
  1091. package/src/duckdb/src/main/capi/config-c.cpp +17 -4
  1092. package/src/duckdb/src/main/capi/datetime-c.cpp +15 -0
  1093. package/src/duckdb/src/main/capi/duckdb-c.cpp +54 -13
  1094. package/src/duckdb/src/main/capi/duckdb_value-c.cpp +212 -4
  1095. package/src/duckdb/src/main/capi/helper-c.cpp +3 -0
  1096. package/src/duckdb/src/main/capi/prepared-c.cpp +26 -7
  1097. package/src/duckdb/src/main/capi/replacement_scan-c.cpp +1 -1
  1098. package/src/duckdb/src/main/capi/result-c.cpp +3 -0
  1099. package/src/duckdb/src/main/capi/table_description-c.cpp +43 -10
  1100. package/src/duckdb/src/main/capi/threading-c.cpp +4 -4
  1101. package/src/duckdb/src/main/client_context.cpp +125 -51
  1102. package/src/duckdb/src/main/client_context_file_opener.cpp +4 -0
  1103. package/src/duckdb/src/main/client_context_wrapper.cpp +4 -0
  1104. package/src/duckdb/src/main/client_data.cpp +1 -1
  1105. package/src/duckdb/src/main/client_verify.cpp +39 -20
  1106. package/src/duckdb/src/main/config.cpp +266 -74
  1107. package/src/duckdb/src/main/connection.cpp +53 -13
  1108. package/src/duckdb/src/main/database.cpp +39 -18
  1109. package/src/duckdb/src/main/database_manager.cpp +12 -11
  1110. package/src/duckdb/src/main/db_instance_cache.cpp +14 -7
  1111. package/src/duckdb/src/main/extension/extension_helper.cpp +24 -23
  1112. package/src/duckdb/src/main/extension/extension_install.cpp +19 -7
  1113. package/src/duckdb/src/main/extension/extension_load.cpp +91 -41
  1114. package/src/duckdb/src/main/extension/extension_util.cpp +40 -19
  1115. package/src/duckdb/src/main/extension.cpp +20 -11
  1116. package/src/duckdb/src/main/profiling_info.cpp +19 -5
  1117. package/src/duckdb/src/main/query_profiler.cpp +135 -36
  1118. package/src/duckdb/src/main/query_result.cpp +2 -1
  1119. package/src/duckdb/src/main/relation/aggregate_relation.cpp +3 -3
  1120. package/src/duckdb/src/main/relation/create_table_relation.cpp +5 -4
  1121. package/src/duckdb/src/main/relation/create_view_relation.cpp +2 -2
  1122. package/src/duckdb/src/main/relation/cross_product_relation.cpp +2 -2
  1123. package/src/duckdb/src/main/relation/delete_relation.cpp +2 -2
  1124. package/src/duckdb/src/main/relation/delim_get_relation.cpp +1 -1
  1125. package/src/duckdb/src/main/relation/distinct_relation.cpp +1 -1
  1126. package/src/duckdb/src/main/relation/explain_relation.cpp +1 -1
  1127. package/src/duckdb/src/main/relation/filter_relation.cpp +1 -1
  1128. package/src/duckdb/src/main/relation/insert_relation.cpp +1 -1
  1129. package/src/duckdb/src/main/relation/join_relation.cpp +5 -5
  1130. package/src/duckdb/src/main/relation/order_relation.cpp +1 -1
  1131. package/src/duckdb/src/main/relation/projection_relation.cpp +3 -3
  1132. package/src/duckdb/src/main/relation/query_relation.cpp +1 -1
  1133. package/src/duckdb/src/main/relation/read_csv_relation.cpp +58 -20
  1134. package/src/duckdb/src/main/relation/setop_relation.cpp +2 -2
  1135. package/src/duckdb/src/main/relation/subquery_relation.cpp +3 -8
  1136. package/src/duckdb/src/main/relation/table_function_relation.cpp +10 -1
  1137. package/src/duckdb/src/main/relation/table_relation.cpp +19 -3
  1138. package/src/duckdb/src/main/relation/update_relation.cpp +2 -2
  1139. package/src/duckdb/src/main/relation/value_relation.cpp +42 -2
  1140. package/src/duckdb/src/main/relation/view_relation.cpp +8 -2
  1141. package/src/duckdb/src/main/relation/write_csv_relation.cpp +1 -1
  1142. package/src/duckdb/src/main/relation/write_parquet_relation.cpp +1 -1
  1143. package/src/duckdb/src/main/relation.cpp +49 -28
  1144. package/src/duckdb/src/main/secret/secret_manager.cpp +1 -1
  1145. package/src/duckdb/src/main/secret/secret_storage.cpp +6 -4
  1146. package/src/duckdb/src/main/settings/autogenerated_settings.cpp +1102 -0
  1147. package/src/duckdb/src/main/settings/custom_settings.cpp +1343 -0
  1148. package/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +60 -37
  1149. package/src/duckdb/src/optimizer/column_binding_replacer.cpp +1 -1
  1150. package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +126 -72
  1151. package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +22 -6
  1152. package/src/duckdb/src/optimizer/compressed_materialization/compress_aggregate.cpp +3 -3
  1153. package/src/duckdb/src/optimizer/compressed_materialization/compress_distinct.cpp +2 -2
  1154. package/src/duckdb/src/optimizer/compressed_materialization.cpp +3 -3
  1155. package/src/duckdb/src/optimizer/cse_optimizer.cpp +7 -7
  1156. package/src/duckdb/src/optimizer/deliminator.cpp +6 -5
  1157. package/src/duckdb/src/optimizer/empty_result_pullup.cpp +96 -0
  1158. package/src/duckdb/src/optimizer/expression_heuristics.cpp +11 -3
  1159. package/src/duckdb/src/optimizer/expression_rewriter.cpp +9 -2
  1160. package/src/duckdb/src/optimizer/filter_combiner.cpp +190 -88
  1161. package/src/duckdb/src/optimizer/filter_pushdown.cpp +6 -5
  1162. package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +25 -9
  1163. package/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp +170 -72
  1164. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +5 -4
  1165. package/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +3 -1
  1166. package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +7 -7
  1167. package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +15 -6
  1168. package/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp +37 -22
  1169. package/src/duckdb/src/optimizer/late_materialization.cpp +414 -0
  1170. package/src/duckdb/src/optimizer/limit_pushdown.cpp +1 -0
  1171. package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +30 -2
  1172. package/src/duckdb/src/optimizer/optimizer.cpp +67 -7
  1173. package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +3 -3
  1174. package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +2 -2
  1175. package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +1 -1
  1176. package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +2 -2
  1177. package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +1 -1
  1178. package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +1 -1
  1179. package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +3 -3
  1180. package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +5 -3
  1181. package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +1 -1
  1182. package/src/duckdb/src/optimizer/pushdown/pushdown_unnest.cpp +52 -0
  1183. package/src/duckdb/src/optimizer/pushdown/pushdown_window.cpp +2 -2
  1184. package/src/duckdb/src/optimizer/regex_range_filter.cpp +1 -1
  1185. package/src/duckdb/src/optimizer/remove_duplicate_groups.cpp +1 -1
  1186. package/src/duckdb/src/optimizer/remove_unused_columns.cpp +168 -38
  1187. package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +2 -1
  1188. package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +8 -5
  1189. package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +2 -2
  1190. package/src/duckdb/src/optimizer/rule/constant_folding.cpp +2 -2
  1191. package/src/duckdb/src/optimizer/rule/distinct_aggregate_optimizer.cpp +65 -0
  1192. package/src/duckdb/src/optimizer/rule/distributivity.cpp +2 -2
  1193. package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +2 -1
  1194. package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +4 -3
  1195. package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +3 -3
  1196. package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +3 -1
  1197. package/src/duckdb/src/optimizer/rule/move_constants.cpp +9 -9
  1198. package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +4 -3
  1199. package/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp +1 -1
  1200. package/src/duckdb/src/optimizer/sampling_pushdown.cpp +24 -0
  1201. package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +1 -1
  1202. package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +1 -1
  1203. package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +1 -1
  1204. package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +74 -0
  1205. package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +10 -7
  1206. package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +3 -3
  1207. package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +3 -3
  1208. package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +3 -0
  1209. package/src/duckdb/src/optimizer/sum_rewriter.cpp +174 -0
  1210. package/src/duckdb/src/optimizer/topn_optimizer.cpp +71 -0
  1211. package/src/duckdb/src/optimizer/unnest_rewriter.cpp +5 -5
  1212. package/src/duckdb/src/parallel/event.cpp +4 -0
  1213. package/src/duckdb/src/parallel/executor.cpp +11 -29
  1214. package/src/duckdb/src/parallel/executor_task.cpp +8 -3
  1215. package/src/duckdb/src/parallel/pipeline.cpp +15 -8
  1216. package/src/duckdb/src/parallel/pipeline_executor.cpp +67 -43
  1217. package/src/duckdb/src/parallel/thread_context.cpp +12 -1
  1218. package/src/duckdb/src/parser/column_definition.cpp +3 -3
  1219. package/src/duckdb/src/parser/constraints/unique_constraint.cpp +72 -9
  1220. package/src/duckdb/src/parser/expression/columnref_expression.cpp +15 -3
  1221. package/src/duckdb/src/parser/expression/conjunction_expression.cpp +1 -1
  1222. package/src/duckdb/src/parser/expression/function_expression.cpp +1 -1
  1223. package/src/duckdb/src/parser/expression/lambda_expression.cpp +3 -3
  1224. package/src/duckdb/src/parser/expression/lambdaref_expression.cpp +1 -1
  1225. package/src/duckdb/src/parser/expression/star_expression.cpp +46 -2
  1226. package/src/duckdb/src/parser/expression/window_expression.cpp +24 -1
  1227. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +26 -2
  1228. package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +5 -3
  1229. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +29 -1
  1230. package/src/duckdb/src/parser/parsed_data/attach_info.cpp +6 -6
  1231. package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +1 -1
  1232. package/src/duckdb/src/parser/parsed_data/create_function_info.cpp +17 -0
  1233. package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +16 -15
  1234. package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +1 -1
  1235. package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +1 -1
  1236. package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -2
  1237. package/src/duckdb/src/parser/parsed_data/create_schema_info.cpp +1 -1
  1238. package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +1 -1
  1239. package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +1 -0
  1240. package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +4 -4
  1241. package/src/duckdb/src/parser/parsed_data/load_info.cpp +1 -0
  1242. package/src/duckdb/src/parser/parsed_data/sample_options.cpp +31 -1
  1243. package/src/duckdb/src/parser/parsed_expression.cpp +1 -1
  1244. package/src/duckdb/src/parser/parsed_expression_iterator.cpp +4 -1
  1245. package/src/duckdb/src/parser/parser.cpp +129 -0
  1246. package/src/duckdb/src/parser/qualified_name.cpp +99 -0
  1247. package/src/duckdb/src/parser/query_error_context.cpp +35 -6
  1248. package/src/duckdb/src/parser/query_node/select_node.cpp +4 -4
  1249. package/src/duckdb/src/parser/statement/delete_statement.cpp +6 -1
  1250. package/src/duckdb/src/parser/statement/insert_statement.cpp +4 -3
  1251. package/src/duckdb/src/parser/statement/update_statement.cpp +6 -1
  1252. package/src/duckdb/src/parser/tableref/pivotref.cpp +2 -2
  1253. package/src/duckdb/src/parser/tableref.cpp +2 -2
  1254. package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +16 -24
  1255. package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +1 -1
  1256. package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +5 -5
  1257. package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +61 -13
  1258. package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +10 -4
  1259. package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +2 -2
  1260. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +30 -3
  1261. package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +1 -1
  1262. package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +25 -6
  1263. package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +1 -1
  1264. package/src/duckdb/src/parser/transform/helpers/transform_sample.cpp +10 -3
  1265. package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +4 -3
  1266. package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +18 -3
  1267. package/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp +1 -1
  1268. package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +0 -1
  1269. package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +5 -5
  1270. package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +26 -12
  1271. package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +11 -3
  1272. package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +1 -1
  1273. package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -0
  1274. package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +3 -3
  1275. package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +4 -4
  1276. package/src/duckdb/src/parser/transform/statement/transform_set.cpp +2 -2
  1277. package/src/duckdb/src/parser/transform/statement/transform_show.cpp +21 -3
  1278. package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +8 -6
  1279. package/src/duckdb/src/parser/transformer.cpp +2 -2
  1280. package/src/duckdb/src/planner/bind_context.cpp +308 -136
  1281. package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +30 -31
  1282. package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +4 -2
  1283. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +102 -94
  1284. package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +7 -5
  1285. package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +1 -1
  1286. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +7 -7
  1287. package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +10 -10
  1288. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +24 -6
  1289. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -15
  1290. package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +1 -1
  1291. package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +97 -19
  1292. package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +74 -16
  1293. package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +6 -6
  1294. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +49 -15
  1295. package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +32 -23
  1296. package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +20 -3
  1297. package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +2 -2
  1298. package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +3 -0
  1299. package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +6 -5
  1300. package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +38 -19
  1301. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +2 -12
  1302. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +117 -412
  1303. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +423 -144
  1304. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
  1305. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +5 -0
  1306. package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +1 -1
  1307. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +0 -4
  1308. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +31 -13
  1309. package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +1 -1
  1310. package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +96 -27
  1311. package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +1 -1
  1312. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +5 -3
  1313. package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +7 -6
  1314. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +36 -9
  1315. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +34 -34
  1316. package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +72 -35
  1317. package/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +99 -18
  1318. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +23 -11
  1319. package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +22 -19
  1320. package/src/duckdb/src/planner/binder.cpp +23 -45
  1321. package/src/duckdb/src/planner/binding_alias.cpp +69 -0
  1322. package/src/duckdb/src/planner/bound_parameter_map.cpp +1 -1
  1323. package/src/duckdb/src/planner/bound_result_modifier.cpp +6 -2
  1324. package/src/duckdb/src/planner/collation_binding.cpp +38 -4
  1325. package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +17 -5
  1326. package/src/duckdb/src/planner/expression/bound_expression.cpp +1 -1
  1327. package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -1
  1328. package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +2 -2
  1329. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +24 -4
  1330. package/src/duckdb/src/planner/expression.cpp +7 -1
  1331. package/src/duckdb/src/planner/expression_binder/aggregate_binder.cpp +1 -1
  1332. package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +2 -2
  1333. package/src/duckdb/src/planner/expression_binder/group_binder.cpp +2 -2
  1334. package/src/duckdb/src/planner/expression_binder/having_binder.cpp +16 -0
  1335. package/src/duckdb/src/planner/expression_binder/index_binder.cpp +53 -1
  1336. package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +3 -3
  1337. package/src/duckdb/src/planner/expression_binder/order_binder.cpp +8 -8
  1338. package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +1 -1
  1339. package/src/duckdb/src/planner/expression_binder/select_bind_state.cpp +2 -2
  1340. package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +1 -1
  1341. package/src/duckdb/src/planner/expression_binder/update_binder.cpp +1 -1
  1342. package/src/duckdb/src/planner/expression_binder.cpp +7 -7
  1343. package/src/duckdb/src/planner/expression_iterator.cpp +6 -3
  1344. package/src/duckdb/src/planner/filter/constant_filter.cpp +17 -2
  1345. package/src/duckdb/src/planner/filter/dynamic_filter.cpp +68 -0
  1346. package/src/duckdb/src/planner/filter/in_filter.cpp +84 -0
  1347. package/src/duckdb/src/planner/filter/null_filter.cpp +1 -2
  1348. package/src/duckdb/src/planner/filter/optional_filter.cpp +29 -0
  1349. package/src/duckdb/src/planner/filter/struct_filter.cpp +11 -6
  1350. package/src/duckdb/src/planner/joinside.cpp +6 -5
  1351. package/src/duckdb/src/planner/logical_operator.cpp +4 -1
  1352. package/src/duckdb/src/planner/logical_operator_visitor.cpp +68 -2
  1353. package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +23 -0
  1354. package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -12
  1355. package/src/duckdb/src/planner/operator/logical_filter.cpp +1 -1
  1356. package/src/duckdb/src/planner/operator/logical_get.cpp +48 -25
  1357. package/src/duckdb/src/planner/operator/logical_insert.cpp +1 -1
  1358. package/src/duckdb/src/planner/operator/logical_join.cpp +1 -1
  1359. package/src/duckdb/src/planner/operator/logical_order.cpp +4 -11
  1360. package/src/duckdb/src/planner/operator/logical_top_n.cpp +7 -0
  1361. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +33 -5
  1362. package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +2 -2
  1363. package/src/duckdb/src/planner/table_binding.cpp +74 -36
  1364. package/src/duckdb/src/planner/table_filter.cpp +5 -8
  1365. package/src/duckdb/src/storage/arena_allocator.cpp +5 -4
  1366. package/src/duckdb/src/storage/buffer/block_handle.cpp +88 -17
  1367. package/src/duckdb/src/storage/buffer/block_manager.cpp +34 -26
  1368. package/src/duckdb/src/storage/buffer/buffer_handle.cpp +2 -2
  1369. package/src/duckdb/src/storage/buffer/buffer_pool.cpp +70 -49
  1370. package/src/duckdb/src/storage/buffer_manager.cpp +4 -0
  1371. package/src/duckdb/src/storage/checkpoint_manager.cpp +24 -5
  1372. package/src/duckdb/src/storage/compression/bitpacking.cpp +14 -16
  1373. package/src/duckdb/src/storage/compression/dictionary/analyze.cpp +54 -0
  1374. package/src/duckdb/src/storage/compression/dictionary/common.cpp +90 -0
  1375. package/src/duckdb/src/storage/compression/dictionary/compression.cpp +174 -0
  1376. package/src/duckdb/src/storage/compression/dictionary/decompression.cpp +115 -0
  1377. package/src/duckdb/src/storage/compression/dictionary_compression.cpp +53 -545
  1378. package/src/duckdb/src/storage/compression/empty_validity.cpp +15 -0
  1379. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +25 -16
  1380. package/src/duckdb/src/storage/compression/fsst.cpp +101 -47
  1381. package/src/duckdb/src/storage/compression/numeric_constant.cpp +92 -2
  1382. package/src/duckdb/src/storage/compression/rle.cpp +216 -46
  1383. package/src/duckdb/src/storage/compression/roaring/analyze.cpp +179 -0
  1384. package/src/duckdb/src/storage/compression/roaring/common.cpp +282 -0
  1385. package/src/duckdb/src/storage/compression/roaring/compress.cpp +481 -0
  1386. package/src/duckdb/src/storage/compression/roaring/metadata.cpp +262 -0
  1387. package/src/duckdb/src/storage/compression/roaring/scan.cpp +364 -0
  1388. package/src/duckdb/src/storage/compression/string_uncompressed.cpp +47 -65
  1389. package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +102 -39
  1390. package/src/duckdb/src/storage/compression/zstd.cpp +1049 -0
  1391. package/src/duckdb/src/storage/data_table.cpp +312 -172
  1392. package/src/duckdb/src/storage/local_storage.cpp +104 -46
  1393. package/src/duckdb/src/storage/metadata/metadata_manager.cpp +1 -1
  1394. package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +7 -3
  1395. package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +138 -58
  1396. package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +14 -0
  1397. package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +19 -8
  1398. package/src/duckdb/src/storage/serialization/serialize_statement.cpp +2 -0
  1399. package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +43 -0
  1400. package/src/duckdb/src/storage/serialization/serialize_types.cpp +32 -5
  1401. package/src/duckdb/src/storage/single_file_block_manager.cpp +6 -8
  1402. package/src/duckdb/src/storage/standard_buffer_manager.cpp +82 -71
  1403. package/src/duckdb/src/storage/statistics/column_statistics.cpp +3 -3
  1404. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +18 -17
  1405. package/src/duckdb/src/storage/statistics/numeric_stats.cpp +34 -22
  1406. package/src/duckdb/src/storage/statistics/string_stats.cpp +14 -3
  1407. package/src/duckdb/src/storage/storage_info.cpp +72 -10
  1408. package/src/duckdb/src/storage/storage_manager.cpp +41 -47
  1409. package/src/duckdb/src/storage/table/array_column_data.cpp +7 -1
  1410. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +10 -9
  1411. package/src/duckdb/src/storage/table/column_data.cpp +105 -43
  1412. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +307 -132
  1413. package/src/duckdb/src/storage/table/column_segment.cpp +36 -13
  1414. package/src/duckdb/src/storage/table/list_column_data.cpp +4 -4
  1415. package/src/duckdb/src/storage/table/row_group.cpp +159 -66
  1416. package/src/duckdb/src/storage/table/row_group_collection.cpp +157 -68
  1417. package/src/duckdb/src/storage/table/row_version_manager.cpp +33 -10
  1418. package/src/duckdb/src/storage/table/scan_state.cpp +21 -7
  1419. package/src/duckdb/src/storage/table/standard_column_data.cpp +68 -5
  1420. package/src/duckdb/src/storage/table/struct_column_data.cpp +42 -4
  1421. package/src/duckdb/src/storage/table/table_statistics.cpp +91 -5
  1422. package/src/duckdb/src/storage/table/update_segment.cpp +287 -210
  1423. package/src/duckdb/src/storage/table_index_list.cpp +55 -58
  1424. package/src/duckdb/src/storage/temporary_file_manager.cpp +412 -149
  1425. package/src/duckdb/src/storage/wal_replay.cpp +132 -48
  1426. package/src/duckdb/src/storage/write_ahead_log.cpp +75 -48
  1427. package/src/duckdb/src/transaction/cleanup_state.cpp +0 -1
  1428. package/src/duckdb/src/transaction/commit_state.cpp +23 -14
  1429. package/src/duckdb/src/transaction/duck_transaction.cpp +29 -25
  1430. package/src/duckdb/src/transaction/duck_transaction_manager.cpp +18 -6
  1431. package/src/duckdb/src/transaction/meta_transaction.cpp +3 -2
  1432. package/src/duckdb/src/transaction/rollback_state.cpp +5 -2
  1433. package/src/duckdb/src/transaction/transaction_context.cpp +9 -1
  1434. package/src/duckdb/src/transaction/undo_buffer.cpp +35 -27
  1435. package/src/duckdb/src/transaction/undo_buffer_allocator.cpp +72 -0
  1436. package/src/duckdb/src/transaction/wal_write_state.cpp +12 -10
  1437. package/src/duckdb/src/verification/copied_statement_verifier.cpp +7 -4
  1438. package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +7 -5
  1439. package/src/duckdb/src/verification/external_statement_verifier.cpp +7 -4
  1440. package/src/duckdb/src/verification/fetch_row_verifier.cpp +7 -4
  1441. package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +8 -4
  1442. package/src/duckdb/src/verification/parsed_statement_verifier.cpp +7 -4
  1443. package/src/duckdb/src/verification/prepared_statement_verifier.cpp +16 -12
  1444. package/src/duckdb/src/verification/statement_verifier.cpp +20 -15
  1445. package/src/duckdb/src/verification/unoptimized_statement_verifier.cpp +7 -4
  1446. package/src/duckdb/third_party/fsst/libfsst.hpp +1 -0
  1447. package/src/duckdb/third_party/httplib/httplib.hpp +15 -22
  1448. package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +4 -2
  1449. package/src/duckdb/third_party/libpg_query/pg_functions.cpp +2 -4
  1450. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +14278 -13832
  1451. package/src/duckdb/third_party/parquet/parquet_types.cpp +3410 -1686
  1452. package/src/duckdb/third_party/parquet/parquet_types.h +1585 -1204
  1453. package/src/duckdb/third_party/skiplist/SkipList.h +0 -1
  1454. package/src/duckdb/third_party/snappy/snappy-stubs-internal.h +13 -15
  1455. package/src/duckdb/third_party/zstd/common/debug.cpp +36 -0
  1456. package/src/duckdb/third_party/zstd/common/entropy_common.cpp +173 -49
  1457. package/src/duckdb/third_party/zstd/common/error_private.cpp +11 -3
  1458. package/src/duckdb/third_party/zstd/common/fse_decompress.cpp +126 -97
  1459. package/src/duckdb/third_party/zstd/common/pool.cpp +376 -0
  1460. package/src/duckdb/third_party/zstd/common/threading.cpp +193 -0
  1461. package/src/duckdb/third_party/zstd/common/xxhash.cpp +18 -14
  1462. package/src/duckdb/third_party/zstd/common/zstd_common.cpp +3 -38
  1463. package/src/duckdb/third_party/zstd/compress/fse_compress.cpp +93 -165
  1464. package/src/duckdb/third_party/zstd/compress/hist.cpp +28 -31
  1465. package/src/duckdb/third_party/zstd/compress/huf_compress.cpp +957 -291
  1466. package/src/duckdb/third_party/zstd/compress/zstd_compress.cpp +3988 -1124
  1467. package/src/duckdb/third_party/zstd/compress/zstd_compress_literals.cpp +120 -43
  1468. package/src/duckdb/third_party/zstd/compress/zstd_compress_sequences.cpp +47 -23
  1469. package/src/duckdb/third_party/zstd/compress/zstd_compress_superblock.cpp +274 -424
  1470. package/src/duckdb/third_party/zstd/compress/zstd_double_fast.cpp +403 -153
  1471. package/src/duckdb/third_party/zstd/compress/zstd_fast.cpp +741 -268
  1472. package/src/duckdb/third_party/zstd/compress/zstd_lazy.cpp +1339 -278
  1473. package/src/duckdb/third_party/zstd/compress/zstd_ldm.cpp +334 -222
  1474. package/src/duckdb/third_party/zstd/compress/zstd_opt.cpp +674 -298
  1475. package/src/duckdb/third_party/zstd/compress/zstdmt_compress.cpp +1885 -0
  1476. package/src/duckdb/third_party/zstd/decompress/huf_decompress.cpp +1247 -586
  1477. package/src/duckdb/third_party/zstd/decompress/zstd_ddict.cpp +18 -17
  1478. package/src/duckdb/third_party/zstd/decompress/zstd_decompress.cpp +724 -270
  1479. package/src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp +1193 -393
  1480. package/src/duckdb/third_party/zstd/deprecated/zbuff_common.cpp +30 -0
  1481. package/src/duckdb/third_party/zstd/deprecated/zbuff_compress.cpp +171 -0
  1482. package/src/duckdb/third_party/zstd/deprecated/zbuff_decompress.cpp +80 -0
  1483. package/src/duckdb/third_party/zstd/dict/cover.cpp +1271 -0
  1484. package/src/duckdb/third_party/zstd/dict/divsufsort.cpp +1916 -0
  1485. package/src/duckdb/third_party/zstd/dict/fastcover.cpp +775 -0
  1486. package/src/duckdb/third_party/zstd/dict/zdict.cpp +1139 -0
  1487. package/src/duckdb/third_party/zstd/include/zdict.h +473 -0
  1488. package/src/duckdb/third_party/zstd/include/zstd/common/allocations.h +58 -0
  1489. package/src/duckdb/third_party/zstd/include/zstd/common/bits.h +204 -0
  1490. package/src/duckdb/third_party/zstd/include/zstd/common/bitstream.h +88 -85
  1491. package/src/duckdb/third_party/zstd/include/zstd/common/compiler.h +243 -47
  1492. package/src/duckdb/third_party/zstd/include/zstd/common/cpu.h +253 -0
  1493. package/src/duckdb/third_party/zstd/include/zstd/common/debug.h +31 -31
  1494. package/src/duckdb/third_party/zstd/include/zstd/common/error_private.h +94 -6
  1495. package/src/duckdb/third_party/zstd/include/zstd/common/fse.h +424 -64
  1496. package/src/duckdb/third_party/zstd/include/zstd/common/huf.h +255 -70
  1497. package/src/duckdb/third_party/zstd/include/zstd/common/mem.h +125 -85
  1498. package/src/duckdb/third_party/zstd/include/zstd/common/pool.h +84 -0
  1499. package/src/duckdb/third_party/zstd/include/zstd/common/portability_macros.h +158 -0
  1500. package/src/duckdb/third_party/zstd/include/zstd/common/threading.h +152 -0
  1501. package/src/duckdb/third_party/zstd/include/zstd/common/{xxhash.h → xxhash.hpp} +0 -1
  1502. package/src/duckdb/third_party/zstd/include/zstd/common/{xxhash_static.h → xxhash_static.hpp} +1 -1
  1503. package/src/duckdb/third_party/zstd/include/zstd/common/zstd_deps.h +122 -0
  1504. package/src/duckdb/third_party/zstd/include/zstd/common/zstd_internal.h +143 -174
  1505. package/src/duckdb/third_party/zstd/include/zstd/common/zstd_trace.h +159 -0
  1506. package/src/duckdb/third_party/zstd/include/zstd/compress/clevels.h +136 -0
  1507. package/src/duckdb/third_party/zstd/include/zstd/compress/hist.h +4 -4
  1508. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_internal.h +631 -220
  1509. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_literals.h +17 -7
  1510. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_sequences.h +2 -2
  1511. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_superblock.h +3 -2
  1512. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_cwksp.h +256 -153
  1513. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_double_fast.h +16 -3
  1514. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_fast.h +4 -3
  1515. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_lazy.h +145 -11
  1516. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_ldm.h +14 -6
  1517. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_ldm_geartab.h +110 -0
  1518. package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_opt.h +33 -9
  1519. package/src/duckdb/third_party/zstd/include/zstd/compress/zstdmt_compress.h +107 -0
  1520. package/src/duckdb/third_party/zstd/include/zstd/decompress/zstd_ddict.h +4 -3
  1521. package/src/duckdb/third_party/zstd/include/zstd/decompress/zstd_decompress_block.h +20 -6
  1522. package/src/duckdb/third_party/zstd/include/zstd/decompress/zstd_decompress_internal.h +88 -16
  1523. package/src/duckdb/third_party/zstd/include/zstd/deprecated/zbuff.h +214 -0
  1524. package/src/duckdb/third_party/zstd/include/zstd/dict/cover.h +156 -0
  1525. package/src/duckdb/third_party/zstd/include/zstd/dict/divsufsort.h +62 -0
  1526. package/src/duckdb/third_party/zstd/include/zstd.h +2171 -93
  1527. package/src/duckdb/third_party/zstd/include/{zstd/common/zstd_errors.h → zstd_errors.h} +32 -10
  1528. package/src/duckdb/ub_extension_core_functions_aggregate_algebraic.cpp +8 -0
  1529. package/src/duckdb/ub_extension_core_functions_aggregate_distributive.cpp +20 -0
  1530. package/src/duckdb/ub_extension_core_functions_aggregate_holistic.cpp +12 -0
  1531. package/src/duckdb/ub_extension_core_functions_aggregate_nested.cpp +6 -0
  1532. package/src/duckdb/ub_extension_core_functions_aggregate_regression.cpp +14 -0
  1533. package/src/duckdb/ub_extension_core_functions_scalar_array.cpp +4 -0
  1534. package/src/duckdb/ub_extension_core_functions_scalar_bit.cpp +2 -0
  1535. package/src/duckdb/ub_extension_core_functions_scalar_blob.cpp +4 -0
  1536. package/src/duckdb/ub_extension_core_functions_scalar_date.cpp +20 -0
  1537. package/src/duckdb/ub_extension_core_functions_scalar_debug.cpp +2 -0
  1538. package/src/duckdb/ub_extension_core_functions_scalar_enum.cpp +2 -0
  1539. package/src/duckdb/ub_extension_core_functions_scalar_generic.cpp +18 -0
  1540. package/src/duckdb/ub_extension_core_functions_scalar_list.cpp +22 -0
  1541. package/src/duckdb/ub_extension_core_functions_scalar_map.cpp +14 -0
  1542. package/src/duckdb/ub_extension_core_functions_scalar_math.cpp +2 -0
  1543. package/src/duckdb/ub_extension_core_functions_scalar_operators.cpp +2 -0
  1544. package/src/duckdb/ub_extension_core_functions_scalar_random.cpp +4 -0
  1545. package/src/duckdb/ub_extension_core_functions_scalar_string.cpp +48 -0
  1546. package/src/duckdb/ub_extension_core_functions_scalar_struct.cpp +2 -0
  1547. package/src/duckdb/ub_extension_core_functions_scalar_union.cpp +6 -0
  1548. package/src/duckdb/ub_src_common.cpp +4 -0
  1549. package/src/duckdb/ub_src_common_arrow.cpp +3 -1
  1550. package/src/duckdb/ub_src_execution.cpp +0 -6
  1551. package/src/duckdb/ub_src_execution_operator_aggregate.cpp +2 -0
  1552. package/src/duckdb/ub_src_execution_operator_csv_scanner_encode.cpp +2 -0
  1553. package/src/duckdb/ub_src_execution_operator_csv_scanner_util.cpp +2 -0
  1554. package/src/duckdb/ub_src_execution_sample.cpp +4 -0
  1555. package/src/duckdb/ub_src_function.cpp +6 -0
  1556. package/src/duckdb/ub_src_function_aggregate.cpp +0 -2
  1557. package/src/duckdb/ub_src_function_aggregate_distributive.cpp +3 -1
  1558. package/src/duckdb/ub_src_function_scalar.cpp +2 -8
  1559. package/src/duckdb/ub_src_function_scalar_date.cpp +2 -0
  1560. package/src/duckdb/ub_src_function_scalar_generic.cpp +2 -2
  1561. package/src/duckdb/ub_src_function_scalar_map.cpp +2 -0
  1562. package/src/duckdb/ub_src_function_scalar_operator.cpp +8 -0
  1563. package/src/duckdb/ub_src_function_scalar_string.cpp +10 -0
  1564. package/src/duckdb/ub_src_function_scalar_struct.cpp +4 -0
  1565. package/src/duckdb/ub_src_function_scalar_system.cpp +2 -0
  1566. package/src/duckdb/ub_src_function_table_system.cpp +6 -0
  1567. package/src/duckdb/ub_src_function_window.cpp +36 -0
  1568. package/src/duckdb/ub_src_logging.cpp +8 -0
  1569. package/src/duckdb/ub_src_main_settings.cpp +3 -1
  1570. package/src/duckdb/ub_src_optimizer.cpp +8 -0
  1571. package/src/duckdb/ub_src_optimizer_pushdown.cpp +2 -0
  1572. package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
  1573. package/src/duckdb/ub_src_parser.cpp +2 -0
  1574. package/src/duckdb/ub_src_parser_parsed_data.cpp +2 -0
  1575. package/src/duckdb/ub_src_planner.cpp +2 -0
  1576. package/src/duckdb/ub_src_planner_filter.cpp +6 -0
  1577. package/src/duckdb/ub_src_storage_compression.cpp +4 -0
  1578. package/src/duckdb/ub_src_storage_compression_dictionary.cpp +8 -0
  1579. package/src/duckdb/ub_src_storage_compression_roaring.cpp +10 -0
  1580. package/src/duckdb/ub_src_transaction.cpp +2 -0
  1581. package/vendor.py +1 -1
  1582. package/src/duckdb/extension/json/yyjson/include/yyjson.hpp +0 -6003
  1583. package/src/duckdb/extension/json/yyjson/yyjson.cpp +0 -8218
  1584. package/src/duckdb/src/common/arrow/appender/list_data.cpp +0 -78
  1585. package/src/duckdb/src/common/arrow/appender/map_data.cpp +0 -91
  1586. package/src/duckdb/src/common/cycle_counter.cpp +0 -76
  1587. package/src/duckdb/src/common/field_writer.cpp +0 -97
  1588. package/src/duckdb/src/common/http_state.cpp +0 -95
  1589. package/src/duckdb/src/common/preserved_error.cpp +0 -87
  1590. package/src/duckdb/src/common/row_operations/row_match.cpp +0 -359
  1591. package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +0 -27
  1592. package/src/duckdb/src/common/serializer/buffered_serializer.cpp +0 -36
  1593. package/src/duckdb/src/common/serializer/format_serializer.cpp +0 -15
  1594. package/src/duckdb/src/common/serializer.cpp +0 -24
  1595. package/src/duckdb/src/common/types/chunk_collection.cpp +0 -190
  1596. package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +0 -183
  1597. package/src/duckdb/src/core_functions/scalar/date/current.cpp +0 -54
  1598. package/src/duckdb/src/core_functions/scalar/list/list_cosine_similarity.cpp +0 -78
  1599. package/src/duckdb/src/core_functions/scalar/list/list_inner_product.cpp +0 -70
  1600. package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +0 -412
  1601. package/src/duckdb/src/core_functions/scalar/secret/which_secret.cpp +0 -28
  1602. package/src/duckdb/src/core_functions/scalar/string/jaro_winkler.cpp +0 -71
  1603. package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +0 -238
  1604. package/src/duckdb/src/execution/index/art/node16.cpp +0 -196
  1605. package/src/duckdb/src/execution/index/art/node4.cpp +0 -189
  1606. package/src/duckdb/src/execution/index/unknown_index.cpp +0 -65
  1607. package/src/duckdb/src/execution/operator/csv_scanner/base_csv_reader.cpp +0 -595
  1608. package/src/duckdb/src/execution/operator/csv_scanner/buffered_csv_reader.cpp +0 -434
  1609. package/src/duckdb/src/execution/operator/csv_scanner/csv_buffer.cpp +0 -89
  1610. package/src/duckdb/src/execution/operator/csv_scanner/csv_buffer_manager.cpp +0 -90
  1611. package/src/duckdb/src/execution/operator/csv_scanner/csv_file_handle.cpp +0 -95
  1612. package/src/duckdb/src/execution/operator/csv_scanner/csv_reader_options.cpp +0 -494
  1613. package/src/duckdb/src/execution/operator/csv_scanner/csv_state_machine.cpp +0 -35
  1614. package/src/duckdb/src/execution/operator/csv_scanner/csv_state_machine_cache.cpp +0 -99
  1615. package/src/duckdb/src/execution/operator/csv_scanner/parallel_csv_reader.cpp +0 -689
  1616. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +0 -242
  1617. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +0 -695
  1618. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +0 -1487
  1619. package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +0 -72
  1620. package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +0 -158
  1621. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +0 -280
  1622. package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +0 -666
  1623. package/src/duckdb/src/execution/operator/persistent/physical_fixed_batch_copy.cpp +0 -499
  1624. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +0 -207
  1625. package/src/duckdb/src/execution/partitionable_hashtable.cpp +0 -207
  1626. package/src/duckdb/src/execution/physical_plan/plan_limit_percent.cpp +0 -18
  1627. package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +0 -47
  1628. package/src/duckdb/src/execution/reservoir_sample.cpp +0 -324
  1629. package/src/duckdb/src/execution/window_executor.cpp +0 -1830
  1630. package/src/duckdb/src/execution/window_segment_tree.cpp +0 -2073
  1631. package/src/duckdb/src/extension_forward_decl/icu.cpp +0 -59
  1632. package/src/duckdb/src/function/aggregate/distributive_functions.cpp +0 -15
  1633. package/src/duckdb/src/function/scalar/compressed_materialization_functions.cpp +0 -29
  1634. package/src/duckdb/src/function/scalar/generic_functions.cpp +0 -11
  1635. package/src/duckdb/src/function/scalar/list/list_concat.cpp +0 -143
  1636. package/src/duckdb/src/function/scalar/operators.cpp +0 -14
  1637. package/src/duckdb/src/function/scalar/sequence_functions.cpp +0 -10
  1638. package/src/duckdb/src/function/scalar/string_functions.cpp +0 -22
  1639. package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +0 -173
  1640. package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +0 -101
  1641. package/src/duckdb/src/include/duckdb/catalog/mapping_value.hpp +0 -92
  1642. package/src/duckdb/src/include/duckdb/common/arrow/arrow_types_extension.hpp +0 -42
  1643. package/src/duckdb/src/include/duckdb/common/cycle_counter.hpp +0 -68
  1644. package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +0 -34
  1645. package/src/duckdb/src/include/duckdb/common/http_state.hpp +0 -113
  1646. package/src/duckdb/src/include/duckdb/common/platform.h +0 -58
  1647. package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +0 -59
  1648. package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +0 -192
  1649. package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +0 -137
  1650. package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +0 -65
  1651. package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +0 -63
  1652. package/src/duckdb/src/include/duckdb/execution/index/unknown_index.hpp +0 -65
  1653. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_buffer.hpp +0 -103
  1654. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.hpp +0 -74
  1655. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_file_handle.hpp +0 -60
  1656. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_sniffer.hpp +0 -253
  1657. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/csv_option.hpp +0 -155
  1658. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/csv_reader_options.hpp +0 -163
  1659. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/state_machine_options.hpp +0 -35
  1660. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/base_scanner.hpp +0 -228
  1661. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/column_count_scanner.hpp +0 -70
  1662. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/scanner_boundary.hpp +0 -93
  1663. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/skip_scanner.hpp +0 -60
  1664. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/string_value_scanner.hpp +0 -197
  1665. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/quote_rules.hpp +0 -21
  1666. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state.hpp +0 -30
  1667. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state_machine.hpp +0 -99
  1668. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.hpp +0 -87
  1669. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/table_function/csv_file_scanner.hpp +0 -70
  1670. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/table_function/global_csv_state.hpp +0 -80
  1671. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/util/csv_casting.hpp +0 -137
  1672. package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/util/csv_error.hpp +0 -104
  1673. package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +0 -79
  1674. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/base_csv_reader.hpp +0 -119
  1675. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/buffered_csv_reader.hpp +0 -72
  1676. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_buffer.hpp +0 -110
  1677. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_buffer_manager.hpp +0 -103
  1678. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_file_handle.hpp +0 -59
  1679. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_line_info.hpp +0 -46
  1680. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_reader_options.hpp +0 -210
  1681. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_sniffer.hpp +0 -131
  1682. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state.hpp +0 -28
  1683. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state_machine.hpp +0 -70
  1684. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state_machine_cache.hpp +0 -65
  1685. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/parallel_csv_reader.hpp +0 -167
  1686. package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/quote_rules.hpp +0 -21
  1687. package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +0 -343
  1688. package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +0 -165
  1689. package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_optimizer.hpp +0 -45
  1690. package/src/duckdb/src/include/duckdb/optimizer/join_order/estimated_properties.hpp +0 -57
  1691. package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_info.hpp +0 -45
  1692. package/src/duckdb/src/include/duckdb/parser/statement/show_statement.hpp +0 -32
  1693. package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +0 -49
  1694. package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +0 -42
  1695. package/src/duckdb/src/main/settings/settings.cpp +0 -2056
  1696. package/src/duckdb/src/optimizer/join_order/estimated_properties.cpp +0 -36
  1697. package/src/duckdb/src/parser/parsed_data/comment_on_info.cpp +0 -19
  1698. package/src/duckdb/src/parser/statement/show_statement.cpp +0 -15
  1699. package/src/duckdb/src/planner/binder/statement/bind_show.cpp +0 -30
  1700. package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +0 -14
  1701. package/src/duckdb/src/storage/statistics/numeric_stats_union.cpp +0 -70
  1702. package/src/duckdb/third_party/fsst/fsst_avx512.cpp +0 -140
  1703. package/src/duckdb/third_party/fsst/fsst_avx512.inc +0 -57
  1704. package/src/duckdb/third_party/fsst/fsst_avx512_unroll1.inc +0 -57
  1705. package/src/duckdb/third_party/fsst/fsst_avx512_unroll2.inc +0 -114
  1706. package/src/duckdb/third_party/fsst/fsst_avx512_unroll3.inc +0 -171
  1707. package/src/duckdb/third_party/fsst/fsst_avx512_unroll4.inc +0 -228
  1708. package/src/duckdb/third_party/parquet/parquet_constants.cpp +0 -17
  1709. package/src/duckdb/third_party/parquet/parquet_constants.h +0 -24
  1710. package/src/duckdb/third_party/re2/util/pod_array.h +0 -55
  1711. package/src/duckdb/third_party/re2/util/sparse_array.h +0 -392
  1712. package/src/duckdb/third_party/re2/util/sparse_set.h +0 -264
  1713. package/src/duckdb/third_party/zstd/include/zstd/common/fse_static.h +0 -421
  1714. package/src/duckdb/third_party/zstd/include/zstd/common/huf_static.h +0 -238
  1715. package/src/duckdb/third_party/zstd/include/zstd_static.h +0 -1070
  1716. package/src/duckdb/ub_src_core_functions.cpp +0 -6
  1717. package/src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp +0 -8
  1718. package/src/duckdb/ub_src_core_functions_aggregate_distributive.cpp +0 -24
  1719. package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +0 -12
  1720. package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +0 -6
  1721. package/src/duckdb/ub_src_core_functions_aggregate_regression.cpp +0 -14
  1722. package/src/duckdb/ub_src_core_functions_scalar_array.cpp +0 -4
  1723. package/src/duckdb/ub_src_core_functions_scalar_bit.cpp +0 -2
  1724. package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +0 -6
  1725. package/src/duckdb/ub_src_core_functions_scalar_date.cpp +0 -22
  1726. package/src/duckdb/ub_src_core_functions_scalar_debug.cpp +0 -2
  1727. package/src/duckdb/ub_src_core_functions_scalar_enum.cpp +0 -2
  1728. package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +0 -18
  1729. package/src/duckdb/ub_src_core_functions_scalar_list.cpp +0 -22
  1730. package/src/duckdb/ub_src_core_functions_scalar_map.cpp +0 -16
  1731. package/src/duckdb/ub_src_core_functions_scalar_math.cpp +0 -2
  1732. package/src/duckdb/ub_src_core_functions_scalar_operators.cpp +0 -2
  1733. package/src/duckdb/ub_src_core_functions_scalar_random.cpp +0 -4
  1734. package/src/duckdb/ub_src_core_functions_scalar_secret.cpp +0 -2
  1735. package/src/duckdb/ub_src_core_functions_scalar_string.cpp +0 -58
  1736. package/src/duckdb/ub_src_core_functions_scalar_struct.cpp +0 -4
  1737. package/src/duckdb/ub_src_core_functions_scalar_union.cpp +0 -6
  1738. package/src/duckdb/ub_src_execution_operator_csv_scanner.cpp +0 -18
  1739. package/src/duckdb/ub_src_function_scalar_operators.cpp +0 -8
  1740. /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic/covar.hpp +0 -0
  1741. /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic/stddev.hpp +0 -0
  1742. /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/sum_helpers.hpp +0 -0
  1743. /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/array_kernels.hpp +0 -0
  1744. /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/function_list.hpp +0 -0
  1745. /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/secret_functions.hpp +0 -0
  1746. /package/src/duckdb/src/function/scalar/{operators → operator}/multiply.cpp +0 -0
  1747. /package/src/duckdb/src/function/scalar/{operators → operator}/subtract.cpp +0 -0
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -7,31 +7,71 @@
7
7
  * in the COPYING file in the root directory of this source tree).
8
8
  * You may select, at your option, one of the above-listed licenses.
9
9
  */
10
+
10
11
  #ifndef ZSTD_H_235446
11
12
  #define ZSTD_H_235446
12
13
 
13
- /* ====== Dependency ======*/
14
+ // DuckDB: just enable everything for amalgamation
15
+ #ifdef DUCKDB_AMALGAMATION
16
+ #define ZSTD_STATIC_LINKING_ONLY
17
+ #endif
18
+
19
+ /* ====== Dependencies ======*/
14
20
  #include <limits.h> /* INT_MAX */
15
21
  #include <stddef.h> /* size_t */
16
22
 
23
+ namespace duckdb_zstd {
17
24
 
18
25
  /* ===== ZSTDLIB_API : control library symbols visibility ===== */
19
- #ifndef ZSTDLIB_VISIBILITY
20
- # if defined(__GNUC__) && (__GNUC__ >= 4)
21
- # define ZSTDLIB_VISIBILITY __attribute__ ((visibility ("default")))
26
+ #ifndef ZSTDLIB_VISIBLE
27
+ /* Backwards compatibility with old macro name */
28
+ # ifdef ZSTDLIB_VISIBILITY
29
+ # define ZSTDLIB_VISIBLE ZSTDLIB_VISIBILITY
30
+ # elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__)
31
+ # define ZSTDLIB_VISIBLE __attribute__ ((visibility ("default")))
32
+ # else
33
+ # define ZSTDLIB_VISIBLE
34
+ # endif
35
+ #endif
36
+
37
+ #ifndef ZSTDLIB_HIDDEN
38
+ # if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__)
39
+ # define ZSTDLIB_HIDDEN __attribute__ ((visibility ("hidden")))
22
40
  # else
23
- # define ZSTDLIB_VISIBILITY
41
+ # define ZSTDLIB_HIDDEN
24
42
  # endif
25
43
  #endif
44
+
26
45
  #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
27
- # define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBILITY
46
+ # define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBLE
28
47
  #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
29
- # define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
48
+ # define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
30
49
  #else
31
- # define ZSTDLIB_API ZSTDLIB_VISIBILITY
50
+ # define ZSTDLIB_API ZSTDLIB_VISIBLE
32
51
  #endif
33
52
 
34
- namespace duckdb_zstd {
53
+ /* Deprecation warnings :
54
+ * Should these warnings be a problem, it is generally possible to disable them,
55
+ * typically with -Wno-deprecated-declarations for gcc or _CRT_SECURE_NO_WARNINGS in Visual.
56
+ * Otherwise, it's also possible to define ZSTD_DISABLE_DEPRECATE_WARNINGS.
57
+ */
58
+ #ifdef ZSTD_DISABLE_DEPRECATE_WARNINGS
59
+ # define ZSTD_DEPRECATED(message) /* disable deprecation warnings */
60
+ #else
61
+ # if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
62
+ # define ZSTD_DEPRECATED(message) [[deprecated(message)]]
63
+ # elif (defined(GNUC) && (GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 5))) || defined(__clang__)
64
+ # define ZSTD_DEPRECATED(message) __attribute__((deprecated(message)))
65
+ # elif defined(__GNUC__) && (__GNUC__ >= 3)
66
+ # define ZSTD_DEPRECATED(message) __attribute__((deprecated))
67
+ # elif defined(_MSC_VER)
68
+ # define ZSTD_DEPRECATED(message) __declspec(deprecated(message))
69
+ # else
70
+ # pragma message("WARNING: You need to implement ZSTD_DEPRECATED for this compiler")
71
+ # define ZSTD_DEPRECATED(message)
72
+ # endif
73
+ #endif /* ZSTD_DISABLE_DEPRECATE_WARNINGS */
74
+
35
75
 
36
76
  /*******************************************************************************
37
77
  Introduction
@@ -68,17 +108,22 @@ namespace duckdb_zstd {
68
108
 
69
109
  /*------ Version ------*/
70
110
  #define ZSTD_VERSION_MAJOR 1
71
- #define ZSTD_VERSION_MINOR 4
72
- #define ZSTD_VERSION_RELEASE 5
73
-
111
+ #define ZSTD_VERSION_MINOR 5
112
+ #define ZSTD_VERSION_RELEASE 6
74
113
  #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
75
- ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< to check runtime library version */
114
+
115
+ /*! ZSTD_versionNumber() :
116
+ * Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE). */
117
+ ZSTDLIB_API unsigned ZSTD_versionNumber(void);
76
118
 
77
119
  #define ZSTD_LIB_VERSION ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE
78
120
  #define ZSTD_QUOTE(str) #str
79
121
  #define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str)
80
122
  #define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
81
- ZSTDLIB_API const char* ZSTD_versionString(void); /* requires v1.3.0+ */
123
+
124
+ /*! ZSTD_versionString() :
125
+ * Return runtime library version, like "1.4.5". Requires v1.3.0+. */
126
+ ZSTDLIB_API const char* ZSTD_versionString(void);
82
127
 
83
128
  /* *************************************
84
129
  * Default constant
@@ -101,13 +146,13 @@ ZSTDLIB_API const char* ZSTD_versionString(void); /* requires v1.3.0+ */
101
146
  #define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX)
102
147
 
103
148
 
104
-
105
149
  /***************************************
106
150
  * Simple API
107
151
  ***************************************/
108
152
  /*! ZSTD_compress() :
109
153
  * Compresses `src` content as a single zstd compressed frame into already allocated `dst`.
110
- * Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`.
154
+ * NOTE: Providing `dstCapacity >= ZSTD_compressBound(srcSize)` guarantees that zstd will have
155
+ * enough space to successfully compress the data.
111
156
  * @return : compressed size written into `dst` (<= `dstCapacity),
112
157
  * or an error code if it fails (which can be tested using ZSTD_isError()). */
113
158
  ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity,
@@ -156,9 +201,11 @@ ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t
156
201
  * "empty", "unknown" and "error" results to the same return value (0),
157
202
  * while ZSTD_getFrameContentSize() gives them separate return values.
158
203
  * @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise. */
159
- ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
204
+ ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize")
205
+ ZSTDLIB_API
206
+ unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
160
207
 
161
- /*! ZSTD_findFrameCompressedSize() :
208
+ /*! ZSTD_findFrameCompressedSize() : Requires v1.4.0+
162
209
  * `src` should point to the start of a ZSTD frame or skippable frame.
163
210
  * `srcSize` must be >= first frame size
164
211
  * @return : the compressed size of the first frame starting at `src`,
@@ -168,12 +215,35 @@ ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize)
168
215
 
169
216
 
170
217
  /*====== Helper functions ======*/
171
- #define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
172
- ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
218
+ /* ZSTD_compressBound() :
219
+ * maximum compressed size in worst case single-pass scenario.
220
+ * When invoking `ZSTD_compress()` or any other one-pass compression function,
221
+ * it's recommended to provide @dstCapacity >= ZSTD_compressBound(srcSize)
222
+ * as it eliminates one potential failure scenario,
223
+ * aka not enough room in dst buffer to write the compressed frame.
224
+ * Note : ZSTD_compressBound() itself can fail, if @srcSize > ZSTD_MAX_INPUT_SIZE .
225
+ * In which case, ZSTD_compressBound() will return an error code
226
+ * which can be tested using ZSTD_isError().
227
+ *
228
+ * ZSTD_COMPRESSBOUND() :
229
+ * same as ZSTD_compressBound(), but as a macro.
230
+ * It can be used to produce constants, which can be useful for static allocation,
231
+ * for example to size a static array on stack.
232
+ * Will produce constant value 0 if srcSize too large.
233
+ */
234
+ #define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00ULL : 0xFF00FF00U)
235
+ #define ZSTD_COMPRESSBOUND(srcSize) (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
236
+ ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
237
+ /* ZSTD_isError() :
238
+ * Most ZSTD_* functions returning a size_t value can be tested for error,
239
+ * using ZSTD_isError().
240
+ * @return 1 if error, 0 otherwise
241
+ */
173
242
  ZSTDLIB_API unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
174
243
  ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */
175
- ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed */
244
+ ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed, requires v1.4.0+ */
176
245
  ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compression level available */
246
+ ZSTDLIB_API int ZSTD_defaultCLevel(void); /*!< default compression level, specified by ZSTD_CLEVEL_DEFAULT, requires v1.5.0+ */
177
247
 
178
248
 
179
249
  /***************************************
@@ -182,7 +252,7 @@ ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compres
182
252
  /*= Compression context
183
253
  * When compressing many times,
184
254
  * it is recommended to allocate a context just once,
185
- * and re-use it for each successive compression operation.
255
+ * and reuse it for each successive compression operation.
186
256
  * This will make workload friendlier for system's memory.
187
257
  * Note : re-using context is just a speed / resource optimization.
188
258
  * It doesn't change the compression ratio, which remains identical.
@@ -191,13 +261,13 @@ ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compres
191
261
  */
192
262
  typedef struct ZSTD_CCtx_s ZSTD_CCtx;
193
263
  ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx(void);
194
- ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
264
+ ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx); /* accept NULL pointer */
195
265
 
196
266
  /*! ZSTD_compressCCtx() :
197
267
  * Same as ZSTD_compress(), using an explicit ZSTD_CCtx.
198
- * Important : in order to behave similarly to `ZSTD_compress()`,
199
- * this function compresses at requested compression level,
200
- * __ignoring any other parameter__ .
268
+ * Important : in order to mirror `ZSTD_compress()` behavior,
269
+ * this function compresses at the requested compression level,
270
+ * __ignoring any other advanced parameter__ .
201
271
  * If any advanced parameter was set using the advanced API,
202
272
  * they will all be reset. Only `compressionLevel` remains.
203
273
  */
@@ -209,38 +279,38 @@ ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx,
209
279
  /*= Decompression context
210
280
  * When decompressing many times,
211
281
  * it is recommended to allocate a context only once,
212
- * and re-use it for each successive compression operation.
282
+ * and reuse it for each successive compression operation.
213
283
  * This will make workload friendlier for system's memory.
214
284
  * Use one context per thread for parallel execution. */
215
285
  typedef struct ZSTD_DCtx_s ZSTD_DCtx;
216
286
  ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx(void);
217
- ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
287
+ ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); /* accept NULL pointer */
218
288
 
219
289
  /*! ZSTD_decompressDCtx() :
220
290
  * Same as ZSTD_decompress(),
221
291
  * requires an allocated ZSTD_DCtx.
222
- * Compatible with sticky parameters.
292
+ * Compatible with sticky parameters (see below).
223
293
  */
224
294
  ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx,
225
295
  void* dst, size_t dstCapacity,
226
296
  const void* src, size_t srcSize);
227
297
 
228
298
 
229
- /***************************************
230
- * Advanced compression API
231
- ***************************************/
299
+ /*********************************************
300
+ * Advanced compression API (Requires v1.4.0+)
301
+ **********************************************/
232
302
 
233
303
  /* API design :
234
304
  * Parameters are pushed one by one into an existing context,
235
305
  * using ZSTD_CCtx_set*() functions.
236
306
  * Pushed parameters are sticky : they are valid for next compressed frame, and any subsequent frame.
237
307
  * "sticky" parameters are applicable to `ZSTD_compress2()` and `ZSTD_compressStream*()` !
238
- * __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ .
308
+ * __They do not apply to one-shot variants such as ZSTD_compressCCtx()__ .
239
309
  *
240
310
  * It's possible to reset all parameters to "default" using ZSTD_CCtx_reset().
241
311
  *
242
- * This API supercedes all other "advanced" API entry points in the experimental section.
243
- * In the future, we expect to remove from experimental API entry points which are redundant with this API.
312
+ * This API supersedes all other "advanced" API entry points in the experimental section.
313
+ * In the future, we expect to remove API entry points from experimental which are redundant with this API.
244
314
  */
245
315
 
246
316
 
@@ -258,7 +328,6 @@ typedef enum { ZSTD_fast=1,
258
328
  Only the order (from fast to strong) is guaranteed */
259
329
  } ZSTD_strategy;
260
330
 
261
-
262
331
  typedef enum {
263
332
 
264
333
  /* compression parameters
@@ -325,13 +394,27 @@ typedef enum {
325
394
  * resulting in stronger and slower compression.
326
395
  * Special: value 0 means "use default strategy". */
327
396
 
397
+ ZSTD_c_targetCBlockSize=130, /* v1.5.6+
398
+ * Attempts to fit compressed block size into approximatively targetCBlockSize.
399
+ * Bound by ZSTD_TARGETCBLOCKSIZE_MIN and ZSTD_TARGETCBLOCKSIZE_MAX.
400
+ * Note that it's not a guarantee, just a convergence target (default:0).
401
+ * No target when targetCBlockSize == 0.
402
+ * This is helpful in low bandwidth streaming environments to improve end-to-end latency,
403
+ * when a client can make use of partial documents (a prominent example being Chrome).
404
+ * Note: this parameter is stable since v1.5.6.
405
+ * It was present as an experimental parameter in earlier versions,
406
+ * but it's not recommended using it with earlier library versions
407
+ * due to massive performance regressions.
408
+ */
328
409
  /* LDM mode parameters */
329
410
  ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching.
330
411
  * This parameter is designed to improve compression ratio
331
412
  * for large inputs, by finding large matches at long distance.
332
413
  * It increases memory usage and window size.
333
414
  * Note: enabling this parameter increases default ZSTD_c_windowLog to 128 MB
334
- * except when expressly set to a different value. */
415
+ * except when expressly set to a different value.
416
+ * Note: will be enabled by default if ZSTD_c_windowLog >= 128 MB and
417
+ * compression strategy >= ZSTD_btopt (== compression level 16+) */
335
418
  ZSTD_c_ldmHashLog=161, /* Size of the table for long distance matching, as a power of 2.
336
419
  * Larger values increase memory usage and compression ratio,
337
420
  * but decrease compression speed.
@@ -362,20 +445,24 @@ typedef enum {
362
445
  ZSTD_c_dictIDFlag=202, /* When applicable, dictionary's ID is written into frame header (default:1) */
363
446
 
364
447
  /* multi-threading parameters */
365
- /* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).
366
- * They return an error otherwise. */
448
+ /* These parameters are only active if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).
449
+ * Otherwise, trying to set any other value than default (0) will be a no-op and return an error.
450
+ * In a situation where it's unknown if the linked library supports multi-threading or not,
451
+ * setting ZSTD_c_nbWorkers to any value >= 1 and consulting the return value provides a quick way to check this property.
452
+ */
367
453
  ZSTD_c_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel.
368
- * When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() :
454
+ * When nbWorkers >= 1, triggers asynchronous mode when invoking ZSTD_compressStream*() :
369
455
  * ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller,
370
- * while compression work is performed in parallel, within worker threads.
456
+ * while compression is performed in parallel, within worker thread(s).
371
457
  * (note : a strong exception to this rule is when first invocation of ZSTD_compressStream2() sets ZSTD_e_end :
372
458
  * in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call).
373
459
  * More workers improve speed, but also increase memory usage.
374
- * Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
460
+ * Default value is `0`, aka "single-threaded mode" : no worker is spawned,
461
+ * compression is performed inside Caller's thread, and all invocations are blocking */
375
462
  ZSTD_c_jobSize=401, /* Size of a compression job. This value is enforced only when nbWorkers >= 1.
376
463
  * Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
377
464
  * 0 means default, which is dynamically determined based on compression parameters.
378
- * Job size must be a minimum of overlap size, or 1 MB, whichever is largest.
465
+ * Job size must be a minimum of overlap size, or ZSTDMT_JOBSIZE_MIN (= 512 KB), whichever is largest.
379
466
  * The minimum size is automatically and transparently enforced. */
380
467
  ZSTD_c_overlapLog=402, /* Control the overlap size, as a fraction of window size.
381
468
  * The overlap size is an amount of data reloaded from previous job at the beginning of a new job.
@@ -398,8 +485,17 @@ typedef enum {
398
485
  * ZSTD_c_forceMaxWindow
399
486
  * ZSTD_c_forceAttachDict
400
487
  * ZSTD_c_literalCompressionMode
401
- * ZSTD_c_targetCBlockSize
402
488
  * ZSTD_c_srcSizeHint
489
+ * ZSTD_c_enableDedicatedDictSearch
490
+ * ZSTD_c_stableInBuffer
491
+ * ZSTD_c_stableOutBuffer
492
+ * ZSTD_c_blockDelimiters
493
+ * ZSTD_c_validateSequences
494
+ * ZSTD_c_useBlockSplitter
495
+ * ZSTD_c_useRowMatchFinder
496
+ * ZSTD_c_prefetchCDictTables
497
+ * ZSTD_c_enableSeqProducerFallback
498
+ * ZSTD_c_maxBlockSize
403
499
  * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
404
500
  * note : never ever use experimentalParam? names directly;
405
501
  * also, the enums values themselves are unstable and can still change.
@@ -409,8 +505,20 @@ typedef enum {
409
505
  ZSTD_c_experimentalParam3=1000,
410
506
  ZSTD_c_experimentalParam4=1001,
411
507
  ZSTD_c_experimentalParam5=1002,
412
- ZSTD_c_experimentalParam6=1003,
413
- ZSTD_c_experimentalParam7=1004
508
+ /* was ZSTD_c_experimentalParam6=1003; is now ZSTD_c_targetCBlockSize */
509
+ ZSTD_c_experimentalParam7=1004,
510
+ ZSTD_c_experimentalParam8=1005,
511
+ ZSTD_c_experimentalParam9=1006,
512
+ ZSTD_c_experimentalParam10=1007,
513
+ ZSTD_c_experimentalParam11=1008,
514
+ ZSTD_c_experimentalParam12=1009,
515
+ ZSTD_c_experimentalParam13=1010,
516
+ ZSTD_c_experimentalParam14=1011,
517
+ ZSTD_c_experimentalParam15=1012,
518
+ ZSTD_c_experimentalParam16=1013,
519
+ ZSTD_c_experimentalParam17=1014,
520
+ ZSTD_c_experimentalParam18=1015,
521
+ ZSTD_c_experimentalParam19=1016
414
522
  } ZSTD_cParameter;
415
523
 
416
524
  typedef struct {
@@ -473,7 +581,7 @@ typedef enum {
473
581
  * They will be used to compress next frame.
474
582
  * Resetting session never fails.
475
583
  * - The parameters : changes all parameters back to "default".
476
- * This removes any reference to any dictionary too.
584
+ * This also removes any reference to any dictionary or external sequence producer.
477
585
  * Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing)
478
586
  * otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())
479
587
  * - Both : similar to resetting the session, followed by resetting parameters.
@@ -482,11 +590,13 @@ ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset);
482
590
 
483
591
  /*! ZSTD_compress2() :
484
592
  * Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API.
593
+ * (note that this entry point doesn't even expose a compression level parameter).
485
594
  * ZSTD_compress2() always starts a new frame.
486
595
  * Should cctx hold data from a previously unfinished frame, everything about it is forgotten.
487
596
  * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
488
597
  * - The function is always blocking, returns when compression is completed.
489
- * Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`.
598
+ * NOTE: Providing `dstCapacity >= ZSTD_compressBound(srcSize)` guarantees that zstd will have
599
+ * enough space to successfully compress the data, though it is possible it fails for other reasons.
490
600
  * @return : compressed size written into `dst` (<= `dstCapacity),
491
601
  * or an error code if it fails (which can be tested using ZSTD_isError()).
492
602
  */
@@ -495,9 +605,9 @@ ZSTDLIB_API size_t ZSTD_compress2( ZSTD_CCtx* cctx,
495
605
  const void* src, size_t srcSize);
496
606
 
497
607
 
498
- /***************************************
499
- * Advanced decompression API
500
- ***************************************/
608
+ /***********************************************
609
+ * Advanced decompression API (Requires v1.4.0+)
610
+ ************************************************/
501
611
 
502
612
  /* The advanced API pushes parameters one by one into an existing DCtx context.
503
613
  * Parameters are sticky, and remain valid for all following frames
@@ -521,11 +631,19 @@ typedef enum {
521
631
  * At the time of this writing, they include :
522
632
  * ZSTD_d_format
523
633
  * ZSTD_d_stableOutBuffer
634
+ * ZSTD_d_forceIgnoreChecksum
635
+ * ZSTD_d_refMultipleDDicts
636
+ * ZSTD_d_disableHuffmanAssembly
637
+ * ZSTD_d_maxBlockSize
524
638
  * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
525
639
  * note : never ever use experimentalParam? names directly
526
640
  */
527
641
  ZSTD_d_experimentalParam1=1000,
528
- ZSTD_d_experimentalParam2=1001
642
+ ZSTD_d_experimentalParam2=1001,
643
+ ZSTD_d_experimentalParam3=1002,
644
+ ZSTD_d_experimentalParam4=1003,
645
+ ZSTD_d_experimentalParam5=1004,
646
+ ZSTD_d_experimentalParam6=1005
529
647
 
530
648
  } ZSTD_dParameter;
531
649
 
@@ -580,14 +698,14 @@ typedef struct ZSTD_outBuffer_s {
580
698
  * A ZSTD_CStream object is required to track streaming operation.
581
699
  * Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources.
582
700
  * ZSTD_CStream objects can be reused multiple times on consecutive compression operations.
583
- * It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory.
701
+ * It is recommended to reuse ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory.
584
702
  *
585
703
  * For parallel execution, use one separate ZSTD_CStream per thread.
586
704
  *
587
705
  * note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing.
588
706
  *
589
707
  * Parameters are sticky : when starting a new compression on the same context,
590
- * it will re-use the same sticky parameters as previous compression session.
708
+ * it will reuse the same sticky parameters as previous compression session.
591
709
  * When in doubt, it's recommended to fully initialize the context before usage.
592
710
  * Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(),
593
711
  * ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to
@@ -639,7 +757,7 @@ typedef ZSTD_CCtx ZSTD_CStream; /**< CCtx and CStream are now effectively same
639
757
  /* Continue to distinguish them for compatibility with older versions <= v1.2.0 */
640
758
  /*===== ZSTD_CStream management functions =====*/
641
759
  ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream(void);
642
- ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream* zcs);
760
+ ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream* zcs); /* accept NULL pointer */
643
761
 
644
762
  /*===== Streaming compression functions =====*/
645
763
  typedef enum {
@@ -655,14 +773,15 @@ typedef enum {
655
773
  : note : multithreaded compression will block to flush as much output as possible. */
656
774
  } ZSTD_EndDirective;
657
775
 
658
- /*! ZSTD_compressStream2() :
776
+ /*! ZSTD_compressStream2() : Requires v1.4.0+
659
777
  * Behaves about the same as ZSTD_compressStream, with additional control on end directive.
660
778
  * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
661
779
  * - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode)
662
780
  * - output->pos must be <= dstCapacity, input->pos must be <= srcSize
663
781
  * - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit.
782
+ * - endOp must be a valid directive
664
783
  * - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller.
665
- * - When nbWorkers>=1, function is non-blocking : it just acquires a copy of input, and distributes jobs to internal worker threads, flush whatever is available,
784
+ * - When nbWorkers>=1, function is non-blocking : it copies a portion of input, distributes jobs to internal worker threads, flush to output whatever is available,
666
785
  * and then immediately returns, just indicating that there is some data remaining to be flushed.
667
786
  * The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte.
668
787
  * - Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity, the function delegates to ZSTD_compress2() which is always blocking.
@@ -675,6 +794,11 @@ typedef enum {
675
794
  * only ZSTD_e_end or ZSTD_e_flush operations are allowed.
676
795
  * Before starting a new compression job, or changing compression parameters,
677
796
  * it is required to fully flush internal buffers.
797
+ * - note: if an operation ends with an error, it may leave @cctx in an undefined state.
798
+ * Therefore, it's UB to invoke ZSTD_compressStream2() of ZSTD_compressStream() on such a state.
799
+ * In order to be re-employed after an error, a state must be reset,
800
+ * which can be done explicitly (ZSTD_CCtx_reset()),
801
+ * or is sometimes implied by methods starting a new compression job (ZSTD_initCStream(), ZSTD_compressCCtx())
678
802
  */
679
803
  ZSTDLIB_API size_t ZSTD_compressStream2( ZSTD_CCtx* cctx,
680
804
  ZSTD_outBuffer* output,
@@ -700,11 +824,9 @@ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output
700
824
 
701
825
 
702
826
  /* *****************************************************************************
703
- * This following is a legacy streaming API.
827
+ * This following is a legacy streaming API, available since v1.0+ .
704
828
  * It can be replaced by ZSTD_CCtx_reset() and ZSTD_compressStream2().
705
829
  * It is redundant, but remains fully supported.
706
- * Advanced parameters and dictionary compression can only be used through the
707
- * new API.
708
830
  ******************************************************************************/
709
831
 
710
832
  /*!
@@ -713,6 +835,9 @@ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output
713
835
  * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
714
836
  * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)
715
837
  * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);
838
+ *
839
+ * Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API
840
+ * to compress with a dictionary.
716
841
  */
717
842
  ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel);
718
843
  /*!
@@ -733,7 +858,7 @@ ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output);
733
858
  *
734
859
  * A ZSTD_DStream object is required to track streaming operations.
735
860
  * Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources.
736
- * ZSTD_DStream objects can be re-used multiple times.
861
+ * ZSTD_DStream objects can be reused multiple times.
737
862
  *
738
863
  * Use ZSTD_initDStream() to start a new decompression operation.
739
864
  * @return : recommended first input size
@@ -759,17 +884,41 @@ typedef ZSTD_DCtx ZSTD_DStream; /**< DCtx and DStream are now effectively same
759
884
  /* For compatibility with versions <= v1.2.0, prefer differentiating them. */
760
885
  /*===== ZSTD_DStream management functions =====*/
761
886
  ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream(void);
762
- ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds);
887
+ ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds); /* accept NULL pointer */
763
888
 
764
889
  /*===== Streaming decompression functions =====*/
765
890
 
766
- /* This function is redundant with the advanced API and equivalent to:
891
+ /*! ZSTD_initDStream() :
892
+ * Initialize/reset DStream state for new decompression operation.
893
+ * Call before new decompression operation using same DStream.
767
894
  *
895
+ * Note : This function is redundant with the advanced API and equivalent to:
768
896
  * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
769
897
  * ZSTD_DCtx_refDDict(zds, NULL);
770
898
  */
771
899
  ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream* zds);
772
900
 
901
+ /*! ZSTD_decompressStream() :
902
+ * Streaming decompression function.
903
+ * Call repetitively to consume full input updating it as necessary.
904
+ * Function will update both input and output `pos` fields exposing current state via these fields:
905
+ * - `input.pos < input.size`, some input remaining and caller should provide remaining input
906
+ * on the next call.
907
+ * - `output.pos < output.size`, decoder finished and flushed all remaining buffers.
908
+ * - `output.pos == output.size`, potentially uncflushed data present in the internal buffers,
909
+ * call ZSTD_decompressStream() again to flush remaining data to output.
910
+ * Note : with no additional input, amount of data flushed <= ZSTD_BLOCKSIZE_MAX.
911
+ *
912
+ * @return : 0 when a frame is completely decoded and fully flushed,
913
+ * or an error code, which can be tested using ZSTD_isError(),
914
+ * or any other value > 0, which means there is some decoding or flushing to do to complete current frame.
915
+ *
916
+ * Note: when an operation returns with an error code, the @zds state may be left in undefined state.
917
+ * It's UB to invoke `ZSTD_decompressStream()` on such a state.
918
+ * In order to re-use such a state, it must be first reset,
919
+ * which can be done explicitly (`ZSTD_DCtx_reset()`),
920
+ * or is implied for operations starting some new decompression job (`ZSTD_initDStream`, `ZSTD_decompressDCtx()`, `ZSTD_decompress_usingDict()`)
921
+ */
773
922
  ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
774
923
 
775
924
  ZSTDLIB_API size_t ZSTD_DStreamInSize(void); /*!< recommended size for input buffer */
@@ -782,7 +931,7 @@ ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output
782
931
  /*! ZSTD_compress_usingDict() :
783
932
  * Compression at an explicit compression level using a Dictionary.
784
933
  * A dictionary can be any arbitrary data segment (also called a prefix),
785
- * or a buffer with specified information (see dict/zdict.h).
934
+ * or a buffer with specified information (see zdict.h).
786
935
  * Note : This function loads the dictionary, resulting in significant startup delay.
787
936
  * It's intended for a dictionary used only once.
788
937
  * Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used. */
@@ -825,7 +974,8 @@ ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize
825
974
  int compressionLevel);
826
975
 
827
976
  /*! ZSTD_freeCDict() :
828
- * Function frees memory allocated by ZSTD_createCDict(). */
977
+ * Function frees memory allocated by ZSTD_createCDict().
978
+ * If a NULL pointer is passed, no operation is performed. */
829
979
  ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict* CDict);
830
980
 
831
981
  /*! ZSTD_compress_usingCDict() :
@@ -847,7 +997,8 @@ typedef struct ZSTD_DDict_s ZSTD_DDict;
847
997
  ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict(const void* dictBuffer, size_t dictSize);
848
998
 
849
999
  /*! ZSTD_freeDDict() :
850
- * Function frees memory allocated with ZSTD_createDDict() */
1000
+ * Function frees memory allocated with ZSTD_createDDict()
1001
+ * If a NULL pointer is passed, no operation is performed. */
851
1002
  ZSTDLIB_API size_t ZSTD_freeDDict(ZSTD_DDict* ddict);
852
1003
 
853
1004
  /*! ZSTD_decompress_usingDDict() :
@@ -863,24 +1014,30 @@ ZSTDLIB_API size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx,
863
1014
  * Dictionary helper functions
864
1015
  *******************************/
865
1016
 
866
- /*! ZSTD_getDictID_fromDict() :
1017
+ /*! ZSTD_getDictID_fromDict() : Requires v1.4.0+
867
1018
  * Provides the dictID stored within dictionary.
868
1019
  * if @return == 0, the dictionary is not conformant with Zstandard specification.
869
1020
  * It can still be loaded, but as a content-only dictionary. */
870
1021
  ZSTDLIB_API unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize);
871
1022
 
872
- /*! ZSTD_getDictID_fromDDict() :
1023
+ /*! ZSTD_getDictID_fromCDict() : Requires v1.5.0+
1024
+ * Provides the dictID of the dictionary loaded into `cdict`.
1025
+ * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
1026
+ * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
1027
+ ZSTDLIB_API unsigned ZSTD_getDictID_fromCDict(const ZSTD_CDict* cdict);
1028
+
1029
+ /*! ZSTD_getDictID_fromDDict() : Requires v1.4.0+
873
1030
  * Provides the dictID of the dictionary loaded into `ddict`.
874
1031
  * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
875
1032
  * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
876
1033
  ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict);
877
1034
 
878
- /*! ZSTD_getDictID_fromFrame() :
1035
+ /*! ZSTD_getDictID_fromFrame() : Requires v1.4.0+
879
1036
  * Provides the dictID required to decompressed the frame stored within `src`.
880
1037
  * If @return == 0, the dictID could not be decoded.
881
1038
  * This could for one of the following reasons :
882
1039
  * - The frame does not require a dictionary to be decoded (most common case).
883
- * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information.
1040
+ * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden piece of information.
884
1041
  * Note : this use case also happens when using a non-conformant dictionary.
885
1042
  * - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).
886
1043
  * - This is not a Zstandard frame.
@@ -889,23 +1046,26 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize);
889
1046
 
890
1047
 
891
1048
  /*******************************************************************************
892
- * Advanced dictionary and prefix API
1049
+ * Advanced dictionary and prefix API (Requires v1.4.0+)
893
1050
  *
894
1051
  * This API allows dictionaries to be used with ZSTD_compress2(),
895
- * ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and
896
- * only reset with the context is reset with ZSTD_reset_parameters or
897
- * ZSTD_reset_session_and_parameters. Prefixes are single-use.
1052
+ * ZSTD_compressStream2(), and ZSTD_decompressDCtx().
1053
+ * Dictionaries are sticky, they remain valid when same context is reused,
1054
+ * they only reset when the context is reset
1055
+ * with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters.
1056
+ * In contrast, Prefixes are single-use.
898
1057
  ******************************************************************************/
899
1058
 
900
1059
 
901
- /*! ZSTD_CCtx_loadDictionary() :
1060
+ /*! ZSTD_CCtx_loadDictionary() : Requires v1.4.0+
902
1061
  * Create an internal CDict from `dict` buffer.
903
1062
  * Decompression will have to use same dictionary.
904
1063
  * @result : 0, or an error code (which can be tested with ZSTD_isError()).
905
1064
  * Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,
906
1065
  * meaning "return to no-dictionary mode".
907
- * Note 1 : Dictionary is sticky, it will be used for all future compressed frames.
908
- * To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters).
1066
+ * Note 1 : Dictionary is sticky, it will be used for all future compressed frames,
1067
+ * until parameters are reset, a new dictionary is loaded, or the dictionary
1068
+ * is explicitly invalidated by loading a NULL dictionary.
909
1069
  * Note 2 : Loading a dictionary involves building tables.
910
1070
  * It's also a CPU consuming operation, with non-negligible impact on latency.
911
1071
  * Tables are dependent on compression parameters, and for this reason,
@@ -914,14 +1074,18 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize);
914
1074
  * Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead.
915
1075
  * In such a case, dictionary buffer must outlive its users.
916
1076
  * Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()
917
- * to precisely select how dictionary content must be interpreted. */
1077
+ * to precisely select how dictionary content must be interpreted.
1078
+ * Note 5 : This method does not benefit from LDM (long distance mode).
1079
+ * If you want to employ LDM on some large dictionary content,
1080
+ * prefer employing ZSTD_CCtx_refPrefix() described below.
1081
+ */
918
1082
  ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
919
1083
 
920
- /*! ZSTD_CCtx_refCDict() :
921
- * Reference a prepared dictionary, to be used for all next compressed frames.
1084
+ /*! ZSTD_CCtx_refCDict() : Requires v1.4.0+
1085
+ * Reference a prepared dictionary, to be used for all future compressed frames.
922
1086
  * Note that compression parameters are enforced from within CDict,
923
1087
  * and supersede any compression parameter previously set within CCtx.
924
- * The parameters ignored are labled as "superseded-by-cdict" in the ZSTD_cParameter enum docs.
1088
+ * The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs.
925
1089
  * The ignored parameters will be used again if the CCtx is returned to no-dictionary mode.
926
1090
  * The dictionary will remain valid for future compressed frames using same CCtx.
927
1091
  * @result : 0, or an error code (which can be tested with ZSTD_isError()).
@@ -931,12 +1095,13 @@ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, s
931
1095
  * Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx. */
932
1096
  ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
933
1097
 
934
- /*! ZSTD_CCtx_refPrefix() :
1098
+ /*! ZSTD_CCtx_refPrefix() : Requires v1.4.0+
935
1099
  * Reference a prefix (single-usage dictionary) for next compressed frame.
936
1100
  * A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end).
937
1101
  * Decompression will need same prefix to properly regenerate data.
938
1102
  * Compressing with a prefix is similar in outcome as performing a diff and compressing it,
939
1103
  * but performs much faster, especially during decompression (compression speed is tunable with compression level).
1104
+ * This method is compatible with LDM (long distance mode).
940
1105
  * @result : 0, or an error code (which can be tested with ZSTD_isError()).
941
1106
  * Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary
942
1107
  * Note 1 : Prefix buffer is referenced. It **must** outlive compression.
@@ -952,10 +1117,10 @@ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
952
1117
  ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx,
953
1118
  const void* prefix, size_t prefixSize);
954
1119
 
955
- /*! ZSTD_DCtx_loadDictionary() :
956
- * Create an internal DDict from dict buffer,
957
- * to be used to decompress next frames.
958
- * The dictionary remains valid for all future frames, until explicitly invalidated.
1120
+ /*! ZSTD_DCtx_loadDictionary() : Requires v1.4.0+
1121
+ * Create an internal DDict from dict buffer, to be used to decompress all future frames.
1122
+ * The dictionary remains valid for all future frames, until explicitly invalidated, or
1123
+ * a new dictionary is loaded.
959
1124
  * @result : 0, or an error code (which can be tested with ZSTD_isError()).
960
1125
  * Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,
961
1126
  * meaning "return to no-dictionary mode".
@@ -969,18 +1134,26 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx,
969
1134
  */
970
1135
  ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
971
1136
 
972
- /*! ZSTD_DCtx_refDDict() :
1137
+ /*! ZSTD_DCtx_refDDict() : Requires v1.4.0+
973
1138
  * Reference a prepared dictionary, to be used to decompress next frames.
974
1139
  * The dictionary remains active for decompression of future frames using same DCtx.
1140
+ *
1141
+ * If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function
1142
+ * will store the DDict references in a table, and the DDict used for decompression
1143
+ * will be determined at decompression time, as per the dict ID in the frame.
1144
+ * The memory for the table is allocated on the first call to refDDict, and can be
1145
+ * freed with ZSTD_freeDCtx().
1146
+ *
1147
+ * If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary
1148
+ * will be managed, and referencing a dictionary effectively "discards" any previous one.
1149
+ *
975
1150
  * @result : 0, or an error code (which can be tested with ZSTD_isError()).
976
- * Note 1 : Currently, only one dictionary can be managed.
977
- * Referencing a new dictionary effectively "discards" any previous one.
978
1151
  * Special: referencing a NULL DDict means "return to no-dictionary mode".
979
1152
  * Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx.
980
1153
  */
981
1154
  ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
982
1155
 
983
- /*! ZSTD_DCtx_refPrefix() :
1156
+ /*! ZSTD_DCtx_refPrefix() : Requires v1.4.0+
984
1157
  * Reference a prefix (single-usage dictionary) to decompress next frame.
985
1158
  * This is the reverse operation of ZSTD_CCtx_refPrefix(),
986
1159
  * and must use the same prefix as the one used during compression.
@@ -1001,7 +1174,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx,
1001
1174
 
1002
1175
  /* === Memory management === */
1003
1176
 
1004
- /*! ZSTD_sizeof_*() :
1177
+ /*! ZSTD_sizeof_*() : Requires v1.4.0+
1005
1178
  * These functions give the _current_ memory usage of selected object.
1006
1179
  * Note that object memory usage can evolve (increase or decrease) over time. */
1007
1180
  ZSTDLIB_API size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx);
@@ -1011,5 +1184,1910 @@ ZSTDLIB_API size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds);
1011
1184
  ZSTDLIB_API size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict);
1012
1185
  ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
1013
1186
 
1014
- }
1187
+ } // namespace duckdb_zstd
1188
+
1015
1189
  #endif /* ZSTD_H_235446 */
1190
+
1191
+ namespace duckdb_zstd {
1192
+
1193
+ /* **************************************************************************************
1194
+ * ADVANCED AND EXPERIMENTAL FUNCTIONS
1195
+ ****************************************************************************************
1196
+ * The definitions in the following section are considered experimental.
1197
+ * They are provided for advanced scenarios.
1198
+ * They should never be used with a dynamic library, as prototypes may change in the future.
1199
+ * Use them only in association with static linking.
1200
+ * ***************************************************************************************/
1201
+
1202
+ #if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY)
1203
+ #define ZSTD_H_ZSTD_STATIC_LINKING_ONLY
1204
+
1205
+ /* This can be overridden externally to hide static symbols. */
1206
+ #ifndef ZSTDLIB_STATIC_API
1207
+ # if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
1208
+ # define ZSTDLIB_STATIC_API __declspec(dllexport) ZSTDLIB_VISIBLE
1209
+ # elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
1210
+ # define ZSTDLIB_STATIC_API __declspec(dllimport) ZSTDLIB_VISIBLE
1211
+ # else
1212
+ # define ZSTDLIB_STATIC_API ZSTDLIB_VISIBLE
1213
+ # endif
1214
+ #endif
1215
+
1216
+ /****************************************************************************************
1217
+ * experimental API (static linking only)
1218
+ ****************************************************************************************
1219
+ * The following symbols and constants
1220
+ * are not planned to join "stable API" status in the near future.
1221
+ * They can still change in future versions.
1222
+ * Some of them are planned to remain in the static_only section indefinitely.
1223
+ * Some of them might be removed in the future (especially when redundant with existing stable functions)
1224
+ * ***************************************************************************************/
1225
+
1226
+ #define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1) /* minimum input size required to query frame header size */
1227
+ #define ZSTD_FRAMEHEADERSIZE_MIN(format) ((format) == ZSTD_f_zstd1 ? 6 : 2)
1228
+ #define ZSTD_FRAMEHEADERSIZE_MAX 18 /* can be useful for static allocation */
1229
+ #define ZSTD_SKIPPABLEHEADERSIZE 8
1230
+
1231
+ /* compression parameter bounds */
1232
+ #define ZSTD_WINDOWLOG_MAX_32 30
1233
+ #define ZSTD_WINDOWLOG_MAX_64 31
1234
+ #define ZSTD_WINDOWLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
1235
+ #define ZSTD_WINDOWLOG_MIN 10
1236
+ #define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30)
1237
+ #define ZSTD_HASHLOG_MIN 6
1238
+ #define ZSTD_CHAINLOG_MAX_32 29
1239
+ #define ZSTD_CHAINLOG_MAX_64 30
1240
+ #define ZSTD_CHAINLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64))
1241
+ #define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN
1242
+ #define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1)
1243
+ #define ZSTD_SEARCHLOG_MIN 1
1244
+ #define ZSTD_MINMATCH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */
1245
+ #define ZSTD_MINMATCH_MIN 3 /* only for ZSTD_btopt+, faster strategies are limited to 4 */
1246
+ #define ZSTD_TARGETLENGTH_MAX ZSTD_BLOCKSIZE_MAX
1247
+ #define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */
1248
+ #define ZSTD_STRATEGY_MIN ZSTD_fast
1249
+ #define ZSTD_STRATEGY_MAX ZSTD_btultra2
1250
+ #define ZSTD_BLOCKSIZE_MAX_MIN (1 << 10) /* The minimum valid max blocksize. Maximum blocksizes smaller than this make compressBound() inaccurate. */
1251
+
1252
+
1253
+ #define ZSTD_OVERLAPLOG_MIN 0
1254
+ #define ZSTD_OVERLAPLOG_MAX 9
1255
+
1256
+ #define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27 /* by default, the streaming decoder will refuse any frame */
1257
+ /* requiring larger than (1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT) window size, */
1258
+ /* to preserve host's memory from unreasonable requirements. */
1259
+ /* This limit can be overridden using ZSTD_DCtx_setParameter(,ZSTD_d_windowLogMax,). */
1260
+ /* The limit does not apply for one-pass decoders (such as ZSTD_decompress()), since no additional memory is allocated */
1261
+
1262
+
1263
+ /* LDM parameter bounds */
1264
+ #define ZSTD_LDM_HASHLOG_MIN ZSTD_HASHLOG_MIN
1265
+ #define ZSTD_LDM_HASHLOG_MAX ZSTD_HASHLOG_MAX
1266
+ #define ZSTD_LDM_MINMATCH_MIN 4
1267
+ #define ZSTD_LDM_MINMATCH_MAX 4096
1268
+ #define ZSTD_LDM_BUCKETSIZELOG_MIN 1
1269
+ #define ZSTD_LDM_BUCKETSIZELOG_MAX 8
1270
+ #define ZSTD_LDM_HASHRATELOG_MIN 0
1271
+ #define ZSTD_LDM_HASHRATELOG_MAX (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)
1272
+
1273
+ /* Advanced parameter bounds */
1274
+ #define ZSTD_TARGETCBLOCKSIZE_MIN 1340 /* suitable to fit into an ethernet / wifi / 4G transport frame */
1275
+ #define ZSTD_TARGETCBLOCKSIZE_MAX ZSTD_BLOCKSIZE_MAX
1276
+ #define ZSTD_SRCSIZEHINT_MIN 0
1277
+ #define ZSTD_SRCSIZEHINT_MAX INT_MAX
1278
+
1279
+
1280
+ /* --- Advanced types --- */
1281
+
1282
+ typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params;
1283
+
1284
+ typedef struct {
1285
+ unsigned int offset; /* The offset of the match. (NOT the same as the offset code)
1286
+ * If offset == 0 and matchLength == 0, this sequence represents the last
1287
+ * literals in the block of litLength size.
1288
+ */
1289
+
1290
+ unsigned int litLength; /* Literal length of the sequence. */
1291
+ unsigned int matchLength; /* Match length of the sequence. */
1292
+
1293
+ /* Note: Users of this API may provide a sequence with matchLength == litLength == offset == 0.
1294
+ * In this case, we will treat the sequence as a marker for a block boundary.
1295
+ */
1296
+
1297
+ unsigned int rep; /* Represents which repeat offset is represented by the field 'offset'.
1298
+ * Ranges from [0, 3].
1299
+ *
1300
+ * Repeat offsets are essentially previous offsets from previous sequences sorted in
1301
+ * recency order. For more detail, see doc/zstd_compression_format.md
1302
+ *
1303
+ * If rep == 0, then 'offset' does not contain a repeat offset.
1304
+ * If rep > 0:
1305
+ * If litLength != 0:
1306
+ * rep == 1 --> offset == repeat_offset_1
1307
+ * rep == 2 --> offset == repeat_offset_2
1308
+ * rep == 3 --> offset == repeat_offset_3
1309
+ * If litLength == 0:
1310
+ * rep == 1 --> offset == repeat_offset_2
1311
+ * rep == 2 --> offset == repeat_offset_3
1312
+ * rep == 3 --> offset == repeat_offset_1 - 1
1313
+ *
1314
+ * Note: This field is optional. ZSTD_generateSequences() will calculate the value of
1315
+ * 'rep', but repeat offsets do not necessarily need to be calculated from an external
1316
+ * sequence provider's perspective. For example, ZSTD_compressSequences() does not
1317
+ * use this 'rep' field at all (as of now).
1318
+ */
1319
+ } ZSTD_Sequence;
1320
+
1321
+ typedef struct {
1322
+ unsigned windowLog; /**< largest match distance : larger == more compression, more memory needed during decompression */
1323
+ unsigned chainLog; /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */
1324
+ unsigned hashLog; /**< dispatch table : larger == faster, more memory */
1325
+ unsigned searchLog; /**< nb of searches : larger == more compression, slower */
1326
+ unsigned minMatch; /**< match length searched : larger == faster decompression, sometimes less compression */
1327
+ unsigned targetLength; /**< acceptable match size for optimal parser (only) : larger == more compression, slower */
1328
+ ZSTD_strategy strategy; /**< see ZSTD_strategy definition above */
1329
+ } ZSTD_compressionParameters;
1330
+
1331
+ typedef struct {
1332
+ int contentSizeFlag; /**< 1: content size will be in frame header (when known) */
1333
+ int checksumFlag; /**< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for error detection */
1334
+ int noDictIDFlag; /**< 1: no dictID will be saved into frame header (dictID is only useful for dictionary compression) */
1335
+ } ZSTD_frameParameters;
1336
+
1337
+ typedef struct {
1338
+ ZSTD_compressionParameters cParams;
1339
+ ZSTD_frameParameters fParams;
1340
+ } ZSTD_parameters;
1341
+
1342
+ typedef enum {
1343
+ ZSTD_dct_auto = 0, /* dictionary is "full" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */
1344
+ ZSTD_dct_rawContent = 1, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */
1345
+ ZSTD_dct_fullDict = 2 /* refuses to load a dictionary if it does not respect Zstandard's specification, starting with ZSTD_MAGIC_DICTIONARY */
1346
+ } ZSTD_dictContentType_e;
1347
+
1348
+ typedef enum {
1349
+ ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */
1350
+ ZSTD_dlm_byRef = 1 /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
1351
+ } ZSTD_dictLoadMethod_e;
1352
+
1353
+ typedef enum {
1354
+ ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */
1355
+ ZSTD_f_zstd1_magicless = 1 /* Variant of zstd frame format, without initial 4-bytes magic number.
1356
+ * Useful to save 4 bytes per generated frame.
1357
+ * Decoder cannot recognise automatically this format, requiring this instruction. */
1358
+ } ZSTD_format_e;
1359
+
1360
+ typedef enum {
1361
+ /* Note: this enum controls ZSTD_d_forceIgnoreChecksum */
1362
+ ZSTD_d_validateChecksum = 0,
1363
+ ZSTD_d_ignoreChecksum = 1
1364
+ } ZSTD_forceIgnoreChecksum_e;
1365
+
1366
+ typedef enum {
1367
+ /* Note: this enum controls ZSTD_d_refMultipleDDicts */
1368
+ ZSTD_rmd_refSingleDDict = 0,
1369
+ ZSTD_rmd_refMultipleDDicts = 1
1370
+ } ZSTD_refMultipleDDicts_e;
1371
+
1372
+ typedef enum {
1373
+ /* Note: this enum and the behavior it controls are effectively internal
1374
+ * implementation details of the compressor. They are expected to continue
1375
+ * to evolve and should be considered only in the context of extremely
1376
+ * advanced performance tuning.
1377
+ *
1378
+ * Zstd currently supports the use of a CDict in three ways:
1379
+ *
1380
+ * - The contents of the CDict can be copied into the working context. This
1381
+ * means that the compression can search both the dictionary and input
1382
+ * while operating on a single set of internal tables. This makes
1383
+ * the compression faster per-byte of input. However, the initial copy of
1384
+ * the CDict's tables incurs a fixed cost at the beginning of the
1385
+ * compression. For small compressions (< 8 KB), that copy can dominate
1386
+ * the cost of the compression.
1387
+ *
1388
+ * - The CDict's tables can be used in-place. In this model, compression is
1389
+ * slower per input byte, because the compressor has to search two sets of
1390
+ * tables. However, this model incurs no start-up cost (as long as the
1391
+ * working context's tables can be reused). For small inputs, this can be
1392
+ * faster than copying the CDict's tables.
1393
+ *
1394
+ * - The CDict's tables are not used at all, and instead we use the working
1395
+ * context alone to reload the dictionary and use params based on the source
1396
+ * size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict().
1397
+ * This method is effective when the dictionary sizes are very small relative
1398
+ * to the input size, and the input size is fairly large to begin with.
1399
+ *
1400
+ * Zstd has a simple internal heuristic that selects which strategy to use
1401
+ * at the beginning of a compression. However, if experimentation shows that
1402
+ * Zstd is making poor choices, it is possible to override that choice with
1403
+ * this enum.
1404
+ */
1405
+ ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
1406
+ ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */
1407
+ ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */
1408
+ ZSTD_dictForceLoad = 3 /* Always reload the dictionary */
1409
+ } ZSTD_dictAttachPref_e;
1410
+
1411
+ typedef enum {
1412
+ ZSTD_lcm_auto = 0, /**< Automatically determine the compression mode based on the compression level.
1413
+ * Negative compression levels will be uncompressed, and positive compression
1414
+ * levels will be compressed. */
1415
+ ZSTD_lcm_huffman = 1, /**< Always attempt Huffman compression. Uncompressed literals will still be
1416
+ * emitted if Huffman compression is not profitable. */
1417
+ ZSTD_lcm_uncompressed = 2 /**< Always emit uncompressed literals. */
1418
+ } ZSTD_literalCompressionMode_e;
1419
+
1420
+ typedef enum {
1421
+ /* Note: This enum controls features which are conditionally beneficial. Zstd typically will make a final
1422
+ * decision on whether or not to enable the feature (ZSTD_ps_auto), but setting the switch to ZSTD_ps_enable
1423
+ * or ZSTD_ps_disable allow for a force enable/disable the feature.
1424
+ */
1425
+ ZSTD_ps_auto = 0, /* Let the library automatically determine whether the feature shall be enabled */
1426
+ ZSTD_ps_enable = 1, /* Force-enable the feature */
1427
+ ZSTD_ps_disable = 2 /* Do not use the feature */
1428
+ } ZSTD_paramSwitch_e;
1429
+
1430
+ /***************************************
1431
+ * Frame header and size functions
1432
+ ***************************************/
1433
+
1434
+ /*! ZSTD_findDecompressedSize() :
1435
+ * `src` should point to the start of a series of ZSTD encoded and/or skippable frames
1436
+ * `srcSize` must be the _exact_ size of this series
1437
+ * (i.e. there should be a frame boundary at `src + srcSize`)
1438
+ * @return : - decompressed size of all data in all successive frames
1439
+ * - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN
1440
+ * - if an error occurred: ZSTD_CONTENTSIZE_ERROR
1441
+ *
1442
+ * note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode.
1443
+ * When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size.
1444
+ * In which case, it's necessary to use streaming mode to decompress data.
1445
+ * note 2 : decompressed size is always present when compression is done with ZSTD_compress()
1446
+ * note 3 : decompressed size can be very large (64-bits value),
1447
+ * potentially larger than what local system can handle as a single memory segment.
1448
+ * In which case, it's necessary to use streaming mode to decompress data.
1449
+ * note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified.
1450
+ * Always ensure result fits within application's authorized limits.
1451
+ * Each application can set its own limits.
1452
+ * note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to
1453
+ * read each contained frame header. This is fast as most of the data is skipped,
1454
+ * however it does mean that all frame data must be present and valid. */
1455
+ ZSTDLIB_STATIC_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
1456
+
1457
+ /*! ZSTD_decompressBound() :
1458
+ * `src` should point to the start of a series of ZSTD encoded and/or skippable frames
1459
+ * `srcSize` must be the _exact_ size of this series
1460
+ * (i.e. there should be a frame boundary at `src + srcSize`)
1461
+ * @return : - upper-bound for the decompressed size of all data in all successive frames
1462
+ * - if an error occurred: ZSTD_CONTENTSIZE_ERROR
1463
+ *
1464
+ * note 1 : an error can occur if `src` contains an invalid or incorrectly formatted frame.
1465
+ * note 2 : the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of `src`.
1466
+ * in this case, `ZSTD_findDecompressedSize` and `ZSTD_decompressBound` return the same value.
1467
+ * note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by:
1468
+ * upper-bound = # blocks * min(128 KB, Window_Size)
1469
+ */
1470
+ ZSTDLIB_STATIC_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize);
1471
+
1472
+ /*! ZSTD_frameHeaderSize() :
1473
+ * srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX.
1474
+ * @return : size of the Frame Header,
1475
+ * or an error code (if srcSize is too small) */
1476
+ ZSTDLIB_STATIC_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
1477
+
1478
+ typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
1479
+ typedef struct {
1480
+ unsigned long long frameContentSize; /* if == ZSTD_CONTENTSIZE_UNKNOWN, it means this field is not available. 0 means "empty" */
1481
+ unsigned long long windowSize; /* can be very large, up to <= frameContentSize */
1482
+ unsigned blockSizeMax;
1483
+ ZSTD_frameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */
1484
+ unsigned headerSize;
1485
+ unsigned dictID;
1486
+ unsigned checksumFlag;
1487
+ unsigned _reserved1;
1488
+ unsigned _reserved2;
1489
+ } ZSTD_frameHeader;
1490
+
1491
+ /*! ZSTD_getFrameHeader() :
1492
+ * decode Frame Header, or requires larger `srcSize`.
1493
+ * @return : 0, `zfhPtr` is correctly filled,
1494
+ * >0, `srcSize` is too small, value is wanted `srcSize` amount,
1495
+ * or an error code, which can be tested using ZSTD_isError() */
1496
+ ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */
1497
+ /*! ZSTD_getFrameHeader_advanced() :
1498
+ * same as ZSTD_getFrameHeader(),
1499
+ * with added capability to select a format (like ZSTD_f_zstd1_magicless) */
1500
+ ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format);
1501
+
1502
+ /*! ZSTD_decompressionMargin() :
1503
+ * Zstd supports in-place decompression, where the input and output buffers overlap.
1504
+ * In this case, the output buffer must be at least (Margin + Output_Size) bytes large,
1505
+ * and the input buffer must be at the end of the output buffer.
1506
+ *
1507
+ * _______________________ Output Buffer ________________________
1508
+ * | |
1509
+ * | ____ Input Buffer ____|
1510
+ * | | |
1511
+ * v v v
1512
+ * |---------------------------------------|-----------|----------|
1513
+ * ^ ^ ^
1514
+ * |___________________ Output_Size ___________________|_ Margin _|
1515
+ *
1516
+ * NOTE: See also ZSTD_DECOMPRESSION_MARGIN().
1517
+ * NOTE: This applies only to single-pass decompression through ZSTD_decompress() or
1518
+ * ZSTD_decompressDCtx().
1519
+ * NOTE: This function supports multi-frame input.
1520
+ *
1521
+ * @param src The compressed frame(s)
1522
+ * @param srcSize The size of the compressed frame(s)
1523
+ * @returns The decompression margin or an error that can be checked with ZSTD_isError().
1524
+ */
1525
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressionMargin(const void* src, size_t srcSize);
1526
+
1527
+ /*! ZSTD_DECOMPRESS_MARGIN() :
1528
+ * Similar to ZSTD_decompressionMargin(), but instead of computing the margin from
1529
+ * the compressed frame, compute it from the original size and the blockSizeLog.
1530
+ * See ZSTD_decompressionMargin() for details.
1531
+ *
1532
+ * WARNING: This macro does not support multi-frame input, the input must be a single
1533
+ * zstd frame. If you need that support use the function, or implement it yourself.
1534
+ *
1535
+ * @param originalSize The original uncompressed size of the data.
1536
+ * @param blockSize The block size == MIN(windowSize, ZSTD_BLOCKSIZE_MAX).
1537
+ * Unless you explicitly set the windowLog smaller than
1538
+ * ZSTD_BLOCKSIZELOG_MAX you can just use ZSTD_BLOCKSIZE_MAX.
1539
+ */
1540
+ #define ZSTD_DECOMPRESSION_MARGIN(originalSize, blockSize) ((size_t)( \
1541
+ ZSTD_FRAMEHEADERSIZE_MAX /* Frame header */ + \
1542
+ 4 /* checksum */ + \
1543
+ ((originalSize) == 0 ? 0 : 3 * (((originalSize) + (blockSize) - 1) / blockSize)) /* 3 bytes per block */ + \
1544
+ (blockSize) /* One block of margin */ \
1545
+ ))
1546
+
1547
+ typedef enum {
1548
+ ZSTD_sf_noBlockDelimiters = 0, /* Representation of ZSTD_Sequence has no block delimiters, sequences only */
1549
+ ZSTD_sf_explicitBlockDelimiters = 1 /* Representation of ZSTD_Sequence contains explicit block delimiters */
1550
+ } ZSTD_sequenceFormat_e;
1551
+
1552
+ /*! ZSTD_sequenceBound() :
1553
+ * `srcSize` : size of the input buffer
1554
+ * @return : upper-bound for the number of sequences that can be generated
1555
+ * from a buffer of srcSize bytes
1556
+ *
1557
+ * note : returns number of sequences - to get bytes, multiply by sizeof(ZSTD_Sequence).
1558
+ */
1559
+ ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize);
1560
+
1561
+ /*! ZSTD_generateSequences() :
1562
+ * WARNING: This function is meant for debugging and informational purposes ONLY!
1563
+ * Its implementation is flawed, and it will be deleted in a future version.
1564
+ * It is not guaranteed to succeed, as there are several cases where it will give
1565
+ * up and fail. You should NOT use this function in production code.
1566
+ *
1567
+ * This function is deprecated, and will be removed in a future version.
1568
+ *
1569
+ * Generate sequences using ZSTD_compress2(), given a source buffer.
1570
+ *
1571
+ * @param zc The compression context to be used for ZSTD_compress2(). Set any
1572
+ * compression parameters you need on this context.
1573
+ * @param outSeqs The output sequences buffer of size @p outSeqsSize
1574
+ * @param outSeqsSize The size of the output sequences buffer.
1575
+ * ZSTD_sequenceBound(srcSize) is an upper bound on the number
1576
+ * of sequences that can be generated.
1577
+ * @param src The source buffer to generate sequences from of size @p srcSize.
1578
+ * @param srcSize The size of the source buffer.
1579
+ *
1580
+ * Each block will end with a dummy sequence
1581
+ * with offset == 0, matchLength == 0, and litLength == length of last literals.
1582
+ * litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0)
1583
+ * simply acts as a block delimiter.
1584
+ *
1585
+ * @returns The number of sequences generated, necessarily less than
1586
+ * ZSTD_sequenceBound(srcSize), or an error code that can be checked
1587
+ * with ZSTD_isError().
1588
+ */
1589
+ ZSTD_DEPRECATED("For debugging only, will be replaced by ZSTD_extractSequences()")
1590
+ ZSTDLIB_STATIC_API size_t
1591
+ ZSTD_generateSequences(ZSTD_CCtx* zc,
1592
+ ZSTD_Sequence* outSeqs, size_t outSeqsSize,
1593
+ const void* src, size_t srcSize);
1594
+
1595
+ /*! ZSTD_mergeBlockDelimiters() :
1596
+ * Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals
1597
+ * by merging them into the literals of the next sequence.
1598
+ *
1599
+ * As such, the final generated result has no explicit representation of block boundaries,
1600
+ * and the final last literals segment is not represented in the sequences.
1601
+ *
1602
+ * The output of this function can be fed into ZSTD_compressSequences() with CCtx
1603
+ * setting of ZSTD_c_blockDelimiters as ZSTD_sf_noBlockDelimiters
1604
+ * @return : number of sequences left after merging
1605
+ */
1606
+ ZSTDLIB_STATIC_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize);
1607
+
1608
+ /*! ZSTD_compressSequences() :
1609
+ * Compress an array of ZSTD_Sequence, associated with @src buffer, into dst.
1610
+ * @src contains the entire input (not just the literals).
1611
+ * If @srcSize > sum(sequence.length), the remaining bytes are considered all literals
1612
+ * If a dictionary is included, then the cctx should reference the dict. (see: ZSTD_CCtx_refCDict(), ZSTD_CCtx_loadDictionary(), etc.)
1613
+ * The entire source is compressed into a single frame.
1614
+ *
1615
+ * The compression behavior changes based on cctx params. In particular:
1616
+ * If ZSTD_c_blockDelimiters == ZSTD_sf_noBlockDelimiters, the array of ZSTD_Sequence is expected to contain
1617
+ * no block delimiters (defined in ZSTD_Sequence). Block boundaries are roughly determined based on
1618
+ * the block size derived from the cctx, and sequences may be split. This is the default setting.
1619
+ *
1620
+ * If ZSTD_c_blockDelimiters == ZSTD_sf_explicitBlockDelimiters, the array of ZSTD_Sequence is expected to contain
1621
+ * block delimiters (defined in ZSTD_Sequence). Behavior is undefined if no block delimiters are provided.
1622
+ *
1623
+ * If ZSTD_c_validateSequences == 0, this function will blindly accept the sequences provided. Invalid sequences cause undefined
1624
+ * behavior. If ZSTD_c_validateSequences == 1, then if sequence is invalid (see doc/zstd_compression_format.md for
1625
+ * specifics regarding offset/matchlength requirements) then the function will bail out and return an error.
1626
+ *
1627
+ * In addition to the two adjustable experimental params, there are other important cctx params.
1628
+ * - ZSTD_c_minMatch MUST be set as less than or equal to the smallest match generated by the match finder. It has a minimum value of ZSTD_MINMATCH_MIN.
1629
+ * - ZSTD_c_compressionLevel accordingly adjusts the strength of the entropy coder, as it would in typical compression.
1630
+ * - ZSTD_c_windowLog affects offset validation: this function will return an error at higher debug levels if a provided offset
1631
+ * is larger than what the spec allows for a given window log and dictionary (if present). See: doc/zstd_compression_format.md
1632
+ *
1633
+ * Note: Repcodes are, as of now, always re-calculated within this function, so ZSTD_Sequence::rep is unused.
1634
+ * Note 2: Once we integrate ability to ingest repcodes, the explicit block delims mode must respect those repcodes exactly,
1635
+ * and cannot emit an RLE block that disagrees with the repcode history
1636
+ * @return : final compressed size, or a ZSTD error code.
1637
+ */
1638
+ ZSTDLIB_STATIC_API size_t
1639
+ ZSTD_compressSequences( ZSTD_CCtx* cctx, void* dst, size_t dstSize,
1640
+ const ZSTD_Sequence* inSeqs, size_t inSeqsSize,
1641
+ const void* src, size_t srcSize);
1642
+
1643
+
1644
+ /*! ZSTD_writeSkippableFrame() :
1645
+ * Generates a zstd skippable frame containing data given by src, and writes it to dst buffer.
1646
+ *
1647
+ * Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number,
1648
+ * ranging from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15.
1649
+ * As such, the parameter magicVariant controls the exact skippable frame magic number variant used, so
1650
+ * the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant.
1651
+ *
1652
+ * Returns an error if destination buffer is not large enough, if the source size is not representable
1653
+ * with a 4-byte unsigned int, or if the parameter magicVariant is greater than 15 (and therefore invalid).
1654
+ *
1655
+ * @return : number of bytes written or a ZSTD error.
1656
+ */
1657
+ ZSTDLIB_STATIC_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
1658
+ const void* src, size_t srcSize, unsigned magicVariant);
1659
+
1660
+ /*! ZSTD_readSkippableFrame() :
1661
+ * Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer.
1662
+ *
1663
+ * The parameter magicVariant will receive the magicVariant that was supplied when the frame was written,
1664
+ * i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested
1665
+ * in the magicVariant.
1666
+ *
1667
+ * Returns an error if destination buffer is not large enough, or if the frame is not skippable.
1668
+ *
1669
+ * @return : number of bytes written or a ZSTD error.
1670
+ */
1671
+ ZSTDLIB_API size_t ZSTD_readSkippableFrame(void* dst, size_t dstCapacity, unsigned* magicVariant,
1672
+ const void* src, size_t srcSize);
1673
+
1674
+ /*! ZSTD_isSkippableFrame() :
1675
+ * Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame.
1676
+ */
1677
+ ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);
1678
+
1679
+
1680
+
1681
+ /***************************************
1682
+ * Memory management
1683
+ ***************************************/
1684
+
1685
+ /*! ZSTD_estimate*() :
1686
+ * These functions make it possible to estimate memory usage
1687
+ * of a future {D,C}Ctx, before its creation.
1688
+ * This is useful in combination with ZSTD_initStatic(),
1689
+ * which makes it possible to employ a static buffer for ZSTD_CCtx* state.
1690
+ *
1691
+ * ZSTD_estimateCCtxSize() will provide a memory budget large enough
1692
+ * to compress data of any size using one-shot compression ZSTD_compressCCtx() or ZSTD_compress2()
1693
+ * associated with any compression level up to max specified one.
1694
+ * The estimate will assume the input may be arbitrarily large,
1695
+ * which is the worst case.
1696
+ *
1697
+ * Note that the size estimation is specific for one-shot compression,
1698
+ * it is not valid for streaming (see ZSTD_estimateCStreamSize*())
1699
+ * nor other potential ways of using a ZSTD_CCtx* state.
1700
+ *
1701
+ * When srcSize can be bound by a known and rather "small" value,
1702
+ * this knowledge can be used to provide a tighter budget estimation
1703
+ * because the ZSTD_CCtx* state will need less memory for small inputs.
1704
+ * This tighter estimation can be provided by employing more advanced functions
1705
+ * ZSTD_estimateCCtxSize_usingCParams(), which can be used in tandem with ZSTD_getCParams(),
1706
+ * and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter().
1707
+ * Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits.
1708
+ *
1709
+ * Note : only single-threaded compression is supported.
1710
+ * ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
1711
+ */
1712
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int maxCompressionLevel);
1713
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
1714
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
1715
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateDCtxSize(void);
1716
+
1717
+ /*! ZSTD_estimateCStreamSize() :
1718
+ * ZSTD_estimateCStreamSize() will provide a memory budget large enough for streaming compression
1719
+ * using any compression level up to the max specified one.
1720
+ * It will also consider src size to be arbitrarily "large", which is a worst case scenario.
1721
+ * If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
1722
+ * ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
1723
+ * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
1724
+ * Note : CStream size estimation is only correct for single-threaded compression.
1725
+ * ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
1726
+ * Note 2 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time.
1727
+ * Size estimates assume that no external sequence producer is registered.
1728
+ *
1729
+ * ZSTD_DStream memory budget depends on frame's window Size.
1730
+ * This information can be passed manually, using ZSTD_estimateDStreamSize,
1731
+ * or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame();
1732
+ * Any frame requesting a window size larger than max specified one will be rejected.
1733
+ * Note : if streaming is init with function ZSTD_init?Stream_usingDict(),
1734
+ * an internal ?Dict will be created, which additional size is not estimated here.
1735
+ * In this case, get total size by adding ZSTD_estimate?DictSize
1736
+ */
1737
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int maxCompressionLevel);
1738
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams);
1739
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params);
1740
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t maxWindowSize);
1741
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
1742
+
1743
+ /*! ZSTD_estimate?DictSize() :
1744
+ * ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict().
1745
+ * ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced().
1746
+ * Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller.
1747
+ */
1748
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
1749
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod);
1750
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod);
1751
+
1752
+ /*! ZSTD_initStatic*() :
1753
+ * Initialize an object using a pre-allocated fixed-size buffer.
1754
+ * workspace: The memory area to emplace the object into.
1755
+ * Provided pointer *must be 8-bytes aligned*.
1756
+ * Buffer must outlive object.
1757
+ * workspaceSize: Use ZSTD_estimate*Size() to determine
1758
+ * how large workspace must be to support target scenario.
1759
+ * @return : pointer to object (same address as workspace, just different type),
1760
+ * or NULL if error (size too small, incorrect alignment, etc.)
1761
+ * Note : zstd will never resize nor malloc() when using a static buffer.
1762
+ * If the object requires more memory than available,
1763
+ * zstd will just error out (typically ZSTD_error_memory_allocation).
1764
+ * Note 2 : there is no corresponding "free" function.
1765
+ * Since workspace is allocated externally, it must be freed externally too.
1766
+ * Note 3 : cParams : use ZSTD_getCParams() to convert a compression level
1767
+ * into its associated cParams.
1768
+ * Limitation 1 : currently not compatible with internal dictionary creation, triggered by
1769
+ * ZSTD_CCtx_loadDictionary(), ZSTD_initCStream_usingDict() or ZSTD_initDStream_usingDict().
1770
+ * Limitation 2 : static cctx currently not compatible with multi-threading.
1771
+ * Limitation 3 : static dctx is incompatible with legacy support.
1772
+ */
1773
+ ZSTDLIB_STATIC_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
1774
+ ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */
1775
+
1776
+ ZSTDLIB_STATIC_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize);
1777
+ ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */
1778
+
1779
+ ZSTDLIB_STATIC_API const ZSTD_CDict* ZSTD_initStaticCDict(
1780
+ void* workspace, size_t workspaceSize,
1781
+ const void* dict, size_t dictSize,
1782
+ ZSTD_dictLoadMethod_e dictLoadMethod,
1783
+ ZSTD_dictContentType_e dictContentType,
1784
+ ZSTD_compressionParameters cParams);
1785
+
1786
+ ZSTDLIB_STATIC_API const ZSTD_DDict* ZSTD_initStaticDDict(
1787
+ void* workspace, size_t workspaceSize,
1788
+ const void* dict, size_t dictSize,
1789
+ ZSTD_dictLoadMethod_e dictLoadMethod,
1790
+ ZSTD_dictContentType_e dictContentType);
1791
+
1792
+
1793
+ /*! Custom memory allocation :
1794
+ * These prototypes make it possible to pass your own allocation/free functions.
1795
+ * ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below.
1796
+ * All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones.
1797
+ */
1798
+ typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
1799
+ typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
1800
+ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
1801
+ static
1802
+ #ifdef __GNUC__
1803
+ __attribute__((__unused__))
1804
+ #endif
1805
+ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */
1806
+
1807
+ ZSTDLIB_STATIC_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
1808
+ ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem);
1809
+ ZSTDLIB_STATIC_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
1810
+ ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem);
1811
+
1812
+ ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize,
1813
+ ZSTD_dictLoadMethod_e dictLoadMethod,
1814
+ ZSTD_dictContentType_e dictContentType,
1815
+ ZSTD_compressionParameters cParams,
1816
+ ZSTD_customMem customMem);
1817
+
1818
+ /*! Thread pool :
1819
+ * These prototypes make it possible to share a thread pool among multiple compression contexts.
1820
+ * This can limit resources for applications with multiple threads where each one uses
1821
+ * a threaded compression mode (via ZSTD_c_nbWorkers parameter).
1822
+ * ZSTD_createThreadPool creates a new thread pool with a given number of threads.
1823
+ * Note that the lifetime of such pool must exist while being used.
1824
+ * ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value
1825
+ * to use an internal thread pool).
1826
+ * ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer.
1827
+ */
1828
+ typedef struct POOL_ctx_s ZSTD_threadPool;
1829
+ ZSTDLIB_STATIC_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads);
1830
+ ZSTDLIB_STATIC_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool); /* accept NULL pointer */
1831
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool);
1832
+
1833
+
1834
+ /*
1835
+ * This API is temporary and is expected to change or disappear in the future!
1836
+ */
1837
+ ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_advanced2(
1838
+ const void* dict, size_t dictSize,
1839
+ ZSTD_dictLoadMethod_e dictLoadMethod,
1840
+ ZSTD_dictContentType_e dictContentType,
1841
+ const ZSTD_CCtx_params* cctxParams,
1842
+ ZSTD_customMem customMem);
1843
+
1844
+ ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_advanced(
1845
+ const void* dict, size_t dictSize,
1846
+ ZSTD_dictLoadMethod_e dictLoadMethod,
1847
+ ZSTD_dictContentType_e dictContentType,
1848
+ ZSTD_customMem customMem);
1849
+
1850
+
1851
+ /***************************************
1852
+ * Advanced compression functions
1853
+ ***************************************/
1854
+
1855
+ /*! ZSTD_createCDict_byReference() :
1856
+ * Create a digested dictionary for compression
1857
+ * Dictionary content is just referenced, not duplicated.
1858
+ * As a consequence, `dictBuffer` **must** outlive CDict,
1859
+ * and its content must remain unmodified throughout the lifetime of CDict.
1860
+ * note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */
1861
+ ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
1862
+
1863
+ /*! ZSTD_getCParams() :
1864
+ * @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
1865
+ * `estimatedSrcSize` value is optional, select 0 if not known */
1866
+ ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
1867
+
1868
+ /*! ZSTD_getParams() :
1869
+ * same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`.
1870
+ * All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0 */
1871
+ ZSTDLIB_STATIC_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
1872
+
1873
+ /*! ZSTD_checkCParams() :
1874
+ * Ensure param values remain within authorized range.
1875
+ * @return 0 on success, or an error code (can be checked with ZSTD_isError()) */
1876
+ ZSTDLIB_STATIC_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
1877
+
1878
+ /*! ZSTD_adjustCParams() :
1879
+ * optimize params for a given `srcSize` and `dictSize`.
1880
+ * `srcSize` can be unknown, in which case use ZSTD_CONTENTSIZE_UNKNOWN.
1881
+ * `dictSize` must be `0` when there is no dictionary.
1882
+ * cPar can be invalid : all parameters will be clamped within valid range in the @return struct.
1883
+ * This function never fails (wide contract) */
1884
+ ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);
1885
+
1886
+ /*! ZSTD_CCtx_setCParams() :
1887
+ * Set all parameters provided within @p cparams into the working @p cctx.
1888
+ * Note : if modifying parameters during compression (MT mode only),
1889
+ * note that changes to the .windowLog parameter will be ignored.
1890
+ * @return 0 on success, or an error code (can be checked with ZSTD_isError()).
1891
+ * On failure, no parameters are updated.
1892
+ */
1893
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setCParams(ZSTD_CCtx* cctx, ZSTD_compressionParameters cparams);
1894
+
1895
+ /*! ZSTD_CCtx_setFParams() :
1896
+ * Set all parameters provided within @p fparams into the working @p cctx.
1897
+ * @return 0 on success, or an error code (can be checked with ZSTD_isError()).
1898
+ */
1899
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setFParams(ZSTD_CCtx* cctx, ZSTD_frameParameters fparams);
1900
+
1901
+ /*! ZSTD_CCtx_setParams() :
1902
+ * Set all parameters provided within @p params into the working @p cctx.
1903
+ * @return 0 on success, or an error code (can be checked with ZSTD_isError()).
1904
+ */
1905
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setParams(ZSTD_CCtx* cctx, ZSTD_parameters params);
1906
+
1907
+ /*! ZSTD_compress_advanced() :
1908
+ * Note : this function is now DEPRECATED.
1909
+ * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters.
1910
+ * This prototype will generate compilation warnings. */
1911
+ ZSTD_DEPRECATED("use ZSTD_compress2")
1912
+ ZSTDLIB_STATIC_API
1913
+ size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx,
1914
+ void* dst, size_t dstCapacity,
1915
+ const void* src, size_t srcSize,
1916
+ const void* dict,size_t dictSize,
1917
+ ZSTD_parameters params);
1918
+
1919
+ /*! ZSTD_compress_usingCDict_advanced() :
1920
+ * Note : this function is now DEPRECATED.
1921
+ * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters.
1922
+ * This prototype will generate compilation warnings. */
1923
+ ZSTD_DEPRECATED("use ZSTD_compress2 with ZSTD_CCtx_loadDictionary")
1924
+ ZSTDLIB_STATIC_API
1925
+ size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
1926
+ void* dst, size_t dstCapacity,
1927
+ const void* src, size_t srcSize,
1928
+ const ZSTD_CDict* cdict,
1929
+ ZSTD_frameParameters fParams);
1930
+
1931
+
1932
+ /*! ZSTD_CCtx_loadDictionary_byReference() :
1933
+ * Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx.
1934
+ * It saves some memory, but also requires that `dict` outlives its usage within `cctx` */
1935
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
1936
+
1937
+ /*! ZSTD_CCtx_loadDictionary_advanced() :
1938
+ * Same as ZSTD_CCtx_loadDictionary(), but gives finer control over
1939
+ * how to load the dictionary (by copy ? by reference ?)
1940
+ * and how to interpret it (automatic ? force raw mode ? full mode only ?) */
1941
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
1942
+
1943
+ /*! ZSTD_CCtx_refPrefix_advanced() :
1944
+ * Same as ZSTD_CCtx_refPrefix(), but gives finer control over
1945
+ * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */
1946
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
1947
+
1948
+ /* === experimental parameters === */
1949
+ /* these parameters can be used with ZSTD_setParameter()
1950
+ * they are not guaranteed to remain supported in the future */
1951
+
1952
+ /* Enables rsyncable mode,
1953
+ * which makes compressed files more rsync friendly
1954
+ * by adding periodic synchronization points to the compressed data.
1955
+ * The target average block size is ZSTD_c_jobSize / 2.
1956
+ * It's possible to modify the job size to increase or decrease
1957
+ * the granularity of the synchronization point.
1958
+ * Once the jobSize is smaller than the window size,
1959
+ * it will result in compression ratio degradation.
1960
+ * NOTE 1: rsyncable mode only works when multithreading is enabled.
1961
+ * NOTE 2: rsyncable performs poorly in combination with long range mode,
1962
+ * since it will decrease the effectiveness of synchronization points,
1963
+ * though mileage may vary.
1964
+ * NOTE 3: Rsyncable mode limits maximum compression speed to ~400 MB/s.
1965
+ * If the selected compression level is already running significantly slower,
1966
+ * the overall speed won't be significantly impacted.
1967
+ */
1968
+ #define ZSTD_c_rsyncable ZSTD_c_experimentalParam1
1969
+
1970
+ /* Select a compression format.
1971
+ * The value must be of type ZSTD_format_e.
1972
+ * See ZSTD_format_e enum definition for details */
1973
+ #define ZSTD_c_format ZSTD_c_experimentalParam2
1974
+
1975
+ /* Force back-reference distances to remain < windowSize,
1976
+ * even when referencing into Dictionary content (default:0) */
1977
+ #define ZSTD_c_forceMaxWindow ZSTD_c_experimentalParam3
1978
+
1979
+ /* Controls whether the contents of a CDict
1980
+ * are used in place, or copied into the working context.
1981
+ * Accepts values from the ZSTD_dictAttachPref_e enum.
1982
+ * See the comments on that enum for an explanation of the feature. */
1983
+ #define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4
1984
+
1985
+ /* Controlled with ZSTD_paramSwitch_e enum.
1986
+ * Default is ZSTD_ps_auto.
1987
+ * Set to ZSTD_ps_disable to never compress literals.
1988
+ * Set to ZSTD_ps_enable to always compress literals. (Note: uncompressed literals
1989
+ * may still be emitted if huffman is not beneficial to use.)
1990
+ *
1991
+ * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
1992
+ * literals compression based on the compression parameters - specifically,
1993
+ * negative compression levels do not use literal compression.
1994
+ */
1995
+ #define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5
1996
+
1997
+ /* User's best guess of source size.
1998
+ * Hint is not valid when srcSizeHint == 0.
1999
+ * There is no guarantee that hint is close to actual source size,
2000
+ * but compression ratio may regress significantly if guess considerably underestimates */
2001
+ #define ZSTD_c_srcSizeHint ZSTD_c_experimentalParam7
2002
+
2003
+ /* Controls whether the new and experimental "dedicated dictionary search
2004
+ * structure" can be used. This feature is still rough around the edges, be
2005
+ * prepared for surprising behavior!
2006
+ *
2007
+ * How to use it:
2008
+ *
2009
+ * When using a CDict, whether to use this feature or not is controlled at
2010
+ * CDict creation, and it must be set in a CCtxParams set passed into that
2011
+ * construction (via ZSTD_createCDict_advanced2()). A compression will then
2012
+ * use the feature or not based on how the CDict was constructed; the value of
2013
+ * this param, set in the CCtx, will have no effect.
2014
+ *
2015
+ * However, when a dictionary buffer is passed into a CCtx, such as via
2016
+ * ZSTD_CCtx_loadDictionary(), this param can be set on the CCtx to control
2017
+ * whether the CDict that is created internally can use the feature or not.
2018
+ *
2019
+ * What it does:
2020
+ *
2021
+ * Normally, the internal data structures of the CDict are analogous to what
2022
+ * would be stored in a CCtx after compressing the contents of a dictionary.
2023
+ * To an approximation, a compression using a dictionary can then use those
2024
+ * data structures to simply continue what is effectively a streaming
2025
+ * compression where the simulated compression of the dictionary left off.
2026
+ * Which is to say, the search structures in the CDict are normally the same
2027
+ * format as in the CCtx.
2028
+ *
2029
+ * It is possible to do better, since the CDict is not like a CCtx: the search
2030
+ * structures are written once during CDict creation, and then are only read
2031
+ * after that, while the search structures in the CCtx are both read and
2032
+ * written as the compression goes along. This means we can choose a search
2033
+ * structure for the dictionary that is read-optimized.
2034
+ *
2035
+ * This feature enables the use of that different structure.
2036
+ *
2037
+ * Note that some of the members of the ZSTD_compressionParameters struct have
2038
+ * different semantics and constraints in the dedicated search structure. It is
2039
+ * highly recommended that you simply set a compression level in the CCtxParams
2040
+ * you pass into the CDict creation call, and avoid messing with the cParams
2041
+ * directly.
2042
+ *
2043
+ * Effects:
2044
+ *
2045
+ * This will only have any effect when the selected ZSTD_strategy
2046
+ * implementation supports this feature. Currently, that's limited to
2047
+ * ZSTD_greedy, ZSTD_lazy, and ZSTD_lazy2.
2048
+ *
2049
+ * Note that this means that the CDict tables can no longer be copied into the
2050
+ * CCtx, so the dict attachment mode ZSTD_dictForceCopy will no longer be
2051
+ * usable. The dictionary can only be attached or reloaded.
2052
+ *
2053
+ * In general, you should expect compression to be faster--sometimes very much
2054
+ * so--and CDict creation to be slightly slower. Eventually, we will probably
2055
+ * make this mode the default.
2056
+ */
2057
+ #define ZSTD_c_enableDedicatedDictSearch ZSTD_c_experimentalParam8
2058
+
2059
+ /* ZSTD_c_stableInBuffer
2060
+ * Experimental parameter.
2061
+ * Default is 0 == disabled. Set to 1 to enable.
2062
+ *
2063
+ * Tells the compressor that input data presented with ZSTD_inBuffer
2064
+ * will ALWAYS be the same between calls.
2065
+ * Technically, the @src pointer must never be changed,
2066
+ * and the @pos field can only be updated by zstd.
2067
+ * However, it's possible to increase the @size field,
2068
+ * allowing scenarios where more data can be appended after compressions starts.
2069
+ * These conditions are checked by the compressor,
2070
+ * and compression will fail if they are not respected.
2071
+ * Also, data in the ZSTD_inBuffer within the range [src, src + pos)
2072
+ * MUST not be modified during compression or it will result in data corruption.
2073
+ *
2074
+ * When this flag is enabled zstd won't allocate an input window buffer,
2075
+ * because the user guarantees it can reference the ZSTD_inBuffer until
2076
+ * the frame is complete. But, it will still allocate an output buffer
2077
+ * large enough to fit a block (see ZSTD_c_stableOutBuffer). This will also
2078
+ * avoid the memcpy() from the input buffer to the input window buffer.
2079
+ *
2080
+ * NOTE: So long as the ZSTD_inBuffer always points to valid memory, using
2081
+ * this flag is ALWAYS memory safe, and will never access out-of-bounds
2082
+ * memory. However, compression WILL fail if conditions are not respected.
2083
+ *
2084
+ * WARNING: The data in the ZSTD_inBuffer in the range [src, src + pos) MUST
2085
+ * not be modified during compression or it will result in data corruption.
2086
+ * This is because zstd needs to reference data in the ZSTD_inBuffer to find
2087
+ * matches. Normally zstd maintains its own window buffer for this purpose,
2088
+ * but passing this flag tells zstd to rely on user provided buffer instead.
2089
+ */
2090
+ #define ZSTD_c_stableInBuffer ZSTD_c_experimentalParam9
2091
+
2092
+ /* ZSTD_c_stableOutBuffer
2093
+ * Experimental parameter.
2094
+ * Default is 0 == disabled. Set to 1 to enable.
2095
+ *
2096
+ * Tells he compressor that the ZSTD_outBuffer will not be resized between
2097
+ * calls. Specifically: (out.size - out.pos) will never grow. This gives the
2098
+ * compressor the freedom to say: If the compressed data doesn't fit in the
2099
+ * output buffer then return ZSTD_error_dstSizeTooSmall. This allows us to
2100
+ * always decompress directly into the output buffer, instead of decompressing
2101
+ * into an internal buffer and copying to the output buffer.
2102
+ *
2103
+ * When this flag is enabled zstd won't allocate an output buffer, because
2104
+ * it can write directly to the ZSTD_outBuffer. It will still allocate the
2105
+ * input window buffer (see ZSTD_c_stableInBuffer).
2106
+ *
2107
+ * Zstd will check that (out.size - out.pos) never grows and return an error
2108
+ * if it does. While not strictly necessary, this should prevent surprises.
2109
+ */
2110
+ #define ZSTD_c_stableOutBuffer ZSTD_c_experimentalParam10
2111
+
2112
+ /* ZSTD_c_blockDelimiters
2113
+ * Default is 0 == ZSTD_sf_noBlockDelimiters.
2114
+ *
2115
+ * For use with sequence compression API: ZSTD_compressSequences().
2116
+ *
2117
+ * Designates whether or not the given array of ZSTD_Sequence contains block delimiters
2118
+ * and last literals, which are defined as sequences with offset == 0 and matchLength == 0.
2119
+ * See the definition of ZSTD_Sequence for more specifics.
2120
+ */
2121
+ #define ZSTD_c_blockDelimiters ZSTD_c_experimentalParam11
2122
+
2123
+ /* ZSTD_c_validateSequences
2124
+ * Default is 0 == disabled. Set to 1 to enable sequence validation.
2125
+ *
2126
+ * For use with sequence compression API: ZSTD_compressSequences().
2127
+ * Designates whether or not we validate sequences provided to ZSTD_compressSequences()
2128
+ * during function execution.
2129
+ *
2130
+ * Without validation, providing a sequence that does not conform to the zstd spec will cause
2131
+ * undefined behavior, and may produce a corrupted block.
2132
+ *
2133
+ * With validation enabled, if sequence is invalid (see doc/zstd_compression_format.md for
2134
+ * specifics regarding offset/matchlength requirements) then the function will bail out and
2135
+ * return an error.
2136
+ *
2137
+ */
2138
+ #define ZSTD_c_validateSequences ZSTD_c_experimentalParam12
2139
+
2140
+ /* ZSTD_c_useBlockSplitter
2141
+ * Controlled with ZSTD_paramSwitch_e enum.
2142
+ * Default is ZSTD_ps_auto.
2143
+ * Set to ZSTD_ps_disable to never use block splitter.
2144
+ * Set to ZSTD_ps_enable to always use block splitter.
2145
+ *
2146
+ * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
2147
+ * block splitting based on the compression parameters.
2148
+ */
2149
+ #define ZSTD_c_useBlockSplitter ZSTD_c_experimentalParam13
2150
+
2151
+ /* ZSTD_c_useRowMatchFinder
2152
+ * Controlled with ZSTD_paramSwitch_e enum.
2153
+ * Default is ZSTD_ps_auto.
2154
+ * Set to ZSTD_ps_disable to never use row-based matchfinder.
2155
+ * Set to ZSTD_ps_enable to force usage of row-based matchfinder.
2156
+ *
2157
+ * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
2158
+ * the row-based matchfinder based on support for SIMD instructions and the window log.
2159
+ * Note that this only pertains to compression strategies: greedy, lazy, and lazy2
2160
+ */
2161
+ #define ZSTD_c_useRowMatchFinder ZSTD_c_experimentalParam14
2162
+
2163
+ /* ZSTD_c_deterministicRefPrefix
2164
+ * Default is 0 == disabled. Set to 1 to enable.
2165
+ *
2166
+ * Zstd produces different results for prefix compression when the prefix is
2167
+ * directly adjacent to the data about to be compressed vs. when it isn't.
2168
+ * This is because zstd detects that the two buffers are contiguous and it can
2169
+ * use a more efficient match finding algorithm. However, this produces different
2170
+ * results than when the two buffers are non-contiguous. This flag forces zstd
2171
+ * to always load the prefix in non-contiguous mode, even if it happens to be
2172
+ * adjacent to the data, to guarantee determinism.
2173
+ *
2174
+ * If you really care about determinism when using a dictionary or prefix,
2175
+ * like when doing delta compression, you should select this option. It comes
2176
+ * at a speed penalty of about ~2.5% if the dictionary and data happened to be
2177
+ * contiguous, and is free if they weren't contiguous. We don't expect that
2178
+ * intentionally making the dictionary and data contiguous will be worth the
2179
+ * cost to memcpy() the data.
2180
+ */
2181
+ #define ZSTD_c_deterministicRefPrefix ZSTD_c_experimentalParam15
2182
+
2183
+ /* ZSTD_c_prefetchCDictTables
2184
+ * Controlled with ZSTD_paramSwitch_e enum. Default is ZSTD_ps_auto.
2185
+ *
2186
+ * In some situations, zstd uses CDict tables in-place rather than copying them
2187
+ * into the working context. (See docs on ZSTD_dictAttachPref_e above for details).
2188
+ * In such situations, compression speed is seriously impacted when CDict tables are
2189
+ * "cold" (outside CPU cache). This parameter instructs zstd to prefetch CDict tables
2190
+ * when they are used in-place.
2191
+ *
2192
+ * For sufficiently small inputs, the cost of the prefetch will outweigh the benefit.
2193
+ * For sufficiently large inputs, zstd will by default memcpy() CDict tables
2194
+ * into the working context, so there is no need to prefetch. This parameter is
2195
+ * targeted at a middle range of input sizes, where a prefetch is cheap enough to be
2196
+ * useful but memcpy() is too expensive. The exact range of input sizes where this
2197
+ * makes sense is best determined by careful experimentation.
2198
+ *
2199
+ * Note: for this parameter, ZSTD_ps_auto is currently equivalent to ZSTD_ps_disable,
2200
+ * but in the future zstd may conditionally enable this feature via an auto-detection
2201
+ * heuristic for cold CDicts.
2202
+ * Use ZSTD_ps_disable to opt out of prefetching under any circumstances.
2203
+ */
2204
+ #define ZSTD_c_prefetchCDictTables ZSTD_c_experimentalParam16
2205
+
2206
+ /* ZSTD_c_enableSeqProducerFallback
2207
+ * Allowed values are 0 (disable) and 1 (enable). The default setting is 0.
2208
+ *
2209
+ * Controls whether zstd will fall back to an internal sequence producer if an
2210
+ * external sequence producer is registered and returns an error code. This fallback
2211
+ * is block-by-block: the internal sequence producer will only be called for blocks
2212
+ * where the external sequence producer returns an error code. Fallback parsing will
2213
+ * follow any other cParam settings, such as compression level, the same as in a
2214
+ * normal (fully-internal) compression operation.
2215
+ *
2216
+ * The user is strongly encouraged to read the full Block-Level Sequence Producer API
2217
+ * documentation (below) before setting this parameter. */
2218
+ #define ZSTD_c_enableSeqProducerFallback ZSTD_c_experimentalParam17
2219
+
2220
+ /* ZSTD_c_maxBlockSize
2221
+ * Allowed values are between 1KB and ZSTD_BLOCKSIZE_MAX (128KB).
2222
+ * The default is ZSTD_BLOCKSIZE_MAX, and setting to 0 will set to the default.
2223
+ *
2224
+ * This parameter can be used to set an upper bound on the blocksize
2225
+ * that overrides the default ZSTD_BLOCKSIZE_MAX. It cannot be used to set upper
2226
+ * bounds greater than ZSTD_BLOCKSIZE_MAX or bounds lower than 1KB (will make
2227
+ * compressBound() inaccurate). Only currently meant to be used for testing.
2228
+ *
2229
+ */
2230
+ #define ZSTD_c_maxBlockSize ZSTD_c_experimentalParam18
2231
+
2232
+ /* ZSTD_c_searchForExternalRepcodes
2233
+ * This parameter affects how zstd parses external sequences, such as sequences
2234
+ * provided through the compressSequences() API or from an external block-level
2235
+ * sequence producer.
2236
+ *
2237
+ * If set to ZSTD_ps_enable, the library will check for repeated offsets in
2238
+ * external sequences, even if those repcodes are not explicitly indicated in
2239
+ * the "rep" field. Note that this is the only way to exploit repcode matches
2240
+ * while using compressSequences() or an external sequence producer, since zstd
2241
+ * currently ignores the "rep" field of external sequences.
2242
+ *
2243
+ * If set to ZSTD_ps_disable, the library will not exploit repeated offsets in
2244
+ * external sequences, regardless of whether the "rep" field has been set. This
2245
+ * reduces sequence compression overhead by about 25% while sacrificing some
2246
+ * compression ratio.
2247
+ *
2248
+ * The default value is ZSTD_ps_auto, for which the library will enable/disable
2249
+ * based on compression level.
2250
+ *
2251
+ * Note: for now, this param only has an effect if ZSTD_c_blockDelimiters is
2252
+ * set to ZSTD_sf_explicitBlockDelimiters. That may change in the future.
2253
+ */
2254
+ #define ZSTD_c_searchForExternalRepcodes ZSTD_c_experimentalParam19
2255
+
2256
+ /*! ZSTD_CCtx_getParameter() :
2257
+ * Get the requested compression parameter value, selected by enum ZSTD_cParameter,
2258
+ * and store it into int* value.
2259
+ * @return : 0, or an error code (which can be tested with ZSTD_isError()).
2260
+ */
2261
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value);
2262
+
2263
+
2264
+ /*! ZSTD_CCtx_params :
2265
+ * Quick howto :
2266
+ * - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure
2267
+ * - ZSTD_CCtxParams_setParameter() : Push parameters one by one into
2268
+ * an existing ZSTD_CCtx_params structure.
2269
+ * This is similar to
2270
+ * ZSTD_CCtx_setParameter().
2271
+ * - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to
2272
+ * an existing CCtx.
2273
+ * These parameters will be applied to
2274
+ * all subsequent frames.
2275
+ * - ZSTD_compressStream2() : Do compression using the CCtx.
2276
+ * - ZSTD_freeCCtxParams() : Free the memory, accept NULL pointer.
2277
+ *
2278
+ * This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams()
2279
+ * for static allocation of CCtx for single-threaded compression.
2280
+ */
2281
+ ZSTDLIB_STATIC_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
2282
+ ZSTDLIB_STATIC_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointer */
2283
+
2284
+ /*! ZSTD_CCtxParams_reset() :
2285
+ * Reset params to default values.
2286
+ */
2287
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params);
2288
+
2289
+ /*! ZSTD_CCtxParams_init() :
2290
+ * Initializes the compression parameters of cctxParams according to
2291
+ * compression level. All other parameters are reset to their default values.
2292
+ */
2293
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel);
2294
+
2295
+ /*! ZSTD_CCtxParams_init_advanced() :
2296
+ * Initializes the compression and frame parameters of cctxParams according to
2297
+ * params. All other parameters are reset to their default values.
2298
+ */
2299
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
2300
+
2301
+ /*! ZSTD_CCtxParams_setParameter() : Requires v1.4.0+
2302
+ * Similar to ZSTD_CCtx_setParameter.
2303
+ * Set one compression parameter, selected by enum ZSTD_cParameter.
2304
+ * Parameters must be applied to a ZSTD_CCtx using
2305
+ * ZSTD_CCtx_setParametersUsingCCtxParams().
2306
+ * @result : a code representing success or failure (which can be tested with
2307
+ * ZSTD_isError()).
2308
+ */
2309
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
2310
+
2311
+ /*! ZSTD_CCtxParams_getParameter() :
2312
+ * Similar to ZSTD_CCtx_getParameter.
2313
+ * Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.
2314
+ * @result : 0, or an error code (which can be tested with ZSTD_isError()).
2315
+ */
2316
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
2317
+
2318
+ /*! ZSTD_CCtx_setParametersUsingCCtxParams() :
2319
+ * Apply a set of ZSTD_CCtx_params to the compression context.
2320
+ * This can be done even after compression is started,
2321
+ * if nbWorkers==0, this will have no impact until a new compression is started.
2322
+ * if nbWorkers>=1, new parameters will be picked up at next job,
2323
+ * with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated).
2324
+ */
2325
+ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
2326
+ ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
2327
+
2328
+ /*! ZSTD_compressStream2_simpleArgs() :
2329
+ * Same as ZSTD_compressStream2(),
2330
+ * but using only integral types as arguments.
2331
+ * This variant might be helpful for binders from dynamic languages
2332
+ * which have troubles handling structures containing memory pointers.
2333
+ */
2334
+ ZSTDLIB_STATIC_API size_t ZSTD_compressStream2_simpleArgs (
2335
+ ZSTD_CCtx* cctx,
2336
+ void* dst, size_t dstCapacity, size_t* dstPos,
2337
+ const void* src, size_t srcSize, size_t* srcPos,
2338
+ ZSTD_EndDirective endOp);
2339
+
2340
+
2341
+ /***************************************
2342
+ * Advanced decompression functions
2343
+ ***************************************/
2344
+
2345
+ /*! ZSTD_isFrame() :
2346
+ * Tells if the content of `buffer` starts with a valid Frame Identifier.
2347
+ * Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0.
2348
+ * Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.
2349
+ * Note 3 : Skippable Frame Identifiers are considered valid. */
2350
+ ZSTDLIB_STATIC_API unsigned ZSTD_isFrame(const void* buffer, size_t size);
2351
+
2352
+ /*! ZSTD_createDDict_byReference() :
2353
+ * Create a digested dictionary, ready to start decompression operation without startup delay.
2354
+ * Dictionary content is referenced, and therefore stays in dictBuffer.
2355
+ * It is important that dictBuffer outlives DDict,
2356
+ * it must remain read accessible throughout the lifetime of DDict */
2357
+ ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
2358
+
2359
+ /*! ZSTD_DCtx_loadDictionary_byReference() :
2360
+ * Same as ZSTD_DCtx_loadDictionary(),
2361
+ * but references `dict` content instead of copying it into `dctx`.
2362
+ * This saves memory if `dict` remains around.,
2363
+ * However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression. */
2364
+ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
2365
+
2366
+ /*! ZSTD_DCtx_loadDictionary_advanced() :
2367
+ * Same as ZSTD_DCtx_loadDictionary(),
2368
+ * but gives direct control over
2369
+ * how to load the dictionary (by copy ? by reference ?)
2370
+ * and how to interpret it (automatic ? force raw mode ? full mode only ?). */
2371
+ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
2372
+
2373
+ /*! ZSTD_DCtx_refPrefix_advanced() :
2374
+ * Same as ZSTD_DCtx_refPrefix(), but gives finer control over
2375
+ * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */
2376
+ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
2377
+
2378
+ /*! ZSTD_DCtx_setMaxWindowSize() :
2379
+ * Refuses allocating internal buffers for frames requiring a window size larger than provided limit.
2380
+ * This protects a decoder context from reserving too much memory for itself (potential attack scenario).
2381
+ * This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode.
2382
+ * By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT)
2383
+ * @return : 0, or an error code (which can be tested using ZSTD_isError()).
2384
+ */
2385
+ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize);
2386
+
2387
+ /*! ZSTD_DCtx_getParameter() :
2388
+ * Get the requested decompression parameter value, selected by enum ZSTD_dParameter,
2389
+ * and store it into int* value.
2390
+ * @return : 0, or an error code (which can be tested with ZSTD_isError()).
2391
+ */
2392
+ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value);
2393
+
2394
+ /* ZSTD_d_format
2395
+ * experimental parameter,
2396
+ * allowing selection between ZSTD_format_e input compression formats
2397
+ */
2398
+ #define ZSTD_d_format ZSTD_d_experimentalParam1
2399
+ /* ZSTD_d_stableOutBuffer
2400
+ * Experimental parameter.
2401
+ * Default is 0 == disabled. Set to 1 to enable.
2402
+ *
2403
+ * Tells the decompressor that the ZSTD_outBuffer will ALWAYS be the same
2404
+ * between calls, except for the modifications that zstd makes to pos (the
2405
+ * caller must not modify pos). This is checked by the decompressor, and
2406
+ * decompression will fail if it ever changes. Therefore the ZSTD_outBuffer
2407
+ * MUST be large enough to fit the entire decompressed frame. This will be
2408
+ * checked when the frame content size is known. The data in the ZSTD_outBuffer
2409
+ * in the range [dst, dst + pos) MUST not be modified during decompression
2410
+ * or you will get data corruption.
2411
+ *
2412
+ * When this flag is enabled zstd won't allocate an output buffer, because
2413
+ * it can write directly to the ZSTD_outBuffer, but it will still allocate
2414
+ * an input buffer large enough to fit any compressed block. This will also
2415
+ * avoid the memcpy() from the internal output buffer to the ZSTD_outBuffer.
2416
+ * If you need to avoid the input buffer allocation use the buffer-less
2417
+ * streaming API.
2418
+ *
2419
+ * NOTE: So long as the ZSTD_outBuffer always points to valid memory, using
2420
+ * this flag is ALWAYS memory safe, and will never access out-of-bounds
2421
+ * memory. However, decompression WILL fail if you violate the preconditions.
2422
+ *
2423
+ * WARNING: The data in the ZSTD_outBuffer in the range [dst, dst + pos) MUST
2424
+ * not be modified during decompression or you will get data corruption. This
2425
+ * is because zstd needs to reference data in the ZSTD_outBuffer to regenerate
2426
+ * matches. Normally zstd maintains its own buffer for this purpose, but passing
2427
+ * this flag tells zstd to use the user provided buffer.
2428
+ */
2429
+ #define ZSTD_d_stableOutBuffer ZSTD_d_experimentalParam2
2430
+
2431
+ /* ZSTD_d_forceIgnoreChecksum
2432
+ * Experimental parameter.
2433
+ * Default is 0 == disabled. Set to 1 to enable
2434
+ *
2435
+ * Tells the decompressor to skip checksum validation during decompression, regardless
2436
+ * of whether checksumming was specified during compression. This offers some
2437
+ * slight performance benefits, and may be useful for debugging.
2438
+ * Param has values of type ZSTD_forceIgnoreChecksum_e
2439
+ */
2440
+ #define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
2441
+
2442
+ /* ZSTD_d_refMultipleDDicts
2443
+ * Experimental parameter.
2444
+ * Default is 0 == disabled. Set to 1 to enable
2445
+ *
2446
+ * If enabled and dctx is allocated on the heap, then additional memory will be allocated
2447
+ * to store references to multiple ZSTD_DDict. That is, multiple calls of ZSTD_refDDict()
2448
+ * using a given ZSTD_DCtx, rather than overwriting the previous DDict reference, will instead
2449
+ * store all references. At decompression time, the appropriate dictID is selected
2450
+ * from the set of DDicts based on the dictID in the frame.
2451
+ *
2452
+ * Usage is simply calling ZSTD_refDDict() on multiple dict buffers.
2453
+ *
2454
+ * Param has values of byte ZSTD_refMultipleDDicts_e
2455
+ *
2456
+ * WARNING: Enabling this parameter and calling ZSTD_DCtx_refDDict(), will trigger memory
2457
+ * allocation for the hash table. ZSTD_freeDCtx() also frees this memory.
2458
+ * Memory is allocated as per ZSTD_DCtx::customMem.
2459
+ *
2460
+ * Although this function allocates memory for the table, the user is still responsible for
2461
+ * memory management of the underlying ZSTD_DDict* themselves.
2462
+ */
2463
+ #define ZSTD_d_refMultipleDDicts ZSTD_d_experimentalParam4
2464
+
2465
+ /* ZSTD_d_disableHuffmanAssembly
2466
+ * Set to 1 to disable the Huffman assembly implementation.
2467
+ * The default value is 0, which allows zstd to use the Huffman assembly
2468
+ * implementation if available.
2469
+ *
2470
+ * This parameter can be used to disable Huffman assembly at runtime.
2471
+ * If you want to disable it at compile time you can define the macro
2472
+ * ZSTD_DISABLE_ASM.
2473
+ */
2474
+ #define ZSTD_d_disableHuffmanAssembly ZSTD_d_experimentalParam5
2475
+
2476
+ /* ZSTD_d_maxBlockSize
2477
+ * Allowed values are between 1KB and ZSTD_BLOCKSIZE_MAX (128KB).
2478
+ * The default is ZSTD_BLOCKSIZE_MAX, and setting to 0 will set to the default.
2479
+ *
2480
+ * Forces the decompressor to reject blocks whose content size is
2481
+ * larger than the configured maxBlockSize. When maxBlockSize is
2482
+ * larger than the windowSize, the windowSize is used instead.
2483
+ * This saves memory on the decoder when you know all blocks are small.
2484
+ *
2485
+ * This option is typically used in conjunction with ZSTD_c_maxBlockSize.
2486
+ *
2487
+ * WARNING: This causes the decoder to reject otherwise valid frames
2488
+ * that have block sizes larger than the configured maxBlockSize.
2489
+ */
2490
+ #define ZSTD_d_maxBlockSize ZSTD_d_experimentalParam6
2491
+
2492
+
2493
+ /*! ZSTD_DCtx_setFormat() :
2494
+ * This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter().
2495
+ * Instruct the decoder context about what kind of data to decode next.
2496
+ * This instruction is mandatory to decode data without a fully-formed header,
2497
+ * such ZSTD_f_zstd1_magicless for example.
2498
+ * @return : 0, or an error code (which can be tested using ZSTD_isError()). */
2499
+ ZSTD_DEPRECATED("use ZSTD_DCtx_setParameter() instead")
2500
+ ZSTDLIB_STATIC_API
2501
+ size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
2502
+
2503
+ /*! ZSTD_decompressStream_simpleArgs() :
2504
+ * Same as ZSTD_decompressStream(),
2505
+ * but using only integral types as arguments.
2506
+ * This can be helpful for binders from dynamic languages
2507
+ * which have troubles handling structures containing memory pointers.
2508
+ */
2509
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressStream_simpleArgs (
2510
+ ZSTD_DCtx* dctx,
2511
+ void* dst, size_t dstCapacity, size_t* dstPos,
2512
+ const void* src, size_t srcSize, size_t* srcPos);
2513
+
2514
+
2515
+ /********************************************************************
2516
+ * Advanced streaming functions
2517
+ * Warning : most of these functions are now redundant with the Advanced API.
2518
+ * Once Advanced API reaches "stable" status,
2519
+ * redundant functions will be deprecated, and then at some point removed.
2520
+ ********************************************************************/
2521
+
2522
+ /*===== Advanced Streaming compression functions =====*/
2523
+
2524
+ /*! ZSTD_initCStream_srcSize() :
2525
+ * This function is DEPRECATED, and equivalent to:
2526
+ * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
2527
+ * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)
2528
+ * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);
2529
+ * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);
2530
+ *
2531
+ * pledgedSrcSize must be correct. If it is not known at init time, use
2532
+ * ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs,
2533
+ * "0" also disables frame content size field. It may be enabled in the future.
2534
+ * This prototype will generate compilation warnings.
2535
+ */
2536
+ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
2537
+ ZSTDLIB_STATIC_API
2538
+ size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,
2539
+ int compressionLevel,
2540
+ unsigned long long pledgedSrcSize);
2541
+
2542
+ /*! ZSTD_initCStream_usingDict() :
2543
+ * This function is DEPRECATED, and is equivalent to:
2544
+ * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
2545
+ * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);
2546
+ * ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);
2547
+ *
2548
+ * Creates of an internal CDict (incompatible with static CCtx), except if
2549
+ * dict == NULL or dictSize < 8, in which case no dict is used.
2550
+ * Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if
2551
+ * it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy.
2552
+ * This prototype will generate compilation warnings.
2553
+ */
2554
+ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
2555
+ ZSTDLIB_STATIC_API
2556
+ size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs,
2557
+ const void* dict, size_t dictSize,
2558
+ int compressionLevel);
2559
+
2560
+ /*! ZSTD_initCStream_advanced() :
2561
+ * This function is DEPRECATED, and is equivalent to:
2562
+ * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
2563
+ * ZSTD_CCtx_setParams(zcs, params);
2564
+ * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);
2565
+ * ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);
2566
+ *
2567
+ * dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy.
2568
+ * pledgedSrcSize must be correct.
2569
+ * If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN.
2570
+ * This prototype will generate compilation warnings.
2571
+ */
2572
+ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
2573
+ ZSTDLIB_STATIC_API
2574
+ size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
2575
+ const void* dict, size_t dictSize,
2576
+ ZSTD_parameters params,
2577
+ unsigned long long pledgedSrcSize);
2578
+
2579
+ /*! ZSTD_initCStream_usingCDict() :
2580
+ * This function is DEPRECATED, and equivalent to:
2581
+ * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
2582
+ * ZSTD_CCtx_refCDict(zcs, cdict);
2583
+ *
2584
+ * note : cdict will just be referenced, and must outlive compression session
2585
+ * This prototype will generate compilation warnings.
2586
+ */
2587
+ ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")
2588
+ ZSTDLIB_STATIC_API
2589
+ size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict);
2590
+
2591
+ /*! ZSTD_initCStream_usingCDict_advanced() :
2592
+ * This function is DEPRECATED, and is equivalent to:
2593
+ * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
2594
+ * ZSTD_CCtx_setFParams(zcs, fParams);
2595
+ * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);
2596
+ * ZSTD_CCtx_refCDict(zcs, cdict);
2597
+ *
2598
+ * same as ZSTD_initCStream_usingCDict(), with control over frame parameters.
2599
+ * pledgedSrcSize must be correct. If srcSize is not known at init time, use
2600
+ * value ZSTD_CONTENTSIZE_UNKNOWN.
2601
+ * This prototype will generate compilation warnings.
2602
+ */
2603
+ ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")
2604
+ ZSTDLIB_STATIC_API
2605
+ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
2606
+ const ZSTD_CDict* cdict,
2607
+ ZSTD_frameParameters fParams,
2608
+ unsigned long long pledgedSrcSize);
2609
+
2610
+ /*! ZSTD_resetCStream() :
2611
+ * This function is DEPRECATED, and is equivalent to:
2612
+ * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
2613
+ * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);
2614
+ * Note: ZSTD_resetCStream() interprets pledgedSrcSize == 0 as ZSTD_CONTENTSIZE_UNKNOWN, but
2615
+ * ZSTD_CCtx_setPledgedSrcSize() does not do the same, so ZSTD_CONTENTSIZE_UNKNOWN must be
2616
+ * explicitly specified.
2617
+ *
2618
+ * start a new frame, using same parameters from previous frame.
2619
+ * This is typically useful to skip dictionary loading stage, since it will reuse it in-place.
2620
+ * Note that zcs must be init at least once before using ZSTD_resetCStream().
2621
+ * If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN.
2622
+ * If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end.
2623
+ * For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs,
2624
+ * but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead.
2625
+ * @return : 0, or an error code (which can be tested using ZSTD_isError())
2626
+ * This prototype will generate compilation warnings.
2627
+ */
2628
+ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
2629
+ ZSTDLIB_STATIC_API
2630
+ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
2631
+
2632
+
2633
+ typedef struct {
2634
+ unsigned long long ingested; /* nb input bytes read and buffered */
2635
+ unsigned long long consumed; /* nb input bytes actually compressed */
2636
+ unsigned long long produced; /* nb of compressed bytes generated and buffered */
2637
+ unsigned long long flushed; /* nb of compressed bytes flushed : not provided; can be tracked from caller side */
2638
+ unsigned currentJobID; /* MT only : latest started job nb */
2639
+ unsigned nbActiveWorkers; /* MT only : nb of workers actively compressing at probe time */
2640
+ } ZSTD_frameProgression;
2641
+
2642
+ /* ZSTD_getFrameProgression() :
2643
+ * tells how much data has been ingested (read from input)
2644
+ * consumed (input actually compressed) and produced (output) for current frame.
2645
+ * Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed.
2646
+ * Aggregates progression inside active worker threads.
2647
+ */
2648
+ ZSTDLIB_STATIC_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx);
2649
+
2650
+ /*! ZSTD_toFlushNow() :
2651
+ * Tell how many bytes are ready to be flushed immediately.
2652
+ * Useful for multithreading scenarios (nbWorkers >= 1).
2653
+ * Probe the oldest active job, defined as oldest job not yet entirely flushed,
2654
+ * and check its output buffer.
2655
+ * @return : amount of data stored in oldest job and ready to be flushed immediately.
2656
+ * if @return == 0, it means either :
2657
+ * + there is no active job (could be checked with ZSTD_frameProgression()), or
2658
+ * + oldest job is still actively compressing data,
2659
+ * but everything it has produced has also been flushed so far,
2660
+ * therefore flush speed is limited by production speed of oldest job
2661
+ * irrespective of the speed of concurrent (and newer) jobs.
2662
+ */
2663
+ ZSTDLIB_STATIC_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
2664
+
2665
+
2666
+ /*===== Advanced Streaming decompression functions =====*/
2667
+
2668
+ /*!
2669
+ * This function is deprecated, and is equivalent to:
2670
+ *
2671
+ * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
2672
+ * ZSTD_DCtx_loadDictionary(zds, dict, dictSize);
2673
+ *
2674
+ * note: no dictionary will be used if dict == NULL or dictSize < 8
2675
+ */
2676
+ ZSTD_DEPRECATED("use ZSTD_DCtx_reset + ZSTD_DCtx_loadDictionary, see zstd.h for detailed instructions")
2677
+ ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize);
2678
+
2679
+ /*!
2680
+ * This function is deprecated, and is equivalent to:
2681
+ *
2682
+ * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
2683
+ * ZSTD_DCtx_refDDict(zds, ddict);
2684
+ *
2685
+ * note : ddict is referenced, it must outlive decompression session
2686
+ */
2687
+ ZSTD_DEPRECATED("use ZSTD_DCtx_reset + ZSTD_DCtx_refDDict, see zstd.h for detailed instructions")
2688
+ ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);
2689
+
2690
+ /*!
2691
+ * This function is deprecated, and is equivalent to:
2692
+ *
2693
+ * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
2694
+ *
2695
+ * reuse decompression parameters from previous init; saves dictionary loading
2696
+ */
2697
+ ZSTD_DEPRECATED("use ZSTD_DCtx_reset, see zstd.h for detailed instructions")
2698
+ ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds);
2699
+
2700
+
2701
+ /* ********************* BLOCK-LEVEL SEQUENCE PRODUCER API *********************
2702
+ *
2703
+ * *** OVERVIEW ***
2704
+ * The Block-Level Sequence Producer API allows users to provide their own custom
2705
+ * sequence producer which libzstd invokes to process each block. The produced list
2706
+ * of sequences (literals and matches) is then post-processed by libzstd to produce
2707
+ * valid compressed blocks.
2708
+ *
2709
+ * This block-level offload API is a more granular complement of the existing
2710
+ * frame-level offload API compressSequences() (introduced in v1.5.1). It offers
2711
+ * an easier migration story for applications already integrated with libzstd: the
2712
+ * user application continues to invoke the same compression functions
2713
+ * ZSTD_compress2() or ZSTD_compressStream2() as usual, and transparently benefits
2714
+ * from the specific advantages of the external sequence producer. For example,
2715
+ * the sequence producer could be tuned to take advantage of known characteristics
2716
+ * of the input, to offer better speed / ratio, or could leverage hardware
2717
+ * acceleration not available within libzstd itself.
2718
+ *
2719
+ * See contrib/externalSequenceProducer for an example program employing the
2720
+ * Block-Level Sequence Producer API.
2721
+ *
2722
+ * *** USAGE ***
2723
+ * The user is responsible for implementing a function of type
2724
+ * ZSTD_sequenceProducer_F. For each block, zstd will pass the following
2725
+ * arguments to the user-provided function:
2726
+ *
2727
+ * - sequenceProducerState: a pointer to a user-managed state for the sequence
2728
+ * producer.
2729
+ *
2730
+ * - outSeqs, outSeqsCapacity: an output buffer for the sequence producer.
2731
+ * outSeqsCapacity is guaranteed >= ZSTD_sequenceBound(srcSize). The memory
2732
+ * backing outSeqs is managed by the CCtx.
2733
+ *
2734
+ * - src, srcSize: an input buffer for the sequence producer to parse.
2735
+ * srcSize is guaranteed to be <= ZSTD_BLOCKSIZE_MAX.
2736
+ *
2737
+ * - dict, dictSize: a history buffer, which may be empty, which the sequence
2738
+ * producer may reference as it parses the src buffer. Currently, zstd will
2739
+ * always pass dictSize == 0 into external sequence producers, but this will
2740
+ * change in the future.
2741
+ *
2742
+ * - compressionLevel: a signed integer representing the zstd compression level
2743
+ * set by the user for the current operation. The sequence producer may choose
2744
+ * to use this information to change its compression strategy and speed/ratio
2745
+ * tradeoff. Note: the compression level does not reflect zstd parameters set
2746
+ * through the advanced API.
2747
+ *
2748
+ * - windowSize: a size_t representing the maximum allowed offset for external
2749
+ * sequences. Note that sequence offsets are sometimes allowed to exceed the
2750
+ * windowSize if a dictionary is present, see doc/zstd_compression_format.md
2751
+ * for details.
2752
+ *
2753
+ * The user-provided function shall return a size_t representing the number of
2754
+ * sequences written to outSeqs. This return value will be treated as an error
2755
+ * code if it is greater than outSeqsCapacity. The return value must be non-zero
2756
+ * if srcSize is non-zero. The ZSTD_SEQUENCE_PRODUCER_ERROR macro is provided
2757
+ * for convenience, but any value greater than outSeqsCapacity will be treated as
2758
+ * an error code.
2759
+ *
2760
+ * If the user-provided function does not return an error code, the sequences
2761
+ * written to outSeqs must be a valid parse of the src buffer. Data corruption may
2762
+ * occur if the parse is not valid. A parse is defined to be valid if the
2763
+ * following conditions hold:
2764
+ * - The sum of matchLengths and literalLengths must equal srcSize.
2765
+ * - All sequences in the parse, except for the final sequence, must have
2766
+ * matchLength >= ZSTD_MINMATCH_MIN. The final sequence must have
2767
+ * matchLength >= ZSTD_MINMATCH_MIN or matchLength == 0.
2768
+ * - All offsets must respect the windowSize parameter as specified in
2769
+ * doc/zstd_compression_format.md.
2770
+ * - If the final sequence has matchLength == 0, it must also have offset == 0.
2771
+ *
2772
+ * zstd will only validate these conditions (and fail compression if they do not
2773
+ * hold) if the ZSTD_c_validateSequences cParam is enabled. Note that sequence
2774
+ * validation has a performance cost.
2775
+ *
2776
+ * If the user-provided function returns an error, zstd will either fall back
2777
+ * to an internal sequence producer or fail the compression operation. The user can
2778
+ * choose between the two behaviors by setting the ZSTD_c_enableSeqProducerFallback
2779
+ * cParam. Fallback compression will follow any other cParam settings, such as
2780
+ * compression level, the same as in a normal compression operation.
2781
+ *
2782
+ * The user shall instruct zstd to use a particular ZSTD_sequenceProducer_F
2783
+ * function by calling
2784
+ * ZSTD_registerSequenceProducer(cctx,
2785
+ * sequenceProducerState,
2786
+ * sequenceProducer)
2787
+ * This setting will persist until the next parameter reset of the CCtx.
2788
+ *
2789
+ * The sequenceProducerState must be initialized by the user before calling
2790
+ * ZSTD_registerSequenceProducer(). The user is responsible for destroying the
2791
+ * sequenceProducerState.
2792
+ *
2793
+ * *** LIMITATIONS ***
2794
+ * This API is compatible with all zstd compression APIs which respect advanced parameters.
2795
+ * However, there are three limitations:
2796
+ *
2797
+ * First, the ZSTD_c_enableLongDistanceMatching cParam is not currently supported.
2798
+ * COMPRESSION WILL FAIL if it is enabled and the user tries to compress with a block-level
2799
+ * external sequence producer.
2800
+ * - Note that ZSTD_c_enableLongDistanceMatching is auto-enabled by default in some
2801
+ * cases (see its documentation for details). Users must explicitly set
2802
+ * ZSTD_c_enableLongDistanceMatching to ZSTD_ps_disable in such cases if an external
2803
+ * sequence producer is registered.
2804
+ * - As of this writing, ZSTD_c_enableLongDistanceMatching is disabled by default
2805
+ * whenever ZSTD_c_windowLog < 128MB, but that's subject to change. Users should
2806
+ * check the docs on ZSTD_c_enableLongDistanceMatching whenever the Block-Level Sequence
2807
+ * Producer API is used in conjunction with advanced settings (like ZSTD_c_windowLog).
2808
+ *
2809
+ * Second, history buffers are not currently supported. Concretely, zstd will always pass
2810
+ * dictSize == 0 to the external sequence producer (for now). This has two implications:
2811
+ * - Dictionaries are not currently supported. Compression will *not* fail if the user
2812
+ * references a dictionary, but the dictionary won't have any effect.
2813
+ * - Stream history is not currently supported. All advanced compression APIs, including
2814
+ * streaming APIs, work with external sequence producers, but each block is treated as
2815
+ * an independent chunk without history from previous blocks.
2816
+ *
2817
+ * Third, multi-threading within a single compression is not currently supported. In other words,
2818
+ * COMPRESSION WILL FAIL if ZSTD_c_nbWorkers > 0 and an external sequence producer is registered.
2819
+ * Multi-threading across compressions is fine: simply create one CCtx per thread.
2820
+ *
2821
+ * Long-term, we plan to overcome all three limitations. There is no technical blocker to
2822
+ * overcoming them. It is purely a question of engineering effort.
2823
+ */
2824
+
2825
+ #define ZSTD_SEQUENCE_PRODUCER_ERROR ((size_t)(-1))
2826
+
2827
+ typedef size_t (*ZSTD_sequenceProducer_F) (
2828
+ void* sequenceProducerState,
2829
+ ZSTD_Sequence* outSeqs, size_t outSeqsCapacity,
2830
+ const void* src, size_t srcSize,
2831
+ const void* dict, size_t dictSize,
2832
+ int compressionLevel,
2833
+ size_t windowSize
2834
+ );
2835
+
2836
+ /*! ZSTD_registerSequenceProducer() :
2837
+ * Instruct zstd to use a block-level external sequence producer function.
2838
+ *
2839
+ * The sequenceProducerState must be initialized by the caller, and the caller is
2840
+ * responsible for managing its lifetime. This parameter is sticky across
2841
+ * compressions. It will remain set until the user explicitly resets compression
2842
+ * parameters.
2843
+ *
2844
+ * Sequence producer registration is considered to be an "advanced parameter",
2845
+ * part of the "advanced API". This means it will only have an effect on compression
2846
+ * APIs which respect advanced parameters, such as compress2() and compressStream2().
2847
+ * Older compression APIs such as compressCCtx(), which predate the introduction of
2848
+ * "advanced parameters", will ignore any external sequence producer setting.
2849
+ *
2850
+ * The sequence producer can be "cleared" by registering a NULL function pointer. This
2851
+ * removes all limitations described above in the "LIMITATIONS" section of the API docs.
2852
+ *
2853
+ * The user is strongly encouraged to read the full API documentation (above) before
2854
+ * calling this function. */
2855
+ ZSTDLIB_STATIC_API void
2856
+ ZSTD_registerSequenceProducer(
2857
+ ZSTD_CCtx* cctx,
2858
+ void* sequenceProducerState,
2859
+ ZSTD_sequenceProducer_F sequenceProducer
2860
+ );
2861
+
2862
+ /*! ZSTD_CCtxParams_registerSequenceProducer() :
2863
+ * Same as ZSTD_registerSequenceProducer(), but operates on ZSTD_CCtx_params.
2864
+ * This is used for accurate size estimation with ZSTD_estimateCCtxSize_usingCCtxParams(),
2865
+ * which is needed when creating a ZSTD_CCtx with ZSTD_initStaticCCtx().
2866
+ *
2867
+ * If you are using the external sequence producer API in a scenario where ZSTD_initStaticCCtx()
2868
+ * is required, then this function is for you. Otherwise, you probably don't need it.
2869
+ *
2870
+ * See tests/zstreamtest.c for example usage. */
2871
+ ZSTDLIB_STATIC_API void
2872
+ ZSTD_CCtxParams_registerSequenceProducer(
2873
+ ZSTD_CCtx_params* params,
2874
+ void* sequenceProducerState,
2875
+ ZSTD_sequenceProducer_F sequenceProducer
2876
+ );
2877
+
2878
+
2879
+ /*********************************************************************
2880
+ * Buffer-less and synchronous inner streaming functions (DEPRECATED)
2881
+ *
2882
+ * This API is deprecated, and will be removed in a future version.
2883
+ * It allows streaming (de)compression with user allocated buffers.
2884
+ * However, it is hard to use, and not as well tested as the rest of
2885
+ * our API.
2886
+ *
2887
+ * Please use the normal streaming API instead: ZSTD_compressStream2,
2888
+ * and ZSTD_decompressStream.
2889
+ * If there is functionality that you need, but it doesn't provide,
2890
+ * please open an issue on our GitHub.
2891
+ ********************************************************************* */
2892
+
2893
+ /**
2894
+ Buffer-less streaming compression (synchronous mode)
2895
+
2896
+ A ZSTD_CCtx object is required to track streaming operations.
2897
+ Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource.
2898
+ ZSTD_CCtx object can be reused multiple times within successive compression operations.
2899
+
2900
+ Start by initializing a context.
2901
+ Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression.
2902
+
2903
+ Then, consume your input using ZSTD_compressContinue().
2904
+ There are some important considerations to keep in mind when using this advanced function :
2905
+ - ZSTD_compressContinue() has no internal buffer. It uses externally provided buffers only.
2906
+ - Interface is synchronous : input is consumed entirely and produces 1+ compressed blocks.
2907
+ - Caller must ensure there is enough space in `dst` to store compressed data under worst case scenario.
2908
+ Worst case evaluation is provided by ZSTD_compressBound().
2909
+ ZSTD_compressContinue() doesn't guarantee recover after a failed compression.
2910
+ - ZSTD_compressContinue() presumes prior input ***is still accessible and unmodified*** (up to maximum distance size, see WindowLog).
2911
+ It remembers all previous contiguous blocks, plus one separated memory segment (which can itself consists of multiple contiguous blocks)
2912
+ - ZSTD_compressContinue() detects that prior input has been overwritten when `src` buffer overlaps.
2913
+ In which case, it will "discard" the relevant memory section from its history.
2914
+
2915
+ Finish a frame with ZSTD_compressEnd(), which will write the last block(s) and optional checksum.
2916
+ It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame.
2917
+ Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders.
2918
+
2919
+ `ZSTD_CCtx` object can be reused (ZSTD_compressBegin()) to compress again.
2920
+ */
2921
+
2922
+ /*===== Buffer-less streaming compression functions =====*/
2923
+ ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
2924
+ ZSTDLIB_STATIC_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
2925
+ ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
2926
+ ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
2927
+ ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
2928
+ ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */
2929
+
2930
+ ZSTD_DEPRECATED("This function will likely be removed in a future release. It is misleading and has very limited utility.")
2931
+ ZSTDLIB_STATIC_API
2932
+ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */
2933
+
2934
+ ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
2935
+ ZSTDLIB_STATIC_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
2936
+ ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
2937
+ ZSTDLIB_STATIC_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
2938
+
2939
+ /* The ZSTD_compressBegin_advanced() and ZSTD_compressBegin_usingCDict_advanced() are now DEPRECATED and will generate a compiler warning */
2940
+ ZSTD_DEPRECATED("use advanced API to access custom parameters")
2941
+ ZSTDLIB_STATIC_API
2942
+ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); /**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */
2943
+ ZSTD_DEPRECATED("use advanced API to access custom parameters")
2944
+ ZSTDLIB_STATIC_API
2945
+ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize); /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */
2946
+ /**
2947
+ Buffer-less streaming decompression (synchronous mode)
2948
+
2949
+ A ZSTD_DCtx object is required to track streaming operations.
2950
+ Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.
2951
+ A ZSTD_DCtx object can be reused multiple times.
2952
+
2953
+ First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader().
2954
+ Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough.
2955
+ Data fragment must be large enough to ensure successful decoding.
2956
+ `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough.
2957
+ result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled.
2958
+ >0 : `srcSize` is too small, please provide at least result bytes on next attempt.
2959
+ errorCode, which can be tested using ZSTD_isError().
2960
+
2961
+ It fills a ZSTD_frameHeader structure with important information to correctly decode the frame,
2962
+ such as the dictionary ID, content size, or maximum back-reference distance (`windowSize`).
2963
+ Note that these values could be wrong, either because of data corruption, or because a 3rd party deliberately spoofs false information.
2964
+ As a consequence, check that values remain within valid application range.
2965
+ For example, do not allocate memory blindly, check that `windowSize` is within expectation.
2966
+ Each application can set its own limits, depending on local restrictions.
2967
+ For extended interoperability, it is recommended to support `windowSize` of at least 8 MB.
2968
+
2969
+ ZSTD_decompressContinue() needs previous data blocks during decompression, up to `windowSize` bytes.
2970
+ ZSTD_decompressContinue() is very sensitive to contiguity,
2971
+ if 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the same place,
2972
+ or that previous contiguous segment is large enough to properly handle maximum back-reference distance.
2973
+ There are multiple ways to guarantee this condition.
2974
+
2975
+ The most memory efficient way is to use a round buffer of sufficient size.
2976
+ Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(),
2977
+ which can return an error code if required value is too large for current system (in 32-bits mode).
2978
+ In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one,
2979
+ up to the moment there is not enough room left in the buffer to guarantee decoding another full block,
2980
+ which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`.
2981
+ At which point, decoding can resume from the beginning of the buffer.
2982
+ Note that already decoded data stored in the buffer should be flushed before being overwritten.
2983
+
2984
+ There are alternatives possible, for example using two or more buffers of size `windowSize` each, though they consume more memory.
2985
+
2986
+ Finally, if you control the compression process, you can also ignore all buffer size rules,
2987
+ as long as the encoder and decoder progress in "lock-step",
2988
+ aka use exactly the same buffer sizes, break contiguity at the same place, etc.
2989
+
2990
+ Once buffers are setup, start decompression, with ZSTD_decompressBegin().
2991
+ If decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict().
2992
+
2993
+ Then use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively.
2994
+ ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue().
2995
+ ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail.
2996
+
2997
+ result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity).
2998
+ It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item.
2999
+ It can also be an error code, which can be tested with ZSTD_isError().
3000
+
3001
+ A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero.
3002
+ Context can then be reset to start a new decompression.
3003
+
3004
+ Note : it's possible to know if next input to present is a header or a block, using ZSTD_nextInputType().
3005
+ This information is not required to properly decode a frame.
3006
+
3007
+ == Special case : skippable frames ==
3008
+
3009
+ Skippable frames allow integration of user-defined data into a flow of concatenated frames.
3010
+ Skippable frames will be ignored (skipped) by decompressor.
3011
+ The format of skippable frames is as follows :
3012
+ a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F
3013
+ b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits
3014
+ c) Frame Content - any content (User Data) of length equal to Frame Size
3015
+ For skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame.
3016
+ For skippable frames ZSTD_decompressContinue() always returns 0 : it only skips the content.
3017
+ */
3018
+
3019
+ /*===== Buffer-less streaming decompression functions =====*/
3020
+
3021
+ ZSTDLIB_STATIC_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
3022
+
3023
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
3024
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
3025
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
3026
+
3027
+ ZSTDLIB_STATIC_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx);
3028
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
3029
+
3030
+ /* misc */
3031
+ ZSTD_DEPRECATED("This function will likely be removed in the next minor release. It is misleading and has very limited utility.")
3032
+ ZSTDLIB_STATIC_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx);
3033
+ typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
3034
+ ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
3035
+
3036
+
3037
+
3038
+
3039
+ /* ========================================= */
3040
+ /** Block level API (DEPRECATED) */
3041
+ /* ========================================= */
3042
+
3043
+ /*!
3044
+
3045
+ This API is deprecated in favor of the regular compression API.
3046
+ You can get the frame header down to 2 bytes by setting:
3047
+ - ZSTD_c_format = ZSTD_f_zstd1_magicless
3048
+ - ZSTD_c_contentSizeFlag = 0
3049
+ - ZSTD_c_checksumFlag = 0
3050
+ - ZSTD_c_dictIDFlag = 0
3051
+
3052
+ This API is not as well tested as our normal API, so we recommend not using it.
3053
+ We will be removing it in a future version. If the normal API doesn't provide
3054
+ the functionality you need, please open a GitHub issue.
3055
+
3056
+ Block functions produce and decode raw zstd blocks, without frame metadata.
3057
+ Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes).
3058
+ But users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes.
3059
+
3060
+ A few rules to respect :
3061
+ - Compressing and decompressing require a context structure
3062
+ + Use ZSTD_createCCtx() and ZSTD_createDCtx()
3063
+ - It is necessary to init context before starting
3064
+ + compression : any ZSTD_compressBegin*() variant, including with dictionary
3065
+ + decompression : any ZSTD_decompressBegin*() variant, including with dictionary
3066
+ - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB
3067
+ + If input is larger than a block size, it's necessary to split input data into multiple blocks
3068
+ + For inputs larger than a single block, consider using regular ZSTD_compress() instead.
3069
+ Frame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block.
3070
+ - When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) !
3071
+ ===> In which case, nothing is produced into `dst` !
3072
+ + User __must__ test for such outcome and deal directly with uncompressed data
3073
+ + A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0.
3074
+ Doing so would mess up with statistics history, leading to potential data corruption.
3075
+ + ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !!
3076
+ + In case of multiple successive blocks, should some of them be uncompressed,
3077
+ decoder must be informed of their existence in order to follow proper history.
3078
+ Use ZSTD_insertBlock() for such a case.
3079
+ */
3080
+
3081
+ /*===== Raw zstd block functions =====*/
3082
+ ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
3083
+ ZSTDLIB_STATIC_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx);
3084
+ ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
3085
+ ZSTDLIB_STATIC_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
3086
+ ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
3087
+ ZSTDLIB_STATIC_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
3088
+ ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
3089
+ ZSTDLIB_STATIC_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */
3090
+
3091
+ #endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */
3092
+
3093
+ } // namespace duckdb_zstd