Supported Spark Expressions#
Comet supports the following Spark expressions. See the Comet Compatibility Guide for details on known incompatibilities and unsupported cases.
All expressions are enabled by default, but most can be disabled by setting
spark.comet.expression.EXPRNAME.enabled=false, where EXPRNAME is the expression name as specified in
the following tables, such as Length, or StartsWith. See the Comet Configuration Guide for a full list
of expressions that be disabled.
Conditional Expressions#
Expression |
SQL |
|---|---|
CaseWhen |
|
If |
|
Predicate Expressions#
Expression |
SQL |
|---|---|
And |
|
EqualTo |
|
EqualNullSafe |
|
GreaterThan |
|
GreaterThanOrEqual |
|
LessThan |
|
LessThanOrEqual |
|
In |
|
IsNotNull |
|
IsNull |
|
InSet |
|
Not |
|
Or |
|
String Functions#
Expression |
|---|
Ascii |
BitLength |
Chr |
Concat |
ConcatWs |
Contains |
EndsWith |
InitCap |
Left |
Length |
Like |
Lower |
OctetLength |
Reverse |
RLike |
StartsWith |
StringInstr |
StringRepeat |
StringReplace |
StringLPad |
StringRPad |
StringSpace |
StringTranslate |
StringTrim |
StringTrimBoth |
StringTrimLeft |
StringTrimRight |
Substring |
Upper |
JSON Functions#
Expression |
|---|
GetJsonObject |
Date/Time Functions#
Expression |
SQL |
|---|---|
DateAdd |
|
DateDiff |
|
DateFormat |
|
DateSub |
|
DatePart |
|
Days |
|
Extract |
|
FromUnixTime |
|
Hour |
|
LastDay |
|
Minute |
|
Second |
|
TruncDate |
|
TruncTimestamp |
|
UnixDate |
|
UnixTimestamp |
|
Year |
|
Month |
|
DayOfMonth |
|
DayOfWeek |
|
WeekDay |
|
DayOfYear |
|
WeekOfYear |
|
Quarter |
|
Math Expressions#
Expression |
SQL |
|---|---|
Abs |
|
Acos |
|
Add |
|
Asin |
|
Atan |
|
Atan2 |
|
BRound |
|
Ceil |
|
Cos |
|
Cosh |
|
Cot |
|
Divide |
|
Exp |
|
Expm1 |
|
Floor |
|
Hex |
|
IntegralDivide |
|
IsNaN |
|
Log |
|
Log2 |
|
Log10 |
|
Multiply |
|
Pow |
|
Rand |
|
Randn |
|
Remainder |
|
Round |
|
Signum |
|
Sin |
|
Sinh |
|
Sqrt |
|
Subtract |
|
Tan |
|
Tanh |
|
TryAdd |
|
TryDivide |
|
TryMultiply |
|
TrySubtract |
|
UnaryMinus |
|
Unhex |
|
Hashing Functions#
Expression |
|---|
Md5 |
Murmur3Hash |
Sha1 |
Sha2 |
XxHash64 |
Bitwise Expressions#
Expression |
SQL |
|---|---|
BitwiseAnd |
|
BitwiseCount |
|
BitwiseGet |
|
BitwiseOr |
|
BitwiseNot |
|
BitwiseXor |
|
ShiftLeft |
|
ShiftRight |
|
Aggregate Expressions#
Expression |
SQL |
|---|---|
Average |
|
BitAndAgg |
|
BitOrAgg |
|
BitXorAgg |
|
BoolAnd |
|
BoolOr |
|
CollectSet |
|
Corr |
|
Count |
|
CovPopulation |
|
CovSample |
|
First |
|
Last |
|
Max |
|
Min |
|
StddevPop |
|
StddevSamp |
|
Sum |
|
VariancePop |
|
VarianceSamp |
Window Functions#
Warning
Window support is disabled by default due to known correctness issues. Tracking issue: #2721.
Comet supports using the following aggregate functions within window contexts with PARTITION BY and ORDER BY clauses.
Expression |
|---|
Count |
Max |
Min |
Sum |
Note: Dedicated window functions such as rank, dense_rank, row_number, lag, lead, ntile, cume_dist, percent_rank, and nth_value are not currently supported and will fall back to Spark.
Array Expressions#
Expression |
|---|
ArrayAppend |
ArrayCompact |
ArrayContains |
ArrayDistinct |
ArrayExcept |
ArrayFilter |
ArrayInsert |
ArrayIntersect |
ArrayJoin |
ArrayMax |
ArrayMin |
ArrayRemove |
ArrayRepeat |
ArrayUnion |
ArraysOverlap |
CreateArray |
ElementAt |
Flatten |
GetArrayItem |
Map Expressions#
Expression |
|---|
GetMapValue |
MapKeys |
MapEntries |
MapValues |
MapFromArrays |
StringToMap |
Struct Expressions#
Expression |
|---|
CreateNamedStruct |
GetArrayStructFields |
GetStructField |
JsonToStructs |
StructsToJson |
Conversion Expressions#
Expression |
|---|
Cast |
SortOrder#
Expression |
|---|
NullsFirst |
NullsLast |
Ascending |
Descending |
Other#
Expression |
|---|
Alias |
AttributeReference |
BloomFilterMightContain |
Coalesce |
CheckOverflow |
KnownFloatingPointNormalized |
Literal |
MakeDecimal |
MonotonicallyIncreasingID |
NormalizeNaNAndZero |
PromotePrecision |
RegExpReplace |
ScalarSubquery |
SparkPartitionID |
ToPrettyString |
UnscaledValue |