Function list
StarRocks offers a rich set of functions to facilitate data queries and analysis. In addition to commonly used functions, StarRocks supports semi-structured functions such as ARRAY, JSON, MAP, and STRUCT functions. It also supports higher-order Lambda functions. If these functions cannot meet your business requirements, you can use Java UDF to compile functions. StarRocks also provides Hive Bitmap UDFs. You can generate Bitmap data in Hive and then load Bitmap into StarRocks. You can also export the Bitmap data generated in StarRocks to Hive for other systems to use.
You can find a built-in function based on the following categories:
- Function list
- Aggregate functions
- Array functions
- Binary functions
- Bit functions
- Bitmap functions
- Conditional functions
- Cryptographic functions
- Date and time functions
- Geographic functions
- Hash functions
- JSON functions
- String functions
- Map functions
- Math functions
- Pattern matching functions
- Percentile functions
- Scalar functions
- Struct functions
- Table functions
- Utility functions
- Dictionary functions
Aggregate functions
- any_value
- approx_count_distinct
- approx_top_k
- array_agg
- avg
- bitmap
- bitmap_agg
- corr
- covar_pop
- covar_samp
- count
- count_if
- group_concat
- grouping
- grouping_id
- hll_raw_agg
- hll_union
- hll_union_agg
- max
- max_by
- min
- min_by
- multi_distinct_sum
- multi_distinct_count
- percentile_approx
- percentile_cont
- percentile_disc
- retention
- stddev, stddev_pop
- stddev_samp
- sum
- variance, variance_pop, var_pop
- var_samp
- window_funnel
Array functions
- all_match
- any_match
- array_agg
- array_append
- array_avg
- array_concat
- array_contains
- array_contains_all
- array_cum_sum
- array_difference
- array_distinct
- array_filter
- array_generate
- array_intersect
- array_join
- array_length
- array_map
- array_max
- array_min
- array_position
- array_remove
- array_slice
- array_sort
- array_sortby
- array_sum
- arrays_overlap
- array_to_bitmap
- array_unique_agg
- cardinality
- element_at
- reverse
- unnest
Binary functions
Bit functions
Bitmap functions
- base64_to_bitmap
- bitmap_agg
- bitmap_and
- bitmap_andnot
- bitmap_contains
- bitmap_count
- bitmap_from_binary
- bitmap_from_string
- bitmap_empty
- bitmap_has_any
- bitmap_hash
- bitmap_intersect
- bitmap_max
- bitmap_min
- bitmap_or
- bitmap_remove
- bitmap_to_array
- bitmap_to_base64
- bitmap_to_binary
- bitmap_to_string
- bitmap_union
- bitmap_union_count
- bitmap_union_int
- bitmap_xor
- intersect_count
- subdivide_bitmap
- sub_bitmap
- to_bitmap
- unnest_bitmap
Conditional functions
Cryptographic functions
- aes_encrypt
- aes_decrypt
- base64_decode_binary
- base64_decode_string
- from_base64
- md5
- md5sum
- md5sum_numeric
- sha2
- sm3
- to_base64
Date and time functions
- add_months
- adddate
- convert_tz
- current_date, curdate
- current_time, curtime
- current_timestamp
- date
- date_add, adddate
- date_diff
- date_format
- date_slice
- date_sub, subdate
- date_trunc
- datediff
- day
- dayofweek_iso
- dayname
- dayofmonth
- dayofweek
- dayofyear
- days_add
- days_diff
- days_sub
- from_days
- from_unixtime
- hour
- hours_add
- hours_diff
- hours_sub
- jodatime_format
- last_day
- makedate
- microseconds_add
- microseconds_sub
- milliseconds_diff
- minute
- minutes_add
- minutes_diff
- minutes_sub
- month
- monthname
- months_add
- months_diff
- months_sub
- next_day
- now
- previous_day
- quarter
- second
- seconds_add
- seconds_diff
- seconds_sub
- str2date
- str_to_date
- str_to_jodatime
- time_slice
- time_to_sec
- timediff
- timestamp
- timestampadd
- timestampdiff
- to_date
- to_days
- to_iso8601
- to_tera_date
- to_tera_timestamp
- unix_timestamp
- utc_timestamp
- week
- week_iso
- weekofyear
- weeks_add
- weeks_diff
- weeks_sub
- year
- years_add
- years_diff
- years_sub
Geographic functions
- ST_AsText, ST_AsWKT
- st_circle
- st_contains
- st_distance_sphere
- st_geometryfromtext
- st_linefromtext, ST_LineStringFromText
- st_point
- st_polygon
- st_x
- st_y
Hash functions
JSON functions
- json_array
- json_object
- parse_json
- Arrow function
- cast
- get_json_double
- get_json_int
- get_json_string, get_json_object
- json_each
- json_exists
- json_length
- json_keys
- json_query
- json_string
- to_json
String functions
- append_trailing_char_if_absent
- ascii
- char
- char_length
- character_length
- concat
- concat_ws
- ends_with
- find_in_set
- group_concat
- hex
- hex_decode_binary
- hex_decode_string
- instr
- lcase
- left
- length
- locate
- lower
- lpad
- ltrim
- money_format
- null_or_empty
- parse_url
- repeat
- replace
- reverse
- right
- rpad
- rtrim
- space
- split
- split_part
- starts_with
- strleft
- strright
- str_to_map
- substr, substring
- substring_index
- translate
- trim
- ucase
- unhex
- upper
- url_decode
- url_encode
- url_extract_parameter
Map functions
- cardinality
- distinct_map_keys
- element_at
- map_apply
- map_concat
- map_filter
- map_from_arrays
- map_keys
- map_size
- map_values
- transform_keys
- transform_values
Math functions
- abs
- acos
- asin
- atan
- atan2
- bin
- ceil, dceil
- ceiling
- conv
- cos
- cosh
- cosine_similarity
- cosine_similarity_norm
- cot
- degrees
- divide
- e
- expexp, dexp
- floor, dfloor
- fmod
- greatest
- least
- ln, dlog1, log
- log
- log2
- log10, dlog10
- mod
- multiply
- negative
- pi
- pmod
- positive
- pow, power, dpow, fpow
- radians
- rand, random
- round, dround
- sign
- sin
- sinh
- sqrt, dsqrt
- square
- tan
- tanh
- truncate
Pattern matching functions
Percentile functions
Scalar functions
Struct functions
Table functions
Utility functions
- catalog
- current_role
- current_version
- database
- get_query_profile
- host_name
- isnull
- isnotnull
- is_role_in_session
- last_query_id
- sleep
- uuid
- uuid_numeric
- version