Ray's Knowledge Base
Unlock

duql expressions run as vectorized kernels, never row by row unless needed

PreferenceVerified 29 Sep 2026Holds project: dftracer-utils
Preference. A rule, why it holds, and how to apply it.

Rule#

duql expressions compile to vectorized dataframe kernels. A missing kernel is added; a form without a kernel is a compile error, not a silent slow path. Row-by-row evaluation stays only for a function on a declared json field. A differential test keeps the kernels equal to the row evaluator.

Why#

The user: "never do row by row unless it is needed IMO. need vectorizing it".

How to apply#

When a duql form has no vectorized kernel, add the kernel or make the form a compile error; do not fall back to row-by-row evaluation.

Evidence#

Stage 12b (commit 05a7f86b): the mask benchmark on 1M rows went from 54 ms to 5 ms, and the differential test showed all 84 expression forms agree with the row evaluator.

Also found by searching

  • new duql function has no vectorized kernel, should it fall back to row by row evaluation
  • a duql expression is slow on 1M rows because it evaluates per row
  • how should I implement a duql expression form that has no kernel yet
  • vectorized dataframe kernel vs row evaluator fallback, compile error, differential test
  • duql expression falls back to row by row evaluation and is slow on 1M rows
  • what to do when a duql form has no vectorized kernel
  • should I add a row-by-row fallback for a function in duql expressions
  • differential test between kernels and row evaluator, json declared field exception