Restore Expression Peeling Flatten Optimization (PR #10521)? #16899
Unanswered
zhli1142015
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
History
peelInternal()— whenbaseSize / 8 > rows.end(), deep-copies peeled vectors into compact flat vectors instead of keeping oversized dictionary wrapping. Reported 10x speedup.PeeledEncoding.h:35-38describing this behavior.weak_ptrexpiry detection inevaluateSharedSubexpr()(Expr.h:660,Expr.cpp:914).Current State
On
main,PeeledEncoding.h:35-38says:But the code has
VELOX_CHECK(wrapEncoding_ != FLAT)in bothtranslateToInnerRows()andwrap(), which asserts FLAT is impossible. The comment is orphaned and misleading.Motivation: Parquet Dictionary Columns
The default Parquet dictionary page size limit is 1 MB (
Properties.h:210). For string columns with moderate-length values (e.g., 20–100 bytes), a single dictionary page can hold 10K–50K unique entries. When the reader produces aDictionaryVector, the base vector size equals the number of unique dictionary entries, while batch sizes are typically 1K–10K rows.Without the optimization, every expression evaluation on these columns allocates vectors at
baseSize(10K–50K elements) when only the batch rows (1K) are needed — up to 50x memory over-allocation per eval.Safety Argument
The only reason for the revert was the CSE ABA bug. PR #10837 fixed this root cause independently:
InputForSharedResultsnow storesweak_ptralongside raw pointers (Expr.h:653)evaluateSharedSubexpr()checksisExpired()before cache reuse (Expr.cpp:913-919)weak_ptr::expired()returnstrue→ stale entry evicted → fresh computationShould we restore Expression Peeling Flatten Optimization (PR #10521)?
cc @Yuhta , @bikramSingh91 , @mbasmanova
Beta Was this translation helpful? Give feedback.
All reactions