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.
- package/.github/workflows/NodeJS.yml +5 -54
- package/binding.gyp +73 -52
- package/package.json +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/avg.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/corr.cpp +4 -4
- package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/covar.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/algebraic/stddev.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/approx_count.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/arg_min_max.cpp +66 -18
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/bitagg.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/bitstring_agg.cpp +5 -7
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/bool.cpp +3 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/kurtosis.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/product.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/skew.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/string_agg.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/distributive/sum.cpp +13 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/approx_top_k.cpp +3 -3
- package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/approximate_quantile.cpp +51 -15
- package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/mad.cpp +25 -10
- package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/mode.cpp +215 -71
- package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/quantile.cpp +58 -31
- package/src/duckdb/{src → extension}/core_functions/aggregate/holistic/reservoir_quantile.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/nested/binned_histogram.cpp +9 -4
- package/src/duckdb/{src → extension}/core_functions/aggregate/nested/histogram.cpp +4 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/nested/list.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_avg.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_count.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_intercept.cpp +6 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_r2.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_slope.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_sxx_syy.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/aggregate/regression/regr_sxy.cpp +3 -3
- package/src/duckdb/extension/core_functions/core_functions_extension.cpp +85 -0
- package/src/duckdb/{src → extension}/core_functions/function_list.cpp +30 -51
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic/corr.hpp +3 -7
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/distributive_functions.hpp +16 -21
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/histogram_helpers.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/holistic_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/nested_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/quantile_helpers.hpp +2 -2
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/quantile_sort_tree.hpp +140 -58
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/quantile_state.hpp +50 -43
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/regression/regr_count.hpp +2 -2
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/regression/regr_slope.hpp +3 -7
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/regression_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/array_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/bit_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/blob_functions.hpp +1 -10
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/date_functions.hpp +22 -55
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/debug_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/enum_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/generic_functions.hpp +1 -10
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/list_functions.hpp +4 -4
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/map_functions.hpp +1 -10
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/math_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/operators_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/random_functions.hpp +1 -1
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/string_functions.hpp +10 -103
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/struct_functions.hpp +1 -19
- package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/union_functions.hpp +1 -1
- package/src/duckdb/extension/core_functions/include/core_functions_extension.hpp +22 -0
- package/src/duckdb/{src → extension}/core_functions/lambda_functions.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/array/array_functions.cpp +11 -4
- package/src/duckdb/{src → extension}/core_functions/scalar/array/array_value.cpp +2 -2
- package/src/duckdb/{src → extension}/core_functions/scalar/bit/bitstring.cpp +12 -5
- package/src/duckdb/{src → extension}/core_functions/scalar/blob/base64.cpp +4 -2
- package/src/duckdb/{src → extension}/core_functions/scalar/blob/encode.cpp +4 -2
- package/src/duckdb/{src → extension}/core_functions/scalar/date/age.cpp +9 -3
- package/src/duckdb/extension/core_functions/scalar/date/current.cpp +29 -0
- package/src/duckdb/{src → extension}/core_functions/scalar/date/date_diff.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/date/date_part.cpp +42 -9
- package/src/duckdb/{src → extension}/core_functions/scalar/date/date_sub.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/date/date_trunc.cpp +4 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/date/epoch.cpp +19 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/date/make_date.cpp +40 -5
- package/src/duckdb/{src → extension}/core_functions/scalar/date/time_bucket.cpp +4 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/date/to_interval.cpp +54 -28
- package/src/duckdb/{src → extension}/core_functions/scalar/debug/vector_type.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/enum/enum_functions.cpp +2 -7
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/alias.cpp +2 -2
- package/src/duckdb/{src/function → extension/core_functions}/scalar/generic/binning.cpp +4 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/can_implicitly_cast.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/current_setting.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/hash.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/least.cpp +30 -10
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/stats.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/system_functions.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/generic/typeof.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/list/array_slice.cpp +93 -88
- package/src/duckdb/{src → extension}/core_functions/scalar/list/flatten.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_aggregates.cpp +7 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_distance.cpp +8 -2
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_filter.cpp +3 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_has_any_or_all.cpp +3 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_reduce.cpp +5 -5
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_sort.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_transform.cpp +3 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/list/list_value.cpp +3 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/list/range.cpp +7 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/map/cardinality.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/map/map.cpp +5 -4
- package/src/duckdb/{src → extension}/core_functions/scalar/map/map_concat.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/map/map_entries.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/map/map_extract.cpp +13 -25
- package/src/duckdb/{src → extension}/core_functions/scalar/map/map_from_entries.cpp +2 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/map/map_keys_values.cpp +11 -9
- package/src/duckdb/{src → extension}/core_functions/scalar/math/numeric.cpp +83 -37
- package/src/duckdb/{src → extension}/core_functions/scalar/operators/bitwise.cpp +19 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/random/random.cpp +4 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/random/setseed.cpp +2 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/ascii.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/bar.cpp +6 -4
- package/src/duckdb/{src → extension}/core_functions/scalar/string/chr.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/damerau_levenshtein.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/format_bytes.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/hamming.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/hex.cpp +7 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/string/instr.cpp +4 -4
- package/src/duckdb/{src → extension}/core_functions/scalar/string/jaccard.cpp +1 -1
- package/src/duckdb/extension/core_functions/scalar/string/jaro_winkler.cpp +112 -0
- package/src/duckdb/{src → extension}/core_functions/scalar/string/left_right.cpp +6 -6
- package/src/duckdb/{src → extension}/core_functions/scalar/string/levenshtein.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/pad.cpp +9 -5
- package/src/duckdb/{src → extension}/core_functions/scalar/string/parse_path.cpp +4 -4
- package/src/duckdb/{src → extension}/core_functions/scalar/string/printf.cpp +3 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/repeat.cpp +4 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/replace.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/reverse.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/starts_with.cpp +5 -3
- package/src/duckdb/{src → extension}/core_functions/scalar/string/to_base.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/translate.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/trim.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/unicode.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/string/url_encode.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/struct/struct_insert.cpp +25 -31
- package/src/duckdb/{src → extension}/core_functions/scalar/union/union_extract.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/union/union_tag.cpp +1 -1
- package/src/duckdb/{src → extension}/core_functions/scalar/union/union_value.cpp +3 -3
- package/src/duckdb/extension/icu/icu-dateadd.cpp +16 -11
- package/src/duckdb/extension/icu/icu-datefunc.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datepart.cpp +8 -5
- package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +8 -1
- package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-makedate.cpp +18 -7
- package/src/duckdb/extension/icu/icu-strptime.cpp +9 -3
- package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timebucket.cpp +4 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +67 -1
- package/src/duckdb/extension/icu/icu_extension.cpp +60 -5
- package/src/duckdb/extension/icu/include/icu-datefunc.hpp +2 -1
- package/src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/dtintrv.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/filteredbrk.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/locid.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/lsr.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/lsr.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/rbbinode.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/schriter.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp +8 -8
- package/src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/brkiter.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestriebuilder.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/chariter.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/dtintrv.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/locid.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/messagepattern.h +4 -4
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/normlzr.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/parsepos.h +4 -4
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/rbbi.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/schriter.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/strenum.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/stringpiece.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/stringtriebuilder.h +9 -9
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/ucharstriebuilder.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/uchriter.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/uniset.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/unistr.h +12 -12
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/uobject.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.h +4 -4
- package/src/duckdb/extension/icu/third_party/icu/common/uniset.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/ustr_titlecase_brkiter.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uvector.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uvectr32.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uvectr64.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen_impl.h +4 -4
- package/src/duckdb/extension/icu/third_party/icu/i18n/dtrule.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp +9 -9
- package/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp +4 -4
- package/src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/region.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/selfmt.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/simpletz.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/smpdtfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/sortkey.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/timezone.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/tmutamt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/tzfmt.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/tznames.cpp +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/tznames_impl.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/tznames_impl.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/tzrule.cpp +8 -8
- package/src/duckdb/extension/icu/third_party/icu/i18n/tztrans.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/alphaindex.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/calendar.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/choicfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coleitr.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coll.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/currpinf.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/datefmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dcfmtsym.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/decimfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtfmtsym.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtitvfmt.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtitvinf.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtptngen.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/dtrule.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/fieldpos.h +4 -4
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/fmtable.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/format.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/fpositer.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/measfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/measunit.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/measure.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/msgfmt.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/numfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/plurfmt.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/plurrule.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/rbnf.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/rbtz.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/region.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/search.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/selfmt.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/simpletz.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/smpdtfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/sortkey.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/stsearch.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tblcoll.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/timezone.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tmutamt.h +3 -3
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tmutfmt.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tzfmt.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tznames.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tzrule.h +8 -8
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/tztrans.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/vtzone.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/utf16collationiterator.cpp +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/utf16collationiterator.h +2 -2
- package/src/duckdb/extension/icu/third_party/icu/i18n/vtzone.cpp +2 -2
- package/src/duckdb/extension/json/buffered_json_reader.cpp +6 -1
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +2 -0
- package/src/duckdb/extension/json/include/json_common.hpp +14 -10
- package/src/duckdb/extension/json/include/json_scan.hpp +48 -7
- package/src/duckdb/extension/json/include/json_structure.hpp +2 -1
- package/src/duckdb/extension/json/include/json_transform.hpp +5 -2
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_create.cpp +57 -20
- package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +7 -6
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +6 -5
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +20 -17
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +48 -17
- package/src/duckdb/extension/json/json_functions/read_json.cpp +83 -34
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +3 -3
- package/src/duckdb/extension/json/json_functions.cpp +14 -16
- package/src/duckdb/extension/json/json_scan.cpp +36 -16
- package/src/duckdb/extension/json/json_serializer.cpp +1 -1
- package/src/duckdb/extension/json/serialize_json.cpp +2 -2
- package/src/duckdb/extension/parquet/column_reader.cpp +136 -116
- package/src/duckdb/extension/parquet/column_writer.cpp +870 -604
- package/src/duckdb/extension/parquet/geo_parquet.cpp +4 -5
- package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +0 -4
- package/src/duckdb/extension/parquet/include/column_reader.hpp +24 -19
- package/src/duckdb/extension/parquet/include/column_writer.hpp +7 -5
- package/src/duckdb/extension/parquet/include/decode_utils.hpp +138 -18
- package/src/duckdb/extension/parquet/include/geo_parquet.hpp +4 -3
- package/src/duckdb/extension/parquet/include/null_column_reader.hpp +1 -14
- package/src/duckdb/extension/parquet/include/parquet_bss_encoder.hpp +45 -0
- package/src/duckdb/extension/parquet/include/parquet_crypto.hpp +1 -1
- package/src/duckdb/extension/parquet/include/parquet_dbp_decoder.hpp +101 -90
- package/src/duckdb/extension/parquet/include/parquet_dbp_encoder.hpp +179 -0
- package/src/duckdb/extension/parquet/include/parquet_decimal_utils.hpp +2 -3
- package/src/duckdb/extension/parquet/include/parquet_dlba_encoder.hpp +48 -0
- package/src/duckdb/extension/parquet/include/parquet_extension.hpp +8 -0
- package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +2 -2
- package/src/duckdb/extension/parquet/include/parquet_metadata.hpp +5 -0
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +22 -18
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -5
- package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +87 -3
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +30 -16
- package/src/duckdb/extension/parquet/include/resizable_buffer.hpp +1 -0
- package/src/duckdb/extension/parquet/include/string_column_reader.hpp +0 -8
- package/src/duckdb/extension/parquet/include/struct_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +1 -42
- package/src/duckdb/extension/parquet/include/thrift_tools.hpp +13 -1
- package/src/duckdb/extension/parquet/include/zstd_file_system.hpp +4 -0
- package/src/duckdb/extension/parquet/parquet_extension.cpp +240 -197
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +138 -6
- package/src/duckdb/extension/parquet/parquet_reader.cpp +155 -79
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +258 -38
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +17 -3
- package/src/duckdb/extension/parquet/parquet_writer.cpp +65 -34
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +4 -0
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +13 -0
- package/src/duckdb/src/catalog/catalog.cpp +272 -97
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +9 -4
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +8 -0
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +145 -95
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +9 -3
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +15 -0
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +40 -24
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry.cpp +3 -0
- package/src/duckdb/src/catalog/catalog_entry_retriever.cpp +60 -5
- package/src/duckdb/src/catalog/catalog_search_path.cpp +27 -14
- package/src/duckdb/src/catalog/catalog_set.cpp +75 -31
- package/src/duckdb/src/catalog/default/default_functions.cpp +13 -8
- package/src/duckdb/src/catalog/default/default_views.cpp +1 -0
- package/src/duckdb/src/catalog/dependency_manager.cpp +133 -5
- package/src/duckdb/src/catalog/duck_catalog.cpp +17 -9
- package/src/duckdb/src/common/adbc/adbc.cpp +18 -0
- package/src/duckdb/src/common/allocator.cpp +3 -1
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +30 -9
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +63 -82
- package/src/duckdb/src/common/arrow/arrow_merge_event.cpp +4 -3
- package/src/duckdb/src/common/arrow/arrow_type_extension.cpp +361 -0
- package/src/duckdb/src/common/arrow/arrow_util.cpp +10 -6
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +6 -2
- package/src/duckdb/src/common/arrow/physical_arrow_collector.cpp +2 -1
- package/src/duckdb/src/common/arrow/schema_metadata.cpp +27 -14
- package/src/duckdb/src/common/assert.cpp +1 -2
- package/src/duckdb/src/common/bind_helpers.cpp +1 -1
- package/src/duckdb/src/common/box_renderer.cpp +316 -26
- package/src/duckdb/src/common/cgroups.cpp +7 -1
- package/src/duckdb/src/common/compressed_file_system.cpp +1 -1
- package/src/duckdb/src/common/enum_util.cpp +2865 -6882
- package/src/duckdb/src/common/enums/compression_type.cpp +12 -0
- package/src/duckdb/src/common/enums/metric_type.cpp +24 -0
- package/src/duckdb/src/common/enums/optimizer_type.cpp +4 -0
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/error_data.cpp +23 -6
- package/src/duckdb/src/common/exception/binder_exception.cpp +1 -1
- package/src/duckdb/src/common/exception.cpp +20 -28
- package/src/duckdb/src/common/extra_type_info.cpp +85 -20
- package/src/duckdb/src/common/file_buffer.cpp +5 -2
- package/src/duckdb/src/common/file_system.cpp +8 -3
- package/src/duckdb/src/common/fsst.cpp +3 -3
- package/src/duckdb/src/common/hive_partitioning.cpp +1 -1
- package/src/duckdb/src/common/local_file_system.cpp +169 -60
- package/src/duckdb/src/common/multi_file_list.cpp +4 -1
- package/src/duckdb/src/common/multi_file_reader.cpp +240 -63
- package/src/duckdb/src/common/opener_file_system.cpp +37 -0
- package/src/duckdb/src/common/operator/cast_operators.cpp +77 -11
- package/src/duckdb/src/common/operator/string_cast.cpp +6 -2
- package/src/duckdb/src/common/pipe_file_system.cpp +4 -4
- package/src/duckdb/src/common/progress_bar/progress_bar.cpp +25 -14
- package/src/duckdb/src/common/radix_partitioning.cpp +17 -16
- package/src/duckdb/src/common/random_engine.cpp +39 -3
- package/src/duckdb/src/common/render_tree.cpp +3 -19
- package/src/duckdb/src/common/row_operations/row_external.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_gather.cpp +2 -58
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_radix_scatter.cpp +2 -0
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +20 -19
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +1 -1
- package/src/duckdb/src/common/serializer/memory_stream.cpp +36 -0
- package/src/duckdb/src/common/sort/comparators.cpp +7 -7
- package/src/duckdb/src/common/sort/partition_state.cpp +2 -2
- package/src/duckdb/src/common/stacktrace.cpp +127 -0
- package/src/duckdb/src/common/string_util.cpp +157 -32
- package/src/duckdb/src/common/tree_renderer/text_tree_renderer.cpp +15 -3
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +4 -0
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +71 -8
- package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +27 -6
- package/src/duckdb/src/common/types/conflict_manager.cpp +21 -7
- package/src/duckdb/src/common/types/date.cpp +39 -25
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +4 -11
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +21 -7
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +10 -1
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +17 -17
- package/src/duckdb/src/common/types/timestamp.cpp +70 -33
- package/src/duckdb/src/common/types/uuid.cpp +11 -0
- package/src/duckdb/src/common/types/validity_mask.cpp +16 -5
- package/src/duckdb/src/common/types/value.cpp +357 -199
- package/src/duckdb/src/common/types/varint.cpp +64 -18
- package/src/duckdb/src/common/types/vector.cpp +78 -38
- package/src/duckdb/src/common/types.cpp +199 -92
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +2 -1
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +32 -5
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +3 -1
- package/src/duckdb/src/execution/adaptive_filter.cpp +6 -2
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +410 -111
- package/src/duckdb/src/execution/column_binding_resolver.cpp +2 -2
- package/src/duckdb/src/execution/expression_executor/execute_between.cpp +6 -0
- package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +4 -3
- package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +2 -2
- package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +2 -2
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +1 -0
- package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +5 -4
- package/src/duckdb/src/execution/expression_executor.cpp +5 -3
- package/src/duckdb/src/execution/index/art/art.cpp +208 -72
- package/src/duckdb/src/execution/index/art/base_leaf.cpp +1 -1
- package/src/duckdb/src/execution/index/art/leaf.cpp +12 -7
- package/src/duckdb/src/execution/index/art/node.cpp +2 -1
- package/src/duckdb/src/execution/index/art/node256_leaf.cpp +6 -6
- package/src/duckdb/src/execution/index/art/plan_art.cpp +50 -55
- package/src/duckdb/src/execution/index/art/prefix.cpp +7 -13
- package/src/duckdb/src/execution/index/bound_index.cpp +30 -5
- package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +3 -5
- package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +14 -9
- package/src/duckdb/src/execution/join_hashtable.cpp +254 -158
- package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +7 -7
- package/src/duckdb/src/execution/operator/aggregate/physical_partitioned_aggregate.cpp +226 -0
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +3 -3
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +3 -3
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +77 -70
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +114 -50
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +2 -2
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +19 -10
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +22 -15
- package/src/duckdb/src/execution/operator/csv_scanner/encode/csv_encoder.cpp +95 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +6 -1
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/csv_schema.cpp +75 -2
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +40 -12
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +395 -163
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +20 -23
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +115 -49
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +66 -12
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +20 -23
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +220 -46
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +43 -32
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +54 -119
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +184 -20
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +83 -21
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_validator.cpp +63 -0
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +7 -4
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_verify_vector.cpp +9 -1
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +132 -15
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +64 -55
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +284 -154
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +40 -55
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +0 -1
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +7 -3
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +298 -227
- package/src/duckdb/src/execution/operator/persistent/csv_rejects_table.cpp +5 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +3 -4
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +32 -19
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +1 -0
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +6 -0
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +58 -19
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +11 -27
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +308 -119
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +105 -55
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +6 -2
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +15 -6
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +92 -50
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +0 -1
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +8 -4
- package/src/duckdb/src/execution/operator/schema/physical_create_art_index.cpp +54 -22
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +5 -1
- package/src/duckdb/src/execution/physical_operator.cpp +15 -9
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +101 -12
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +11 -140
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +11 -13
- package/src/duckdb/src/execution/physical_plan/plan_cte.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +6 -5
- package/src/duckdb/src/execution/physical_plan/plan_export.cpp +0 -4
- package/src/duckdb/src/execution/physical_plan/plan_filter.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +16 -13
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_order.cpp +7 -7
- package/src/duckdb/src/execution/physical_plan/plan_prepare.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +8 -3
- package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +1 -2
- package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +1 -2
- package/src/duckdb/src/execution/physical_plan/plan_top_n.cpp +3 -2
- package/src/duckdb/src/execution/physical_plan_generator.cpp +0 -22
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +136 -116
- package/src/duckdb/src/execution/sample/base_reservoir_sample.cpp +136 -0
- package/src/duckdb/src/execution/sample/reservoir_sample.cpp +930 -0
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +6 -12
- package/src/duckdb/src/function/aggregate/distributive/{first.cpp → first_last_any.cpp} +37 -18
- package/src/duckdb/src/{core_functions → function}/aggregate/distributive/minmax.cpp +19 -12
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +72 -13
- package/src/duckdb/src/function/built_in_functions.cpp +85 -2
- package/src/duckdb/src/function/cast/decimal_cast.cpp +1 -1
- package/src/duckdb/src/function/cast/string_cast.cpp +1 -1
- package/src/duckdb/src/function/cast/struct_cast.cpp +81 -49
- package/src/duckdb/src/function/cast/union/from_struct.cpp +7 -5
- package/src/duckdb/src/function/compression_config.cpp +6 -0
- package/src/duckdb/src/function/encoding_function.cpp +134 -0
- package/src/duckdb/src/function/function.cpp +8 -13
- package/src/duckdb/src/function/function_binder.cpp +100 -21
- package/src/duckdb/src/function/function_list.cpp +178 -0
- package/src/duckdb/src/function/macro_function.cpp +4 -4
- package/src/duckdb/src/function/pragma/pragma_functions.cpp +0 -2
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +0 -4
- package/src/duckdb/src/{core_functions/core_functions.cpp → function/register_function_list.cpp} +12 -8
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +62 -23
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +33 -16
- package/src/duckdb/src/function/scalar/compressed_materialization_utils.cpp +21 -0
- package/src/duckdb/src/{core_functions/scalar/blob → function/scalar}/create_sort_key.cpp +86 -23
- package/src/duckdb/src/{core_functions → function}/scalar/date/strftime.cpp +6 -4
- package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +5 -7
- package/src/duckdb/src/{core_functions → function}/scalar/generic/error.cpp +3 -1
- package/src/duckdb/src/function/scalar/generic/getvariable.cpp +2 -2
- package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +1 -7
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +27 -21
- package/src/duckdb/src/function/scalar/list/list_resize.cpp +8 -12
- package/src/duckdb/src/function/scalar/list/list_select.cpp +1 -4
- package/src/duckdb/src/function/scalar/list/list_zip.cpp +6 -6
- package/src/duckdb/src/{core_functions → function}/scalar/map/map_contains.cpp +2 -2
- package/src/duckdb/src/function/scalar/nested_functions.cpp +0 -11
- package/src/duckdb/src/function/scalar/{operators → operator}/add.cpp +2 -1
- package/src/duckdb/src/function/scalar/{operators → operator}/arithmetic.cpp +195 -127
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +30 -21
- package/src/duckdb/src/function/scalar/strftime_format.cpp +10 -0
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +11 -41
- package/src/duckdb/src/function/scalar/string/concat.cpp +22 -20
- package/src/duckdb/src/function/scalar/string/concat_ws.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/contains.cpp +16 -19
- package/src/duckdb/src/function/scalar/string/length.cpp +38 -24
- package/src/duckdb/src/function/scalar/string/like.cpp +80 -47
- package/src/duckdb/src/{core_functions → function}/scalar/string/md5.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/nfc_normalize.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/prefix.cpp +0 -4
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +2 -1
- package/src/duckdb/src/function/scalar/string/regexp.cpp +17 -7
- package/src/duckdb/src/{core_functions → function}/scalar/string/regexp_escape.cpp +2 -2
- package/src/duckdb/src/{core_functions → function}/scalar/string/sha1.cpp +1 -1
- package/src/duckdb/src/{core_functions → function}/scalar/string/sha256.cpp +1 -1
- package/src/duckdb/src/{core_functions → function}/scalar/string/string_split.cpp +4 -5
- package/src/duckdb/src/function/scalar/string/strip_accents.cpp +3 -6
- package/src/duckdb/src/function/scalar/string/substring.cpp +14 -13
- package/src/duckdb/src/function/scalar/string/suffix.cpp +0 -4
- package/src/duckdb/src/function/scalar/struct/struct_concat.cpp +115 -0
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +35 -31
- package/src/duckdb/src/{core_functions → function}/scalar/struct/struct_pack.cpp +7 -7
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -8
- package/src/duckdb/src/function/scalar/system/write_log.cpp +170 -0
- package/src/duckdb/src/function/scalar_function.cpp +5 -5
- package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +3 -2
- package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +287 -1
- package/src/duckdb/src/function/table/arrow/arrow_type_info.cpp +6 -6
- package/src/duckdb/src/function/table/arrow.cpp +32 -352
- package/src/duckdb/src/function/table/arrow_conversion.cpp +43 -7
- package/src/duckdb/src/function/table/copy_csv.cpp +38 -23
- package/src/duckdb/src/function/table/glob.cpp +1 -1
- package/src/duckdb/src/function/table/query_function.cpp +12 -7
- package/src/duckdb/src/function/table/read_csv.cpp +114 -46
- package/src/duckdb/src/function/table/read_file.cpp +26 -6
- package/src/duckdb/src/function/table/sniff_csv.cpp +25 -5
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +6 -7
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +141 -16
- package/src/duckdb/src/function/table/system/duckdb_log.cpp +64 -0
- package/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp +65 -0
- package/src/duckdb/src/function/table/system/duckdb_memory.cpp +0 -1
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +1 -13
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +17 -0
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +6 -0
- package/src/duckdb/src/function/table/system/pragma_table_sample.cpp +95 -0
- package/src/duckdb/src/function/table/system/test_all_types.cpp +56 -46
- package/src/duckdb/src/function/table/system_functions.cpp +3 -0
- package/src/duckdb/src/function/table/table_scan.cpp +487 -289
- package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
- package/src/duckdb/src/function/table_function.cpp +10 -6
- package/src/duckdb/src/function/window/window_aggregate_function.cpp +248 -0
- package/src/duckdb/src/function/window/window_aggregate_states.cpp +48 -0
- package/src/duckdb/src/function/window/window_aggregator.cpp +88 -0
- package/src/duckdb/src/function/window/window_boundaries_state.cpp +854 -0
- package/src/duckdb/src/function/window/window_collection.cpp +146 -0
- package/src/duckdb/src/function/window/window_constant_aggregator.cpp +357 -0
- package/src/duckdb/src/function/window/window_custom_aggregator.cpp +146 -0
- package/src/duckdb/src/function/window/window_distinct_aggregator.cpp +758 -0
- package/src/duckdb/src/function/window/window_executor.cpp +99 -0
- package/src/duckdb/src/function/window/window_index_tree.cpp +63 -0
- package/src/duckdb/src/function/window/window_merge_sort_tree.cpp +275 -0
- package/src/duckdb/src/function/window/window_naive_aggregator.cpp +361 -0
- package/src/duckdb/src/function/window/window_rank_function.cpp +288 -0
- package/src/duckdb/src/function/window/window_rownumber_function.cpp +191 -0
- package/src/duckdb/src/function/window/window_segment_tree.cpp +594 -0
- package/src/duckdb/src/function/window/window_shared_expressions.cpp +50 -0
- package/src/duckdb/src/function/window/window_token_tree.cpp +142 -0
- package/src/duckdb/src/function/window/window_value_function.cpp +566 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +74 -17
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +9 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/function_entry.hpp +4 -10
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +18 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +5 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry_retriever.hpp +21 -18
- package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +3 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +10 -2
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +11 -0
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -4
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/array_ptr.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_view_data.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_converter.hpp +26 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_query_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_type_extension.hpp +144 -0
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_util.hpp +5 -2
- package/src/duckdb/src/include/duckdb/common/arrow/result_arrow_wrapper.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/arrow/schema_metadata.hpp +11 -4
- package/src/duckdb/src/include/duckdb/common/assert.hpp +12 -1
- package/src/duckdb/src/include/duckdb/common/atomic_ptr.hpp +102 -0
- package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +65 -6
- package/src/duckdb/src/include/duckdb/common/chrono.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/column_index.hpp +72 -0
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +120 -0
- package/src/duckdb/src/include/duckdb/{core_functions/core_functions.hpp → common/enums/collation_type.hpp} +2 -7
- package/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp +5 -2
- package/src/duckdb/src/include/duckdb/common/enums/function_errors.hpp +18 -0
- package/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +7 -2
- package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/enums/order_preservation_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/profiler_format.hpp +1 -1
- package/src/duckdb/src/include/duckdb/{core_functions/aggregate → common/enums}/quantile_enum.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/enums/scan_vector_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/error_data.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/extension_type_info.hpp +37 -0
- package/src/duckdb/src/include/duckdb/common/extra_operator_info.hpp +7 -2
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +9 -3
- package/src/duckdb/src/include/duckdb/common/fast_mem.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +19 -10
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +6 -1
- package/src/duckdb/src/include/duckdb/common/fsst.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/helper.hpp +6 -0
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/insertion_order_preserving_map.hpp +12 -2
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/multi_file_list.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +147 -27
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +2 -7
- package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +16 -5
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +16 -0
- package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/platform.hpp +34 -3
- package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +10 -13
- package/src/duckdb/src/include/duckdb/common/random_engine.hpp +8 -3
- package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +0 -2
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/memory_stream.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serializer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/stacktrace.hpp +25 -0
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +30 -2
- package/src/duckdb/src/include/duckdb/common/tree_renderer/graphviz_tree_renderer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/tree_renderer/html_tree_renderer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/tree_renderer/json_tree_renderer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/tree_renderer/text_tree_renderer.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/type_util.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +13 -2
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +21 -4
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/types/date.hpp +9 -4
- package/src/duckdb/src/include/duckdb/common/types/date_lookup_cache.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +58 -10
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +43 -16
- package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +63 -21
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +62 -16
- package/src/duckdb/src/include/duckdb/common/types/varint.hpp +13 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +34 -7
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +15 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +12 -7
- package/src/duckdb/src/include/duckdb/common/uhugeint.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +12 -13
- package/src/duckdb/src/include/duckdb/common/vector_operations/binary_executor.hpp +27 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +111 -4
- package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/adaptive_filter.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +48 -10
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/ht_entry.hpp +25 -27
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +28 -18
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/index/bound_index.hpp +23 -16
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +25 -16
- package/src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp +15 -10
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/{persistent/physical_fixed_batch_copy.hpp → aggregate/physical_partitioned_aggregate.hpp} +25 -27
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +5 -4
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/ungrouped_aggregate_state.hpp +21 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +38 -9
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer.hpp +8 -9
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +7 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +29 -23
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +15 -13
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +13 -5
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +24 -10
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_schema.hpp +36 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +21 -13
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +52 -22
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine_cache.hpp +6 -6
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_validator.hpp +58 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/encode/csv_encoder.hpp +62 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +6 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner_boundary.hpp +16 -6
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +9 -4
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine_options.hpp +8 -4
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +55 -10
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_batch_collector.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/join_filter_pushdown.hpp +28 -7
- package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +6 -9
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +17 -16
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +7 -3
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +5 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +55 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +10 -9
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_art_index.hpp +16 -13
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_cte.hpp +0 -4
- package/src/duckdb/src/include/duckdb/execution/partition_info.hpp +79 -0
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +20 -9
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +1 -11
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/progress_data.hpp +58 -0
- package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/reservoir_sample.hpp +160 -31
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_function_utils.hpp +31 -0
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +61 -10
- package/src/duckdb/src/include/duckdb/{core_functions → function}/aggregate/minmax_n_helpers.hpp +1 -1
- package/src/duckdb/src/include/duckdb/{core_functions → function}/aggregate/sort_key_helpers.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +47 -27
- package/src/duckdb/src/include/duckdb/function/aggregate_state.hpp +2 -0
- package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +3 -10
- package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +13 -6
- package/src/duckdb/src/include/duckdb/function/compression/compression.hpp +15 -0
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +29 -6
- package/src/duckdb/src/include/duckdb/{core_functions → function}/create_sort_key.hpp +4 -1
- package/src/duckdb/src/include/duckdb/function/encoding_function.hpp +78 -0
- package/src/duckdb/src/include/duckdb/function/function.hpp +22 -1
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/function_list.hpp +39 -0
- package/src/duckdb/src/include/duckdb/function/function_set.hpp +13 -7
- package/src/duckdb/src/include/duckdb/{core_functions → function}/lambda_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/partition_stats.hpp +36 -0
- package/src/duckdb/src/include/duckdb/function/register_function_list_helper.hpp +69 -0
- package/src/duckdb/src/include/duckdb/function/scalar/compressed_materialization_functions.hpp +154 -23
- package/src/duckdb/src/include/duckdb/function/scalar/compressed_materialization_utils.hpp +45 -0
- package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +45 -0
- package/src/duckdb/src/include/duckdb/function/scalar/generic_common.hpp +36 -0
- package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +32 -23
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/list_functions.hpp +156 -0
- package/src/duckdb/src/include/duckdb/function/scalar/map_functions.hpp +27 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +4 -45
- package/src/duckdb/src/include/duckdb/function/scalar/operator_functions.hpp +102 -0
- package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +2 -16
- package/src/duckdb/src/include/duckdb/function/scalar/sequence_functions.hpp +16 -25
- package/src/duckdb/src/include/duckdb/function/scalar/sequence_utils.hpp +38 -0
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/string_common.hpp +49 -0
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +401 -76
- package/src/duckdb/src/include/duckdb/function/scalar/struct_functions.hpp +63 -0
- package/src/duckdb/src/include/duckdb/function/scalar/struct_utils.hpp +33 -0
- package/src/duckdb/src/include/duckdb/function/scalar/system_functions.hpp +45 -0
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +17 -8
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +59 -6
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_type_info.hpp +12 -9
- package/src/duckdb/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +18 -13
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +7 -4
- package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +14 -0
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +15 -10
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +94 -18
- package/src/duckdb/src/include/duckdb/{core_functions → function}/to_interval.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/window/window_aggregate_function.hpp +44 -0
- package/src/duckdb/src/include/duckdb/function/window/window_aggregate_states.hpp +56 -0
- package/src/duckdb/src/include/duckdb/function/window/window_aggregator.hpp +194 -0
- package/src/duckdb/src/include/duckdb/function/window/window_boundaries_state.hpp +153 -0
- package/src/duckdb/src/include/duckdb/function/window/window_collection.hpp +146 -0
- package/src/duckdb/src/include/duckdb/function/window/window_constant_aggregator.hpp +38 -0
- package/src/duckdb/src/include/duckdb/function/window/window_custom_aggregator.hpp +32 -0
- package/src/duckdb/src/include/duckdb/function/window/window_distinct_aggregator.hpp +39 -0
- package/src/duckdb/src/include/duckdb/function/window/window_executor.hpp +122 -0
- package/src/duckdb/src/include/duckdb/function/window/window_index_tree.hpp +42 -0
- package/src/duckdb/src/include/duckdb/function/window/window_merge_sort_tree.hpp +108 -0
- package/src/duckdb/src/include/duckdb/function/window/window_naive_aggregator.hpp +33 -0
- package/src/duckdb/src/include/duckdb/function/window/window_rank_function.hpp +63 -0
- package/src/duckdb/src/include/duckdb/function/window/window_rownumber_function.hpp +43 -0
- package/src/duckdb/src/include/duckdb/function/window/window_segment_tree.hpp +31 -0
- package/src/duckdb/src/include/duckdb/function/window/window_shared_expressions.hpp +76 -0
- package/src/duckdb/src/include/duckdb/function/window/window_token_tree.hpp +46 -0
- package/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp +79 -0
- package/src/duckdb/src/include/duckdb/logging/http_logger.hpp +2 -0
- package/src/duckdb/src/include/duckdb/logging/log_manager.hpp +81 -0
- package/src/duckdb/src/include/duckdb/logging/log_storage.hpp +127 -0
- package/src/duckdb/src/include/duckdb/logging/logger.hpp +287 -0
- package/src/duckdb/src/include/duckdb/logging/logging.hpp +83 -0
- package/src/duckdb/src/include/duckdb/main/appender.hpp +41 -18
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +6 -3
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +7 -2
- package/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp +317 -231
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +17 -1
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +28 -6
- package/src/duckdb/src/include/duckdb/main/client_context_file_opener.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/client_context_wrapper.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/client_properties.hpp +8 -3
- package/src/duckdb/src/include/duckdb/main/config.hpp +52 -8
- package/src/duckdb/src/include/duckdb/main/connection.hpp +18 -3
- package/src/duckdb/src/include/duckdb/main/database.hpp +8 -7
- package/src/duckdb/src/include/duckdb/main/database_file_opener.hpp +5 -1
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/db_instance_cache.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/extension.hpp +8 -2
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +548 -9
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +18 -0
- package/src/duckdb/src/include/duckdb/main/extension_util.hpp +12 -7
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/profiling_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +8 -4
- package/src/duckdb/src/include/duckdb/main/relation/create_table_relation.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/relation/delete_relation.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/relation/subquery_relation.hpp +1 -4
- package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/relation/table_relation.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/relation/update_relation.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/relation/value_relation.hpp +7 -0
- package/src/duckdb/src/include/duckdb/main/relation/view_relation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/relation/write_parquet_relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/relation.hpp +45 -9
- package/src/duckdb/src/include/duckdb/main/secret/secret_storage.hpp +20 -22
- package/src/duckdb/src/include/duckdb/main/settings.hpp +613 -378
- package/src/duckdb/src/include/duckdb/main/table_description.hpp +14 -4
- package/src/duckdb/src/include/duckdb/optimizer/build_probe_side_optimizer.hpp +1 -3
- package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_analyzer.hpp +14 -7
- package/src/duckdb/src/include/duckdb/optimizer/common_aggregate_optimizer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/empty_result_pullup.hpp +27 -0
- package/src/duckdb/src/include/duckdb/optimizer/expression_heuristics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +6 -1
- package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +2 -0
- package/src/duckdb/src/include/duckdb/optimizer/in_clause_rewriter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_filter_pushdown_optimizer.hpp +5 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/plan_enumerator.hpp +2 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/late_materialization.hpp +45 -0
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +23 -0
- package/src/duckdb/src/include/duckdb/optimizer/matcher/type_matcher.hpp +18 -0
- package/src/duckdb/src/include/duckdb/optimizer/optimizer.hpp +9 -0
- package/src/duckdb/src/include/duckdb/optimizer/remove_unused_columns.hpp +33 -11
- package/src/duckdb/src/include/duckdb/optimizer/rule/distinct_aggregate_optimizer.hpp +34 -0
- package/src/duckdb/src/include/duckdb/optimizer/sampling_pushdown.hpp +25 -0
- package/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +3 -1
- package/src/duckdb/src/include/duckdb/optimizer/sum_rewriter.hpp +37 -0
- package/src/duckdb/src/include/duckdb/optimizer/topn_optimizer.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +26 -8
- package/src/duckdb/src/include/duckdb/parallel/thread_context.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +51 -3
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +28 -44
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +6 -6
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +11 -1
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +12 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_scalar_function_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +22 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +3 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_column_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +16 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +12 -3
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +17 -57
- package/src/duckdb/src/include/duckdb/parser/qualified_name_set.hpp +19 -3
- package/src/duckdb/src/include/duckdb/parser/simplified_token.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +12 -9
- package/src/duckdb/src/include/duckdb/parser/tokens.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +45 -28
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +23 -11
- package/src/duckdb/src/include/duckdb/planner/binding_alias.hpp +44 -0
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/collation_binding.hpp +4 -3
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +11 -10
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +4 -4
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +9 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +8 -2
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/filter/dynamic_filter.hpp +48 -0
- package/src/duckdb/src/include/duckdb/planner/filter/in_filter.hpp +37 -0
- package/src/duckdb/src/include/duckdb/planner/filter/optional_filter.hpp +35 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator_visitor.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +9 -9
- package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +16 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +5 -3
- package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +14 -6
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +12 -8
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/block_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +82 -26
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_handle.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +10 -3
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +4 -13
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +14 -15
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_constants.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +13 -15
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/dictionary/analyze.hpp +46 -0
- package/src/duckdb/src/include/duckdb/storage/compression/dictionary/common.hpp +60 -0
- package/src/duckdb/src/include/duckdb/storage/compression/dictionary/compression.hpp +61 -0
- package/src/duckdb/src/include/duckdb/storage/compression/dictionary/decompression.hpp +50 -0
- package/src/duckdb/src/include/duckdb/storage/compression/empty_validity.hpp +100 -0
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/roaring/appender.hpp +150 -0
- package/src/duckdb/src/include/duckdb/storage/compression/roaring/roaring.hpp +618 -0
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +53 -31
- package/src/duckdb/src/include/duckdb/storage/index.hpp +2 -3
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp +4 -1
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +5 -4
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +16 -1
- package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/storage_index.hpp +70 -0
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +5 -7
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +4 -3
- package/src/duckdb/src/include/duckdb/storage/storage_options.hpp +23 -0
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +34 -6
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +39 -10
- package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +56 -14
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +35 -29
- package/src/duckdb/src/include/duckdb/storage/table/delete_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +7 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +19 -6
- package/src/duckdb/src/include/duckdb/storage/table/row_version_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +29 -6
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +10 -10
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +26 -19
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +8 -1
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +16 -14
- package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/table_io_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/temporary_file_manager.hpp +228 -61
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +14 -10
- package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +3 -1
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -2
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +1 -0
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +19 -17
- package/src/duckdb/src/include/duckdb/transaction/rollback_state.hpp +5 -2
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +1 -2
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +13 -8
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer_allocator.hpp +79 -0
- package/src/duckdb/src/include/duckdb/transaction/update_info.hpp +43 -13
- package/src/duckdb/src/include/duckdb/transaction/wal_write_state.hpp +4 -1
- package/src/duckdb/src/include/duckdb/verification/copied_statement_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb/verification/deserialized_statement_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb/verification/external_statement_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb/verification/fetch_row_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb/verification/parsed_statement_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb/verification/prepared_statement_verifier.hpp +7 -3
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +11 -5
- package/src/duckdb/src/include/duckdb/verification/unoptimized_statement_verifier.hpp +4 -2
- package/src/duckdb/src/include/duckdb.h +424 -41
- package/src/duckdb/src/include/duckdb_extension.h +301 -195
- package/src/duckdb/src/logging/log_manager.cpp +157 -0
- package/src/duckdb/src/logging/log_storage.cpp +209 -0
- package/src/duckdb/src/logging/logger.cpp +211 -0
- package/src/duckdb/src/logging/logging.cpp +42 -0
- package/src/duckdb/src/main/appender.cpp +187 -45
- package/src/duckdb/src/main/attached_database.cpp +16 -8
- package/src/duckdb/src/main/capi/appender-c.cpp +47 -4
- package/src/duckdb/src/main/capi/arrow-c.cpp +9 -4
- package/src/duckdb/src/main/capi/config-c.cpp +17 -4
- package/src/duckdb/src/main/capi/datetime-c.cpp +15 -0
- package/src/duckdb/src/main/capi/duckdb-c.cpp +54 -13
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +212 -4
- package/src/duckdb/src/main/capi/helper-c.cpp +3 -0
- package/src/duckdb/src/main/capi/prepared-c.cpp +26 -7
- package/src/duckdb/src/main/capi/replacement_scan-c.cpp +1 -1
- package/src/duckdb/src/main/capi/result-c.cpp +3 -0
- package/src/duckdb/src/main/capi/table_description-c.cpp +43 -10
- package/src/duckdb/src/main/capi/threading-c.cpp +4 -4
- package/src/duckdb/src/main/client_context.cpp +125 -51
- package/src/duckdb/src/main/client_context_file_opener.cpp +4 -0
- package/src/duckdb/src/main/client_context_wrapper.cpp +4 -0
- package/src/duckdb/src/main/client_data.cpp +1 -1
- package/src/duckdb/src/main/client_verify.cpp +39 -20
- package/src/duckdb/src/main/config.cpp +266 -74
- package/src/duckdb/src/main/connection.cpp +53 -13
- package/src/duckdb/src/main/database.cpp +39 -18
- package/src/duckdb/src/main/database_manager.cpp +12 -11
- package/src/duckdb/src/main/db_instance_cache.cpp +14 -7
- package/src/duckdb/src/main/extension/extension_helper.cpp +24 -23
- package/src/duckdb/src/main/extension/extension_install.cpp +19 -7
- package/src/duckdb/src/main/extension/extension_load.cpp +91 -41
- package/src/duckdb/src/main/extension/extension_util.cpp +40 -19
- package/src/duckdb/src/main/extension.cpp +20 -11
- package/src/duckdb/src/main/profiling_info.cpp +19 -5
- package/src/duckdb/src/main/query_profiler.cpp +135 -36
- package/src/duckdb/src/main/query_result.cpp +2 -1
- package/src/duckdb/src/main/relation/aggregate_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/create_table_relation.cpp +5 -4
- package/src/duckdb/src/main/relation/create_view_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/cross_product_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/delete_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/delim_get_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/distinct_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/explain_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/filter_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/insert_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/join_relation.cpp +5 -5
- package/src/duckdb/src/main/relation/order_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/projection_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/query_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +58 -20
- package/src/duckdb/src/main/relation/setop_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/subquery_relation.cpp +3 -8
- package/src/duckdb/src/main/relation/table_function_relation.cpp +10 -1
- package/src/duckdb/src/main/relation/table_relation.cpp +19 -3
- package/src/duckdb/src/main/relation/update_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/value_relation.cpp +42 -2
- package/src/duckdb/src/main/relation/view_relation.cpp +8 -2
- package/src/duckdb/src/main/relation/write_csv_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/write_parquet_relation.cpp +1 -1
- package/src/duckdb/src/main/relation.cpp +49 -28
- package/src/duckdb/src/main/secret/secret_manager.cpp +1 -1
- package/src/duckdb/src/main/secret/secret_storage.cpp +6 -4
- package/src/duckdb/src/main/settings/autogenerated_settings.cpp +1102 -0
- package/src/duckdb/src/main/settings/custom_settings.cpp +1343 -0
- package/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +60 -37
- package/src/duckdb/src/optimizer/column_binding_replacer.cpp +1 -1
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +126 -72
- package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +22 -6
- package/src/duckdb/src/optimizer/compressed_materialization/compress_aggregate.cpp +3 -3
- package/src/duckdb/src/optimizer/compressed_materialization/compress_distinct.cpp +2 -2
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +3 -3
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +7 -7
- package/src/duckdb/src/optimizer/deliminator.cpp +6 -5
- package/src/duckdb/src/optimizer/empty_result_pullup.cpp +96 -0
- package/src/duckdb/src/optimizer/expression_heuristics.cpp +11 -3
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +9 -2
- package/src/duckdb/src/optimizer/filter_combiner.cpp +190 -88
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +6 -5
- package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +25 -9
- package/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp +170 -72
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +5 -4
- package/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +3 -1
- package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +7 -7
- package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +15 -6
- package/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp +37 -22
- package/src/duckdb/src/optimizer/late_materialization.cpp +414 -0
- package/src/duckdb/src/optimizer/limit_pushdown.cpp +1 -0
- package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +30 -2
- package/src/duckdb/src/optimizer/optimizer.cpp +67 -7
- package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +3 -3
- package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +2 -2
- package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +5 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_unnest.cpp +52 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_window.cpp +2 -2
- package/src/duckdb/src/optimizer/regex_range_filter.cpp +1 -1
- package/src/duckdb/src/optimizer/remove_duplicate_groups.cpp +1 -1
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +168 -38
- package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +2 -1
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +8 -5
- package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/constant_folding.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/distinct_aggregate_optimizer.cpp +65 -0
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +2 -1
- package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +4 -3
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +3 -1
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +9 -9
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +4 -3
- package/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp +1 -1
- package/src/duckdb/src/optimizer/sampling_pushdown.cpp +24 -0
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +74 -0
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +10 -7
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +3 -0
- package/src/duckdb/src/optimizer/sum_rewriter.cpp +174 -0
- package/src/duckdb/src/optimizer/topn_optimizer.cpp +71 -0
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +5 -5
- package/src/duckdb/src/parallel/event.cpp +4 -0
- package/src/duckdb/src/parallel/executor.cpp +11 -29
- package/src/duckdb/src/parallel/executor_task.cpp +8 -3
- package/src/duckdb/src/parallel/pipeline.cpp +15 -8
- package/src/duckdb/src/parallel/pipeline_executor.cpp +67 -43
- package/src/duckdb/src/parallel/thread_context.cpp +12 -1
- package/src/duckdb/src/parser/column_definition.cpp +3 -3
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +72 -9
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +15 -3
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +1 -1
- package/src/duckdb/src/parser/expression/function_expression.cpp +1 -1
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +3 -3
- package/src/duckdb/src/parser/expression/lambdaref_expression.cpp +1 -1
- package/src/duckdb/src/parser/expression/star_expression.cpp +46 -2
- package/src/duckdb/src/parser/expression/window_expression.cpp +24 -1
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +26 -2
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +5 -3
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +29 -1
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +6 -6
- package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_function_info.cpp +17 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +16 -15
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -2
- package/src/duckdb/src/parser/parsed_data/create_schema_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +1 -0
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +4 -4
- package/src/duckdb/src/parser/parsed_data/load_info.cpp +1 -0
- package/src/duckdb/src/parser/parsed_data/sample_options.cpp +31 -1
- package/src/duckdb/src/parser/parsed_expression.cpp +1 -1
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +4 -1
- package/src/duckdb/src/parser/parser.cpp +129 -0
- package/src/duckdb/src/parser/qualified_name.cpp +99 -0
- package/src/duckdb/src/parser/query_error_context.cpp +35 -6
- package/src/duckdb/src/parser/query_node/select_node.cpp +4 -4
- package/src/duckdb/src/parser/statement/delete_statement.cpp +6 -1
- package/src/duckdb/src/parser/statement/insert_statement.cpp +4 -3
- package/src/duckdb/src/parser/statement/update_statement.cpp +6 -1
- package/src/duckdb/src/parser/tableref/pivotref.cpp +2 -2
- package/src/duckdb/src/parser/tableref.cpp +2 -2
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +16 -24
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +5 -5
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +61 -13
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +10 -4
- package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +30 -3
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +25 -6
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_sample.cpp +10 -3
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +4 -3
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +18 -3
- package/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +0 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +5 -5
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +26 -12
- package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +11 -3
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -0
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +4 -4
- package/src/duckdb/src/parser/transform/statement/transform_set.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +21 -3
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +8 -6
- package/src/duckdb/src/parser/transformer.cpp +2 -2
- package/src/duckdb/src/planner/bind_context.cpp +308 -136
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +30 -31
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +4 -2
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +102 -94
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +7 -5
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +10 -10
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +24 -6
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -15
- package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +97 -19
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +74 -16
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +49 -15
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +32 -23
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +20 -3
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +3 -0
- package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +6 -5
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +38 -19
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +2 -12
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +117 -412
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +423 -144
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +5 -0
- package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +0 -4
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +31 -13
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +96 -27
- package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +5 -3
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +7 -6
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +36 -9
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +34 -34
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +72 -35
- package/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +99 -18
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +23 -11
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +22 -19
- package/src/duckdb/src/planner/binder.cpp +23 -45
- package/src/duckdb/src/planner/binding_alias.cpp +69 -0
- package/src/duckdb/src/planner/bound_parameter_map.cpp +1 -1
- package/src/duckdb/src/planner/bound_result_modifier.cpp +6 -2
- package/src/duckdb/src/planner/collation_binding.cpp +38 -4
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +17 -5
- package/src/duckdb/src/planner/expression/bound_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -1
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +24 -4
- package/src/duckdb/src/planner/expression.cpp +7 -1
- package/src/duckdb/src/planner/expression_binder/aggregate_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +16 -0
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +53 -1
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +8 -8
- package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/select_bind_state.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/update_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder.cpp +7 -7
- package/src/duckdb/src/planner/expression_iterator.cpp +6 -3
- package/src/duckdb/src/planner/filter/constant_filter.cpp +17 -2
- package/src/duckdb/src/planner/filter/dynamic_filter.cpp +68 -0
- package/src/duckdb/src/planner/filter/in_filter.cpp +84 -0
- package/src/duckdb/src/planner/filter/null_filter.cpp +1 -2
- package/src/duckdb/src/planner/filter/optional_filter.cpp +29 -0
- package/src/duckdb/src/planner/filter/struct_filter.cpp +11 -6
- package/src/duckdb/src/planner/joinside.cpp +6 -5
- package/src/duckdb/src/planner/logical_operator.cpp +4 -1
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +68 -2
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +23 -0
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -12
- package/src/duckdb/src/planner/operator/logical_filter.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +48 -25
- package/src/duckdb/src/planner/operator/logical_insert.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_order.cpp +4 -11
- package/src/duckdb/src/planner/operator/logical_top_n.cpp +7 -0
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +33 -5
- package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +2 -2
- package/src/duckdb/src/planner/table_binding.cpp +74 -36
- package/src/duckdb/src/planner/table_filter.cpp +5 -8
- package/src/duckdb/src/storage/arena_allocator.cpp +5 -4
- package/src/duckdb/src/storage/buffer/block_handle.cpp +88 -17
- package/src/duckdb/src/storage/buffer/block_manager.cpp +34 -26
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +2 -2
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +70 -49
- package/src/duckdb/src/storage/buffer_manager.cpp +4 -0
- package/src/duckdb/src/storage/checkpoint_manager.cpp +24 -5
- package/src/duckdb/src/storage/compression/bitpacking.cpp +14 -16
- package/src/duckdb/src/storage/compression/dictionary/analyze.cpp +54 -0
- package/src/duckdb/src/storage/compression/dictionary/common.cpp +90 -0
- package/src/duckdb/src/storage/compression/dictionary/compression.cpp +174 -0
- package/src/duckdb/src/storage/compression/dictionary/decompression.cpp +115 -0
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +53 -545
- package/src/duckdb/src/storage/compression/empty_validity.cpp +15 -0
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +25 -16
- package/src/duckdb/src/storage/compression/fsst.cpp +101 -47
- package/src/duckdb/src/storage/compression/numeric_constant.cpp +92 -2
- package/src/duckdb/src/storage/compression/rle.cpp +216 -46
- package/src/duckdb/src/storage/compression/roaring/analyze.cpp +179 -0
- package/src/duckdb/src/storage/compression/roaring/common.cpp +282 -0
- package/src/duckdb/src/storage/compression/roaring/compress.cpp +481 -0
- package/src/duckdb/src/storage/compression/roaring/metadata.cpp +262 -0
- package/src/duckdb/src/storage/compression/roaring/scan.cpp +364 -0
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +47 -65
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +102 -39
- package/src/duckdb/src/storage/compression/zstd.cpp +1049 -0
- package/src/duckdb/src/storage/data_table.cpp +312 -172
- package/src/duckdb/src/storage/local_storage.cpp +104 -46
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +7 -3
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +138 -58
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +14 -0
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +19 -8
- package/src/duckdb/src/storage/serialization/serialize_statement.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +43 -0
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +32 -5
- package/src/duckdb/src/storage/single_file_block_manager.cpp +6 -8
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +82 -71
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +3 -3
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +18 -17
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +34 -22
- package/src/duckdb/src/storage/statistics/string_stats.cpp +14 -3
- package/src/duckdb/src/storage/storage_info.cpp +72 -10
- package/src/duckdb/src/storage/storage_manager.cpp +41 -47
- package/src/duckdb/src/storage/table/array_column_data.cpp +7 -1
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +10 -9
- package/src/duckdb/src/storage/table/column_data.cpp +105 -43
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +307 -132
- package/src/duckdb/src/storage/table/column_segment.cpp +36 -13
- package/src/duckdb/src/storage/table/list_column_data.cpp +4 -4
- package/src/duckdb/src/storage/table/row_group.cpp +159 -66
- package/src/duckdb/src/storage/table/row_group_collection.cpp +157 -68
- package/src/duckdb/src/storage/table/row_version_manager.cpp +33 -10
- package/src/duckdb/src/storage/table/scan_state.cpp +21 -7
- package/src/duckdb/src/storage/table/standard_column_data.cpp +68 -5
- package/src/duckdb/src/storage/table/struct_column_data.cpp +42 -4
- package/src/duckdb/src/storage/table/table_statistics.cpp +91 -5
- package/src/duckdb/src/storage/table/update_segment.cpp +287 -210
- package/src/duckdb/src/storage/table_index_list.cpp +55 -58
- package/src/duckdb/src/storage/temporary_file_manager.cpp +412 -149
- package/src/duckdb/src/storage/wal_replay.cpp +132 -48
- package/src/duckdb/src/storage/write_ahead_log.cpp +75 -48
- package/src/duckdb/src/transaction/cleanup_state.cpp +0 -1
- package/src/duckdb/src/transaction/commit_state.cpp +23 -14
- package/src/duckdb/src/transaction/duck_transaction.cpp +29 -25
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +18 -6
- package/src/duckdb/src/transaction/meta_transaction.cpp +3 -2
- package/src/duckdb/src/transaction/rollback_state.cpp +5 -2
- package/src/duckdb/src/transaction/transaction_context.cpp +9 -1
- package/src/duckdb/src/transaction/undo_buffer.cpp +35 -27
- package/src/duckdb/src/transaction/undo_buffer_allocator.cpp +72 -0
- package/src/duckdb/src/transaction/wal_write_state.cpp +12 -10
- package/src/duckdb/src/verification/copied_statement_verifier.cpp +7 -4
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +7 -5
- package/src/duckdb/src/verification/external_statement_verifier.cpp +7 -4
- package/src/duckdb/src/verification/fetch_row_verifier.cpp +7 -4
- package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +8 -4
- package/src/duckdb/src/verification/parsed_statement_verifier.cpp +7 -4
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +16 -12
- package/src/duckdb/src/verification/statement_verifier.cpp +20 -15
- package/src/duckdb/src/verification/unoptimized_statement_verifier.cpp +7 -4
- package/src/duckdb/third_party/fsst/libfsst.hpp +1 -0
- package/src/duckdb/third_party/httplib/httplib.hpp +15 -22
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +4 -2
- package/src/duckdb/third_party/libpg_query/pg_functions.cpp +2 -4
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +14278 -13832
- package/src/duckdb/third_party/parquet/parquet_types.cpp +3410 -1686
- package/src/duckdb/third_party/parquet/parquet_types.h +1585 -1204
- package/src/duckdb/third_party/skiplist/SkipList.h +0 -1
- package/src/duckdb/third_party/snappy/snappy-stubs-internal.h +13 -15
- package/src/duckdb/third_party/zstd/common/debug.cpp +36 -0
- package/src/duckdb/third_party/zstd/common/entropy_common.cpp +173 -49
- package/src/duckdb/third_party/zstd/common/error_private.cpp +11 -3
- package/src/duckdb/third_party/zstd/common/fse_decompress.cpp +126 -97
- package/src/duckdb/third_party/zstd/common/pool.cpp +376 -0
- package/src/duckdb/third_party/zstd/common/threading.cpp +193 -0
- package/src/duckdb/third_party/zstd/common/xxhash.cpp +18 -14
- package/src/duckdb/third_party/zstd/common/zstd_common.cpp +3 -38
- package/src/duckdb/third_party/zstd/compress/fse_compress.cpp +93 -165
- package/src/duckdb/third_party/zstd/compress/hist.cpp +28 -31
- package/src/duckdb/third_party/zstd/compress/huf_compress.cpp +957 -291
- package/src/duckdb/third_party/zstd/compress/zstd_compress.cpp +3988 -1124
- package/src/duckdb/third_party/zstd/compress/zstd_compress_literals.cpp +120 -43
- package/src/duckdb/third_party/zstd/compress/zstd_compress_sequences.cpp +47 -23
- package/src/duckdb/third_party/zstd/compress/zstd_compress_superblock.cpp +274 -424
- package/src/duckdb/third_party/zstd/compress/zstd_double_fast.cpp +403 -153
- package/src/duckdb/third_party/zstd/compress/zstd_fast.cpp +741 -268
- package/src/duckdb/third_party/zstd/compress/zstd_lazy.cpp +1339 -278
- package/src/duckdb/third_party/zstd/compress/zstd_ldm.cpp +334 -222
- package/src/duckdb/third_party/zstd/compress/zstd_opt.cpp +674 -298
- package/src/duckdb/third_party/zstd/compress/zstdmt_compress.cpp +1885 -0
- package/src/duckdb/third_party/zstd/decompress/huf_decompress.cpp +1247 -586
- package/src/duckdb/third_party/zstd/decompress/zstd_ddict.cpp +18 -17
- package/src/duckdb/third_party/zstd/decompress/zstd_decompress.cpp +724 -270
- package/src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp +1193 -393
- package/src/duckdb/third_party/zstd/deprecated/zbuff_common.cpp +30 -0
- package/src/duckdb/third_party/zstd/deprecated/zbuff_compress.cpp +171 -0
- package/src/duckdb/third_party/zstd/deprecated/zbuff_decompress.cpp +80 -0
- package/src/duckdb/third_party/zstd/dict/cover.cpp +1271 -0
- package/src/duckdb/third_party/zstd/dict/divsufsort.cpp +1916 -0
- package/src/duckdb/third_party/zstd/dict/fastcover.cpp +775 -0
- package/src/duckdb/third_party/zstd/dict/zdict.cpp +1139 -0
- package/src/duckdb/third_party/zstd/include/zdict.h +473 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/allocations.h +58 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/bits.h +204 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/bitstream.h +88 -85
- package/src/duckdb/third_party/zstd/include/zstd/common/compiler.h +243 -47
- package/src/duckdb/third_party/zstd/include/zstd/common/cpu.h +253 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/debug.h +31 -31
- package/src/duckdb/third_party/zstd/include/zstd/common/error_private.h +94 -6
- package/src/duckdb/third_party/zstd/include/zstd/common/fse.h +424 -64
- package/src/duckdb/third_party/zstd/include/zstd/common/huf.h +255 -70
- package/src/duckdb/third_party/zstd/include/zstd/common/mem.h +125 -85
- package/src/duckdb/third_party/zstd/include/zstd/common/pool.h +84 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/portability_macros.h +158 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/threading.h +152 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/{xxhash.h → xxhash.hpp} +0 -1
- package/src/duckdb/third_party/zstd/include/zstd/common/{xxhash_static.h → xxhash_static.hpp} +1 -1
- package/src/duckdb/third_party/zstd/include/zstd/common/zstd_deps.h +122 -0
- package/src/duckdb/third_party/zstd/include/zstd/common/zstd_internal.h +143 -174
- package/src/duckdb/third_party/zstd/include/zstd/common/zstd_trace.h +159 -0
- package/src/duckdb/third_party/zstd/include/zstd/compress/clevels.h +136 -0
- package/src/duckdb/third_party/zstd/include/zstd/compress/hist.h +4 -4
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_internal.h +631 -220
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_literals.h +17 -7
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_sequences.h +2 -2
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_compress_superblock.h +3 -2
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_cwksp.h +256 -153
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_double_fast.h +16 -3
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_fast.h +4 -3
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_lazy.h +145 -11
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_ldm.h +14 -6
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_ldm_geartab.h +110 -0
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstd_opt.h +33 -9
- package/src/duckdb/third_party/zstd/include/zstd/compress/zstdmt_compress.h +107 -0
- package/src/duckdb/third_party/zstd/include/zstd/decompress/zstd_ddict.h +4 -3
- package/src/duckdb/third_party/zstd/include/zstd/decompress/zstd_decompress_block.h +20 -6
- package/src/duckdb/third_party/zstd/include/zstd/decompress/zstd_decompress_internal.h +88 -16
- package/src/duckdb/third_party/zstd/include/zstd/deprecated/zbuff.h +214 -0
- package/src/duckdb/third_party/zstd/include/zstd/dict/cover.h +156 -0
- package/src/duckdb/third_party/zstd/include/zstd/dict/divsufsort.h +62 -0
- package/src/duckdb/third_party/zstd/include/zstd.h +2171 -93
- package/src/duckdb/third_party/zstd/include/{zstd/common/zstd_errors.h → zstd_errors.h} +32 -10
- package/src/duckdb/ub_extension_core_functions_aggregate_algebraic.cpp +8 -0
- package/src/duckdb/ub_extension_core_functions_aggregate_distributive.cpp +20 -0
- package/src/duckdb/ub_extension_core_functions_aggregate_holistic.cpp +12 -0
- package/src/duckdb/ub_extension_core_functions_aggregate_nested.cpp +6 -0
- package/src/duckdb/ub_extension_core_functions_aggregate_regression.cpp +14 -0
- package/src/duckdb/ub_extension_core_functions_scalar_array.cpp +4 -0
- package/src/duckdb/ub_extension_core_functions_scalar_bit.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_blob.cpp +4 -0
- package/src/duckdb/ub_extension_core_functions_scalar_date.cpp +20 -0
- package/src/duckdb/ub_extension_core_functions_scalar_debug.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_enum.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_generic.cpp +18 -0
- package/src/duckdb/ub_extension_core_functions_scalar_list.cpp +22 -0
- package/src/duckdb/ub_extension_core_functions_scalar_map.cpp +14 -0
- package/src/duckdb/ub_extension_core_functions_scalar_math.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_operators.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_random.cpp +4 -0
- package/src/duckdb/ub_extension_core_functions_scalar_string.cpp +48 -0
- package/src/duckdb/ub_extension_core_functions_scalar_struct.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_union.cpp +6 -0
- package/src/duckdb/ub_src_common.cpp +4 -0
- package/src/duckdb/ub_src_common_arrow.cpp +3 -1
- package/src/duckdb/ub_src_execution.cpp +0 -6
- package/src/duckdb/ub_src_execution_operator_aggregate.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_encode.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_util.cpp +2 -0
- package/src/duckdb/ub_src_execution_sample.cpp +4 -0
- package/src/duckdb/ub_src_function.cpp +6 -0
- package/src/duckdb/ub_src_function_aggregate.cpp +0 -2
- package/src/duckdb/ub_src_function_aggregate_distributive.cpp +3 -1
- package/src/duckdb/ub_src_function_scalar.cpp +2 -8
- package/src/duckdb/ub_src_function_scalar_date.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_generic.cpp +2 -2
- package/src/duckdb/ub_src_function_scalar_map.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_operator.cpp +8 -0
- package/src/duckdb/ub_src_function_scalar_string.cpp +10 -0
- package/src/duckdb/ub_src_function_scalar_struct.cpp +4 -0
- package/src/duckdb/ub_src_function_scalar_system.cpp +2 -0
- package/src/duckdb/ub_src_function_table_system.cpp +6 -0
- package/src/duckdb/ub_src_function_window.cpp +36 -0
- package/src/duckdb/ub_src_logging.cpp +8 -0
- package/src/duckdb/ub_src_main_settings.cpp +3 -1
- package/src/duckdb/ub_src_optimizer.cpp +8 -0
- package/src/duckdb/ub_src_optimizer_pushdown.cpp +2 -0
- package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
- package/src/duckdb/ub_src_parser.cpp +2 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +2 -0
- package/src/duckdb/ub_src_planner.cpp +2 -0
- package/src/duckdb/ub_src_planner_filter.cpp +6 -0
- package/src/duckdb/ub_src_storage_compression.cpp +4 -0
- package/src/duckdb/ub_src_storage_compression_dictionary.cpp +8 -0
- package/src/duckdb/ub_src_storage_compression_roaring.cpp +10 -0
- package/src/duckdb/ub_src_transaction.cpp +2 -0
- package/vendor.py +1 -1
- package/src/duckdb/extension/json/yyjson/include/yyjson.hpp +0 -6003
- package/src/duckdb/extension/json/yyjson/yyjson.cpp +0 -8218
- package/src/duckdb/src/common/arrow/appender/list_data.cpp +0 -78
- package/src/duckdb/src/common/arrow/appender/map_data.cpp +0 -91
- package/src/duckdb/src/common/cycle_counter.cpp +0 -76
- package/src/duckdb/src/common/field_writer.cpp +0 -97
- package/src/duckdb/src/common/http_state.cpp +0 -95
- package/src/duckdb/src/common/preserved_error.cpp +0 -87
- package/src/duckdb/src/common/row_operations/row_match.cpp +0 -359
- package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +0 -27
- package/src/duckdb/src/common/serializer/buffered_serializer.cpp +0 -36
- package/src/duckdb/src/common/serializer/format_serializer.cpp +0 -15
- package/src/duckdb/src/common/serializer.cpp +0 -24
- package/src/duckdb/src/common/types/chunk_collection.cpp +0 -190
- package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +0 -183
- package/src/duckdb/src/core_functions/scalar/date/current.cpp +0 -54
- package/src/duckdb/src/core_functions/scalar/list/list_cosine_similarity.cpp +0 -78
- package/src/duckdb/src/core_functions/scalar/list/list_inner_product.cpp +0 -70
- package/src/duckdb/src/core_functions/scalar/list/list_lambdas.cpp +0 -412
- package/src/duckdb/src/core_functions/scalar/secret/which_secret.cpp +0 -28
- package/src/duckdb/src/core_functions/scalar/string/jaro_winkler.cpp +0 -71
- package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +0 -238
- package/src/duckdb/src/execution/index/art/node16.cpp +0 -196
- package/src/duckdb/src/execution/index/art/node4.cpp +0 -189
- package/src/duckdb/src/execution/index/unknown_index.cpp +0 -65
- package/src/duckdb/src/execution/operator/csv_scanner/base_csv_reader.cpp +0 -595
- package/src/duckdb/src/execution/operator/csv_scanner/buffered_csv_reader.cpp +0 -434
- package/src/duckdb/src/execution/operator/csv_scanner/csv_buffer.cpp +0 -89
- package/src/duckdb/src/execution/operator/csv_scanner/csv_buffer_manager.cpp +0 -90
- package/src/duckdb/src/execution/operator/csv_scanner/csv_file_handle.cpp +0 -95
- package/src/duckdb/src/execution/operator/csv_scanner/csv_reader_options.cpp +0 -494
- package/src/duckdb/src/execution/operator/csv_scanner/csv_state_machine.cpp +0 -35
- package/src/duckdb/src/execution/operator/csv_scanner/csv_state_machine_cache.cpp +0 -99
- package/src/duckdb/src/execution/operator/csv_scanner/parallel_csv_reader.cpp +0 -689
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +0 -242
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +0 -695
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +0 -1487
- package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +0 -72
- package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +0 -158
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +0 -280
- package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +0 -666
- package/src/duckdb/src/execution/operator/persistent/physical_fixed_batch_copy.cpp +0 -499
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +0 -207
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +0 -207
- package/src/duckdb/src/execution/physical_plan/plan_limit_percent.cpp +0 -18
- package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +0 -47
- package/src/duckdb/src/execution/reservoir_sample.cpp +0 -324
- package/src/duckdb/src/execution/window_executor.cpp +0 -1830
- package/src/duckdb/src/execution/window_segment_tree.cpp +0 -2073
- package/src/duckdb/src/extension_forward_decl/icu.cpp +0 -59
- package/src/duckdb/src/function/aggregate/distributive_functions.cpp +0 -15
- package/src/duckdb/src/function/scalar/compressed_materialization_functions.cpp +0 -29
- package/src/duckdb/src/function/scalar/generic_functions.cpp +0 -11
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +0 -143
- package/src/duckdb/src/function/scalar/operators.cpp +0 -14
- package/src/duckdb/src/function/scalar/sequence_functions.cpp +0 -10
- package/src/duckdb/src/function/scalar/string_functions.cpp +0 -22
- package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +0 -173
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +0 -101
- package/src/duckdb/src/include/duckdb/catalog/mapping_value.hpp +0 -92
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_types_extension.hpp +0 -42
- package/src/duckdb/src/include/duckdb/common/cycle_counter.hpp +0 -68
- package/src/duckdb/src/include/duckdb/common/enums/index_type.hpp +0 -34
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +0 -113
- package/src/duckdb/src/include/duckdb/common/platform.h +0 -58
- package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +0 -59
- package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +0 -192
- package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +0 -137
- package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +0 -65
- package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +0 -63
- package/src/duckdb/src/include/duckdb/execution/index/unknown_index.hpp +0 -65
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_buffer.hpp +0 -103
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.hpp +0 -74
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_file_handle.hpp +0 -60
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_sniffer.hpp +0 -253
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/csv_option.hpp +0 -155
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/csv_reader_options.hpp +0 -163
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/state_machine_options.hpp +0 -35
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/base_scanner.hpp +0 -228
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/column_count_scanner.hpp +0 -70
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/scanner_boundary.hpp +0 -93
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/skip_scanner.hpp +0 -60
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/string_value_scanner.hpp +0 -197
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/quote_rules.hpp +0 -21
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state.hpp +0 -30
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state_machine.hpp +0 -99
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.hpp +0 -87
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/table_function/csv_file_scanner.hpp +0 -70
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/table_function/global_csv_state.hpp +0 -80
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/util/csv_casting.hpp +0 -137
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/util/csv_error.hpp +0 -104
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +0 -79
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/base_csv_reader.hpp +0 -119
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/buffered_csv_reader.hpp +0 -72
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_buffer.hpp +0 -110
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_buffer_manager.hpp +0 -103
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_file_handle.hpp +0 -59
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_line_info.hpp +0 -46
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_reader_options.hpp +0 -210
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_sniffer.hpp +0 -131
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state.hpp +0 -28
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state_machine.hpp +0 -70
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/csv_state_machine_cache.hpp +0 -65
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/parallel_csv_reader.hpp +0 -167
- package/src/duckdb/src/include/duckdb/execution/operator/scan/csv/quote_rules.hpp +0 -21
- package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +0 -343
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +0 -165
- package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_optimizer.hpp +0 -45
- package/src/duckdb/src/include/duckdb/optimizer/join_order/estimated_properties.hpp +0 -57
- package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_info.hpp +0 -45
- package/src/duckdb/src/include/duckdb/parser/statement/show_statement.hpp +0 -32
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +0 -49
- package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +0 -42
- package/src/duckdb/src/main/settings/settings.cpp +0 -2056
- package/src/duckdb/src/optimizer/join_order/estimated_properties.cpp +0 -36
- package/src/duckdb/src/parser/parsed_data/comment_on_info.cpp +0 -19
- package/src/duckdb/src/parser/statement/show_statement.cpp +0 -15
- package/src/duckdb/src/planner/binder/statement/bind_show.cpp +0 -30
- package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +0 -14
- package/src/duckdb/src/storage/statistics/numeric_stats_union.cpp +0 -70
- package/src/duckdb/third_party/fsst/fsst_avx512.cpp +0 -140
- package/src/duckdb/third_party/fsst/fsst_avx512.inc +0 -57
- package/src/duckdb/third_party/fsst/fsst_avx512_unroll1.inc +0 -57
- package/src/duckdb/third_party/fsst/fsst_avx512_unroll2.inc +0 -114
- package/src/duckdb/third_party/fsst/fsst_avx512_unroll3.inc +0 -171
- package/src/duckdb/third_party/fsst/fsst_avx512_unroll4.inc +0 -228
- package/src/duckdb/third_party/parquet/parquet_constants.cpp +0 -17
- package/src/duckdb/third_party/parquet/parquet_constants.h +0 -24
- package/src/duckdb/third_party/re2/util/pod_array.h +0 -55
- package/src/duckdb/third_party/re2/util/sparse_array.h +0 -392
- package/src/duckdb/third_party/re2/util/sparse_set.h +0 -264
- package/src/duckdb/third_party/zstd/include/zstd/common/fse_static.h +0 -421
- package/src/duckdb/third_party/zstd/include/zstd/common/huf_static.h +0 -238
- package/src/duckdb/third_party/zstd/include/zstd_static.h +0 -1070
- package/src/duckdb/ub_src_core_functions.cpp +0 -6
- package/src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp +0 -8
- package/src/duckdb/ub_src_core_functions_aggregate_distributive.cpp +0 -24
- package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +0 -12
- package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +0 -6
- package/src/duckdb/ub_src_core_functions_aggregate_regression.cpp +0 -14
- package/src/duckdb/ub_src_core_functions_scalar_array.cpp +0 -4
- package/src/duckdb/ub_src_core_functions_scalar_bit.cpp +0 -2
- package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +0 -6
- package/src/duckdb/ub_src_core_functions_scalar_date.cpp +0 -22
- package/src/duckdb/ub_src_core_functions_scalar_debug.cpp +0 -2
- package/src/duckdb/ub_src_core_functions_scalar_enum.cpp +0 -2
- package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +0 -18
- package/src/duckdb/ub_src_core_functions_scalar_list.cpp +0 -22
- package/src/duckdb/ub_src_core_functions_scalar_map.cpp +0 -16
- package/src/duckdb/ub_src_core_functions_scalar_math.cpp +0 -2
- package/src/duckdb/ub_src_core_functions_scalar_operators.cpp +0 -2
- package/src/duckdb/ub_src_core_functions_scalar_random.cpp +0 -4
- package/src/duckdb/ub_src_core_functions_scalar_secret.cpp +0 -2
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +0 -58
- package/src/duckdb/ub_src_core_functions_scalar_struct.cpp +0 -4
- package/src/duckdb/ub_src_core_functions_scalar_union.cpp +0 -6
- package/src/duckdb/ub_src_execution_operator_csv_scanner.cpp +0 -18
- package/src/duckdb/ub_src_function_scalar_operators.cpp +0 -8
- /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic/covar.hpp +0 -0
- /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/algebraic/stddev.hpp +0 -0
- /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/aggregate/sum_helpers.hpp +0 -0
- /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/array_kernels.hpp +0 -0
- /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/function_list.hpp +0 -0
- /package/src/duckdb/{src/include/duckdb → extension/core_functions/include}/core_functions/scalar/secret_functions.hpp +0 -0
- /package/src/duckdb/src/function/scalar/{operators → operator}/multiply.cpp +0 -0
- /package/src/duckdb/src/function/scalar/{operators → operator}/subtract.cpp +0 -0
@@ -1,1830 +0,0 @@
|
|
1
|
-
#include "duckdb/execution/window_executor.hpp"
|
2
|
-
|
3
|
-
#include "duckdb/common/operator/add.hpp"
|
4
|
-
#include "duckdb/common/operator/subtract.hpp"
|
5
|
-
|
6
|
-
#include "duckdb/common/array.hpp"
|
7
|
-
|
8
|
-
namespace duckdb {
|
9
|
-
|
10
|
-
//===--------------------------------------------------------------------===//
|
11
|
-
// WindowDataChunk
|
12
|
-
//===--------------------------------------------------------------------===//
|
13
|
-
bool WindowDataChunk::IsSimple(const Vector &v) {
|
14
|
-
switch (v.GetType().InternalType()) {
|
15
|
-
case PhysicalType::BOOL:
|
16
|
-
case PhysicalType::UINT8:
|
17
|
-
case PhysicalType::INT8:
|
18
|
-
case PhysicalType::UINT16:
|
19
|
-
case PhysicalType::INT16:
|
20
|
-
case PhysicalType::UINT32:
|
21
|
-
case PhysicalType::INT32:
|
22
|
-
case PhysicalType::UINT64:
|
23
|
-
case PhysicalType::INT64:
|
24
|
-
case PhysicalType::FLOAT:
|
25
|
-
case PhysicalType::DOUBLE:
|
26
|
-
case PhysicalType::INTERVAL:
|
27
|
-
case PhysicalType::UINT128:
|
28
|
-
case PhysicalType::INT128:
|
29
|
-
return true;
|
30
|
-
case PhysicalType::LIST:
|
31
|
-
case PhysicalType::STRUCT:
|
32
|
-
case PhysicalType::ARRAY:
|
33
|
-
case PhysicalType::VARCHAR:
|
34
|
-
case PhysicalType::BIT:
|
35
|
-
return false;
|
36
|
-
default:
|
37
|
-
break;
|
38
|
-
}
|
39
|
-
|
40
|
-
throw InternalException("Unsupported type for WindowDataChunk");
|
41
|
-
}
|
42
|
-
|
43
|
-
WindowDataChunk::WindowDataChunk(DataChunk &chunk) : chunk(chunk) {
|
44
|
-
}
|
45
|
-
|
46
|
-
void WindowDataChunk::Initialize(Allocator &allocator, const vector<LogicalType> &types, idx_t capacity) {
|
47
|
-
vector<mutex> new_locks(types.size());
|
48
|
-
locks.swap(new_locks);
|
49
|
-
chunk.Initialize(allocator, types, capacity);
|
50
|
-
chunk.SetCardinality(capacity);
|
51
|
-
|
52
|
-
is_simple.clear();
|
53
|
-
for (const auto &v : chunk.data) {
|
54
|
-
is_simple.push_back(IsSimple(v));
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
void WindowDataChunk::Copy(DataChunk &input, idx_t begin) {
|
59
|
-
const auto source_count = input.size();
|
60
|
-
const idx_t end = begin + source_count;
|
61
|
-
const idx_t count = chunk.size();
|
62
|
-
D_ASSERT(end <= count);
|
63
|
-
// Can we overwrite the validity mask in parallel?
|
64
|
-
bool aligned = IsMaskAligned(begin, end, count);
|
65
|
-
for (column_t i = 0; i < chunk.data.size(); ++i) {
|
66
|
-
auto &src = input.data[i];
|
67
|
-
auto &dst = chunk.data[i];
|
68
|
-
UnifiedVectorFormat sdata;
|
69
|
-
src.ToUnifiedFormat(count, sdata);
|
70
|
-
if (is_simple[i] && aligned && sdata.validity.AllValid()) {
|
71
|
-
VectorOperations::Copy(src, dst, source_count, 0, begin);
|
72
|
-
} else {
|
73
|
-
lock_guard<mutex> column_guard(locks[i]);
|
74
|
-
VectorOperations::Copy(src, dst, source_count, 0, begin);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
static idx_t FindNextStart(const ValidityMask &mask, idx_t l, const idx_t r, idx_t &n) {
|
80
|
-
if (mask.AllValid()) {
|
81
|
-
auto start = MinValue(l + n - 1, r);
|
82
|
-
n -= MinValue(n, r - l);
|
83
|
-
return start;
|
84
|
-
}
|
85
|
-
|
86
|
-
while (l < r) {
|
87
|
-
// If l is aligned with the start of a block, and the block is blank, then skip forward one block.
|
88
|
-
idx_t entry_idx;
|
89
|
-
idx_t shift;
|
90
|
-
mask.GetEntryIndex(l, entry_idx, shift);
|
91
|
-
|
92
|
-
const auto block = mask.GetValidityEntry(entry_idx);
|
93
|
-
if (mask.NoneValid(block) && !shift) {
|
94
|
-
l += ValidityMask::BITS_PER_VALUE;
|
95
|
-
continue;
|
96
|
-
}
|
97
|
-
|
98
|
-
// Loop over the block
|
99
|
-
for (; shift < ValidityMask::BITS_PER_VALUE && l < r; ++shift, ++l) {
|
100
|
-
if (mask.RowIsValid(block, shift) && --n == 0) {
|
101
|
-
return MinValue(l, r);
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
// Didn't find a start so return the end of the range
|
107
|
-
return r;
|
108
|
-
}
|
109
|
-
|
110
|
-
static idx_t FindPrevStart(const ValidityMask &mask, const idx_t l, idx_t r, idx_t &n) {
|
111
|
-
if (mask.AllValid()) {
|
112
|
-
auto start = (r <= l + n) ? l : r - n;
|
113
|
-
n -= r - start;
|
114
|
-
return start;
|
115
|
-
}
|
116
|
-
|
117
|
-
while (l < r) {
|
118
|
-
// If r is aligned with the start of a block, and the previous block is blank,
|
119
|
-
// then skip backwards one block.
|
120
|
-
idx_t entry_idx;
|
121
|
-
idx_t shift;
|
122
|
-
mask.GetEntryIndex(r - 1, entry_idx, shift);
|
123
|
-
|
124
|
-
const auto block = mask.GetValidityEntry(entry_idx);
|
125
|
-
if (mask.NoneValid(block) && (shift + 1 == ValidityMask::BITS_PER_VALUE)) {
|
126
|
-
// r is nonzero (> l) and word aligned, so this will not underflow.
|
127
|
-
r -= ValidityMask::BITS_PER_VALUE;
|
128
|
-
continue;
|
129
|
-
}
|
130
|
-
|
131
|
-
// Loop backwards over the block
|
132
|
-
// shift is probing r-1 >= l >= 0
|
133
|
-
for (++shift; shift-- > 0 && l < r; --r) {
|
134
|
-
// l < r ensures n == 1 if result is supposed to be NULL because of EXCLUDE
|
135
|
-
if (mask.RowIsValid(block, shift) && --n == 0) {
|
136
|
-
return MaxValue(l, r - 1);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
// Didn't find a start so return the start of the range
|
142
|
-
return l;
|
143
|
-
}
|
144
|
-
|
145
|
-
template <typename T>
|
146
|
-
static T GetCell(const DataChunk &chunk, idx_t column, idx_t index) {
|
147
|
-
D_ASSERT(chunk.ColumnCount() > column);
|
148
|
-
auto &source = chunk.data[column];
|
149
|
-
const auto data = FlatVector::GetData<T>(source);
|
150
|
-
return data[index];
|
151
|
-
}
|
152
|
-
|
153
|
-
static bool CellIsNull(const DataChunk &chunk, idx_t column, idx_t index) {
|
154
|
-
D_ASSERT(chunk.ColumnCount() > column);
|
155
|
-
auto &source = chunk.data[column];
|
156
|
-
return FlatVector::IsNull(source, index);
|
157
|
-
}
|
158
|
-
|
159
|
-
static void CopyCell(const DataChunk &chunk, idx_t column, idx_t index, Vector &target, idx_t target_offset) {
|
160
|
-
D_ASSERT(chunk.ColumnCount() > column);
|
161
|
-
auto &source = chunk.data[column];
|
162
|
-
VectorOperations::Copy(source, target, index + 1, index, target_offset);
|
163
|
-
}
|
164
|
-
|
165
|
-
//===--------------------------------------------------------------------===//
|
166
|
-
// WindowInputColumn
|
167
|
-
//===--------------------------------------------------------------------===//
|
168
|
-
WindowInputColumn::WindowInputColumn(optional_ptr<Expression> expr_p, ClientContext &context, idx_t count)
|
169
|
-
: expr(expr_p), scalar(expr ? expr->IsScalar() : true), count(count), wtarget(target) {
|
170
|
-
|
171
|
-
if (expr) {
|
172
|
-
vector<LogicalType> types;
|
173
|
-
types.emplace_back(expr->return_type);
|
174
|
-
wtarget.Initialize(Allocator::Get(context), types, count);
|
175
|
-
ptype = expr->return_type.InternalType();
|
176
|
-
}
|
177
|
-
}
|
178
|
-
|
179
|
-
void WindowInputColumn::Copy(DataChunk &input_chunk, idx_t input_idx) {
|
180
|
-
if (expr && (!input_idx || !scalar)) {
|
181
|
-
wtarget.Copy(input_chunk, input_idx);
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
//===--------------------------------------------------------------------===//
|
186
|
-
// WindowColumnIterator
|
187
|
-
//===--------------------------------------------------------------------===//
|
188
|
-
template <typename T>
|
189
|
-
struct WindowColumnIterator {
|
190
|
-
using iterator = WindowColumnIterator<T>;
|
191
|
-
using iterator_category = std::random_access_iterator_tag;
|
192
|
-
using difference_type = std::ptrdiff_t;
|
193
|
-
using value_type = T;
|
194
|
-
using reference = T;
|
195
|
-
using pointer = idx_t;
|
196
|
-
|
197
|
-
explicit WindowColumnIterator(const WindowInputColumn &coll_p, pointer pos_p = 0) : coll(&coll_p), pos(pos_p) {
|
198
|
-
}
|
199
|
-
|
200
|
-
// Forward iterator
|
201
|
-
inline reference operator*() const {
|
202
|
-
return coll->GetCell<T>(pos);
|
203
|
-
}
|
204
|
-
inline explicit operator pointer() const {
|
205
|
-
return pos;
|
206
|
-
}
|
207
|
-
|
208
|
-
inline iterator &operator++() {
|
209
|
-
++pos;
|
210
|
-
return *this;
|
211
|
-
}
|
212
|
-
inline iterator operator++(int) {
|
213
|
-
auto result = *this;
|
214
|
-
++(*this);
|
215
|
-
return result;
|
216
|
-
}
|
217
|
-
|
218
|
-
// Bidirectional iterator
|
219
|
-
inline iterator &operator--() {
|
220
|
-
--pos;
|
221
|
-
return *this;
|
222
|
-
}
|
223
|
-
inline iterator operator--(int) {
|
224
|
-
auto result = *this;
|
225
|
-
--(*this);
|
226
|
-
return result;
|
227
|
-
}
|
228
|
-
|
229
|
-
// Random Access
|
230
|
-
inline iterator &operator+=(difference_type n) {
|
231
|
-
pos += UnsafeNumericCast<pointer>(n);
|
232
|
-
return *this;
|
233
|
-
}
|
234
|
-
inline iterator &operator-=(difference_type n) {
|
235
|
-
pos -= UnsafeNumericCast<pointer>(n);
|
236
|
-
return *this;
|
237
|
-
}
|
238
|
-
|
239
|
-
inline reference operator[](difference_type m) const {
|
240
|
-
return coll->GetCell<T>(pos + m);
|
241
|
-
}
|
242
|
-
|
243
|
-
friend inline iterator &operator+(const iterator &a, difference_type n) {
|
244
|
-
return iterator(a.coll, a.pos + n);
|
245
|
-
}
|
246
|
-
|
247
|
-
friend inline iterator operator-(const iterator &a, difference_type n) {
|
248
|
-
return iterator(a.coll, a.pos - n);
|
249
|
-
}
|
250
|
-
|
251
|
-
friend inline iterator operator+(difference_type n, const iterator &a) {
|
252
|
-
return a + n;
|
253
|
-
}
|
254
|
-
friend inline difference_type operator-(const iterator &a, const iterator &b) {
|
255
|
-
return difference_type(a.pos - b.pos);
|
256
|
-
}
|
257
|
-
|
258
|
-
friend inline bool operator==(const iterator &a, const iterator &b) {
|
259
|
-
return a.pos == b.pos;
|
260
|
-
}
|
261
|
-
friend inline bool operator!=(const iterator &a, const iterator &b) {
|
262
|
-
return a.pos != b.pos;
|
263
|
-
}
|
264
|
-
friend inline bool operator<(const iterator &a, const iterator &b) {
|
265
|
-
return a.pos < b.pos;
|
266
|
-
}
|
267
|
-
friend inline bool operator<=(const iterator &a, const iterator &b) {
|
268
|
-
return a.pos <= b.pos;
|
269
|
-
}
|
270
|
-
friend inline bool operator>(const iterator &a, const iterator &b) {
|
271
|
-
return a.pos > b.pos;
|
272
|
-
}
|
273
|
-
friend inline bool operator>=(const iterator &a, const iterator &b) {
|
274
|
-
return a.pos >= b.pos;
|
275
|
-
}
|
276
|
-
|
277
|
-
private:
|
278
|
-
optional_ptr<const WindowInputColumn> coll;
|
279
|
-
pointer pos;
|
280
|
-
};
|
281
|
-
|
282
|
-
template <typename T, typename OP>
|
283
|
-
struct OperationCompare : public std::function<bool(T, T)> {
|
284
|
-
inline bool operator()(const T &lhs, const T &val) const {
|
285
|
-
return OP::template Operation<T>(lhs, val);
|
286
|
-
}
|
287
|
-
};
|
288
|
-
|
289
|
-
template <typename T, typename OP, bool FROM>
|
290
|
-
static idx_t FindTypedRangeBound(const WindowInputColumn &over, const idx_t order_begin, const idx_t order_end,
|
291
|
-
const WindowBoundary range, WindowInputExpression &boundary, const idx_t chunk_idx,
|
292
|
-
const FrameBounds &prev) {
|
293
|
-
D_ASSERT(!boundary.CellIsNull(chunk_idx));
|
294
|
-
const auto val = boundary.GetCell<T>(chunk_idx);
|
295
|
-
|
296
|
-
OperationCompare<T, OP> comp;
|
297
|
-
|
298
|
-
// Check that the value we are searching for is in range.
|
299
|
-
if (range == WindowBoundary::EXPR_PRECEDING_RANGE) {
|
300
|
-
// Preceding but value past the current value
|
301
|
-
const auto cur_val = over.GetCell<T>(order_end - 1);
|
302
|
-
if (comp(cur_val, val)) {
|
303
|
-
throw OutOfRangeException("Invalid RANGE PRECEDING value");
|
304
|
-
}
|
305
|
-
} else {
|
306
|
-
// Following but value before the current value
|
307
|
-
D_ASSERT(range == WindowBoundary::EXPR_FOLLOWING_RANGE);
|
308
|
-
const auto cur_val = over.GetCell<T>(order_begin);
|
309
|
-
if (comp(val, cur_val)) {
|
310
|
-
throw OutOfRangeException("Invalid RANGE FOLLOWING value");
|
311
|
-
}
|
312
|
-
}
|
313
|
-
|
314
|
-
// Try to reuse the previous bounds to restrict the search.
|
315
|
-
// This is only valid if the previous bounds were non-empty
|
316
|
-
// Only inject the comparisons if the previous bounds are a strict subset.
|
317
|
-
WindowColumnIterator<T> begin(over, order_begin);
|
318
|
-
WindowColumnIterator<T> end(over, order_end);
|
319
|
-
if (prev.start < prev.end) {
|
320
|
-
if (order_begin < prev.start && prev.start < order_end) {
|
321
|
-
const auto first = over.GetCell<T>(prev.start);
|
322
|
-
if (!comp(val, first)) {
|
323
|
-
// prev.first <= val, so we can start further forward
|
324
|
-
begin += UnsafeNumericCast<int64_t>(prev.start - order_begin);
|
325
|
-
}
|
326
|
-
}
|
327
|
-
if (order_begin < prev.end && prev.end < order_end) {
|
328
|
-
const auto second = over.GetCell<T>(prev.end - 1);
|
329
|
-
if (!comp(second, val)) {
|
330
|
-
// val <= prev.second, so we can end further back
|
331
|
-
// (prev.second is the largest peer)
|
332
|
-
end -= UnsafeNumericCast<int64_t>(order_end - prev.end - 1);
|
333
|
-
}
|
334
|
-
}
|
335
|
-
}
|
336
|
-
|
337
|
-
if (FROM) {
|
338
|
-
return idx_t(std::lower_bound(begin, end, val, comp));
|
339
|
-
} else {
|
340
|
-
return idx_t(std::upper_bound(begin, end, val, comp));
|
341
|
-
}
|
342
|
-
}
|
343
|
-
|
344
|
-
template <typename OP, bool FROM>
|
345
|
-
static idx_t FindRangeBound(const WindowInputColumn &over, const idx_t order_begin, const idx_t order_end,
|
346
|
-
const WindowBoundary range, WindowInputExpression &boundary, const idx_t chunk_idx,
|
347
|
-
const FrameBounds &prev) {
|
348
|
-
D_ASSERT(boundary.chunk.ColumnCount() == 1);
|
349
|
-
D_ASSERT(boundary.chunk.data[0].GetType().InternalType() == over.ptype);
|
350
|
-
|
351
|
-
switch (over.ptype) {
|
352
|
-
case PhysicalType::INT8:
|
353
|
-
return FindTypedRangeBound<int8_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
354
|
-
case PhysicalType::INT16:
|
355
|
-
return FindTypedRangeBound<int16_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
356
|
-
case PhysicalType::INT32:
|
357
|
-
return FindTypedRangeBound<int32_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
358
|
-
case PhysicalType::INT64:
|
359
|
-
return FindTypedRangeBound<int64_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
360
|
-
case PhysicalType::UINT8:
|
361
|
-
return FindTypedRangeBound<uint8_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
362
|
-
case PhysicalType::UINT16:
|
363
|
-
return FindTypedRangeBound<uint16_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
364
|
-
case PhysicalType::UINT32:
|
365
|
-
return FindTypedRangeBound<uint32_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
366
|
-
case PhysicalType::UINT64:
|
367
|
-
return FindTypedRangeBound<uint64_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
368
|
-
case PhysicalType::INT128:
|
369
|
-
return FindTypedRangeBound<hugeint_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
370
|
-
case PhysicalType::UINT128:
|
371
|
-
return FindTypedRangeBound<uhugeint_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx,
|
372
|
-
prev);
|
373
|
-
case PhysicalType::FLOAT:
|
374
|
-
return FindTypedRangeBound<float, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
375
|
-
case PhysicalType::DOUBLE:
|
376
|
-
return FindTypedRangeBound<double, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
377
|
-
case PhysicalType::INTERVAL:
|
378
|
-
return FindTypedRangeBound<interval_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx,
|
379
|
-
prev);
|
380
|
-
default:
|
381
|
-
throw InternalException("Unsupported column type for RANGE");
|
382
|
-
}
|
383
|
-
}
|
384
|
-
|
385
|
-
template <bool FROM>
|
386
|
-
static idx_t FindOrderedRangeBound(const WindowInputColumn &over, const OrderType range_sense, const idx_t order_begin,
|
387
|
-
const idx_t order_end, const WindowBoundary range, WindowInputExpression &boundary,
|
388
|
-
const idx_t chunk_idx, const FrameBounds &prev) {
|
389
|
-
switch (range_sense) {
|
390
|
-
case OrderType::ASCENDING:
|
391
|
-
return FindRangeBound<LessThan, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
392
|
-
case OrderType::DESCENDING:
|
393
|
-
return FindRangeBound<GreaterThan, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
394
|
-
default:
|
395
|
-
throw InternalException("Unsupported ORDER BY sense for RANGE");
|
396
|
-
}
|
397
|
-
}
|
398
|
-
|
399
|
-
struct WindowBoundariesState {
|
400
|
-
static inline bool IsScalar(const unique_ptr<Expression> &expr) {
|
401
|
-
return !expr || expr->IsScalar();
|
402
|
-
}
|
403
|
-
|
404
|
-
static inline bool BoundaryNeedsPeer(const WindowBoundary &boundary) {
|
405
|
-
switch (boundary) {
|
406
|
-
case WindowBoundary::CURRENT_ROW_RANGE:
|
407
|
-
case WindowBoundary::EXPR_PRECEDING_RANGE:
|
408
|
-
case WindowBoundary::EXPR_FOLLOWING_RANGE:
|
409
|
-
return true;
|
410
|
-
default:
|
411
|
-
return false;
|
412
|
-
}
|
413
|
-
}
|
414
|
-
|
415
|
-
static inline bool ExpressionNeedsPeer(const ExpressionType &type) {
|
416
|
-
switch (type) {
|
417
|
-
case ExpressionType::WINDOW_RANK:
|
418
|
-
case ExpressionType::WINDOW_RANK_DENSE:
|
419
|
-
case ExpressionType::WINDOW_PERCENT_RANK:
|
420
|
-
case ExpressionType::WINDOW_CUME_DIST:
|
421
|
-
return true;
|
422
|
-
default:
|
423
|
-
return false;
|
424
|
-
}
|
425
|
-
}
|
426
|
-
|
427
|
-
WindowBoundariesState(const BoundWindowExpression &wexpr, const idx_t input_size);
|
428
|
-
|
429
|
-
void Update(const idx_t row_idx, const WindowInputColumn &range_collection, const idx_t chunk_idx,
|
430
|
-
WindowInputExpression &boundary_start, WindowInputExpression &boundary_end,
|
431
|
-
const ValidityMask &partition_mask, const ValidityMask &order_mask);
|
432
|
-
|
433
|
-
void Bounds(DataChunk &bounds, idx_t row_idx, const WindowInputColumn &range, const idx_t count,
|
434
|
-
WindowInputExpression &boundary_start, WindowInputExpression &boundary_end,
|
435
|
-
const ValidityMask &partition_mask, const ValidityMask &order_mask);
|
436
|
-
|
437
|
-
// Cached lookups
|
438
|
-
const ExpressionType type;
|
439
|
-
const idx_t input_size;
|
440
|
-
const WindowBoundary start_boundary;
|
441
|
-
const WindowBoundary end_boundary;
|
442
|
-
const size_t partition_count;
|
443
|
-
const size_t order_count;
|
444
|
-
const OrderType range_sense;
|
445
|
-
const bool has_preceding_range;
|
446
|
-
const bool has_following_range;
|
447
|
-
const bool needs_peer;
|
448
|
-
|
449
|
-
idx_t next_pos = 0;
|
450
|
-
idx_t partition_start = 0;
|
451
|
-
idx_t partition_end = 0;
|
452
|
-
idx_t peer_start = 0;
|
453
|
-
idx_t peer_end = 0;
|
454
|
-
idx_t valid_start = 0;
|
455
|
-
idx_t valid_end = 0;
|
456
|
-
idx_t window_start = NumericLimits<idx_t>::Maximum();
|
457
|
-
idx_t window_end = NumericLimits<idx_t>::Maximum();
|
458
|
-
FrameBounds prev;
|
459
|
-
};
|
460
|
-
|
461
|
-
//===--------------------------------------------------------------------===//
|
462
|
-
// WindowBoundariesState
|
463
|
-
//===--------------------------------------------------------------------===//
|
464
|
-
void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn &range_collection,
|
465
|
-
const idx_t chunk_idx, WindowInputExpression &boundary_start,
|
466
|
-
WindowInputExpression &boundary_end, const ValidityMask &partition_mask,
|
467
|
-
const ValidityMask &order_mask) {
|
468
|
-
|
469
|
-
if (partition_count + order_count > 0) {
|
470
|
-
|
471
|
-
// determine partition and peer group boundaries to ultimately figure out window size
|
472
|
-
const auto is_same_partition = !partition_mask.RowIsValidUnsafe(row_idx);
|
473
|
-
const auto is_peer = !order_mask.RowIsValidUnsafe(row_idx);
|
474
|
-
const auto is_jump = (next_pos != row_idx);
|
475
|
-
|
476
|
-
// when the partition changes, recompute the boundaries
|
477
|
-
if (!is_same_partition || is_jump) {
|
478
|
-
if (is_jump) {
|
479
|
-
idx_t n = 1;
|
480
|
-
partition_start = FindPrevStart(partition_mask, 0, row_idx + 1, n);
|
481
|
-
n = 1;
|
482
|
-
peer_start = FindPrevStart(order_mask, 0, row_idx + 1, n);
|
483
|
-
} else {
|
484
|
-
partition_start = row_idx;
|
485
|
-
peer_start = row_idx;
|
486
|
-
}
|
487
|
-
|
488
|
-
// find end of partition
|
489
|
-
partition_end = input_size;
|
490
|
-
if (partition_count) {
|
491
|
-
idx_t n = 1;
|
492
|
-
partition_end = FindNextStart(partition_mask, partition_start + 1, input_size, n);
|
493
|
-
}
|
494
|
-
|
495
|
-
// Find valid ordering values for the new partition
|
496
|
-
// so we can exclude NULLs from RANGE expression computations
|
497
|
-
valid_start = partition_start;
|
498
|
-
valid_end = partition_end;
|
499
|
-
|
500
|
-
if ((valid_start < valid_end) && has_preceding_range) {
|
501
|
-
// Exclude any leading NULLs
|
502
|
-
if (range_collection.CellIsNull(valid_start)) {
|
503
|
-
idx_t n = 1;
|
504
|
-
valid_start = FindNextStart(order_mask, valid_start + 1, valid_end, n);
|
505
|
-
}
|
506
|
-
}
|
507
|
-
|
508
|
-
if ((valid_start < valid_end) && has_following_range) {
|
509
|
-
// Exclude any trailing NULLs
|
510
|
-
if (range_collection.CellIsNull(valid_end - 1)) {
|
511
|
-
idx_t n = 1;
|
512
|
-
valid_end = FindPrevStart(order_mask, valid_start, valid_end, n);
|
513
|
-
}
|
514
|
-
|
515
|
-
// Reset range hints
|
516
|
-
prev.start = valid_start;
|
517
|
-
prev.end = valid_end;
|
518
|
-
}
|
519
|
-
} else if (!is_peer) {
|
520
|
-
peer_start = row_idx;
|
521
|
-
}
|
522
|
-
|
523
|
-
if (needs_peer) {
|
524
|
-
peer_end = partition_end;
|
525
|
-
if (order_count) {
|
526
|
-
idx_t n = 1;
|
527
|
-
peer_end = FindNextStart(order_mask, peer_start + 1, partition_end, n);
|
528
|
-
}
|
529
|
-
}
|
530
|
-
|
531
|
-
} else {
|
532
|
-
// OVER()
|
533
|
-
partition_end = input_size;
|
534
|
-
peer_end = partition_end;
|
535
|
-
}
|
536
|
-
next_pos = row_idx + 1;
|
537
|
-
|
538
|
-
// determine window boundaries depending on the type of expression
|
539
|
-
switch (start_boundary) {
|
540
|
-
case WindowBoundary::UNBOUNDED_PRECEDING:
|
541
|
-
window_start = partition_start;
|
542
|
-
break;
|
543
|
-
case WindowBoundary::CURRENT_ROW_ROWS:
|
544
|
-
window_start = row_idx;
|
545
|
-
break;
|
546
|
-
case WindowBoundary::CURRENT_ROW_RANGE:
|
547
|
-
window_start = peer_start;
|
548
|
-
break;
|
549
|
-
case WindowBoundary::EXPR_PRECEDING_ROWS: {
|
550
|
-
int64_t computed_start;
|
551
|
-
if (!TrySubtractOperator::Operation(static_cast<int64_t>(row_idx), boundary_start.GetCell<int64_t>(chunk_idx),
|
552
|
-
computed_start)) {
|
553
|
-
window_start = partition_start;
|
554
|
-
} else {
|
555
|
-
window_start = UnsafeNumericCast<idx_t>(MaxValue<int64_t>(computed_start, 0));
|
556
|
-
}
|
557
|
-
break;
|
558
|
-
}
|
559
|
-
case WindowBoundary::EXPR_FOLLOWING_ROWS: {
|
560
|
-
int64_t computed_start;
|
561
|
-
if (!TryAddOperator::Operation(static_cast<int64_t>(row_idx), boundary_start.GetCell<int64_t>(chunk_idx),
|
562
|
-
computed_start)) {
|
563
|
-
window_start = partition_start;
|
564
|
-
} else {
|
565
|
-
window_start = UnsafeNumericCast<idx_t>(MaxValue<int64_t>(computed_start, 0));
|
566
|
-
}
|
567
|
-
break;
|
568
|
-
}
|
569
|
-
case WindowBoundary::EXPR_PRECEDING_RANGE: {
|
570
|
-
if (boundary_start.CellIsNull(chunk_idx)) {
|
571
|
-
window_start = peer_start;
|
572
|
-
} else {
|
573
|
-
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, valid_start, row_idx + 1,
|
574
|
-
start_boundary, boundary_start, chunk_idx, prev);
|
575
|
-
window_start = prev.start;
|
576
|
-
}
|
577
|
-
break;
|
578
|
-
}
|
579
|
-
case WindowBoundary::EXPR_FOLLOWING_RANGE: {
|
580
|
-
if (boundary_start.CellIsNull(chunk_idx)) {
|
581
|
-
window_start = peer_start;
|
582
|
-
} else {
|
583
|
-
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, row_idx, valid_end, start_boundary,
|
584
|
-
boundary_start, chunk_idx, prev);
|
585
|
-
window_start = prev.start;
|
586
|
-
}
|
587
|
-
break;
|
588
|
-
}
|
589
|
-
default:
|
590
|
-
throw InternalException("Unsupported window start boundary");
|
591
|
-
}
|
592
|
-
|
593
|
-
switch (end_boundary) {
|
594
|
-
case WindowBoundary::CURRENT_ROW_ROWS:
|
595
|
-
window_end = row_idx + 1;
|
596
|
-
break;
|
597
|
-
case WindowBoundary::CURRENT_ROW_RANGE:
|
598
|
-
window_end = peer_end;
|
599
|
-
break;
|
600
|
-
case WindowBoundary::UNBOUNDED_FOLLOWING:
|
601
|
-
window_end = partition_end;
|
602
|
-
break;
|
603
|
-
case WindowBoundary::EXPR_PRECEDING_ROWS: {
|
604
|
-
int64_t computed_start;
|
605
|
-
if (!TrySubtractOperator::Operation(int64_t(row_idx + 1), boundary_end.GetCell<int64_t>(chunk_idx),
|
606
|
-
computed_start)) {
|
607
|
-
window_end = partition_end;
|
608
|
-
} else {
|
609
|
-
window_end = UnsafeNumericCast<idx_t>(MaxValue<int64_t>(computed_start, 0));
|
610
|
-
}
|
611
|
-
break;
|
612
|
-
}
|
613
|
-
case WindowBoundary::EXPR_FOLLOWING_ROWS: {
|
614
|
-
int64_t computed_start;
|
615
|
-
if (!TryAddOperator::Operation(int64_t(row_idx + 1), boundary_end.GetCell<int64_t>(chunk_idx),
|
616
|
-
computed_start)) {
|
617
|
-
window_end = partition_end;
|
618
|
-
} else {
|
619
|
-
window_end = UnsafeNumericCast<idx_t>(MaxValue<int64_t>(computed_start, 0));
|
620
|
-
}
|
621
|
-
break;
|
622
|
-
}
|
623
|
-
case WindowBoundary::EXPR_PRECEDING_RANGE: {
|
624
|
-
if (boundary_end.CellIsNull(chunk_idx)) {
|
625
|
-
window_end = peer_end;
|
626
|
-
} else {
|
627
|
-
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, valid_start, row_idx + 1,
|
628
|
-
end_boundary, boundary_end, chunk_idx, prev);
|
629
|
-
window_end = prev.end;
|
630
|
-
}
|
631
|
-
break;
|
632
|
-
}
|
633
|
-
case WindowBoundary::EXPR_FOLLOWING_RANGE: {
|
634
|
-
if (boundary_end.CellIsNull(chunk_idx)) {
|
635
|
-
window_end = peer_end;
|
636
|
-
} else {
|
637
|
-
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, row_idx, valid_end, end_boundary,
|
638
|
-
boundary_end, chunk_idx, prev);
|
639
|
-
window_end = prev.end;
|
640
|
-
}
|
641
|
-
break;
|
642
|
-
}
|
643
|
-
default:
|
644
|
-
throw InternalException("Unsupported window end boundary");
|
645
|
-
}
|
646
|
-
|
647
|
-
// clamp windows to partitions if they should exceed
|
648
|
-
if (window_start < partition_start) {
|
649
|
-
window_start = partition_start;
|
650
|
-
}
|
651
|
-
if (window_start > partition_end) {
|
652
|
-
window_start = partition_end;
|
653
|
-
}
|
654
|
-
if (window_end < partition_start) {
|
655
|
-
window_end = partition_start;
|
656
|
-
}
|
657
|
-
if (window_end > partition_end) {
|
658
|
-
window_end = partition_end;
|
659
|
-
}
|
660
|
-
}
|
661
|
-
|
662
|
-
static bool HasPrecedingRange(const BoundWindowExpression &wexpr) {
|
663
|
-
return (wexpr.start == WindowBoundary::EXPR_PRECEDING_RANGE || wexpr.end == WindowBoundary::EXPR_PRECEDING_RANGE);
|
664
|
-
}
|
665
|
-
|
666
|
-
static bool HasFollowingRange(const BoundWindowExpression &wexpr) {
|
667
|
-
return (wexpr.start == WindowBoundary::EXPR_FOLLOWING_RANGE || wexpr.end == WindowBoundary::EXPR_FOLLOWING_RANGE);
|
668
|
-
}
|
669
|
-
|
670
|
-
WindowBoundariesState::WindowBoundariesState(const BoundWindowExpression &wexpr, const idx_t input_size)
|
671
|
-
: type(wexpr.type), input_size(input_size), start_boundary(wexpr.start), end_boundary(wexpr.end),
|
672
|
-
partition_count(wexpr.partitions.size()), order_count(wexpr.orders.size()),
|
673
|
-
range_sense(wexpr.orders.empty() ? OrderType::INVALID : wexpr.orders[0].type),
|
674
|
-
has_preceding_range(HasPrecedingRange(wexpr)), has_following_range(HasFollowingRange(wexpr)),
|
675
|
-
// if we have EXCLUDE GROUP / TIES, we also need peer boundaries
|
676
|
-
needs_peer(BoundaryNeedsPeer(wexpr.end) || ExpressionNeedsPeer(wexpr.type) ||
|
677
|
-
wexpr.exclude_clause >= WindowExcludeMode::GROUP) {
|
678
|
-
}
|
679
|
-
|
680
|
-
void WindowBoundariesState::Bounds(DataChunk &bounds, idx_t row_idx, const WindowInputColumn &range, const idx_t count,
|
681
|
-
WindowInputExpression &boundary_start, WindowInputExpression &boundary_end,
|
682
|
-
const ValidityMask &partition_mask, const ValidityMask &order_mask) {
|
683
|
-
bounds.Reset();
|
684
|
-
D_ASSERT(bounds.ColumnCount() == 6);
|
685
|
-
auto partition_begin_data = FlatVector::GetData<idx_t>(bounds.data[PARTITION_BEGIN]);
|
686
|
-
auto partition_end_data = FlatVector::GetData<idx_t>(bounds.data[PARTITION_END]);
|
687
|
-
auto peer_begin_data = FlatVector::GetData<idx_t>(bounds.data[PEER_BEGIN]);
|
688
|
-
auto peer_end_data = FlatVector::GetData<idx_t>(bounds.data[PEER_END]);
|
689
|
-
auto window_begin_data = FlatVector::GetData<int64_t>(bounds.data[WINDOW_BEGIN]);
|
690
|
-
auto window_end_data = FlatVector::GetData<int64_t>(bounds.data[WINDOW_END]);
|
691
|
-
for (idx_t chunk_idx = 0; chunk_idx < count; ++chunk_idx, ++row_idx) {
|
692
|
-
Update(row_idx, range, chunk_idx, boundary_start, boundary_end, partition_mask, order_mask);
|
693
|
-
*partition_begin_data++ = partition_start;
|
694
|
-
*partition_end_data++ = partition_end;
|
695
|
-
if (needs_peer) {
|
696
|
-
*peer_begin_data++ = peer_start;
|
697
|
-
*peer_end_data++ = peer_end;
|
698
|
-
}
|
699
|
-
*window_begin_data++ = UnsafeNumericCast<int64_t>(window_start);
|
700
|
-
*window_end_data++ = UnsafeNumericCast<int64_t>(window_end);
|
701
|
-
}
|
702
|
-
bounds.SetCardinality(count);
|
703
|
-
}
|
704
|
-
|
705
|
-
//===--------------------------------------------------------------------===//
|
706
|
-
// WindowExecutorBoundsState
|
707
|
-
//===--------------------------------------------------------------------===//
|
708
|
-
class WindowExecutorBoundsState : public WindowExecutorLocalState {
|
709
|
-
public:
|
710
|
-
explicit WindowExecutorBoundsState(const WindowExecutorGlobalState &gstate);
|
711
|
-
~WindowExecutorBoundsState() override {
|
712
|
-
}
|
713
|
-
|
714
|
-
virtual void UpdateBounds(idx_t row_idx, DataChunk &input_chunk, const WindowInputColumn &range);
|
715
|
-
|
716
|
-
// Frame management
|
717
|
-
const ValidityMask &partition_mask;
|
718
|
-
const ValidityMask &order_mask;
|
719
|
-
DataChunk bounds;
|
720
|
-
WindowBoundariesState state;
|
721
|
-
|
722
|
-
// evaluate boundaries if present. Parser has checked boundary types.
|
723
|
-
WindowInputExpression boundary_start;
|
724
|
-
WindowInputExpression boundary_end;
|
725
|
-
};
|
726
|
-
|
727
|
-
WindowExecutorBoundsState::WindowExecutorBoundsState(const WindowExecutorGlobalState &gstate)
|
728
|
-
: WindowExecutorLocalState(gstate), partition_mask(gstate.partition_mask), order_mask(gstate.order_mask),
|
729
|
-
state(gstate.executor.wexpr, gstate.payload_count),
|
730
|
-
boundary_start(gstate.executor.wexpr.start_expr.get(), gstate.executor.context),
|
731
|
-
boundary_end(gstate.executor.wexpr.end_expr.get(), gstate.executor.context) {
|
732
|
-
vector<LogicalType> bounds_types(6, LogicalType(LogicalTypeId::UBIGINT));
|
733
|
-
bounds.Initialize(Allocator::Get(gstate.executor.context), bounds_types);
|
734
|
-
}
|
735
|
-
|
736
|
-
void WindowExecutorBoundsState::UpdateBounds(idx_t row_idx, DataChunk &input_chunk, const WindowInputColumn &range) {
|
737
|
-
// Evaluate the row-level arguments
|
738
|
-
boundary_start.Execute(input_chunk);
|
739
|
-
boundary_end.Execute(input_chunk);
|
740
|
-
|
741
|
-
const auto count = input_chunk.size();
|
742
|
-
bounds.Reset();
|
743
|
-
state.Bounds(bounds, row_idx, range, count, boundary_start, boundary_end, partition_mask, order_mask);
|
744
|
-
}
|
745
|
-
|
746
|
-
//===--------------------------------------------------------------------===//
|
747
|
-
// ExclusionFilter
|
748
|
-
//===--------------------------------------------------------------------===//
|
749
|
-
|
750
|
-
//! Handles window exclusion by piggybacking on the filtering logic.
|
751
|
-
//! (needed for first_value, last_value, nth_value)
|
752
|
-
class ExclusionFilter {
|
753
|
-
public:
|
754
|
-
ExclusionFilter(const WindowExcludeMode exclude_mode_p, idx_t total_count, const ValidityMask &src)
|
755
|
-
: mode(exclude_mode_p), mask_src(src) {
|
756
|
-
mask.Initialize(total_count);
|
757
|
-
|
758
|
-
// copy the data from mask_src
|
759
|
-
FetchFromSource(0, total_count);
|
760
|
-
}
|
761
|
-
|
762
|
-
//! Copy the entries from mask_src to mask, in the index range [begin, end)
|
763
|
-
void FetchFromSource(idx_t begin, idx_t end);
|
764
|
-
//! Apply the current exclusion to the validity mask
|
765
|
-
//! (offset is the current row's index within the chunk)
|
766
|
-
void ApplyExclusion(DataChunk &bounds, idx_t row_idx, idx_t offset);
|
767
|
-
//! Reset the validity mask to match mask_src
|
768
|
-
//! (offset is the current row's index within the chunk)
|
769
|
-
void ResetMask(idx_t row_idx, idx_t offset);
|
770
|
-
|
771
|
-
//! The current peer group's begin
|
772
|
-
idx_t curr_peer_begin;
|
773
|
-
//! The current peer group's end
|
774
|
-
idx_t curr_peer_end;
|
775
|
-
//! The window exclusion mode
|
776
|
-
WindowExcludeMode mode;
|
777
|
-
//! The validity mask representing the exclusion
|
778
|
-
ValidityMask mask;
|
779
|
-
//! The validity mask upon which mask is based
|
780
|
-
const ValidityMask &mask_src;
|
781
|
-
//! A validity mask consisting of only one entries (needed if no ignore_nulls mask is supplied)
|
782
|
-
ValidityMask all_ones_mask;
|
783
|
-
};
|
784
|
-
|
785
|
-
void ExclusionFilter::FetchFromSource(idx_t begin, idx_t end) {
|
786
|
-
idx_t begin_entry_idx;
|
787
|
-
idx_t end_entry_idx;
|
788
|
-
idx_t idx_in_entry;
|
789
|
-
mask.GetEntryIndex(begin, begin_entry_idx, idx_in_entry);
|
790
|
-
mask.GetEntryIndex(end - 1, end_entry_idx, idx_in_entry);
|
791
|
-
auto dst = mask.GetData() + begin_entry_idx;
|
792
|
-
for (idx_t entry_idx = begin_entry_idx; entry_idx <= end_entry_idx; ++entry_idx) {
|
793
|
-
*dst++ = mask_src.GetValidityEntry(entry_idx);
|
794
|
-
}
|
795
|
-
}
|
796
|
-
|
797
|
-
void ExclusionFilter::ApplyExclusion(DataChunk &bounds, idx_t row_idx, idx_t offset) {
|
798
|
-
// flip the bits in mask according to the window exclusion mode
|
799
|
-
switch (mode) {
|
800
|
-
case WindowExcludeMode::CURRENT_ROW:
|
801
|
-
mask.SetInvalid(row_idx);
|
802
|
-
break;
|
803
|
-
case WindowExcludeMode::TIES:
|
804
|
-
case WindowExcludeMode::GROUP: {
|
805
|
-
if (curr_peer_end == row_idx || offset == 0) {
|
806
|
-
// new peer group or input chunk: set entire peer group to invalid
|
807
|
-
auto peer_begin = FlatVector::GetData<const idx_t>(bounds.data[PEER_BEGIN]);
|
808
|
-
auto peer_end = FlatVector::GetData<const idx_t>(bounds.data[PEER_END]);
|
809
|
-
curr_peer_begin = peer_begin[offset];
|
810
|
-
curr_peer_end = peer_end[offset];
|
811
|
-
for (idx_t i = curr_peer_begin; i < curr_peer_end; i++) {
|
812
|
-
mask.SetInvalid(i);
|
813
|
-
}
|
814
|
-
}
|
815
|
-
if (mode == WindowExcludeMode::TIES) {
|
816
|
-
mask.Set(row_idx, mask_src.RowIsValid(row_idx));
|
817
|
-
}
|
818
|
-
break;
|
819
|
-
}
|
820
|
-
default:
|
821
|
-
break;
|
822
|
-
}
|
823
|
-
}
|
824
|
-
|
825
|
-
void ExclusionFilter::ResetMask(idx_t row_idx, idx_t offset) {
|
826
|
-
// flip the bits that were modified in ApplyExclusion back
|
827
|
-
switch (mode) {
|
828
|
-
case WindowExcludeMode::CURRENT_ROW:
|
829
|
-
mask.Set(row_idx, mask_src.RowIsValid(row_idx));
|
830
|
-
break;
|
831
|
-
case WindowExcludeMode::TIES:
|
832
|
-
mask.SetInvalid(row_idx);
|
833
|
-
DUCKDB_EXPLICIT_FALLTHROUGH;
|
834
|
-
case WindowExcludeMode::GROUP:
|
835
|
-
if (curr_peer_end == row_idx + 1) {
|
836
|
-
// if we've reached the peer group's end, restore the entire peer group
|
837
|
-
FetchFromSource(curr_peer_begin, curr_peer_end);
|
838
|
-
}
|
839
|
-
break;
|
840
|
-
default:
|
841
|
-
break;
|
842
|
-
}
|
843
|
-
}
|
844
|
-
|
845
|
-
//===--------------------------------------------------------------------===//
|
846
|
-
// WindowExecutor
|
847
|
-
//===--------------------------------------------------------------------===//
|
848
|
-
static void PrepareInputExpressions(const vector<unique_ptr<Expression>> &exprs, ExpressionExecutor &executor,
|
849
|
-
DataChunk &chunk) {
|
850
|
-
if (exprs.empty()) {
|
851
|
-
return;
|
852
|
-
}
|
853
|
-
|
854
|
-
vector<LogicalType> types;
|
855
|
-
for (idx_t expr_idx = 0; expr_idx < exprs.size(); ++expr_idx) {
|
856
|
-
types.push_back(exprs[expr_idx]->return_type);
|
857
|
-
executor.AddExpression(*exprs[expr_idx]);
|
858
|
-
}
|
859
|
-
|
860
|
-
if (!types.empty()) {
|
861
|
-
auto &allocator = executor.GetAllocator();
|
862
|
-
chunk.Initialize(allocator, types);
|
863
|
-
}
|
864
|
-
}
|
865
|
-
|
866
|
-
WindowExecutor::WindowExecutor(BoundWindowExpression &wexpr, ClientContext &context) : wexpr(wexpr), context(context) {
|
867
|
-
}
|
868
|
-
|
869
|
-
WindowExecutorGlobalState::WindowExecutorGlobalState(const WindowExecutor &executor, const idx_t payload_count,
|
870
|
-
const ValidityMask &partition_mask, const ValidityMask &order_mask)
|
871
|
-
: executor(executor), payload_count(payload_count), partition_mask(partition_mask), order_mask(order_mask),
|
872
|
-
range((HasPrecedingRange(executor.wexpr) || HasFollowingRange(executor.wexpr))
|
873
|
-
? executor.wexpr.orders[0].expression.get()
|
874
|
-
: nullptr,
|
875
|
-
executor.context, payload_count) {
|
876
|
-
for (const auto &child : executor.wexpr.children) {
|
877
|
-
arg_types.emplace_back(child->return_type);
|
878
|
-
}
|
879
|
-
}
|
880
|
-
|
881
|
-
WindowExecutorLocalState::WindowExecutorLocalState(const WindowExecutorGlobalState &gstate)
|
882
|
-
: payload_executor(gstate.executor.context), range_executor(gstate.executor.context) {
|
883
|
-
// TODO: child may be a scalar, don't need to materialize the whole collection then
|
884
|
-
|
885
|
-
// evaluate inner expressions of window functions, could be more complex
|
886
|
-
PrepareInputExpressions(gstate.executor.wexpr.children, payload_executor, payload_chunk);
|
887
|
-
|
888
|
-
if (gstate.range.expr) {
|
889
|
-
vector<LogicalType> types;
|
890
|
-
types.emplace_back(gstate.range.expr->return_type);
|
891
|
-
range_executor.AddExpression(*gstate.range.expr);
|
892
|
-
|
893
|
-
auto &allocator = range_executor.GetAllocator();
|
894
|
-
range_chunk.Initialize(allocator, types);
|
895
|
-
}
|
896
|
-
}
|
897
|
-
|
898
|
-
void WindowExecutorLocalState::Sink(WindowExecutorGlobalState &gstate, DataChunk &input_chunk, idx_t input_idx) {
|
899
|
-
if (gstate.range.expr && (!input_idx || !gstate.range.scalar)) {
|
900
|
-
range_executor.Execute(input_chunk, range_chunk);
|
901
|
-
gstate.range.Copy(range_chunk, input_idx);
|
902
|
-
}
|
903
|
-
}
|
904
|
-
|
905
|
-
unique_ptr<WindowExecutorGlobalState> WindowExecutor::GetGlobalState(const idx_t payload_count,
|
906
|
-
const ValidityMask &partition_mask,
|
907
|
-
const ValidityMask &order_mask) const {
|
908
|
-
return make_uniq<WindowExecutorGlobalState>(*this, payload_count, partition_mask, order_mask);
|
909
|
-
}
|
910
|
-
|
911
|
-
unique_ptr<WindowExecutorLocalState> WindowExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
912
|
-
return make_uniq<WindowExecutorBoundsState>(gstate);
|
913
|
-
}
|
914
|
-
|
915
|
-
void WindowExecutor::Sink(DataChunk &input_chunk, const idx_t input_idx, const idx_t total_count,
|
916
|
-
WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate) const {
|
917
|
-
lstate.Sink(gstate, input_chunk, input_idx);
|
918
|
-
}
|
919
|
-
|
920
|
-
//===--------------------------------------------------------------------===//
|
921
|
-
// WindowAggregateExecutor
|
922
|
-
//===--------------------------------------------------------------------===//
|
923
|
-
class WindowAggregateExecutorGlobalState : public WindowExecutorGlobalState {
|
924
|
-
public:
|
925
|
-
bool IsConstantAggregate();
|
926
|
-
bool IsCustomAggregate();
|
927
|
-
bool IsDistinctAggregate();
|
928
|
-
|
929
|
-
WindowAggregateExecutorGlobalState(const WindowAggregateExecutor &executor, const idx_t payload_count,
|
930
|
-
const ValidityMask &partition_mask, const ValidityMask &order_mask);
|
931
|
-
|
932
|
-
// aggregate computation algorithm
|
933
|
-
unique_ptr<WindowAggregator> aggregator;
|
934
|
-
// aggregate global state
|
935
|
-
unique_ptr<WindowAggregatorState> gsink;
|
936
|
-
};
|
937
|
-
|
938
|
-
bool WindowAggregateExecutorGlobalState::IsConstantAggregate() {
|
939
|
-
const auto &wexpr = executor.wexpr;
|
940
|
-
|
941
|
-
if (!wexpr.aggregate) {
|
942
|
-
return false;
|
943
|
-
}
|
944
|
-
// window exclusion cannot be handled by constant aggregates
|
945
|
-
if (wexpr.exclude_clause != WindowExcludeMode::NO_OTHER) {
|
946
|
-
return false;
|
947
|
-
}
|
948
|
-
|
949
|
-
// COUNT(*) is already handled efficiently by segment trees.
|
950
|
-
if (wexpr.children.empty()) {
|
951
|
-
return false;
|
952
|
-
}
|
953
|
-
|
954
|
-
/*
|
955
|
-
The default framing option is RANGE UNBOUNDED PRECEDING, which
|
956
|
-
is the same as RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT
|
957
|
-
ROW; it sets the frame to be all rows from the partition start
|
958
|
-
up through the current row's last peer (a row that the window's
|
959
|
-
ORDER BY clause considers equivalent to the current row; all
|
960
|
-
rows are peers if there is no ORDER BY). In general, UNBOUNDED
|
961
|
-
PRECEDING means that the frame starts with the first row of the
|
962
|
-
partition, and similarly UNBOUNDED FOLLOWING means that the
|
963
|
-
frame ends with the last row of the partition, regardless of
|
964
|
-
RANGE, ROWS or GROUPS mode. In ROWS mode, CURRENT ROW means that
|
965
|
-
the frame starts or ends with the current row; but in RANGE or
|
966
|
-
GROUPS mode it means that the frame starts or ends with the
|
967
|
-
current row's first or last peer in the ORDER BY ordering. The
|
968
|
-
offset PRECEDING and offset FOLLOWING options vary in meaning
|
969
|
-
depending on the frame mode.
|
970
|
-
*/
|
971
|
-
switch (wexpr.start) {
|
972
|
-
case WindowBoundary::UNBOUNDED_PRECEDING:
|
973
|
-
break;
|
974
|
-
case WindowBoundary::CURRENT_ROW_RANGE:
|
975
|
-
if (!wexpr.orders.empty()) {
|
976
|
-
return false;
|
977
|
-
}
|
978
|
-
break;
|
979
|
-
default:
|
980
|
-
return false;
|
981
|
-
}
|
982
|
-
|
983
|
-
switch (wexpr.end) {
|
984
|
-
case WindowBoundary::UNBOUNDED_FOLLOWING:
|
985
|
-
break;
|
986
|
-
case WindowBoundary::CURRENT_ROW_RANGE:
|
987
|
-
if (!wexpr.orders.empty()) {
|
988
|
-
return false;
|
989
|
-
}
|
990
|
-
break;
|
991
|
-
default:
|
992
|
-
return false;
|
993
|
-
}
|
994
|
-
|
995
|
-
return true;
|
996
|
-
}
|
997
|
-
|
998
|
-
bool WindowAggregateExecutorGlobalState::IsDistinctAggregate() {
|
999
|
-
const auto &wexpr = executor.wexpr;
|
1000
|
-
|
1001
|
-
if (!wexpr.aggregate) {
|
1002
|
-
return false;
|
1003
|
-
}
|
1004
|
-
|
1005
|
-
return wexpr.distinct;
|
1006
|
-
}
|
1007
|
-
|
1008
|
-
bool WindowAggregateExecutorGlobalState::IsCustomAggregate() {
|
1009
|
-
const auto &wexpr = executor.wexpr;
|
1010
|
-
const auto &mode = reinterpret_cast<const WindowAggregateExecutor &>(executor).mode;
|
1011
|
-
|
1012
|
-
if (!wexpr.aggregate) {
|
1013
|
-
return false;
|
1014
|
-
}
|
1015
|
-
|
1016
|
-
if (!AggregateObject(wexpr).function.window) {
|
1017
|
-
return false;
|
1018
|
-
}
|
1019
|
-
|
1020
|
-
return (mode < WindowAggregationMode::COMBINE);
|
1021
|
-
}
|
1022
|
-
|
1023
|
-
void WindowExecutor::Evaluate(idx_t row_idx, DataChunk &input_chunk, Vector &result, WindowExecutorLocalState &lstate,
|
1024
|
-
WindowExecutorGlobalState &gstate) const {
|
1025
|
-
auto &lbstate = lstate.Cast<WindowExecutorBoundsState>();
|
1026
|
-
lbstate.UpdateBounds(row_idx, input_chunk, gstate.range);
|
1027
|
-
|
1028
|
-
const auto count = input_chunk.size();
|
1029
|
-
EvaluateInternal(gstate, lstate, result, count, row_idx);
|
1030
|
-
|
1031
|
-
result.Verify(count);
|
1032
|
-
}
|
1033
|
-
|
1034
|
-
WindowAggregateExecutor::WindowAggregateExecutor(BoundWindowExpression &wexpr, ClientContext &context,
|
1035
|
-
WindowAggregationMode mode)
|
1036
|
-
: WindowExecutor(wexpr, context), mode(mode) {
|
1037
|
-
}
|
1038
|
-
|
1039
|
-
WindowAggregateExecutorGlobalState::WindowAggregateExecutorGlobalState(const WindowAggregateExecutor &executor,
|
1040
|
-
const idx_t group_count,
|
1041
|
-
const ValidityMask &partition_mask,
|
1042
|
-
const ValidityMask &order_mask)
|
1043
|
-
: WindowExecutorGlobalState(executor, group_count, partition_mask, order_mask) {
|
1044
|
-
auto &wexpr = executor.wexpr;
|
1045
|
-
auto &context = executor.context;
|
1046
|
-
auto return_type = wexpr.return_type;
|
1047
|
-
const auto &mode = reinterpret_cast<const WindowAggregateExecutor &>(executor).mode;
|
1048
|
-
|
1049
|
-
// Force naive for SEPARATE mode or for (currently!) unsupported functionality
|
1050
|
-
const auto force_naive =
|
1051
|
-
!ClientConfig::GetConfig(context).enable_optimizer || mode == WindowAggregationMode::SEPARATE;
|
1052
|
-
AggregateObject aggr(wexpr);
|
1053
|
-
if (force_naive || (wexpr.distinct && wexpr.exclude_clause != WindowExcludeMode::NO_OTHER)) {
|
1054
|
-
aggregator = make_uniq<WindowNaiveAggregator>(aggr, arg_types, return_type, wexpr.exclude_clause);
|
1055
|
-
} else if (IsDistinctAggregate()) {
|
1056
|
-
// build a merge sort tree
|
1057
|
-
// see https://dl.acm.org/doi/pdf/10.1145/3514221.3526184
|
1058
|
-
aggregator = make_uniq<WindowDistinctAggregator>(aggr, arg_types, return_type, wexpr.exclude_clause, context);
|
1059
|
-
} else if (IsConstantAggregate()) {
|
1060
|
-
aggregator = make_uniq<WindowConstantAggregator>(aggr, arg_types, return_type, wexpr.exclude_clause);
|
1061
|
-
} else if (IsCustomAggregate()) {
|
1062
|
-
aggregator = make_uniq<WindowCustomAggregator>(aggr, arg_types, return_type, wexpr.exclude_clause);
|
1063
|
-
} else {
|
1064
|
-
// build a segment tree for frame-adhering aggregates
|
1065
|
-
// see http://www.vldb.org/pvldb/vol8/p1058-leis.pdf
|
1066
|
-
aggregator = make_uniq<WindowSegmentTree>(aggr, arg_types, return_type, mode, wexpr.exclude_clause);
|
1067
|
-
}
|
1068
|
-
|
1069
|
-
gsink = aggregator->GetGlobalState(group_count, partition_mask);
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
unique_ptr<WindowExecutorGlobalState> WindowAggregateExecutor::GetGlobalState(const idx_t payload_count,
|
1073
|
-
const ValidityMask &partition_mask,
|
1074
|
-
const ValidityMask &order_mask) const {
|
1075
|
-
return make_uniq<WindowAggregateExecutorGlobalState>(*this, payload_count, partition_mask, order_mask);
|
1076
|
-
}
|
1077
|
-
|
1078
|
-
class WindowAggregateExecutorLocalState : public WindowExecutorBoundsState {
|
1079
|
-
public:
|
1080
|
-
WindowAggregateExecutorLocalState(const WindowExecutorGlobalState &gstate, const WindowAggregator &aggregator)
|
1081
|
-
: WindowExecutorBoundsState(gstate), filter_executor(gstate.executor.context) {
|
1082
|
-
|
1083
|
-
auto &gastate = gstate.Cast<WindowAggregateExecutorGlobalState>();
|
1084
|
-
aggregator_state = aggregator.GetLocalState(*gastate.gsink);
|
1085
|
-
|
1086
|
-
// evaluate the FILTER clause and stuff it into a large mask for compactness and reuse
|
1087
|
-
auto &wexpr = gstate.executor.wexpr;
|
1088
|
-
if (wexpr.filter_expr) {
|
1089
|
-
filter_executor.AddExpression(*wexpr.filter_expr);
|
1090
|
-
filter_sel.Initialize(STANDARD_VECTOR_SIZE);
|
1091
|
-
}
|
1092
|
-
}
|
1093
|
-
|
1094
|
-
public:
|
1095
|
-
// state of aggregator
|
1096
|
-
unique_ptr<WindowAggregatorState> aggregator_state;
|
1097
|
-
//! Executor for any filter clause
|
1098
|
-
ExpressionExecutor filter_executor;
|
1099
|
-
//! Result of filtering
|
1100
|
-
SelectionVector filter_sel;
|
1101
|
-
};
|
1102
|
-
|
1103
|
-
unique_ptr<WindowExecutorLocalState>
|
1104
|
-
WindowAggregateExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
1105
|
-
auto &gastate = gstate.Cast<WindowAggregateExecutorGlobalState>();
|
1106
|
-
auto res = make_uniq<WindowAggregateExecutorLocalState>(gstate, *gastate.aggregator);
|
1107
|
-
return std::move(res);
|
1108
|
-
}
|
1109
|
-
|
1110
|
-
void WindowAggregateExecutor::Sink(DataChunk &input_chunk, const idx_t input_idx, const idx_t total_count,
|
1111
|
-
WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate) const {
|
1112
|
-
auto &gastate = gstate.Cast<WindowAggregateExecutorGlobalState>();
|
1113
|
-
auto &lastate = lstate.Cast<WindowAggregateExecutorLocalState>();
|
1114
|
-
auto &filter_sel = lastate.filter_sel;
|
1115
|
-
auto &filter_executor = lastate.filter_executor;
|
1116
|
-
auto &payload_executor = lastate.payload_executor;
|
1117
|
-
auto &payload_chunk = lastate.payload_chunk;
|
1118
|
-
auto &aggregator = gastate.aggregator;
|
1119
|
-
|
1120
|
-
idx_t filtered = 0;
|
1121
|
-
SelectionVector *filtering = nullptr;
|
1122
|
-
if (wexpr.filter_expr) {
|
1123
|
-
filtering = &filter_sel;
|
1124
|
-
filtered = filter_executor.SelectExpression(input_chunk, filter_sel);
|
1125
|
-
}
|
1126
|
-
|
1127
|
-
if (!wexpr.children.empty()) {
|
1128
|
-
payload_chunk.Reset();
|
1129
|
-
payload_executor.Execute(input_chunk, payload_chunk);
|
1130
|
-
payload_chunk.Verify();
|
1131
|
-
} else if (aggregator) {
|
1132
|
-
// Zero-argument aggregate (e.g., COUNT(*)
|
1133
|
-
payload_chunk.SetCardinality(input_chunk);
|
1134
|
-
}
|
1135
|
-
|
1136
|
-
D_ASSERT(aggregator);
|
1137
|
-
auto &gestate = *gastate.gsink;
|
1138
|
-
auto &lestate = *lastate.aggregator_state;
|
1139
|
-
aggregator->Sink(gestate, lestate, payload_chunk, input_idx, filtering, filtered);
|
1140
|
-
|
1141
|
-
WindowExecutor::Sink(input_chunk, input_idx, total_count, gstate, lstate);
|
1142
|
-
}
|
1143
|
-
|
1144
|
-
static void ApplyWindowStats(const WindowBoundary &boundary, FrameDelta &delta, BaseStatistics *base, bool is_start) {
|
1145
|
-
// Avoid overflow by clamping to the frame bounds
|
1146
|
-
auto base_stats = delta;
|
1147
|
-
|
1148
|
-
switch (boundary) {
|
1149
|
-
case WindowBoundary::UNBOUNDED_PRECEDING:
|
1150
|
-
if (is_start) {
|
1151
|
-
delta.end = 0;
|
1152
|
-
return;
|
1153
|
-
}
|
1154
|
-
break;
|
1155
|
-
case WindowBoundary::UNBOUNDED_FOLLOWING:
|
1156
|
-
if (!is_start) {
|
1157
|
-
delta.begin = 0;
|
1158
|
-
return;
|
1159
|
-
}
|
1160
|
-
break;
|
1161
|
-
case WindowBoundary::CURRENT_ROW_ROWS:
|
1162
|
-
delta.begin = delta.end = 0;
|
1163
|
-
return;
|
1164
|
-
case WindowBoundary::EXPR_PRECEDING_ROWS:
|
1165
|
-
if (base && base->GetStatsType() == StatisticsType::NUMERIC_STATS && NumericStats::HasMinMax(*base)) {
|
1166
|
-
// Preceding so negative offset from current row
|
1167
|
-
base_stats.begin = NumericStats::GetMin<int64_t>(*base);
|
1168
|
-
base_stats.end = NumericStats::GetMax<int64_t>(*base);
|
1169
|
-
if (delta.begin < base_stats.end && base_stats.end < delta.end) {
|
1170
|
-
delta.begin = -base_stats.end;
|
1171
|
-
}
|
1172
|
-
if (delta.begin < base_stats.begin && base_stats.begin < delta.end) {
|
1173
|
-
delta.end = -base_stats.begin + 1;
|
1174
|
-
}
|
1175
|
-
}
|
1176
|
-
return;
|
1177
|
-
case WindowBoundary::EXPR_FOLLOWING_ROWS:
|
1178
|
-
if (base && base->GetStatsType() == StatisticsType::NUMERIC_STATS && NumericStats::HasMinMax(*base)) {
|
1179
|
-
base_stats.begin = NumericStats::GetMin<int64_t>(*base);
|
1180
|
-
base_stats.end = NumericStats::GetMax<int64_t>(*base);
|
1181
|
-
if (base_stats.end < delta.end) {
|
1182
|
-
delta.end = base_stats.end + 1;
|
1183
|
-
}
|
1184
|
-
}
|
1185
|
-
return;
|
1186
|
-
|
1187
|
-
case WindowBoundary::CURRENT_ROW_RANGE:
|
1188
|
-
case WindowBoundary::EXPR_PRECEDING_RANGE:
|
1189
|
-
case WindowBoundary::EXPR_FOLLOWING_RANGE:
|
1190
|
-
return;
|
1191
|
-
default:
|
1192
|
-
break;
|
1193
|
-
}
|
1194
|
-
|
1195
|
-
if (is_start) {
|
1196
|
-
throw InternalException("Unsupported window start boundary");
|
1197
|
-
} else {
|
1198
|
-
throw InternalException("Unsupported window end boundary");
|
1199
|
-
}
|
1200
|
-
}
|
1201
|
-
|
1202
|
-
void WindowAggregateExecutor::Finalize(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate) const {
|
1203
|
-
auto &gastate = gstate.Cast<WindowAggregateExecutorGlobalState>();
|
1204
|
-
auto &aggregator = gastate.aggregator;
|
1205
|
-
auto &gsink = gastate.gsink;
|
1206
|
-
D_ASSERT(aggregator);
|
1207
|
-
|
1208
|
-
// Estimate the frame statistics
|
1209
|
-
// Default to the entire partition if we don't know anything
|
1210
|
-
FrameStats stats;
|
1211
|
-
const auto count = NumericCast<int64_t>(gastate.payload_count);
|
1212
|
-
|
1213
|
-
// First entry is the frame start
|
1214
|
-
stats[0] = FrameDelta(-count, count);
|
1215
|
-
auto base = wexpr.expr_stats.empty() ? nullptr : wexpr.expr_stats[0].get();
|
1216
|
-
ApplyWindowStats(wexpr.start, stats[0], base, true);
|
1217
|
-
|
1218
|
-
// Second entry is the frame end
|
1219
|
-
stats[1] = FrameDelta(-count, count);
|
1220
|
-
base = wexpr.expr_stats.empty() ? nullptr : wexpr.expr_stats[1].get();
|
1221
|
-
ApplyWindowStats(wexpr.end, stats[1], base, false);
|
1222
|
-
|
1223
|
-
auto &lastate = lstate.Cast<WindowAggregateExecutorLocalState>();
|
1224
|
-
aggregator->Finalize(*gsink, *lastate.aggregator_state, stats);
|
1225
|
-
}
|
1226
|
-
|
1227
|
-
void WindowAggregateExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1228
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1229
|
-
auto &gastate = gstate.Cast<WindowAggregateExecutorGlobalState>();
|
1230
|
-
auto &lastate = lstate.Cast<WindowAggregateExecutorLocalState>();
|
1231
|
-
auto &aggregator = gastate.aggregator;
|
1232
|
-
auto &gsink = gastate.gsink;
|
1233
|
-
D_ASSERT(aggregator);
|
1234
|
-
|
1235
|
-
auto &agg_state = *lastate.aggregator_state;
|
1236
|
-
|
1237
|
-
aggregator->Evaluate(*gsink, agg_state, lastate.bounds, result, count, row_idx);
|
1238
|
-
}
|
1239
|
-
|
1240
|
-
//===--------------------------------------------------------------------===//
|
1241
|
-
// WindowRowNumberExecutor
|
1242
|
-
//===--------------------------------------------------------------------===//
|
1243
|
-
WindowRowNumberExecutor::WindowRowNumberExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1244
|
-
: WindowExecutor(wexpr, context) {
|
1245
|
-
}
|
1246
|
-
|
1247
|
-
void WindowRowNumberExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1248
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1249
|
-
auto &lbstate = lstate.Cast<WindowExecutorBoundsState>();
|
1250
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(lbstate.bounds.data[PARTITION_BEGIN]);
|
1251
|
-
auto rdata = FlatVector::GetData<int64_t>(result);
|
1252
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1253
|
-
rdata[i] = NumericCast<int64_t>(row_idx - partition_begin[i] + 1);
|
1254
|
-
}
|
1255
|
-
}
|
1256
|
-
|
1257
|
-
//===--------------------------------------------------------------------===//
|
1258
|
-
// WindowPeerState
|
1259
|
-
//===--------------------------------------------------------------------===//
|
1260
|
-
class WindowPeerState : public WindowExecutorBoundsState {
|
1261
|
-
public:
|
1262
|
-
explicit WindowPeerState(const WindowExecutorGlobalState &gstate) : WindowExecutorBoundsState(gstate) {
|
1263
|
-
}
|
1264
|
-
|
1265
|
-
public:
|
1266
|
-
uint64_t dense_rank = 1;
|
1267
|
-
uint64_t rank_equal = 0;
|
1268
|
-
uint64_t rank = 1;
|
1269
|
-
|
1270
|
-
void NextRank(idx_t partition_begin, idx_t peer_begin, idx_t row_idx);
|
1271
|
-
};
|
1272
|
-
|
1273
|
-
void WindowPeerState::NextRank(idx_t partition_begin, idx_t peer_begin, idx_t row_idx) {
|
1274
|
-
if (partition_begin == row_idx) {
|
1275
|
-
dense_rank = 1;
|
1276
|
-
rank = 1;
|
1277
|
-
rank_equal = 0;
|
1278
|
-
} else if (peer_begin == row_idx) {
|
1279
|
-
dense_rank++;
|
1280
|
-
rank += rank_equal;
|
1281
|
-
rank_equal = 0;
|
1282
|
-
}
|
1283
|
-
rank_equal++;
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
WindowRankExecutor::WindowRankExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1287
|
-
: WindowExecutor(wexpr, context) {
|
1288
|
-
}
|
1289
|
-
|
1290
|
-
unique_ptr<WindowExecutorLocalState> WindowRankExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
1291
|
-
return make_uniq<WindowPeerState>(gstate);
|
1292
|
-
}
|
1293
|
-
|
1294
|
-
void WindowRankExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1295
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1296
|
-
auto &lpeer = lstate.Cast<WindowPeerState>();
|
1297
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PARTITION_BEGIN]);
|
1298
|
-
auto peer_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PEER_BEGIN]);
|
1299
|
-
auto rdata = FlatVector::GetData<int64_t>(result);
|
1300
|
-
|
1301
|
-
// Reset to "previous" row
|
1302
|
-
lpeer.rank = (peer_begin[0] - partition_begin[0]) + 1;
|
1303
|
-
lpeer.rank_equal = (row_idx - peer_begin[0]);
|
1304
|
-
|
1305
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1306
|
-
lpeer.NextRank(partition_begin[i], peer_begin[i], row_idx);
|
1307
|
-
rdata[i] = NumericCast<int64_t>(lpeer.rank);
|
1308
|
-
}
|
1309
|
-
}
|
1310
|
-
|
1311
|
-
WindowDenseRankExecutor::WindowDenseRankExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1312
|
-
: WindowExecutor(wexpr, context) {
|
1313
|
-
}
|
1314
|
-
|
1315
|
-
unique_ptr<WindowExecutorLocalState>
|
1316
|
-
WindowDenseRankExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
1317
|
-
return make_uniq<WindowPeerState>(gstate);
|
1318
|
-
}
|
1319
|
-
|
1320
|
-
void WindowDenseRankExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1321
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1322
|
-
auto &lpeer = lstate.Cast<WindowPeerState>();
|
1323
|
-
|
1324
|
-
auto &order_mask = gstate.order_mask;
|
1325
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PARTITION_BEGIN]);
|
1326
|
-
auto peer_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PEER_BEGIN]);
|
1327
|
-
auto rdata = FlatVector::GetData<int64_t>(result);
|
1328
|
-
|
1329
|
-
// Reset to "previous" row
|
1330
|
-
lpeer.rank = (peer_begin[0] - partition_begin[0]) + 1;
|
1331
|
-
lpeer.rank_equal = (row_idx - peer_begin[0]);
|
1332
|
-
|
1333
|
-
// The previous dense rank is the number of order mask bits in [partition_begin, row_idx)
|
1334
|
-
lpeer.dense_rank = 0;
|
1335
|
-
|
1336
|
-
auto order_begin = partition_begin[0];
|
1337
|
-
idx_t begin_idx;
|
1338
|
-
idx_t begin_offset;
|
1339
|
-
order_mask.GetEntryIndex(order_begin, begin_idx, begin_offset);
|
1340
|
-
|
1341
|
-
auto order_end = row_idx;
|
1342
|
-
idx_t end_idx;
|
1343
|
-
idx_t end_offset;
|
1344
|
-
order_mask.GetEntryIndex(order_end, end_idx, end_offset);
|
1345
|
-
|
1346
|
-
// If they are in the same entry, just loop
|
1347
|
-
if (begin_idx == end_idx) {
|
1348
|
-
const auto entry = order_mask.GetValidityEntry(begin_idx);
|
1349
|
-
for (; begin_offset < end_offset; ++begin_offset) {
|
1350
|
-
lpeer.dense_rank += order_mask.RowIsValid(entry, begin_offset);
|
1351
|
-
}
|
1352
|
-
} else {
|
1353
|
-
// Count the ragged bits at the start of the partition
|
1354
|
-
if (begin_offset) {
|
1355
|
-
const auto entry = order_mask.GetValidityEntry(begin_idx);
|
1356
|
-
for (; begin_offset < order_mask.BITS_PER_VALUE; ++begin_offset) {
|
1357
|
-
lpeer.dense_rank += order_mask.RowIsValid(entry, begin_offset);
|
1358
|
-
++order_begin;
|
1359
|
-
}
|
1360
|
-
++begin_idx;
|
1361
|
-
}
|
1362
|
-
|
1363
|
-
// Count the the aligned bits.
|
1364
|
-
ValidityMask tail_mask(order_mask.GetData() + begin_idx);
|
1365
|
-
lpeer.dense_rank += tail_mask.CountValid(order_end - order_begin);
|
1366
|
-
}
|
1367
|
-
|
1368
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1369
|
-
lpeer.NextRank(partition_begin[i], peer_begin[i], row_idx);
|
1370
|
-
rdata[i] = NumericCast<int64_t>(lpeer.dense_rank);
|
1371
|
-
}
|
1372
|
-
}
|
1373
|
-
|
1374
|
-
WindowPercentRankExecutor::WindowPercentRankExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1375
|
-
: WindowExecutor(wexpr, context) {
|
1376
|
-
}
|
1377
|
-
|
1378
|
-
unique_ptr<WindowExecutorLocalState>
|
1379
|
-
WindowPercentRankExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
1380
|
-
return make_uniq<WindowPeerState>(gstate);
|
1381
|
-
}
|
1382
|
-
|
1383
|
-
void WindowPercentRankExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1384
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1385
|
-
auto &lpeer = lstate.Cast<WindowPeerState>();
|
1386
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PARTITION_BEGIN]);
|
1387
|
-
auto partition_end = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PARTITION_END]);
|
1388
|
-
auto peer_begin = FlatVector::GetData<const idx_t>(lpeer.bounds.data[PEER_BEGIN]);
|
1389
|
-
auto rdata = FlatVector::GetData<double>(result);
|
1390
|
-
|
1391
|
-
// Reset to "previous" row
|
1392
|
-
lpeer.rank = (peer_begin[0] - partition_begin[0]) + 1;
|
1393
|
-
lpeer.rank_equal = (row_idx - peer_begin[0]);
|
1394
|
-
|
1395
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1396
|
-
lpeer.NextRank(partition_begin[i], peer_begin[i], row_idx);
|
1397
|
-
auto denom = static_cast<double>(NumericCast<int64_t>(partition_end[i] - partition_begin[i] - 1));
|
1398
|
-
double percent_rank = denom > 0 ? ((double)lpeer.rank - 1) / denom : 0;
|
1399
|
-
rdata[i] = percent_rank;
|
1400
|
-
}
|
1401
|
-
}
|
1402
|
-
|
1403
|
-
//===--------------------------------------------------------------------===//
|
1404
|
-
// WindowCumeDistExecutor
|
1405
|
-
//===--------------------------------------------------------------------===//
|
1406
|
-
WindowCumeDistExecutor::WindowCumeDistExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1407
|
-
: WindowExecutor(wexpr, context) {
|
1408
|
-
}
|
1409
|
-
|
1410
|
-
void WindowCumeDistExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1411
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1412
|
-
auto &lbstate = lstate.Cast<WindowExecutorBoundsState>();
|
1413
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(lbstate.bounds.data[PARTITION_BEGIN]);
|
1414
|
-
auto partition_end = FlatVector::GetData<const idx_t>(lbstate.bounds.data[PARTITION_END]);
|
1415
|
-
auto peer_end = FlatVector::GetData<const idx_t>(lbstate.bounds.data[PEER_END]);
|
1416
|
-
auto rdata = FlatVector::GetData<double>(result);
|
1417
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1418
|
-
auto denom = static_cast<double>(NumericCast<int64_t>(partition_end[i] - partition_begin[i]));
|
1419
|
-
double cume_dist = denom > 0 ? ((double)(peer_end[i] - partition_begin[i])) / denom : 0;
|
1420
|
-
rdata[i] = cume_dist;
|
1421
|
-
}
|
1422
|
-
}
|
1423
|
-
|
1424
|
-
//===--------------------------------------------------------------------===//
|
1425
|
-
// WindowValueGlobalState
|
1426
|
-
//===--------------------------------------------------------------------===//
|
1427
|
-
|
1428
|
-
class WindowValueGlobalState : public WindowExecutorGlobalState {
|
1429
|
-
public:
|
1430
|
-
WindowValueGlobalState(const WindowExecutor &executor, const idx_t payload_count,
|
1431
|
-
const ValidityMask &partition_mask, const ValidityMask &order_mask)
|
1432
|
-
: WindowExecutorGlobalState(executor, payload_count, partition_mask, order_mask),
|
1433
|
-
payload_collection(payload_data), ignore_nulls(&no_nulls)
|
1434
|
-
|
1435
|
-
{
|
1436
|
-
if (!arg_types.empty()) {
|
1437
|
-
payload_collection.Initialize(Allocator::Get(executor.context), arg_types, payload_count);
|
1438
|
-
}
|
1439
|
-
|
1440
|
-
auto &wexpr = executor.wexpr;
|
1441
|
-
if (wexpr.ignore_nulls) {
|
1442
|
-
switch (wexpr.type) {
|
1443
|
-
case ExpressionType::WINDOW_LEAD:
|
1444
|
-
case ExpressionType::WINDOW_LAG:
|
1445
|
-
case ExpressionType::WINDOW_FIRST_VALUE:
|
1446
|
-
case ExpressionType::WINDOW_LAST_VALUE:
|
1447
|
-
case ExpressionType::WINDOW_NTH_VALUE:
|
1448
|
-
ignore_nulls = &FlatVector::Validity(payload_collection.chunk.data[0]);
|
1449
|
-
break;
|
1450
|
-
default:
|
1451
|
-
break;
|
1452
|
-
}
|
1453
|
-
}
|
1454
|
-
}
|
1455
|
-
|
1456
|
-
// The partition values
|
1457
|
-
DataChunk payload_data;
|
1458
|
-
// The partition values
|
1459
|
-
WindowDataChunk payload_collection;
|
1460
|
-
// Mask to use for exclusion if we are not ignoring NULLs
|
1461
|
-
ValidityMask no_nulls;
|
1462
|
-
// IGNORE NULLS
|
1463
|
-
optional_ptr<ValidityMask> ignore_nulls;
|
1464
|
-
};
|
1465
|
-
|
1466
|
-
//===--------------------------------------------------------------------===//
|
1467
|
-
// WindowValueLocalState
|
1468
|
-
//===--------------------------------------------------------------------===//
|
1469
|
-
|
1470
|
-
//! A class representing the state of the first_value, last_value and nth_value functions
|
1471
|
-
class WindowValueLocalState : public WindowExecutorBoundsState {
|
1472
|
-
public:
|
1473
|
-
explicit WindowValueLocalState(const WindowValueGlobalState &gvstate)
|
1474
|
-
: WindowExecutorBoundsState(gvstate), gvstate(gvstate) {
|
1475
|
-
}
|
1476
|
-
|
1477
|
-
//! Lazily initialize for value Execute
|
1478
|
-
void Initialize();
|
1479
|
-
|
1480
|
-
//! The corresponding global value state
|
1481
|
-
const WindowValueGlobalState &gvstate;
|
1482
|
-
//! Lazy initialization flag
|
1483
|
-
bool initialized = false;
|
1484
|
-
//! The exclusion filter handler
|
1485
|
-
unique_ptr<ExclusionFilter> exclusion_filter;
|
1486
|
-
//! The validity mask that combines both the NULLs and exclusion information
|
1487
|
-
optional_ptr<ValidityMask> ignore_nulls_exclude;
|
1488
|
-
};
|
1489
|
-
|
1490
|
-
void WindowValueLocalState::Initialize() {
|
1491
|
-
if (initialized) {
|
1492
|
-
return;
|
1493
|
-
}
|
1494
|
-
auto ignore_nulls = gvstate.ignore_nulls;
|
1495
|
-
if (gvstate.executor.wexpr.exclude_clause == WindowExcludeMode::NO_OTHER) {
|
1496
|
-
exclusion_filter = nullptr;
|
1497
|
-
ignore_nulls_exclude = ignore_nulls;
|
1498
|
-
} else {
|
1499
|
-
// create the exclusion filter based on ignore_nulls
|
1500
|
-
exclusion_filter =
|
1501
|
-
make_uniq<ExclusionFilter>(gvstate.executor.wexpr.exclude_clause, gvstate.payload_count, *ignore_nulls);
|
1502
|
-
ignore_nulls_exclude = &exclusion_filter->mask;
|
1503
|
-
}
|
1504
|
-
|
1505
|
-
initialized = true;
|
1506
|
-
}
|
1507
|
-
|
1508
|
-
//===--------------------------------------------------------------------===//
|
1509
|
-
// WindowValueExecutor
|
1510
|
-
//===--------------------------------------------------------------------===//
|
1511
|
-
WindowValueExecutor::WindowValueExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1512
|
-
: WindowExecutor(wexpr, context) {
|
1513
|
-
}
|
1514
|
-
|
1515
|
-
WindowNtileExecutor::WindowNtileExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1516
|
-
: WindowValueExecutor(wexpr, context) {
|
1517
|
-
}
|
1518
|
-
|
1519
|
-
unique_ptr<WindowExecutorGlobalState> WindowValueExecutor::GetGlobalState(const idx_t payload_count,
|
1520
|
-
const ValidityMask &partition_mask,
|
1521
|
-
const ValidityMask &order_mask) const {
|
1522
|
-
return make_uniq<WindowValueGlobalState>(*this, payload_count, partition_mask, order_mask);
|
1523
|
-
}
|
1524
|
-
|
1525
|
-
void WindowValueExecutor::Sink(DataChunk &input_chunk, const idx_t input_idx, const idx_t total_count,
|
1526
|
-
WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate) const {
|
1527
|
-
auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1528
|
-
auto &lvstate = lstate.Cast<WindowValueLocalState>();
|
1529
|
-
auto &payload_chunk = lvstate.payload_chunk;
|
1530
|
-
auto &payload_executor = lvstate.payload_executor;
|
1531
|
-
auto &payload_collection = gvstate.payload_collection;
|
1532
|
-
|
1533
|
-
if (!wexpr.children.empty()) {
|
1534
|
-
payload_chunk.Reset();
|
1535
|
-
payload_executor.Execute(input_chunk, payload_chunk);
|
1536
|
-
payload_chunk.Verify();
|
1537
|
-
payload_collection.Copy(payload_chunk, input_idx);
|
1538
|
-
}
|
1539
|
-
|
1540
|
-
WindowExecutor::Sink(input_chunk, input_idx, total_count, gstate, lstate);
|
1541
|
-
}
|
1542
|
-
|
1543
|
-
unique_ptr<WindowExecutorLocalState> WindowValueExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
1544
|
-
const auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1545
|
-
return make_uniq<WindowValueLocalState>(gvstate);
|
1546
|
-
}
|
1547
|
-
|
1548
|
-
void WindowNtileExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1549
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1550
|
-
auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1551
|
-
auto &payload_collection = gvstate.payload_collection.chunk;
|
1552
|
-
D_ASSERT(payload_collection.ColumnCount() == 1);
|
1553
|
-
auto &lbstate = lstate.Cast<WindowExecutorBoundsState>();
|
1554
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(lbstate.bounds.data[PARTITION_BEGIN]);
|
1555
|
-
auto partition_end = FlatVector::GetData<const idx_t>(lbstate.bounds.data[PARTITION_END]);
|
1556
|
-
auto rdata = FlatVector::GetData<int64_t>(result);
|
1557
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1558
|
-
if (CellIsNull(payload_collection, 0, row_idx)) {
|
1559
|
-
FlatVector::SetNull(result, i, true);
|
1560
|
-
} else {
|
1561
|
-
auto n_param = GetCell<int64_t>(payload_collection, 0, row_idx);
|
1562
|
-
if (n_param < 1) {
|
1563
|
-
throw InvalidInputException("Argument for ntile must be greater than zero");
|
1564
|
-
}
|
1565
|
-
// With thanks from SQLite's ntileValueFunc()
|
1566
|
-
auto n_total = NumericCast<int64_t>(partition_end[i] - partition_begin[i]);
|
1567
|
-
if (n_param > n_total) {
|
1568
|
-
// more groups allowed than we have values
|
1569
|
-
// map every entry to a unique group
|
1570
|
-
n_param = n_total;
|
1571
|
-
}
|
1572
|
-
int64_t n_size = (n_total / n_param);
|
1573
|
-
// find the row idx within the group
|
1574
|
-
D_ASSERT(row_idx >= partition_begin[i]);
|
1575
|
-
auto adjusted_row_idx = NumericCast<int64_t>(row_idx - partition_begin[i]);
|
1576
|
-
// now compute the ntile
|
1577
|
-
int64_t n_large = n_total - n_param * n_size;
|
1578
|
-
int64_t i_small = n_large * (n_size + 1);
|
1579
|
-
int64_t result_ntile;
|
1580
|
-
|
1581
|
-
D_ASSERT((n_large * (n_size + 1) + (n_param - n_large) * n_size) == n_total);
|
1582
|
-
|
1583
|
-
if (adjusted_row_idx < i_small) {
|
1584
|
-
result_ntile = 1 + adjusted_row_idx / (n_size + 1);
|
1585
|
-
} else {
|
1586
|
-
result_ntile = 1 + n_large + (adjusted_row_idx - i_small) / n_size;
|
1587
|
-
}
|
1588
|
-
// result has to be between [1, NTILE]
|
1589
|
-
D_ASSERT(result_ntile >= 1 && result_ntile <= n_param);
|
1590
|
-
rdata[i] = result_ntile;
|
1591
|
-
}
|
1592
|
-
}
|
1593
|
-
}
|
1594
|
-
|
1595
|
-
//===--------------------------------------------------------------------===//
|
1596
|
-
// WindowLeadLagLocalState
|
1597
|
-
//===--------------------------------------------------------------------===//
|
1598
|
-
class WindowLeadLagLocalState : public WindowValueLocalState {
|
1599
|
-
public:
|
1600
|
-
explicit WindowLeadLagLocalState(const WindowValueGlobalState &gstate)
|
1601
|
-
: WindowValueLocalState(gstate),
|
1602
|
-
leadlag_offset(gstate.executor.wexpr.offset_expr.get(), gstate.executor.context),
|
1603
|
-
leadlag_default(gstate.executor.wexpr.default_expr.get(), gstate.executor.context) {
|
1604
|
-
}
|
1605
|
-
|
1606
|
-
void UpdateBounds(idx_t row_idx, DataChunk &input_chunk, const WindowInputColumn &range) override;
|
1607
|
-
|
1608
|
-
public:
|
1609
|
-
// LEAD/LAG Evaluation
|
1610
|
-
WindowInputExpression leadlag_offset;
|
1611
|
-
WindowInputExpression leadlag_default;
|
1612
|
-
};
|
1613
|
-
|
1614
|
-
void WindowLeadLagLocalState::UpdateBounds(idx_t row_idx, DataChunk &input_chunk, const WindowInputColumn &range) {
|
1615
|
-
// Evaluate the row-level arguments
|
1616
|
-
leadlag_offset.Execute(input_chunk);
|
1617
|
-
leadlag_default.Execute(input_chunk);
|
1618
|
-
|
1619
|
-
WindowExecutorBoundsState::UpdateBounds(row_idx, input_chunk, range);
|
1620
|
-
}
|
1621
|
-
|
1622
|
-
WindowLeadLagExecutor::WindowLeadLagExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1623
|
-
: WindowValueExecutor(wexpr, context) {
|
1624
|
-
}
|
1625
|
-
|
1626
|
-
unique_ptr<WindowExecutorLocalState>
|
1627
|
-
WindowLeadLagExecutor::GetLocalState(const WindowExecutorGlobalState &gstate) const {
|
1628
|
-
const auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1629
|
-
return make_uniq<WindowLeadLagLocalState>(gvstate);
|
1630
|
-
}
|
1631
|
-
|
1632
|
-
void WindowLeadLagExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1633
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1634
|
-
auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1635
|
-
auto &payload_collection = gvstate.payload_collection.chunk;
|
1636
|
-
auto &ignore_nulls = gvstate.ignore_nulls;
|
1637
|
-
auto &llstate = lstate.Cast<WindowLeadLagLocalState>();
|
1638
|
-
|
1639
|
-
bool can_shift = ignore_nulls->AllValid();
|
1640
|
-
if (wexpr.offset_expr) {
|
1641
|
-
can_shift = can_shift && wexpr.offset_expr->IsFoldable();
|
1642
|
-
}
|
1643
|
-
if (wexpr.default_expr) {
|
1644
|
-
can_shift = can_shift && wexpr.default_expr->IsFoldable();
|
1645
|
-
}
|
1646
|
-
|
1647
|
-
auto partition_begin = FlatVector::GetData<const idx_t>(llstate.bounds.data[PARTITION_BEGIN]);
|
1648
|
-
auto partition_end = FlatVector::GetData<const idx_t>(llstate.bounds.data[PARTITION_END]);
|
1649
|
-
const auto row_end = row_idx + count;
|
1650
|
-
for (idx_t i = 0; i < count;) {
|
1651
|
-
int64_t offset = 1;
|
1652
|
-
if (wexpr.offset_expr) {
|
1653
|
-
offset = llstate.leadlag_offset.GetCell<int64_t>(i);
|
1654
|
-
}
|
1655
|
-
int64_t val_idx = (int64_t)row_idx;
|
1656
|
-
if (wexpr.type == ExpressionType::WINDOW_LEAD) {
|
1657
|
-
val_idx = AddOperatorOverflowCheck::Operation<int64_t, int64_t, int64_t>(val_idx, offset);
|
1658
|
-
} else {
|
1659
|
-
val_idx = SubtractOperatorOverflowCheck::Operation<int64_t, int64_t, int64_t>(val_idx, offset);
|
1660
|
-
}
|
1661
|
-
|
1662
|
-
idx_t delta = 0;
|
1663
|
-
if (val_idx < (int64_t)row_idx) {
|
1664
|
-
// Count backwards
|
1665
|
-
delta = idx_t(row_idx - idx_t(val_idx));
|
1666
|
-
val_idx = int64_t(FindPrevStart(*ignore_nulls, partition_begin[i], row_idx, delta));
|
1667
|
-
} else if (val_idx > (int64_t)row_idx) {
|
1668
|
-
delta = idx_t(idx_t(val_idx) - row_idx);
|
1669
|
-
val_idx = int64_t(FindNextStart(*ignore_nulls, row_idx + 1, partition_end[i], delta));
|
1670
|
-
}
|
1671
|
-
// else offset is zero, so don't move.
|
1672
|
-
|
1673
|
-
if (can_shift) {
|
1674
|
-
const auto target_limit = MinValue(partition_end[i], row_end) - row_idx;
|
1675
|
-
if (!delta) {
|
1676
|
-
// Copy source[index:index+width] => result[i:]
|
1677
|
-
const auto index = NumericCast<idx_t>(val_idx);
|
1678
|
-
const auto source_limit = partition_end[i] - index;
|
1679
|
-
const auto width = MinValue(source_limit, target_limit);
|
1680
|
-
auto &source = payload_collection.data[0];
|
1681
|
-
VectorOperations::Copy(source, result, index + width, index, i);
|
1682
|
-
i += width;
|
1683
|
-
row_idx += width;
|
1684
|
-
} else if (wexpr.default_expr) {
|
1685
|
-
const auto width = MinValue(delta, target_limit);
|
1686
|
-
llstate.leadlag_default.CopyCell(result, i, width);
|
1687
|
-
i += width;
|
1688
|
-
row_idx += width;
|
1689
|
-
} else {
|
1690
|
-
for (idx_t nulls = MinValue(delta, target_limit); nulls--; ++i, ++row_idx) {
|
1691
|
-
FlatVector::SetNull(result, i, true);
|
1692
|
-
}
|
1693
|
-
}
|
1694
|
-
} else {
|
1695
|
-
if (!delta) {
|
1696
|
-
CopyCell(payload_collection, 0, NumericCast<idx_t>(val_idx), result, i);
|
1697
|
-
} else if (wexpr.default_expr) {
|
1698
|
-
llstate.leadlag_default.CopyCell(result, i);
|
1699
|
-
} else {
|
1700
|
-
FlatVector::SetNull(result, i, true);
|
1701
|
-
}
|
1702
|
-
++i;
|
1703
|
-
++row_idx;
|
1704
|
-
}
|
1705
|
-
}
|
1706
|
-
}
|
1707
|
-
|
1708
|
-
WindowFirstValueExecutor::WindowFirstValueExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1709
|
-
: WindowValueExecutor(wexpr, context) {
|
1710
|
-
}
|
1711
|
-
|
1712
|
-
void WindowFirstValueExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1713
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1714
|
-
auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1715
|
-
auto &payload_collection = gvstate.payload_collection.chunk;
|
1716
|
-
auto &lvstate = lstate.Cast<WindowValueLocalState>();
|
1717
|
-
lvstate.Initialize();
|
1718
|
-
auto window_begin = FlatVector::GetData<const idx_t>(lvstate.bounds.data[WINDOW_BEGIN]);
|
1719
|
-
auto window_end = FlatVector::GetData<const idx_t>(lvstate.bounds.data[WINDOW_END]);
|
1720
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1721
|
-
|
1722
|
-
if (lvstate.exclusion_filter) {
|
1723
|
-
lvstate.exclusion_filter->ApplyExclusion(lvstate.bounds, row_idx, i);
|
1724
|
-
}
|
1725
|
-
|
1726
|
-
if (window_begin[i] >= window_end[i]) {
|
1727
|
-
FlatVector::SetNull(result, i, true);
|
1728
|
-
continue;
|
1729
|
-
}
|
1730
|
-
// Same as NTH_VALUE(..., 1)
|
1731
|
-
idx_t n = 1;
|
1732
|
-
const auto first_idx = FindNextStart(*lvstate.ignore_nulls_exclude, window_begin[i], window_end[i], n);
|
1733
|
-
if (!n) {
|
1734
|
-
CopyCell(payload_collection, 0, first_idx, result, i);
|
1735
|
-
} else {
|
1736
|
-
FlatVector::SetNull(result, i, true);
|
1737
|
-
}
|
1738
|
-
|
1739
|
-
if (lvstate.exclusion_filter) {
|
1740
|
-
lvstate.exclusion_filter->ResetMask(row_idx, i);
|
1741
|
-
}
|
1742
|
-
}
|
1743
|
-
}
|
1744
|
-
|
1745
|
-
WindowLastValueExecutor::WindowLastValueExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1746
|
-
: WindowValueExecutor(wexpr, context) {
|
1747
|
-
}
|
1748
|
-
|
1749
|
-
void WindowLastValueExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1750
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1751
|
-
auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1752
|
-
auto &payload_collection = gvstate.payload_collection.chunk;
|
1753
|
-
auto &lvstate = lstate.Cast<WindowValueLocalState>();
|
1754
|
-
lvstate.Initialize();
|
1755
|
-
auto window_begin = FlatVector::GetData<const idx_t>(lvstate.bounds.data[WINDOW_BEGIN]);
|
1756
|
-
auto window_end = FlatVector::GetData<const idx_t>(lvstate.bounds.data[WINDOW_END]);
|
1757
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1758
|
-
|
1759
|
-
if (lvstate.exclusion_filter) {
|
1760
|
-
lvstate.exclusion_filter->ApplyExclusion(lvstate.bounds, row_idx, i);
|
1761
|
-
}
|
1762
|
-
|
1763
|
-
if (window_begin[i] >= window_end[i]) {
|
1764
|
-
FlatVector::SetNull(result, i, true);
|
1765
|
-
continue;
|
1766
|
-
}
|
1767
|
-
idx_t n = 1;
|
1768
|
-
const auto last_idx = FindPrevStart(*lvstate.ignore_nulls_exclude, window_begin[i], window_end[i], n);
|
1769
|
-
if (!n) {
|
1770
|
-
CopyCell(payload_collection, 0, last_idx, result, i);
|
1771
|
-
} else {
|
1772
|
-
FlatVector::SetNull(result, i, true);
|
1773
|
-
}
|
1774
|
-
|
1775
|
-
if (lvstate.exclusion_filter) {
|
1776
|
-
lvstate.exclusion_filter->ResetMask(row_idx, i);
|
1777
|
-
}
|
1778
|
-
}
|
1779
|
-
}
|
1780
|
-
|
1781
|
-
WindowNthValueExecutor::WindowNthValueExecutor(BoundWindowExpression &wexpr, ClientContext &context)
|
1782
|
-
: WindowValueExecutor(wexpr, context) {
|
1783
|
-
}
|
1784
|
-
|
1785
|
-
void WindowNthValueExecutor::EvaluateInternal(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate,
|
1786
|
-
Vector &result, idx_t count, idx_t row_idx) const {
|
1787
|
-
auto &gvstate = gstate.Cast<WindowValueGlobalState>();
|
1788
|
-
auto &payload_collection = gvstate.payload_collection.chunk;
|
1789
|
-
D_ASSERT(payload_collection.ColumnCount() == 2);
|
1790
|
-
|
1791
|
-
auto &lvstate = lstate.Cast<WindowValueLocalState>();
|
1792
|
-
lvstate.Initialize();
|
1793
|
-
auto window_begin = FlatVector::GetData<const idx_t>(lvstate.bounds.data[WINDOW_BEGIN]);
|
1794
|
-
auto window_end = FlatVector::GetData<const idx_t>(lvstate.bounds.data[WINDOW_END]);
|
1795
|
-
for (idx_t i = 0; i < count; ++i, ++row_idx) {
|
1796
|
-
|
1797
|
-
if (lvstate.exclusion_filter) {
|
1798
|
-
lvstate.exclusion_filter->ApplyExclusion(lvstate.bounds, row_idx, i);
|
1799
|
-
}
|
1800
|
-
|
1801
|
-
if (window_begin[i] >= window_end[i]) {
|
1802
|
-
FlatVector::SetNull(result, i, true);
|
1803
|
-
continue;
|
1804
|
-
}
|
1805
|
-
// Returns value evaluated at the row that is the n'th row of the window frame (counting from 1);
|
1806
|
-
// returns NULL if there is no such row.
|
1807
|
-
if (CellIsNull(payload_collection, 1, row_idx)) {
|
1808
|
-
FlatVector::SetNull(result, i, true);
|
1809
|
-
} else {
|
1810
|
-
auto n_param = GetCell<int64_t>(payload_collection, 1, row_idx);
|
1811
|
-
if (n_param < 1) {
|
1812
|
-
FlatVector::SetNull(result, i, true);
|
1813
|
-
} else {
|
1814
|
-
auto n = idx_t(n_param);
|
1815
|
-
const auto nth_index = FindNextStart(*lvstate.ignore_nulls_exclude, window_begin[i], window_end[i], n);
|
1816
|
-
if (!n) {
|
1817
|
-
CopyCell(payload_collection, 0, nth_index, result, i);
|
1818
|
-
} else {
|
1819
|
-
FlatVector::SetNull(result, i, true);
|
1820
|
-
}
|
1821
|
-
}
|
1822
|
-
}
|
1823
|
-
|
1824
|
-
if (lvstate.exclusion_filter) {
|
1825
|
-
lvstate.exclusion_filter->ResetMask(row_idx, i);
|
1826
|
-
}
|
1827
|
-
}
|
1828
|
-
}
|
1829
|
-
|
1830
|
-
} // namespace duckdb
|