标量函数支持状态
标量函数支持状态
在 Spark 3.5 的 357 个标量函数中,Gluten 目前完整支持 247 个函数,部分支持 28 个函数。
Gluten 还完整支持 Spark 4.0 中新增的 2 个函数。
数组函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| array | CreateArray | S | |
| array_append | ArrayAppend | S | |
| array_compact | ArrayCompact | S | |
| array_contains | ArrayContains | S | |
| array_distinct | ArrayDistinct | S | |
| array_except | ArrayExcept | S | |
| array_insert | ArrayInsert | S | |
| array_intersect | ArrayIntersect | S | |
| array_join | ArrayJoin | S | |
| array_max | ArrayMax | S | |
| array_min | ArrayMin | S | |
| array_position | ArrayPosition | S | |
| array_prepend | ArrayPrepend | S | |
| array_remove | ArrayRemove | S | |
| array_repeat | ArrayRepeat | S | |
| array_union | ArrayUnion | S | |
| arrays_overlap | ArraysOverlap | S | |
| arrays_zip | ArraysZip | S | |
| flatten | Flatten | S | |
| get | Get | S | |
| sequence | Sequence | ||
| shuffle | Shuffle | S | |
| slice | Slice | S | |
| sort_array | SortArray | S |
位运算函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 | |
|---|---|---|---|---|
| & | BitwiseAnd | S | ||
| ^ | BitwiseXor | S | ||
| bit_count | BitwiseCount | S | ||
| bit_get | BitwiseGet | S | ||
| getbit | BitwiseGet | S | ||
| shiftright | ShiftRight | S | ||
| shiftrightunsigned | ShiftRightUnsigned | |||
| \ | BitwiseOr | S | ||
| ~ | BitwiseNot | S |
集合函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| array_size | ArraySize | S | |
| cardinality | Size | S | |
| concat | Concat | S | |
| reverse | Reverse | S | |
| size | Size | S |
条件函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| coalesce | Coalesce | S | |
| if | If | S | |
| ifnull | Nvl | S | |
| nanvl | NaNvl | S | |
| nullif | NullIf | S | |
| nvl | Nvl | S | |
| nvl2 | Nvl2 | S | |
| when | CaseWhen | S |
转换函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| bigint | S | ||
| binary | S | ||
| boolean | S | ||
| cast | Cast | S | |
| date | S | ||
| decimal | S | ||
| double | S | ||
| float | S | ||
| int | S | ||
| smallint | S | ||
| string | S | ||
| timestamp | S | ||
| tinyint | S |
CSV 函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| from_csv | CsvToStructs | ||
| schema_of_csv | SchemaOfCsv | ||
| to_csv | StructsToCsv |
日期与时间戳函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| add_months | AddMonths | S | |
| convert_timezone | ConvertTimezone | ||
| curdate | CurDateExpressionBuilder | ||
| current_date | CurrentDate | ||
| current_timestamp | CurrentTimestamp | ||
| current_timezone | CurrentTimeZone | ||
| date_add | DateAdd | S | |
| date_diff | DateDiff | S | |
| date_format | DateFormatClass | S | |
| date_from_unix_date | DateFromUnixDate | S | |
| date_part | DatePartExpressionBuilder | ||
| date_sub | DateSub | S | |
| date_trunc | TruncTimestamp | S | |
| dateadd | DateAdd | S | |
| datediff | DateDiff | S | |
| datepart | DatePartExpressionBuilder | ||
| day | DayOfMonth | S | |
| dayname | DayName | S | Spark 4.0+ |
| dayofmonth | DayOfMonth | S | |
| dayofweek | DayOfWeek | S | |
| dayofyear | DayOfYear | S | |
| extract | Extract | S | |
| from_unixtime | FromUnixTime | S | |
| from_utc_timestamp | FromUTCTimestamp | S | |
| hour | Hour | S | |
| last_day | LastDay | S | |
| localtimestamp | LocalTimestamp | ||
| make_date | MakeDate | S | |
| make_dt_interval | MakeDTInterval | ||
| make_interval | MakeInterval | ||
| make_timestamp | MakeTimestamp | S | |
| make_timestamp_ltz | MakeTimestampLTZExpressionBuilder | ||
| make_timestamp_ntz | MakeTimestampNTZExpressionBuilder | ||
| make_ym_interval | MakeYMInterval | S | |
| minute | Minute | S | |
| month | Month | S | |
| monthname | MonthName | S | Spark 4.0+ |
| months_between | MonthsBetween | S | |
| next_day | NextDay | S | |
| now | Now | ||
| quarter | Quarter | S | |
| second | Second | S | |
| session_window | SessionWindow | ||
| timestamp_micros | MicrosToTimestamp | S | |
| timestamp_millis | MillisToTimestamp | S | |
| timestamp_seconds | SecondsToTimestamp | PS | |
| to_date | ParseToDate | ||
| to_timestamp | ParseToTimestamp | ||
| to_timestamp_ltz | ParseToTimestampLTZExpressionBuilder | ||
| to_timestamp_ntz | ParseToTimestampNTZExpressionBuilder | ||
| to_unix_timestamp | ToUnixTimestamp | PS | |
| to_utc_timestamp | ToUTCTimestamp | S | |
| trunc | TruncDate | S | |
| try_to_timestamp | TryToTimestampExpressionBuilder | ||
| unix_date | UnixDate | S | |
| unix_micros | UnixMicros | S | |
| unix_millis | UnixMillis | S | |
| unix_seconds | UnixSeconds | S | |
| unix_timestamp | UnixTimestamp | S | |
| weekday | WeekDay | S | |
| weekofyear | WeekOfYear | S | |
| window | TimeWindow | ||
| window_time | WindowTime | ||
| year | Year | S |
Hash Functions
| Spark Functions | Spark Expressions | Status | Restrictions |
|---|---|---|---|
| crc32 | Crc32 | S | |
| hash | Murmur3Hash | S | |
| md5 | Md5 | S | |
| sha | Sha1 | S | |
| sha1 | Sha1 | S | |
| sha2 | Sha2 | S | |
| xxhash64 | XxHash64 | S |
JSON Functions
Spark Functions Spark Expressions Status Restrictions
from_json JsonToStructs PS 在 Velox 中不支持 ‘spark.sql.caseSensitive = true’ 的 from_json
在 Velox 中不支持 ‘spark.sql.json.enablePartialResults = false’ 的 from_json
在 Velox 中不支持带 corrupt record 列的 from_json
在 Velox 中不支持带重复键的 from_json
在 Velox 中不支持带 options 的 from_json
get_json_object GetJsonObject S
json_array_length LengthOfJsonArray S
json_object_keys JsonObjectKeys S
json_tuple JsonTuple S
schema_of_json SchemaOfJson
to_json StructsToJson PS 当 ‘spark.sql.caseSensitive = false’ 时,to_json 对字段名为大写的结构体会产生意外结果
在 Velox 中不支持带 options 的 to_json
Lambda Functions
| Spark Functions | Spark Expressions | Status | Restrictions |
|---|---|---|---|
| aggregate | ArrayAggregate | S | |
| array_sort | ArraySort | S | |
| exists | ArrayExists | S | |
| filter | ArrayFilter | S | |
| forall | ArrayForAll | S | |
| map_filter | MapFilter | S | |
| map_zip_with | MapZipWith | S | |
| reduce | ArrayAggregate | S | |
| transform | ArrayTransform | S | |
| transform_keys | TransformKeys | S | |
| transform_values | TransformValues | S | |
| zip_with | ZipWith | S |
Map Functions
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| element_at | ElementAt | S | |
| map | CreateMap | PS | |
| map_concat | MapConcat | PS | |
| map_contains_key | MapContainsKey | S | |
| map_entries | MapEntries | S | |
| map_from_arrays | MapFromArrays | S | |
| map_from_entries | MapFromEntries | S | |
| map_keys | MapKeys | S | |
| map_values | MapValues | S | |
| str_to_map | StringToMap | PS | Velox 后端仅支持 spark.sql.mapKeyDedupPolicy = EXCEPTION |
| try_element_at | TryElementAt |
数学函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| % | Remainder | S | |
| * | Multiply | S | |
| + | Add | S | |
| - | Subtract | S | |
| / | Divide | S | |
| abs | Abs | S | |
| acos | Acos | S | |
| acosh | Acosh | S | |
| asin | Asin | S | |
| asinh | Asinh | S | |
| atan | Atan | S | |
| atan2 | Atan2 | S | |
| atanh | Atanh | S | |
| bin | Bin | S | |
| bround | BRound | ||
| cbrt | Cbrt | S | |
| ceil | CeilExpressionBuilder | PS | |
| ceiling | CeilExpressionBuilder | PS | |
| conv | Conv | S | |
| cos | Cos | S | |
| cosh | Cosh | S | |
| cot | Cot | S | |
| csc | Csc | S | |
| degrees | ToDegrees | S | |
| div | IntegralDivide | S | |
| e | EulerNumber | S | |
| exp | Exp | S | |
| expm1 | Expm1 | S | |
| factorial | Factorial | S | |
| floor | FloorExpressionBuilder | PS | |
| greatest | Greatest | S | |
| hex | Hex | S | |
| hypot | Hypot | S | |
| least | Least | S | |
| ln | Log | ||
| log | Logarithm | S | |
| log10 | Log10 | S | |
| log1p | Log1p | S | |
| log2 | Log2 | S | |
| mod | Remainder | S | |
| negative | UnaryMinus | S | |
| pi | Pi | S | |
| pmod | Pmod | S | |
| positive | UnaryPositive | S | |
| pow | Pow | S | |
| power | Pow | S | |
| radians | ToRadians | ||
| rand | Rand | S | |
| randn | Randn | S | |
| random | Rand | S | |
| rint | Rint | S | |
| round | Round | S | |
| sec | Sec | S | |
| shiftleft | ShiftLeft | S | |
| sign | Signum | S | |
| signum | Signum | S | |
| sin | Sin | ||
| sinh | Sinh | S | |
| sqrt | Sqrt | S | |
| tan | Tan | S | |
| tanh | Tanh | S | |
| try_add | TryAdd | PS | |
| try_divide | TryDivide | ||
| try_multiply | TryMultiply | ||
| try_subtract | TrySubtract | ||
| unhex | Unhex | S | |
| width_bucket | WidthBucket | S |
杂项函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 | ||
|---|---|---|---|---|---|
| aes_decrypt | AesDecrypt | ||||
| aes_encrypt | AesEncrypt | ||||
| assert_true | AssertTrue | S | |||
| bitmap_bit_position | BitmapBitPosition | ||||
| bitmap_bucket_number | BitmapBucketNumber | ||||
| bitmap_count | BitmapCount | ||||
| current_catalog | CurrentCatalog | ||||
| current_database | CurrentDatabase | ||||
| current_schema | CurrentDatabase | ||||
| current_user | CurrentUser | ||||
| equal_null | EqualNull | S | |||
| hll_sketch_estimate | HllSketchEstimate | ||||
| hll_union | HllUnion | ||||
| input_file_block_length | InputFileBlockLength | ||||
| input_file_block_start | InputFileBlockStart | ||||
| input_file_name | InputFileName | ||||
| java_method | CallMethodViaReflection | ||||
| monotonically_increasing_id | MonotonicallyIncreasingID | ||||
| reflect | CallMethodViaReflection | ||||
| spark_partition_id | SparkPartitionID | S | |||
| try_aes_decrypt | TryAesDecrypt | ||||
| typeof | TypeOf | ||||
| user | CurrentUser | ||||
| uuid | Uuid | S | |||
| version | SparkVersion | S | |||
| \ | \ | S |
谓词函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| ! | Not | S | |
| != | S | ||
| < | LessThan | S | |
| <= | LessThanOrEqual | S | |
| <=> | EqualNullSafe | S | |
| <> | S | ||
| = | EqualTo | S | |
| == | EqualTo | S | |
| > | GreaterThan | S | |
| >= | GreaterThanOrEqual | S | |
| and | And | S | |
| between | S | ||
| case | S | ||
| ilike | ILike | S | |
| in | In | PS | |
| isnan | IsNaN | S | |
| isnotnull | IsNotNull | S | |
| isnull | IsNull | S | |
| like | Like | S | |
| not | Not | S | |
| or | Or | S | |
| regexp | RLike | PS | 不支持前后环视 |
| regexp_like | RLike | PS | 不支持前后环视 |
| rlike | RLike | PS | 不支持前后环视 |
字符串函数
Spark 函数 Spark 表达式 状态 限制
ascii Ascii S
base64 Base64 PS 不支持禁用 chunkBase64String 的 base64
bit_length BitLength S
btrim StringTrimBoth S
char Chr S
char_length Length S
character_length Length S
chr Chr S
concat_ws ConcatWs S
contains ContainsExpressionBuilder PS 不支持 BinaryType
decode Decode
elt Elt
encode Encode
endswith EndsWithExpressionBuilder PS 不支持 BinaryType
find_in_set FindInSet S
format_number FormatNumber PS format_number 仅支持 tinyint、smallint、integer、bigint、float 和 double 类型输入;Velox 不支持 DecimalType 输入
Velox 不支持使用字符串格式参数(如 ‘#,###.##’)的 format_number;仅支持整数形式的小数位数
format_string FormatString
initcap InitCap S
instr StringInstr S
lcase Lower S
left Left S
len Length S
length Length S
levenshtein Levenshtein S
locate StringLocate S
lower Lower S
lpad LPadExpressionBuilder PS 不支持 BinaryType
ltrim StringTrimLeft S
luhn_check Luhncheck S
mask MaskExpressionBuilder S
octet_length OctetLength
overlay Overlay S
position StringLocate S
printf FormatString
regexp_count RegExpCount
regexp_extract RegExpExtract PS 不支持环视断言
regexp_extract_all RegExpExtractAll PS 不支持环视断言
regexp_instr RegExpInStr PS 不支持环视断言,忽略分组索引
regexp_replace RegExpReplace PS 不支持环视断言
regexp_substr RegExpSubStr
repeat StringRepeat S
replace StringReplace S
right Right S
rpad RPadExpressionBuilder PS 不支持 BinaryType
rtrim StringTrimRight S
sentences Sentences
soundex SoundEx S
space StringSpace
split StringSplit S
split_part SplitPart S
startswith StartsWithExpressionBuilder PS 不支持 BinaryType
substr Substring PS
substring Substring PS
substring_index SubstringIndex S
to_binary ToBinary
to_char ToCharacter
to_number ToNumber
to_varchar ToCharacter
translate StringTranslate S
trim StringTrim S
try_to_binary TryToBinary
try_to_number TryToNumber
ucase Upper S
unbase64 UnBase64 PS 不支持带 failOnError 的 unbase64
upper Upper S
结构体函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| named_struct | CreateNamedStruct | S | |
| struct | S |
URL 函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| parse_url | ParseUrl | ||
| url_decode | UrlDecode | S | |
| url_encode | UrlEncode | S |
XML 函数
| Spark 函数 | Spark 表达式 | 状态 | 限制 |
|---|---|---|---|
| xpath | XPathList | ||
| xpath_boolean | XPathBoolean | ||
| xpath_double | XPathDouble | ||
| xpath_float | XPathFloat | ||
| xpath_int | XPathInt | ||
| xpath_long | XPathLong | ||
| xpath_number | XPathDouble | ||
| xpath_short | XPathShort | ||
| xpath_string | XPathString |
评论
登录后参与评论
KnowForge