Spark Expression Support#
This page is the complete reference for how Apache Comet handles each Spark built-in expression. Comet accelerates expressions either with a native (Rust) implementation or by dispatching to a Spark-compatible codegen path. When an expression is not supported, Comet transparently falls back to Spark for that part of the plan; results are unaffected.
Expressions marked β Supported are enabled by default and produce Spark-compatible results.
Some β
Supported expressions have specific incompatible cases that are not run by default.
Those cases must be opted into per expression with
spark.comet.expression.EXPRNAME.allowIncompatible=true (where EXPRNAME is the Spark
expression class name, for example Cast). There is no global opt-in. By default such a case
either falls back to Spark (for example the mode aggregate) or, when the expression has a
Spark-compatible codegen-dispatch implementation, runs through that instead (for example cast
and the regex and JSON families). See Native and codegen-dispatch implementations
for how Comet chooses.
Most expressions can also be disabled with spark.comet.expression.EXPRNAME.enabled=false, where
EXPRNAME is the Spark expression class name (for example Length or StartsWith). See the
Comet Configuration Guide for the full list.
Status legend#
Status |
Meaning |
|---|---|
β Supported |
Comet produces Spark-compatible results by default. Some inputs or forms may fall back to Spark, and any incompatible behavior is opt-in (off by default). |
π Planned |
Intended; tracked by an open issue or pull request. |
Implementation legend#
The Implementation column records how Comet executes each expression when it is not falling back to Spark:
Implementation |
Meaning |
|---|---|
Native |
Cometβs Rust engine evaluates the expression end to end. |
Codegen dispatch |
Sparkβs own generated JVM code is evaluated inside the Comet pipeline. Used when a byte-exact match to Spark matters more than the native speedup, or when no native path exists. |
Hybrid |
Both paths exist. Comet picks between them based on input, and the user can override with |
β |
No direct wire-up: the row is either planned, is rewritten to another expression before Comet sees it (for example |
The Implementation column is auto-generated from the serde definitions in QueryPlanSerde; do not edit it by hand.
Not currently planned#
Comet focuses acceleration on mainstream relational, string, datetime, math, and collection expressions. The following function families are not currently planned for native acceleration (they are not on the current roadmap): specialized functionality with narrow real-world analytics use and high implementation cost. They fall back to Spark and may be reconsidered based on demand:
Probabilistic sketches and approximate top-k (
kll_sketch_*,hll_*,theta_*,count_min_sketch,bitmap_*,approx_top_k*): specialized data structures with exact-correctness traps.Geospatial (
st_*): brand-new Spark 4.1 functionality, specialized.Avro / Protobuf codecs (
from_avro,to_avro,from_protobuf,to_protobuf,schema_of_avro): format conversion belongs at the IO layer, not expression evaluation.JVM reflection (
java_method,reflect,try_reflect): niche, and they invoke arbitrary JVM methods (a security concern).UTF-8 validation (
is_valid_utf8,make_valid_utf8,validate_utf8,try_validate_utf8): niche Spark 4.x string-validation helpers.Miscellaneous niche (
histogram_numeric,version,sentences,quote): low-value or specialized functions with little benefit from native acceleration.
The file-metadata functions input_file_name, input_file_block_start, and input_file_block_length depend on scan-internal per-row file information rather than the expression layer; their support status is covered in the scan compatibility guide.
Note that median and mode are supported: they are mainstream exact aggregates. mode runs natively only with spark.comet.expression.Mode.allowIncompatible=true. approx_count_distinct is supported because Comet ports Sparkβs HyperLogLogPlusPlus exactly, so its result is bit-identical to Spark.
The tables below list every Spark built-in expression with its current status.
agg_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
β |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
Byte, short, int, long, float, and double input; other input types fall back to Spark |
|
β |
Native |
Alias for |
|
β |
Native |
Interval types fall back |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
Grouping indicator for ROLLUP/CUBE/GROUPING SETS |
|
β |
β |
Grouping indicator for ROLLUP/CUBE/GROUPING SETS |
|
π |
β |
Not yet implemented natively |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
Spark 4.0+. |
|
β |
Native |
|
|
β |
Native |
Value and ordering must be fixed-length types |
|
β |
Native |
|
|
β |
β |
Rewrites to |
|
β |
Native |
|
|
β |
Native |
Value and ordering must be fixed-length types |
|
β |
β |
|
|
β |
Native |
Single literal percentage on numeric input runs natively; array of percentages and a frequency argument fall back to Spark |
|
β |
Native |
Alias of |
|
β |
β |
Spark 4.0+ |
|
π |
β |
Percentile aggregate |
|
β |
β |
Native: Spark rewrites to |
|
β |
β |
Native: Spark rewrites to |
|
β |
β |
Native: Spark rewrites to |
|
β |
Native |
Falls back by default because the native merge of partial aggregates differs from Spark (#6423); the native path is opt-in via |
|
β |
Native |
Falls back by default because the native merge of partial aggregates differs from Spark (#6423); the native path is opt-in via |
|
β |
Native |
Falls back by default because the native merge of partial aggregates differs from Spark (#6423); the native path is opt-in via |
|
β |
β |
Falls back by default because the native merge of partial aggregates differs from Spark (#6423); the native path is opt-in via |
|
β |
Native |
Falls back by default because the native merge of partial aggregates differs from Spark (#6423); the native path is opt-in via |
|
β |
β |
Falls back by default because the native merge of partial aggregates differs from Spark (#6423); the native path is opt-in via |
|
π |
β |
Not yet implemented natively |
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
Alias of |
|
β |
Native |
|
|
β |
β |
Interval types fall back |
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
array_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Hybrid |
Float/double element arrays route through the JVM codegen dispatcher by default; the native path is opt-in via allowIncompatible |
|
β |
Native |
Floating-point elements fall back on Spark versions other than 4.2.0; signed-zero and NaN results may differ with native opt-in (details) |
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default; the incompatible native path is opt-in via allowIncompatible (details) |
|
β |
Native |
|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default; the incompatible native path is opt-in via allowIncompatible (details) |
|
β |
Hybrid |
Native for literal or column delimiter and null replacement; other cases and non-UTF8_BINARY collations use the JVM codegen dispatcher (details) |
|
β |
Native |
NaN ordering may differ (details) |
|
β |
Native |
May return |
|
β |
Native |
Binary/struct/map/null elements fall back |
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
Floating-point elements fall back on Spark versions other than 4.2.0; signed-zero and NaN results may differ with native opt-in (details) |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
Binary/struct/map elements fall back |
|
β |
β |
|
|
β |
Hybrid |
Integral types run natively; date/timestamp sequences use codegen dispatch |
|
β |
Native |
Binary/struct/map elements fall back |
|
β |
Native |
Native (#4149) |
|
β |
Hybrid |
Struct, nested-array, and null elements run natively; other element types (for example intervals), and floating-point elements when |
bitwise_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
Operator alias for |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
collection_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
β |
|
|
β |
Native |
|
|
β |
Hybrid |
Binary/array children and non-UTF8_BINARY collations route through the JVM codegen dispatcher |
|
β |
Hybrid |
Arrays with binary, struct, or map elements, and collated strings, route through the JVM codegen dispatcher (details) |
|
β |
Native |
conditional_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Codegen dispatch |
|
|
β |
β |
|
|
β |
β |
Lowers to |
|
β |
β |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
β |
Lowers to |
conversion_funcs#
The type-name conversion functions (bigint, binary, boolean, date, decimal, double, float, int, smallint, string, timestamp, tinyint) are SQL aliases for CAST(... AS <type>) and share the support and caveats of cast.
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Hybrid |
Casts without a native path (for example boolean to decimal) route through the JVM codegen dispatcher (details) |
csv_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
Codegen dispatch by default; the native path is opt-in via allowIncompatible |
datetime_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default (handles all timezone forms); the native path is opt-in via allowIncompatible (details) |
|
β |
β |
Constant-folded to a literal (alias of |
|
β |
β |
Constant-folded to a literal before Comet sees the plan |
|
π |
β |
Blocked on Spark 4.1 TIME type support (#4288) |
|
β |
β |
Constant-folded to a literal before Comet sees the plan |
|
β |
β |
|
|
β |
Native |
The 2-argument form is native; the |
|
β |
Native |
The 2-argument form is native; the |
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
Native |
The 2-argument form is native; the |
|
β |
Native |
The 2-argument form is native; the |
|
β |
β |
|
|
β |
Native |
|
|
β |
β |
Abbreviated day name (Spark 4.0+) |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default (handles all timezone forms); the native path is opt-in via allowIncompatible (details) |
|
β |
β |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default; intervals outside Arrowβs nanosecond range are tracked by #5279; the native path is opt-in via allowIncompatible (details) |
|
β |
β |
Spark 4.1+; requires |
|
β |
β |
|
|
β |
β |
2-arg TIME form falls back |
|
β |
β |
2-arg TIME form falls back |
|
β |
Codegen dispatch |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
β |
Abbreviated month name (Spark 4.0+) |
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
Non-UTF8_BINARY collated |
|
β |
β |
Constant-folded to a literal (alias of |
|
β |
Native |
|
|
β |
β |
|
|
π |
β |
Batch session-window grouping falls back ( |
|
π |
β |
Spark 4.1 TIME type; tracked by #4288 |
|
π |
β |
Spark 4.1 TIME type; tracked by #4288 |
|
β |
β |
Spark 4.0+ grammar alias that parses to |
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
|
|
β |
β |
Reached through the grammar rather than the function registry; runs through codegen dispatch |
|
β |
β |
Reached through the grammar rather than the function registry; runs through codegen dispatch |
|
β |
β |
Rewrites to |
|
β |
β |
Spark 4.1+; requires |
|
β |
β |
Rewrites to |
|
β |
β |
Rewrites to |
|
β |
β |
Rewrites to |
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default (handles all timezone forms); the native path is opt-in via allowIncompatible (details) |
|
β |
Hybrid |
|
|
β |
β |
Rewrites to |
|
β |
β |
|
|
β |
β |
Same support as |
|
β |
β |
Same support as |
|
β |
β |
Rewrites to |
|
β |
β |
Same support as |
|
β |
β |
Rewrites to |
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
String parsing uses Sparkβs codegen and honors the time parser policy, ANSI mode, and session time zone. Date and timestamp inputs ignore the format and use native execution. |
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
Batch tumbling and sliding time-window grouping runs natively |
|
β |
β |
Batch time-window grouping runs natively |
|
β |
Native |
generator_funcs#
explode, explode_outer, posexplode, and posexplode_outer are supported via
CometExplodeExec (operator-level, not expression-level) for array input; map input falls back
to Spark (#2837). Enabled by default via
spark.comet.exec.explode.enabled.
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
β |
via |
|
β |
β |
via |
|
π |
β |
Operator-level generator (like |
|
π |
β |
Operator-level generator (like |
|
β |
β |
via |
|
β |
β |
via |
|
π |
β |
Operator-level generator |
hash_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
json_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default; the native path (supported schemas only) is opt-in via allowIncompatible (audit) |
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default; the native path is opt-in via allowIncompatible (audit) |
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default; the native path, which differs for single-quoted JSON, unescaped control characters, and trailing content, is opt-in via allowIncompatible (audit) |
|
β |
Codegen dispatch |
|
|
π |
β |
|
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
Routes through the JVM codegen dispatcher by default, including options and map/array inputs; the native path is opt-in via allowIncompatible (audit) |
lambda_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
General lambda routed through the JVM codegen dispatcher; the |
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
map_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Codegen dispatch |
Routed through the JVM codegen dispatcher |
|
β |
Codegen dispatch |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
BinaryType keys/values and |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
β |
Lowers to |
math_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Native |
DayTime interval multiplication routes through the JVM codegen dispatcher; YearMonth and Calendar interval multiplication fall back |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
Interval types route through the JVM codegen dispatcher; numeric types run natively |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
|
|
β |
β |
Two-arg form falls back |
|
β |
β |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
Folds to a literal (like |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
Two-arg form falls back |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
Alias for |
|
β |
Native |
Random string (Spark 4.0+); length and seed must be literals |
|
β |
Native |
|
|
β |
Hybrid |
Float/double inputs route through the JVM codegen dispatcher; other types run natively |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
Datetime/interval form falls back |
|
β |
β |
|
|
β |
β |
|
|
β |
β |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
β |
Constant-folded; literal arguments only (Spark 4.0+) |
|
β |
Codegen dispatch |
misc_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
β |
Routed through the JVM codegen dispatcher |
|
β |
β |
Routed through the JVM codegen dispatcher; nondeterministic IV by default |
|
π |
β |
Lowers to |
|
β |
β |
Resolved to a literal by the analyzer ( |
|
β |
β |
Resolved to a literal by the analyzer ( |
|
β |
β |
Alias of |
|
β |
β |
Resolved to a literal by the analyzer; same as |
|
β |
β |
Lowers to |
|
π |
β |
Requires |
|
β |
Native |
|
|
π |
β |
Requires |
|
π |
β |
Raises a runtime error |
|
β |
Native |
Seed must be a literal |
|
β |
Native |
Seed must be a literal |
|
π |
β |
Requires |
|
π |
β |
Requires |
|
β |
β |
Alias of |
|
β |
Native |
|
|
π |
β |
Requires |
|
β |
β |
Routed through the JVM codegen dispatcher |
|
π |
β |
Requires |
|
π |
β |
Requires |
|
β |
β |
Foldable; resolved to a literal before Comet sees the plan |
|
β |
β |
Resolved to a literal by the Spark analyzer before reaching Comet |
|
β |
Native |
|
|
π |
β |
Requires |
predicate_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
β |
|
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
In-subset literal patterns run natively; other patterns route through the JVM codegen dispatcher (details) |
|
β |
Hybrid |
In-subset literal patterns run natively; other patterns route through the JVM codegen dispatcher (details) |
|
β |
Hybrid |
In-subset literal patterns run natively; other patterns route through the JVM codegen dispatcher (details) |
string_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
π |
β |
Spark collation (umbrella #2190) |
|
β |
β |
Constant-folded to a literal (Spark 4.0+) |
|
β |
Hybrid |
Mixed string and array arguments run natively; all-foldable arguments use codegen dispatch |
|
β |
β |
|
|
β |
β |
|
|
β |
Codegen dispatch |
|
|
β |
β |
|
|
β |
β |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
Non-UTF8_BINARY collated input routes through the JVM codegen dispatcher; other input runs natively |
|
β |
Codegen dispatch |
|
|
β |
Hybrid |
|
|
β |
Hybrid |
String inputs use the native kernel with a column string and literal padding; literal strings and column padding use codegen dispatch. Binary inputs use codegen dispatch. |
|
β |
Native |
|
|
β |
β |
Native via |
|
β |
β |
Routed through the JVM codegen dispatcher |
|
β |
Native |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
β |
Rewrites to |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Codegen dispatch |
Routed through the JVM codegen dispatcher |
|
β |
Hybrid |
|
|
β |
β |
Rewrites to |
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
Native |
|
|
β |
Hybrid |
String inputs use the native kernel with a column string and literal padding; literal strings and column padding use codegen dispatch. Binary inputs use codegen dispatch. |
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Hybrid |
|
|
β |
β |
Spark 4.0+ |
|
β |
β |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
Native |
|
|
β |
β |
The hex form runs natively; the base64 and |
|
β |
β |
|
|
β |
Codegen dispatch |
|
|
β |
β |
|
|
β |
Hybrid |
Codegen dispatch by default: DataFusionβs |
|
β |
Native |
|
|
β |
β |
Rewrites to |
|
β |
Codegen dispatch |
Routed through the JVM codegen dispatcher |
|
β |
Hybrid |
|
|
β |
Hybrid |
Column or literal input runs natively; other child expressions, and the strict form used by |
|
β |
Hybrid |
struct_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
Duplicate field names fall back |
|
β |
Native |
url_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
Native |
|
|
β |
β |
Spark 4.0+; runs natively and returns NULL for an invalid URL |
|
β |
β |
|
|
β |
β |
|
|
β |
β |
window_funcs#
Window functions run via CometWindowExec, which is enabled by default.
Aggregate window functions (count, min, max, sum, avg,
first_value, last_value), ranking functions (row_number, rank,
dense_rank, percent_rank, cume_dist, ntile), and value-shift
functions (lag, lead, nth_value) are all wired in the window serde
and execute natively. Statistical aggregates such as stddev, var_pop,
corr, and covar_pop run natively as plain aggregations but fall back
to Spark when used as window functions. A handful of frame shapes also
fall back. See window function compatibility
for the full list of supported functions, frames, and fallback cases.
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
|
β |
β |
via |
xml_funcs#
Function |
Status |
Implementation |
Notes |
|---|---|---|---|
|
β |
β |
Spark 4.0+ |
|
β |
β |
Spark 4.0+ |
|
β |
β |
Spark 4.0+ |
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
Alias of |
|
β |
Codegen dispatch |
|
|
β |
Codegen dispatch |
Beyond SQL functions#
Comet also accelerates a number of Catalyst expressions that have no Spark SQL function name and therefore do not appear in the tables above. These arise from the DataFrame API, from SQL syntax other than function calls, or from the query optimizer. They include:
Operator and optimizer-injected expressions: runtime bloom-filter join probes (
BloomFilterMightContain,BloomFilterAggregate), optimizedINsets (InSet), scalar subqueries (ScalarSubquery), and floating-point normalization (KnownFloatingPointNormalized).Accessor expressions (subscript and field access, not functions): struct field access (
col.field), array element access (arr[i]), and map value access (map[key]).Internal decimal arithmetic:
CheckOverflow,MakeDecimal, andUnscaledValue, which the analyzer inserts around decimal operations.User-defined functions: Scala UDFs registered through the DataFrame or SQL API.
DataSource V2 catalog functions: Icebergβs system functions
bucket,truncate,years,months,days, andhours(for examplesystem.bucket(16, id)) run natively; see Iceberg system functions. Other DataSource V2 catalog functions run in Spark.Lowered built-ins: Spark lowers some built-in functions to
StaticInvokeorInvokecalls. Those without a native mapping run through the JVM codegen dispatcher when their input and output types are supported.Structural expressions: aliases, attribute references, literals, sort orders, and
CASE WHEN.
This list is illustrative, not exhaustive: the per-function tables are not the complete set of expressions Comet can accelerate.
See also#
Comet Compatibility Guide - known incompatibilities and edge cases for supported expressions.
Expression Audits (contributor guide) - per-version (Spark 3.4 / 3.5 / 4.0 / 4.1) audit notes for audited expressions.