# Chalk SQL Reference
source: https://docs.chalk.ai/chalksql-docs

Chalk SQL functions for federated queries across data sources, offline stores, and the Chalk catalog.

Each section of this reference is a separate Markdown file, listed with the items it documents.

- [Numeric Functions](https://docs.chalk.ai/chalksql-docs/numeric-functions.md): abs, acos, arccosh, arcsinh, arctanh, asin, atan, atan2, bankers_round, cbrt, ceil, ceiling, clamp, cos, cosh, cot, degrees, e, exp, floor, is_finite, is_infinite, is_nan, ln, log, log10, log1p, log2, nan, negate, pi, pow, power, radians, rand, random, round, round_sig_figs, secure_random, sign, sin, sqrt, tan, tanh, trunc, truncate, %, *, **, +, -, -x, /, //, ^
- [Comparison Functions](https://docs.chalk.ai/chalksql-docs/comparison-functions.md): and, between, coalesce, distinct_from, eq, gt, gte, if_else, is_null, lt, lte, neq, nullif, python_eq, python_ne, scalar_max, scalar_min, sort_order, !=, <, <=, <=>, ==, >, >=
- [Control Flow and Error Handling](https://docs.chalk.ai/chalksql-docs/control-flow-and-error-handling.md): fail, recover, try_, with_policies
- [Bitwise Functions](https://docs.chalk.ai/chalksql-docs/bitwise-functions.md): bit_count, bitwise_and, bitwise_arithmetic_shift_right, bitwise_left_shift, bitwise_logical_shift_right, bitwise_not, bitwise_or, bitwise_right_shift, bitwise_right_shift_arithmetic, bitwise_shift_left, bitwise_xor, &, <<, |, ~
- [Array Functions](https://docs.chalk.ai/chalksql-docs/array-functions.md): all_match, any_match, array_add, array_all, array_any, array_append, array_apply, array_arg_max, array_arg_min, array_average, array_compact, array_constructor, array_contains, array_contains_element, array_cum_sum, array_distinct, array_duplicates, array_except, array_filter, array_frequency, array_has_duplicates, array_indexof, array_intersect, array_join, array_length, array_max, array_median, array_min, array_mode, array_multimode, array_n_unique, array_normalize, array_position, array_reduce, array_reduce_while, array_remove, array_reverse, array_slice, array_sort, array_sort_desc, array_stddev, array_sum, array_to_string, array_transform, array_unique, array_value, arrays_overlap, arrays_union, cardinality, combinations, contains, element_at, find_first, find_first_index, flatten, greatest, least, list_apply, list_avg, list_concat, list_contains, list_count, list_distinct, list_extract, list_filter, list_has, list_has_any, list_intersect, list_max, list_median, list_min, list_mode, list_pack, list_position, list_slice, list_sort, list_stddev_pop, list_sum, list_transform, list_unique, list_value, ngrams, none_match, python_element_at, python_range, python_zip, range, reduce, remove_nulls, repeat, sequence, shuffle, slice, subscript, transform, trim_array, zip, zip_with, &&
- [Vector Functions](https://docs.chalk.ai/chalksql-docs/vector-functions.md): binary_to_vector, cosine_similarity_vector, dot_product_vector, scale_vector, vector_to_binary
- [String Functions](https://docs.chalk.ai/chalksql-docs/string-functions.md): boost_regexp_findall, boyer_moore_search, chr, codepoint, concat, count_matches, editdist3, ends_with, hamming_distance, ilike, instr, jaccard_similarity, jaro_similarity, jaro_winkler_distance, jaro_winkler_similarity, knuth_morris_pratt_search, len, len_bytes, length, levenshtein, levenshtein_distance, like, longest_common_subsequence, lower, lpad, ltrim, minijinja_render, normalize, octet_length, partial_ratio, prefix, python_is_alnum, python_is_alpha, python_is_digit, python_is_lower, python_is_numeric, python_is_space, python_is_title, python_is_upper, python_lstrip, python_remove_prefix, python_remove_suffix, python_rstrip, python_string_slice, python_strip, regexp_extract, regexp_extract_all, regexp_full_match, regexp_like, regexp_matches, regexp_replace, regexp_split, regexp_split_to_array, replace, reverse, rpad, rtrim, sequence_matcher_ratio, split, split_part, starts_with, str_split, str_split_regex, string_split, string_split_regex, string_to_array, string_to_bytes_base64, string_to_bytes_hex, string_to_bytes_utf8, strpos, strrpos, substr, substring, suffix, titlecase, token_set_ratio, token_sort_ratio, trail, trim, unidecode_normalize, unidecode_to_ascii, upper, uuid_string, word_stem, zfill, zi_split_part, !~~, !~~*, ^@, ||, ~~, ~~*
- [Date and Time Functions](https://docs.chalk.ai/chalksql-docs/date-and-time-functions.md): current_date, date, date_add, date_bin, date_diff, date_format, date_trunc, day, day_of_month, day_of_week, day_of_year, days_in_month, dow, doy, format_datetime, format_datetime_in_timezone, from_iso8601_date, from_iso8601_timestamp, from_unix_seconds, from_unixtime, hour, hour_in_timezone, is_business_day, is_federal_holiday, last_day_of_month, make_date, millisecond, minute, month, parse_datetime, quarter, second, to_days, to_hours, to_iso8601, to_microseconds, to_milliseconds, to_minutes, to_months, to_seconds, to_unix_nanos, to_unixtime, to_years, total_seconds, week, week_of_year, year, year_of_week, yow
- [Maps / Dictionaries](https://docs.chalk.ai/chalksql-docs/maps-dictionaries.md): all_keys_match, any_keys_match, any_values_match, map_contains, map_filter, map_from_arrays, map_get, map_key_exists, map_keys, map_keys_by_top_n_values, map_subset, map_top_n, map_top_n_keys, map_top_n_values, map_values, map_zip_with, no_keys_match, no_values_match, transform_keys, transform_values
- [Statistical Functions](https://docs.chalk.ai/chalksql-docs/statistical-functions.md): beta_cdf, binomial_cdf, cauchy_cdf, chi_squared_cdf, cpc_sketch_cardinality, cpc_sketch_of, cpc_sketch_union, f_cdf, gamma_cdf, inverse_beta_cdf, inverse_binomial_cdf, inverse_cauchy_cdf, inverse_chi_squared_cdf, inverse_f_cdf, inverse_gamma_cdf, inverse_laplace_cdf, inverse_normal_cdf, inverse_poisson_cdf, inverse_weibull_cdf, laplace_cdf, normal_cdf, poisson_cdf, weibull_cdf, width_bucket, wilson_interval_lower, wilson_interval_upper
- [Aggregate Functions](https://docs.chalk.ai/chalksql-docs/aggregate-functions.md): approx_count_distinct, array_agg, count, count_distinct, cpc_sketch, kurtosis, max, max_by, max_by_n, mean, min, min_by, min_by_n, mode, one, set_agg, set_union, skewness, stddev, stddev_pop, sum, var_pop, variance
- [JSON Functions](https://docs.chalk.ai/chalksql-docs/json-functions.md): cast_to_json, get_json_value, get_json_value_strict, is_json_scalar, json_array_contains, json_array_length, json_extract, json_extract_array, json_extract_path, json_extract_path_text, json_extract_scalar, json_extract_string, json_format, json_is_null, json_parse, json_size, json_stringify, json_value, jsonify, regorus_eval, ->>
- [URL Functions](https://docs.chalk.ai/chalksql-docs/url-functions.md): from_base64url, to_base64url, url_decode, url_encode, url_extract_fragment, url_extract_host, url_extract_parameter, url_extract_path, url_extract_port, url_extract_protocol, url_extract_query
- [HTTP Functions](https://docs.chalk.ai/chalksql-docs/http-functions.md): fetch_file, fetch_file_raw, http_request
- [LLM Functions](https://docs.chalk.ai/chalksql-docs/llm-functions.md): ai_complete, ai_complete_raw, bedrock_embed, bedrock_predict, chalk_encoder, decision_complete, onnx_run, openai_complete, openai_complete_raw, openai_embed, prompt_jev, sagemaker_predict, vertex_predict
- [Geometry Functions](https://docs.chalk.ai/chalksql-docs/geometry-functions.md): geometry_as_geojson, geometry_from_geojson, geometry_nearest_points, st_area, st_astext, st_boundary, st_buffer, st_centroid, st_contains, st_convexhull, st_crosses, st_difference, st_dimension, st_disjoint, st_distance, st_endpoint, st_envelope, st_envelopeaspts, st_equals, st_exteriorring, st_geometries, st_geometryfromtext, st_geometryn, st_geometrytype, st_interiorringn, st_interiorrings, st_intersection, st_intersects, st_isclosed, st_isempty, st_isring, st_issimple, st_isvalid, st_length, st_linefromtext, st_linestring, st_multipoint, st_numgeometries, st_numinteriorring, st_numpoints, st_overlaps, st_point, st_pointn, st_points, st_polygon, st_relate, st_startpoint, st_symdifference, st_touches, st_union, st_within, st_x, st_xmax, st_xmin, st_y, st_ymax, st_ymin
- [Geospatial Functions](https://docs.chalk.ai/chalksql-docs/geospatial-functions.md): h3_cell_to_lat_lon_degrees, h3_cell_to_lat_lon_radians, h3_lat_lon_to_cell
- [Binary Functions](https://docs.chalk.ai/chalksql-docs/binary-functions.md): avro_deserialize, avro_to_struct, base64, bytes_to_string_base64, bytes_to_string_hex, bytes_to_string_utf8, encode, from_base64, from_big_endian_32, from_big_endian_64, from_hex, from_ieee754_32, from_ieee754_64, from_snappy, gunzip, proto_deserialize, proto_deserialize_strict, proto_serialize, proto_to_struct, proto_to_struct_strict, python_bytes_decode, struct_to_proto, to_base64, to_big_endian_32, to_big_endian_64, to_hex, to_ieee754_32, to_ieee754_64, to_snappy
- [Hash Functions](https://docs.chalk.ai/chalksql-docs/hash-functions.md): crc32, hmac_md5, hmac_sha1, hmac_sha256, hmac_sha512, iceberg_bucket, md5, sha1, sha256, sha512, spooky_hash_v2_32, spooky_hash_v2_64, xxhash64
- [Conversion Functions](https://docs.chalk.ai/chalksql-docs/conversion-functions.md): from_base, from_utf8, to_base, to_utf8
- [Table-Valued Functions](https://docs.chalk.ai/chalksql-docs/table-valued-functions.md): datasource_query
