Implement LIKE in vortex instead of falling back to arrow#8709
Conversation
Merging this PR will not alter performance
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Polar Signals Profiling ResultsLatest Run
Powered by Polar Signals Cloud |
Benchmarks: PolarSignals ProfilingVortex (geomean): 1.001x ➖ How to read Verdict and Engines
datafusion / vortex-file-compressed (1.001x ➖, 1↑ 0↓)
No file size changes detected. |
Benchmarks: TPC-H SF=1 on NVMEVerdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.001x ➖, 0↑ 0↓)
datafusion / parquet (0.967x ➖, 3↑ 0↓)
datafusion / arrow (0.988x ➖, 1↑ 0↓)
duckdb / vortex-file-compressed (0.994x ➖, 0↑ 0↓)
duckdb / parquet (0.994x ➖, 2↑ 2↓)
File Size Changes (17 files changed, -44.5% overall, 2↑ 15↓)
Totals:
|
Benchmarks: FineWeb NVMeVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.011x ➖, 0↑ 0↓)
datafusion / parquet (0.982x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (0.981x ➖, 1↑ 0↓)
duckdb / parquet (1.000x ➖, 0↑ 0↓)
File Size Changes (3 files changed, -46.3% overall, 1↑ 2↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.000x ➖, 1↑ 0↓)
datafusion / parquet (1.008x ➖, 1↑ 1↓)
duckdb / vortex-file-compressed (1.002x ➖, 1↑ 2↓)
duckdb / parquet (0.995x ➖, 1↑ 1↓)
File Size Changes (31 files changed, -43.5% overall, 4↑ 27↓)
Totals:
|
🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨Benchmark |
Benchmarks: Clickbench Sorted on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.982x ➖, 1↑ 1↓)
datafusion / parquet (1.022x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (0.954x ➖, 1↑ 0↓)
duckdb / parquet (0.991x ➖, 0↑ 0↓)
File Size Changes (201 files changed, -42.6% overall, 51↑ 150↓)
Totals:
|
Benchmarks: FineWeb S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.035x ➖, 0↑ 1↓)
datafusion / parquet (1.158x ➖, 0↑ 2↓)
duckdb / vortex-file-compressed (1.013x ➖, 0↑ 0↓)
duckdb / parquet (1.000x ➖, 0↑ 0↓)
|
Benchmarks: Statistical and Population GeneticsVerdict: No clear signal (low confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed (0.994x ➖, 0↑ 0↓)
duckdb / parquet (1.012x ➖, 0↑ 0↓)
File Size Changes (3 files changed, -32.3% overall, 0↑ 3↓)
Totals:
|
Benchmarks: Clickbench on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.983x ➖, 1↑ 0↓)
datafusion / parquet (0.987x ➖, 1↑ 1↓)
duckdb / vortex-file-compressed (0.982x ➖, 2↑ 0↓)
duckdb / parquet (0.987x ➖, 1↑ 0↓)
File Size Changes (201 files changed, -39.1% overall, 58↑ 143↓)
Totals:
|
Benchmarks: TPC-H SF=10 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.955x ➖, 0↑ 0↓)
datafusion / parquet (0.958x ➖, 0↑ 0↓)
datafusion / arrow (0.928x ➖, 2↑ 0↓)
duckdb / vortex-file-compressed (0.998x ➖, 0↑ 0↓)
duckdb / parquet (0.991x ➖, 1↑ 0↓)
File Size Changes (47 files changed, -44.5% overall, 12↑ 35↓)
Totals:
|
AdamGS
left a comment
There was a problem hiding this comment.
code is a bit dense but I think it all makes sense?
Replace the arrow-string backed LIKE executor with a native implementation over canonical VarBinView arrays, dropping the arrow-string dependency from vortex-array. Patterns compile once into a LikePattern: wildcard-free patterns and prefix/suffix/substring shapes use direct byte comparisons (memchr's SIMD substring search for contains, ASCII case-insensitive variants for ILIKE over ASCII data), everything else translates the SQL pattern to an anchored regex over the value bytes, using the same translation as arrow-string so semantics are unchanged. Non-constant pattern children reuse the previous row's compiled pattern while the pattern bytes repeat. Evaluation exploits the view layout: equality is a single masked 16-byte compare for needles that fit inline, the prefix path rejects lanes with a branch-free masked compare of the view's inline 4-byte prefix without touching the data buffers, the suffix path slices exactly the trailing needle bytes out of the view or its buffer, and contains/equality reject on the view length before dereferencing. Benchmarked against the previous arrow implementation (benches/like.rs, 64Ki strings, median): exact 100us -> 18us, prefix 144us -> 48us, suffix 171us -> 105us, contains 876us -> 732us, regex 924us -> 744us, ilike contains 2.52ms -> 2.03ms, per-row patterns 824us -> 565us. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Robert Kruszewski <github@robertk.io>
… flagged words - Reduce the like benchmark input to 2Ki strings so every benchmark stays well under 1ms on CodSpeed's simulated runner (the worst case, ilike, measured 15.8ms at the previous size). - Box the memmem::Finder inside LikePattern::Contains: the searcher is ~300 bytes and dominated the enum size (clippy::large_enum_variant). - Bump the workspace regex pin to 1.12 so direct-minimal-versions agrees with datafusion's floor now that vortex-array depends on regex. - Rename the "hel%" test patterns to "he%" (same matches on the test data) to satisfy the typos spell checker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Robert Kruszewski <github@robertk.io>
26afdf7 to
436e600
Compare
One more operation where we fallback to arrow instead of using our own
implementation. We can leverage view array layouts to speed up certain
comparisons