This topic outlines the functions and operators supported by SQL and the Simple Log Service Processing Language (SPL).
Aggregate functions
```markdownFunction Name |
Description |
Support for SQL |
Support for SPL |
Returns any non-empty value from x. |
√ |
× |
|
Computes the arithmetic average value of x. |
√ |
× |
|
Returns the result of a bitwise AND operation on all values in x. |
√ |
× |
|
Returns the result of a bitwise OR operation on all values in x. |
√ |
× |
|
Determines whether all logs satisfy the condition. If so, returns true. The bool_and function is equivalent to the every function. |
√ |
× |
|
Determines whether there exists a log that satisfies the condition. If so, returns true. |
√ |
× |
|
Calculates the checksum of x. |
√ |
× |
|
Tallies the number of logs. |
√ |
× |
|
Tallies the number of logs, equivalent to count(*). |
√ |
× |
|
Counts the number of logs with a non-null value in x. |
√ |
× |
|
Counts the number of logs satisfying the specified condition. |
√ |
× |
|
Determines whether all logs satisfy the condition. If so, returns true. The every function is equivalent to the bool_and function. |
√ |
× |
|
Computes the geometric mean of x. |
√ |
× |
|
Calculates the kurtosis of x. |
√ |
× |
|
Returns the union of a series of Map data. If the Map contains the same key, the returned key value is one of the values of the key. |
√ |
× |
|
Finds the largest value in x. |
√ |
× |
|
Finds the top n largest values in x and returns them as an array. |
√ |
× |
|
Finds the x value associated with the largest y value. |
√ |
× |
|
Finds the x values associated with the top n largest y values and returns them as an array. |
√ |
× |
|
Finds the smallest value in x. |
√ |
× |
|
Finds the top n smallest values in x and returns them as an array. |
√ |
× |
|
Finds the x value associated with the smallest y value. |
√ |
× |
|
Finds the x values associated with the top n smallest y values and returns them as an array. |
√ |
× |
|
Calculates the skewness of x. |
√ |
× |
|
Calculates the total value of x. |
√ |
× |
String functions
Function Name |
Description |
Supported in SQL |
Supported in SPL |
Converts an ASCII code into the corresponding character. |
√ |
√ |
|
Converts a character into its ASCII code. |
√ |
√ |
|
Concatenates multiple strings into a single string. |
√ |
√ |
|
Decodes a binary string into a UTF-8 encoded string, replacing invalid UTF-8 characters with the default character U+FFFD. |
√ |
√ |
|
Decodes a binary string into a UTF-8 encoded string, replacing invalid UTF-8 characters with a custom string. |
√ |
√ |
|
Calculates the length of a string. |
√ |
√ |
|
Calculates the minimum edit distance between x and y. |
√ |
× |
|
Converts a string to lowercase. |
√ |
√ |
|
Fills the beginning of a string with specified characters until the specified length is reached, then returns the result string. |
√ |
√ |
|
Removes leading spaces from a string. |
√ |
√ |
|
Formats a string using the NFC format. |
√ |
× |
|
Returns the position of a target substring within a string. |
√ |
× |
|
Replaces matched characters in a string with other specified characters. |
√ |
√ |
|
Deletes matched characters from a string. |
√ |
√ |
|
Returns a string in reverse order. |
√ |
√ |
|
Fills the end of a string with specified characters until the specified length is reached, then returns the result string. |
√ |
√ |
|
Removes trailing spaces from a string. |
√ |
√ |
|
Splits a string using a specified separator and returns a collection of substrings. |
√ |
√ |
|
Splits a string using a specified separator and limits the number of splits, then returns a collection of substrings. |
√ |
√ |
|
Splits a string using a specified separator and returns the content at a specified position. |
√ |
√ |
|
Splits a string using a specified first separator, then splits again using a specified second separator. |
√ |
√ |
|
Returns the position of a target substring within a string, equivalent to the position(sub_string in x) function. |
√ |
√ |
|
Returns a substring from a string at a specified position and with a specified length. |
√ |
√ |
|
Returns a substring from a string at a specified position. |
√ |
√ |
|
Transforms a string into UTF-8 encoding format. |
√ |
√ |
|
Deletes leading and trailing spaces from a string. |
√ |
√ |
|
Converts a string to uppercase. |
√ |
√ |
Date and time functions
Function Name |
Description |
Support for SQL |
Support for SPL |
Returns the current date. |
✓ |
× |
|
Returns the current time and time zone. |
✓ |
× |
|
Returns the current date, time, and time zone. |
✓ |
× |
|
Returns the current time zone. |
✓ |
× |
|
Returns the date part of a datetime expression. |
✓ |
× |
|
Converts a datetime expression of timestamp type to a specified format. |
✓ |
✓ |
|
Converts a date and time string to a datetime expression of timestamp type in a specified format. |
✓ |
✓ |
|
Converts an ISO 8601 date expression to a date type date expression. |
✓ |
× |
|
Converts an ISO 8601 datetime expression to a timestamp type datetime expression. |
✓ |
× |
|
Converts a UNIX timestamp to a datetime expression of timestamp type without a time zone. |
✓ |
✓ |
|
Converts a UNIX timestamp to a datetime expression of timestamp type with a time zone. |
✓ |
× |
|
Converts a UNIX timestamp to a datetime expression of timestamp type with a time zone, where hours and minutes are the time zone offsets. |
✓ |
× |
|
Returns the local time. |
✓ |
× |
|
Returns the local date and time. |
✓ |
× |
|
Returns the current date and time. The now function is equivalent to the current_timestamp function. |
✓ |
× |
|
Converts a date or timestamp type datetime expression to an ISO 8601 format datetime expression. |
✓ |
× |
|
Converts a timestamp type datetime expression to a UNIX timestamp. |
✓ |
✓ |
|
Extracts the day from a datetime expression, calculated by month. The day function is equivalent to the day_of_month function. |
✓ |
× |
|
Extracts the day from a datetime expression, calculated by month. The day_of_month function is equivalent to the day function. |
✓ |
× |
|
Extracts the day from a datetime expression, calculated by week. The day_of_week function is equivalent to the dow function. |
✓ |
✓ |
|
Extracts the day from a datetime expression, calculated by year. The day_of_year function is equivalent to the doy function. |
✓ |
✓ |
|
Extracts the day from a datetime expression, calculated by week. The dow function is equivalent to the day_of_week function. |
✓ |
✓ |
|
Extracts the day from a datetime expression, calculated by year. The doy function is equivalent to the day_of_year function. |
✓ |
✓ |
|
Extracts the date or time part from a datetime expression by a specified field. |
✓ |
× |
|
Extracts the hour from a datetime expression, calculated by a 24-hour clock. |
✓ |
✓ |
|
Extracts the minute from a datetime expression. |
✓ |
✓ |
|
Extracts the month from a datetime expression. |
✓ |
✓ |
|
Calculates the quarter of the target date. |
✓ |
✓ |
|
Extracts the second from a datetime expression. |
✓ |
✓ |
|
Calculates the hour offset of the time zone. |
✓ |
× |
|
Calculates the minute offset of the time zone. |
✓ |
× |
|
Calculates the week number of the year for a target date. The week function is equivalent to the week_of_year function. |
✓ |
× |
|
Calculates the week number of the year for a target date. The week_of_year function is equivalent to the week function. |
✓ |
× |
|
Extracts the year from a target date. |
✓ |
✓ |
|
Extracts the year of the target date in the ISO week calendar. The year_of_week function is equivalent to the yow function. |
✓ |
✓ |
|
Extracts the year of the target date in the ISO week calendar. The yow function is equivalent to the year_of_week function. |
✓ |
✓ |
|
Truncates a datetime expression to a specified time unit and aligns it to millisecond, second, minute, hour, day, month, or year. |
✓ |
× |
|
Adds N time units to x. |
✓ |
✓ |
|
Returns the time difference between two datetime expressions, such as the number of time units between x and y. |
✓ |
✓ |
|
Completes the missing data in your query time window. |
✓ |
× |
Json functions
Function Name |
Description |
SQL Support |
SPL Support |
Determines if a specified value is present in a JSON array. |
✓ |
✓ |
|
Retrieves the element at a specified index within a JSON array. |
✓ |
× |
|
Counts the number of elements in a JSON array. |
✓ |
✓ |
|
Extracts a group of JSON values (array or object) from a JSON object or array. |
✓ |
✓ |
|
Extracts a group of scalar values (strings, integers, or Boolean values) from a JSON object or array, similar to the json_extract function. |
✓ |
✓ |
|
Extracts Boolean values from a JSON object or array. |
✓ |
× |
|
Extracts bigint values from a JSON object or array. |
✓ |
× |
|
Extracts double values from a JSON object or array. |
✓ |
× |
|
Converts JSON data into a string format. |
✓ |
✓ |
|
Transforms a string into JSON data. |
✓ |
✓ |
|
Calculates the number of elements in a JSON object or array. |
✓ |
✓ |
Regular expression functions
Function Name |
Description |
Support for SQL |
Support for SPL |
Extracts all substrings from the target string that match the regular expression and returns them as a collection. |
✓ |
× |
|
Extracts substrings from the target string that match the regular expression and returns a collection of substrings that match the target capturing group. |
✓ |
× |
|
Extracts and returns the first substring from the target string that matches the regular expression. |
✓ |
✓ |
|
Extracts the substring from the target string that matches the regular expression and returns the first substring that matches the target capturing group. |
✓ |
✓ |
|
Extracts the first substring from the target string that matches the regular expression and converts it to a Boolean type. The conversion is successful only if the substring is "true" or "false" (case-insensitive); otherwise, returns |
✓ |
× |
|
Extracts substrings from the target string that match the regular expression, returns the substring that matches the specified capturing group, and converts it to a Boolean type. The conversion is successful only if the substring is "true" or "false" (case-insensitive); otherwise, returns |
✓ |
× |
|
Extracts and returns the substring from the target string that matches the regular expression and converts it to a bigint type. Returns |
✓ |
× |
|
Extracts substrings from the target string that match the regular expression, returns the substring that matches the target capturing group, and converts it to a bigint type. Returns |
✓ |
× |
|
Extracts and returns the substring from the target string that matches the regular expression and converts it to a double type. Returns |
✓ |
× |
|
Extracts substrings from the target string that match the regular expression, returns the substring that matches the target capturing group, and converts it to a double type. Returns |
✓ |
× |
|
Determines whether the target string matches the regular expression. |
✓ |
✓ |
|
Deletes substrings from the target string that match the regular expression and returns the remaining substrings. |
✓ |
✓ |
|
Replaces substrings in the target string that match the regular expression and returns the replaced string. |
✓ |
✓ |
|
Splits the target string using the regular expression and returns the resulting collection of substrings. |
✓ |
× |
Interval-valued comparison and periodicity-valued comparison functions
```markdownFunction Name |
Description |
Support for SQL |
Support for SPL |
Compares the results of the current period with those from n seconds prior. |
✓ |
× |
|
Compares the results of the current period with those from n1, n2, and n3 seconds prior. |
✓ |
× |
|
Compares the results of the current period with those from n seconds prior. Important The ts_compare function requires grouping by the time column (GROUP BY). |
✓ |
× |
|
Compares the results of the current period with those from n1, n2, and n3 seconds prior. |
✓ |
× |
Array functions and operators
Function Name |
Description |
Supported in SQL |
Supported in SPL |
Returns the element at the xth position in an array. |
√ |
× |
|
Returns all values in x as an array. |
√ |
× |
|
Eliminates duplicate elements from an array. |
√ |
√ |
|
Calculates the difference between two arrays. |
√ |
√ |
|
Calculates the intersection of two arrays. |
√ |
√ |
|
Joins the elements of an array into a string using a specified delimiter, ignoring null elements. |
√ |
√ |
|
Joins the elements of an array into a string using a specified delimiter, replacing null elements with null_replacement. |
√ |
√ |
|
Finds the maximum value within an array. |
√ |
√ |
|
Finds the minimum value within an array. |
√ |
√ |
|
Returns the index of a specified element in an array, starting at 1, or 0 if the element is not found. |
√ |
√ |
|
Removes a specified element from an array. |
√ |
√ |
|
Sorts array elements in ascending order, placing null elements at the end. |
√ |
√ |
|
Transposes a matrix, extracting elements with the same index from a two-dimensional array to form a new two-dimensional array. |
√ |
× |
|
Calculates the union of two arrays. |
√ |
× |
|
Counts the number of elements in an array. |
√ |
√ |
|
Concatenates multiple arrays into a single array. |
√ |
× |
|
Determines if an array contains a specified element, returning true if it does. |
√ |
× |
|
Returns the element at the yth position in an array. |
√ |
× |
|
Filters elements in an array based on a lambda expression, returning those that match. |
√ |
√ |
|
Converts a two-dimensional array into a one-dimensional array. |
√ |
× |
|
Adds up elements in an array based on a lambda expression, then returns the result. |
√ |
√ |
|
Reverses the order of elements in an array. |
√ |
√ |
|
Generates an array of consecutive and incrementing elements within a specified range, with a default increment of 1. |
√ |
√ |
|
Generates an array of consecutive and incrementing elements within a specified range, with a custom increment value. |
√ |
√ |
|
Randomizes the order of elements in an array. |
√ |
√ |
|
Extracts a subset of an array. |
√ |
√ |
|
Applies a lambda expression to each element in an array. |
√ |
√ |
|
Merges multiple arrays into a two-dimensional array, with elements at the same index forming a new array. |
√ |
√ |
|
Merges two arrays into one using a lambda expression. |
√ |
× |
Map functions and operators
Function Name |
Description |
Supported in SQL |
Supported in SPL |
Retrieves a map value by key. |
√ |
× |
|
Determines the size of a map. |
√ |
× |
|
Retrieves a map value by key. |
√ |
√ |
|
Groups query and analysis results, returning the result in JSON format. |
√ |
× |
|
Groups query and analysis results, returning the result in multiple rows and columns format. |
√ |
× |
|
Returns an empty map. |
√ |
√ |
|
Transforms two arrays into a single map. |
√ |
√ |
|
Maps x and y into a map. x is the key in the map, and y is the value. If multiple values exist for a key, a random value is selected as the key value. |
√ |
× |
|
Merges multiple maps into one map. |
√ |
√ |
|
Uses a lambda expression to filter elements in a map. |
√ |
√ |
|
Extracts all keys from a map and returns them as an array. |
√ |
√ |
|
Extracts all values from a map and returns them as an array. |
√ |
√ |
|
Maps x and y into a map. x is the key in the map, and y is the value in array format. If multiple values exist for a key, all values are extracted as the key value. |
√ |
× |
Mathematical calculation functions
Function Name |
Description |
Support for SQL |
Support for SPL |
Calculates the absolute value of x. |
√ |
√ |
|
Calculates the arccosine of x. |
√ |
√ |
|
Calculates the arcsine of x. |
√ |
√ |
|
Calculates the arctangent of x. |
√ |
√ |
|
Calculates the arctangent of the quotient of x and y. |
√ |
√ |
|
Calculates the cube root of x. |
√ |
√ |
|
Rounds x up to the nearest integer. The ceil function is an alias of the ceiling function. |
√ |
√ |
|
Rounds x up to the nearest integer. |
√ |
√ |
|
Calculates the cosine of x. |
√ |
√ |
|
Calculates the hyperbolic cosine of x. |
√ |
√ |
|
Calculates the cosine similarity between x and y. |
√ |
× |
|
Converts radians to degrees. |
√ |
√ |
|
Returns the value of the mathematical constant e. |
√ |
√ |
|
Calculates e raised to the power of x. |
√ |
× |
|
Rounds x down to the nearest integer. |
√ |
√ |
|
Converts x from a specified base encoding to a base-10 number. |
√ |
√ |
|
Calculates the natural logarithm of x. |
√ |
√ |
|
Returns a value representing positive infinity. |
√ |
√ |
|
Determines if x is NaN. |
√ |
√ |
|
Calculates the binary logarithm of x. |
√ |
√ |
|
Calculates the base-10 logarithm of x. |
√ |
√ |
|
Calculates the logarithm of x with base y. |
√ |
× |
|
Calculates the remainder of dividing x by y. |
√ |
√ |
|
Returns a NaN value. |
√ |
√ |
|
Returns the value of π to 15 decimal places. |
√ |
√ |
|
Calculates x raised to the power of y. The pow function is an alias of the power function. |
√ |
√ |
|
Calculates x raised to the power of y. |
√ |
√ |
|
Converts degrees to radians. |
√ |
√ |
|
Returns a random number. |
√ |
√ |
|
Returns a random number between 0 (inclusive) and 1 (exclusive). |
√ |
√ |
|
Returns a random number between 0 (inclusive) and x (exclusive). |
√ |
√ |
|
Rounds x to the nearest integer. |
√ |
√ |
|
Rounds x to the specified number of decimal places. |
√ |
√ |
|
Returns the sign of x, represented as 1, 0, or -1. |
√ |
× |
|
Calculates the sine of x. |
√ |
√ |
|
Calculates the square root of x. |
√ |
√ |
|
Calculates the tangent of x. |
√ |
√ |
|
Calculates the hyperbolic tangent of x. |
√ |
√ |
|
Converts x to a string representation in the specified base encoding. |
√ |
× |
|
Truncates the decimal portion of x. |
√ |
√ |
|
Divides a range of values into equal-sized buckets and returns the bucket to which x belongs. |
√ |
× |
|
Uses an array to specify bucket ranges and returns the bucket to which x belongs. |
√ |
× |
Mathematical statistics functions
### Proofread English TranslationFunction Name |
Description |
SQL Support |
SPL Support |
Calculates the correlation coefficient between x and y, with a return value ranging from 0 to 1. |
√ |
× |
|
Calculates the population covariance of x and y. |
√ |
× |
|
Calculates the sample covariance of x and y. |
√ |
× |
|
Calculates the sample standard deviation of x, equivalent to the stddev_samp function. |
√ |
× |
|
Calculates the sample standard deviation of x. |
√ |
× |
|
Calculates the population standard deviation of x. |
√ |
× |
|
Calculates the sample variance of x, equivalent to the var_samp function. |
√ |
× |
|
Calculates the sample variance of x. |
√ |
× |
|
Calculates the population variance of x. |
√ |
× |
|
Calculates the y-axis intercept of a linear equation fitted to the input points |
√ |
× |
|
Calculates the slope of a linear equation fitted to the input points |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the beta distribution using the formula P(N ≤ v; α, β), where α and β are the shape parameters of the beta distribution. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the binomial distribution using the formula P(N ≤ v), where N represents the number of trials and v represents the number of successful outcomes, given a certain probability of success per trial. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the Cauchy distribution using the formula P(N ≤ v; x, y), where x represents the location parameter (the peak of the distribution), and y is the scale parameter. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the chi-square distribution using the formula P(N ≤ v; k), where k represents the degrees of freedom. |
√ |
× |
|
Calculates the value corresponding to the inverse of the beta cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; α, β) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the binomial cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the Cauchy cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; x, y) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the chi-square cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; k) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the Laplace cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; μ, b) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the normal cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; x, y) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the Poisson cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; λ) = p. |
√ |
× |
|
Calculates the value corresponding to the inverse of the Weibull cumulative distribution function (CDF). Given a cumulative probability p, this function determines the value of v such that P(N ≤ v; x, y) = p. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the Laplace distribution using the formula P(N ≤ v; μ, b), where μ represents the location parameter, and b denotes the scale parameter. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the normal distribution using the formula P(N ≤ v; x, y), where x represents the mean of the distribution, and y represents the standard deviation. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the Poisson distribution using the formula P(N ≤ v; λ), where λ represents the mean rate of occurrence. |
√ |
× |
|
Calculates the cumulative distribution function (CDF) value for the Weibull distribution using the formula P(N ≤ v; x, y), where x represents the scale parameter, and y denotes the shape parameter. |
√ |
× |
Type conversion functions
Function name | Description | Supported in SQL | Supported in SPL |
Converts the data type of x. If the cast function fails to convert a value, the query that calls this function is terminated. | √ | √ | |
Converts the data type of x. If the try_cast function fails to convert a value, the function returns NULL and skips the value to continue processing. Note Logs may contain dirty data. We recommend that you use the try_cast function to prevent conversion failures from causing the entire query and analysis operation to fail. | √ | × | |
Returns the data type of x. | √ | × |
Window functions
Function Name |
Description |
Supported in SQL |
Supported in SPL |
All aggregate functions can be used within window functions. For a list of aggregate functions, see aggregate functions. |
√ |
× |
|
Computes the cumulative distribution of values within a window partition. It calculates the ratio of the number of rows with values less than or equal to the current value to the total number of rows in the window partition. The return value range is (0,1]. |
√ |
× |
|
Ranks values within a window partition. Identical values receive the same rank, and ranks are consecutive. For example, if two identical values have a rank of 1, the next value will have a rank of 2. |
√ |
× |
|
Divides the data in a window partition into 'n' groups in order. |
√ |
× |
|
Calculates the percentage rank of each row within a window partition. |
√ |
× |
|
Ranks values within a window partition. Identical values receive the same rank, but ranks are not consecutive. For example, if two identical values have a rank of 1, the next value will have a rank of 3. |
√ |
× |
|
Assigns a unique ordinal number to each value within a window partition, starting at 1. For example, if three values are identical, they will be numbered 1, 2, and 3 respectively. |
√ |
× |
|
Returns the value of the first row within each window partition. |
√ |
× |
|
Returns the value of the last row within each window partition. |
√ |
× |
|
Returns the value from a row at a specified offset before the current row within a window partition. If no such row exists, returns the default_value. |
√ |
× |
|
Returns the value from a row at a specified offset after the current row within a window partition. If no such row exists, returns the default_value. |
√ |
× |
|
Returns the value from the row at a specified offset within a window partition. |
√ |
× |
IP functions
Function Name |
Description |
SQL Support |
SPL Support |
Associates an IP address with its corresponding city. Maps an IP address to its corresponding city, returning the city's name in Chinese. |
√ |
× |
|
Identifies the city associated with an IP address. Maps an IP address to its corresponding city, returning the city's administrative division code. |
√ |
× |
|
Determines the geographic coordinates of a city associated with an IP address, providing a single set of longitude and latitude values. |
√ |
× |
|
Identifies the country or region associated with an IP address. Identifies the country or region associated with an IP address, returning the name in Chinese. |
√ |
× |
|
Identifies the country or region associated with an IP address. Identifies the country or region associated with an IP address, returning the corresponding code. |
√ |
× |
|
Identifies the country or region associated with an IP address. Identifies the country or region associated with an IP address, returning the corresponding code. |
√ |
× |
|
Checks if an IP address is private or public. |
√ |
× |
|
Identifies the geographic coordinates of an IP address's location, providing longitude and latitude values. |
√ |
× |
|
Identifies the Internet service provider (ISP) for a given IP address. |
√ |
× |
|
Identifies the or state associated with an IP address. The function retrieves the Chinese name for a given or state. |
√ |
× |
|
Identifies the or state associated with an IP address. The function retrieves the administrative region code for a state. |
√ |
× |
|
Returns the prefix of an IP address. |
√ |
× |
|
Verifies if a CIDR block is a subnet of a specified CIDR block. |
√ |
× |
|
Checks if an IP address falls within a specified CIDR block. |
√ |
× |
|
Provides the largest IP address within a CIDR block. |
√ |
× |
|
Provides the smallest IP address within a CIDR block. |
√ |
× |
|
Calculates the range of IP addresses within a CIDR block. |
√ |
× |
|
Maps an IPv6 address to its corresponding city. |
√ |
× |
|
Identifies the administrative division code of the city associated with an IPv6 address. |
√ |
× |
|
Maps an IPv6 address to the geographic coordinates of its corresponding city. |
√ |
× |
|
Identifies the country or region associated with an IPv6 address. |
√ |
× |
|
Identifies the code of the country or region associated with an IPv6 address. |
√ |
× |
|
Checks if an IPv6 address is private or public. |
√ |
× |
|
Identifies the Internet service provider (ISP) for an IPv6 address. |
√ |
× |
|
Identifies the province associated with an IPv6 address. |
√ |
× |
|
Identifies the administrative division code of the province associated with an IPv6 address. |
√ |
× |
URL functions
Function name |
Description |
SQL Support |
Supports Structured Process Language (SPL) |
Encodes URLs. |
√ |
√ |
|
Decodes URLs. |
√ |
√ |
|
Extracts the fragment component from a URL. |
√ |
√ |
|
Extracts the host component from a URL. |
√ |
√ |
|
Extracts the value of a specified parameter from a URL's query string. |
√ |
√ |
|
Extracts the path component from a URL. |
√ |
√ |
|
Extracts the port information from a URL. |
√ |
√ |
|
Extracts the protocol information from a URL. |
√ |
√ |
|
Extracts the query component from a URL. |
√ |
√ |
Estimation functions
Function Name |
Description |
Support for SQL |
Support for SPL |
Provides an estimate of the unique value count in x, with a default standard error of 2.3%. |
√ |
× |
|
Allows for a custom standard error when estimating the unique value count in xx. |
√ |
× |
|
Orders values in x by ascending order and returns the value approximately at the specified percentile. |
√ |
× |
|
Orders values in x by ascending order and returns the values approximately at the specified percentiles, percentage01 and percentage02. |
√ |
× |
|
Orders the product of x and weight by ascending order and returns the value approximately at the specified percentile. |
√ |
× |
|
Orders the product of x and weight by ascending order and returns the values approximately at the specified percentiles, percentage01 and percentage02. |
√ |
× |
|
Orders the product of x and weight by ascending order and returns the value approximately at the specified percentile, with support for setting the accuracy of the return value. |
√ |
× |
|
Generates an approximate histogram of x with a specified number of buckets (histogram columns), returning a JSON-type result. |
√ |
× |
|
Generates an approximate histogram of x with a specified number of buckets (histogram columns), returning a JSON-type result and allowing for weighted values. |
√ |
× |
|
Creates an approximate histogram of x with a specified number of buckets (histogram columns), producing a multi-row and multi-column format result. |
√ |
× |
Binary functions
Function Name |
Description |
SQL Support |
SPL Support |
Decodes a Base64-encoded string to binary data. |
√ |
√ |
|
Decodes a Base64-encoded string to binary data using URL-safe characters. |
√ |
× |
|
Converts big endian binary data to a number. |
√ |
× |
|
Converts hexadecimal data to binary data. |
√ |
√ |
|
Calculates the length of binary data. |
√ |
× |
|
Performs MD5 encoding on binary data. |
√ |
√ |
|
Encodes binary data into Base64 format. |
√ |
||
Encodes binary data into Base64 format using URL-safe characters. |
√ |
× |
|
Converts binary data to hexadecimal format. |
√ |
√ |
|
Converts a number to big endian binary data. |
√ |
× |
|
Performs SHA-1 encryption on binary data. |
√ |
√ |
|
Performs SHA-256 encryption on binary data. |
√ |
√ |
|
Performs SHA-512 encryption on binary data. |
√ |
√ |
|
Performs xxHash64 encryption on binary data. |
√ |
√ |
Bitwise functions
Function Name |
Description |
Supported in SQL |
Supported in SPL |
Counts the number of '1' bits in x. |
√ |
√ |
|
Performs a bitwise AND operation on x and y in binary form. |
√ |
√ |
|
Performs a bitwise NOT operation on all bits of x in binary form. |
√ |
√ |
|
Performs a bitwise OR operation on x and y in binary form. |
√ |
√ |
|
Performs a bitwise exclusive OR operation on x and y in binary form. |
√ |
√ |
Geospatial functions
Function name |
Description |
SQL Support | Supports Structured Process Language (SPL) |
Returns the Well-Known Text (WKT) representation of a geometry. | Yes | No | |
Returns the boundary of a geometry. | Yes | No | |
Returns a geometry that represents all points whose distance from a given geometry is less than or equal to a specified distance. | Yes | No | |
Returns a geometry representing the points that are in the first geometry but not in the second geometry. | Yes | No | |
Returns the minimum bounding rectangle for a geometry. | Yes | No | |
Returns the exterior ring of a polygon as a line string. | Yes | No | |
Returns a geometry representing the shared portion of two geometries. | Yes | No | |
Returns a geometry representing the symmetric difference between two geometries, which is the set of points belonging to either one but not both. |
Yes |
No |
|
Determines whether the first geometry contains the second geometry (the boundary may intersect). If it does, it returns true. |
Yes |
No |
|
Determines whether two geometries share any interior points. If they do, it returns true. | Yes | No | |
Determines whether two geometries do not share any points. If they do not, it returns true. | Yes | No | |
Determines whether two geometries are exactly the same. If they are, it returns true. | Yes | No | |
Determines whether the planar projections of two geometries share any points. If they do, it returns true. | Yes | No | |
Determines whether two geometries have the same dimension and overlap but neither is contained by the other. If they do, it returns true. | Yes | No | |
Determines whether two geometries are related. If they are, it returns true. | Yes | No | |
Determines whether two geometries share a boundary but do not share any interior points. If they do, it returns true. | Yes | No | |
Determines whether the first geometry is completely within the second geometry (without intersecting the boundary). If it is, it returns true. |
Yes |
No |
|
Calculates the area of a geometry's projection on a two-dimensional plane using the Euclidean method. | Yes | No | |
Returns the center point of a geometric entity. | Yes | No | |
Returns the coordinate dimension of a geometry. | Yes | No | |
Returns the inherent dimension of a geometric entity, which must be less than or equal to the coordinate dimension. | Yes | No | |
Calculates the minimum distance between two geometries. | Yes | No | |
Returns the last point of a line segment. | Yes | No | |
Determines whether a geometry is closed. If it is, it returns true. | Yes | No | |
Determines whether a geometry is empty. If it is, it returns true. | Yes | No | |
Determines whether a geometry is a closed simple line string (ring). If it is, it returns true. | Yes | No | |
Calculates the two-dimensional projected length of a line segment using the Euclidean method. If there are multiple line segments, it returns the sum of all lengths. |
Yes |
No |
|
Returns the number of points in a geometry. | Yes | No | |
Calculates the number of interior rings in a geometry. | Yes | No | |
Returns the first point of a line segment. | Yes | No | |
Returns the x-axis coordinate of a point. | Yes | No | |
Returns the first maximum x-axis coordinate of a geometry. | Yes | No | |
Returns the first minimum x-axis coordinate of a geometry. | Yes | No | |
Returns the y-axis coordinate of a point. |
Yes |
No |
|
Returns the first maximum y-axis coordinate of a geometry. |
Yes |
No |
|
Returns the first minimum y-axis coordinate of a geometry. |
Yes |
No |
|
Constructs a Bing tile using x-coordinate, y-coordinate, and zoom level. |
Yes |
No |
|
Constructs a Bing tile using a quadkey. |
Yes |
No |
|
Constructs a Bing tile using latitude, longitude, and zoom level. |
Yes |
No |
|
Returns the x-coordinate and y-coordinate for a given Bing tile. |
Yes |
No |
|
Returns the polygon format of a given Bing tile. |
Yes |
No |
|
Returns the quadkey of a given Bing tile. |
Yes |
No |
|
Returns the zoom level of a given Bing tile. | Yes | No |
Geo functions
Function name | Description | Supported in SQL | Supported in SPL |
Encodes latitudes and longitudes by using the Geohash algorithm. | ✓ | × |
Color functions
```markdownFunction Name |
Description |
Supported in SQL |
Supported in SPL |
Specifies the width of the entire ANSI bar chart through the width parameter, with the starting color of the ANSI bar chart being red (low_color) and the ending color being green (high_color). Then, a segment of the ANSI bar chart is extracted through the x parameter and returned. |
√ |
× |
|
Specifies the width of the entire ANSI bar chart through the width parameter, with customizable starting and ending colors. Then, a segment of the ANSI bar chart is extracted through the x parameter and returned. |
√ |
× |
|
Transforms a color string into a color type. |
√ |
× |
|
Specifies the proportion of low_color and high_color based on the ratio of x between low and high, then returns a color between low_color and high_color. |
√ |
× |
|
Specifies the proportion of low_color and high_color through y, then returns a color between low_color and high_color. |
√ |
× |
|
Applies color rendering to display results: a green tick for a true Boolean expression, and a red cross for a false one. |
√ |
× |
|
Applies custom color rendering to display results. |
√ |
× |
|
Returns a color value from RGB values. |
√ |
× |
HyperLogLog functions
Function name | Description | Support for SQL | Support for SPL |
Estimates the number of distinct values in x. The maximum standard error is 0.01625, which is the default value. | ✓ | × | |
Converts HyperLogLog data to bigint data. | ✓ | × | |
Returns a null value of the HyperLogLog type. The maximum standard error is 0.01625, which is the default value. | ✓ | × | |
Aggregates all HyperLogLog values. | ✓ | × |
Comparison operators
Operator |
Description |
Supported in SQL |
Supported in SPL |
Compares x and y, returning true if the condition is satisfied. |
√ |
√ |
|
Returns true if x satisfies all specified conditions. |
√ |
× |
|
Returns true if x meets any of the given conditions. |
√ |
× |
|
Returns true if x falls within the range of y and z. |
√ |
√ |
|
Returns true if x is not equal to y (x IS DISTINCT FROM y). |
√ |
× |
|
(x IS NOT DISTINCT FROM y) Returns true if x is equal to y. |
√ |
× |
|
Checks for a match to a specified character pattern in a string, which is case-sensitive. |
√ |
√ |
|
Returns true if x satisfies any of the specified conditions. |
√ |
× |
|
Identifies the largest value among x and y. |
√ |
× |
|
Identifies the smallest value among x and y. |
√ |
× |
|
Returns true if x is null (x IS NULL). |
√ |
× |
|
(x IS NOT NULL) Returns true if x is not null. |
√ |
× |
Logical operators
Operator | Description | Support for SQL | Support for SPL |
If both x and y evaluate to true, true is returned. | √ | √ | |
If either x or y evaluates to true, true is returned. | √ | √ | |
If x evaluates to false, true is returned. | √ | √ |
Aggregate functions
```markdownFunction name |
Description |
SQL supported | Supported in Structured Process Language (SPL) |
This function converts a data size measurement to the most appropriate unit, as determined by the system. It returns the converted value as a string. For instance, 1,024 KB becomes 1 MB, and 1,024 MB becomes 1 GB. | ✓ | × | |
Converts a measurement from the current unit to a specified unit, returning the result as a string. | ✓ | × | |
This function converts byte measurements into a specified unit, returning the result as a string. |
✓ |
× |
|
Transforms a measurement from its current unit into bytes, returning a decimal value. | ✓ | × | |
Converts a measurement to bytes from its current unit, returning a value of type double. | ✓ | × | |
This function converts a given measurement to kilobytes (KB), returning a value of type double. | ✓ | × | |
This function converts a given measurement to megabytes (MB), returning a value of type double. | ✓ | × | |
This function converts a given measurement to gigabytes (GB), returning a value of type double. |
✓ |
× |
|
This function converts a given measurement to terabytes (TB), returning a value of type double. |
✓ |
× |
|
This function converts a given measurement to petabytes (PB), returning a value of type double. |
✓ |
× |
|
This function formats a time interval in seconds into a readable string format. |
✓ |
× |
|
Formats a time interval, converting it to the |
✓ |
× |
|
Converts a time interval into days. |
✓ |
× |
|
Converts a time interval into hours. |
✓ |
× |
|
Converts a time interval into microseconds. |
✓ |
× |
|
Converts a time interval into milliseconds. |
✓ |
× |
|
Converts a time interval into minutes. |
✓ |
× |
|
This function converts a time interval to the most appropriate unit, as determined by the system, and returns the result. |
✓ |
× |
|
Converts a time interval into nanoseconds. |
✓ |
× |
|
Converts a time interval into seconds. |
✓ |
× |
Window funnel functions
Function name | Description | Support for SQL | Support for SPL |
Searches for an event chain in a sliding time window and counts the maximum number of consecutive events in the event chain. | ✓ | × |
Lambda expressions
Simple Log Service enables the definition of lambda expressions within SQL analytic statements and SPL statements. These expressions can be passed to specific functions, enhancing their expressive capabilities. For more information, see the referenced document.
Conditional expressions
Expression |
Description |
Supported in SQL |
Supported in SPL |
Classifies data based on conditions. |
√ |
√ |
|
Classifies data based on conditions. |
√ |
√ |
|
Returns the first non-null value from a list of expressions. |
√ |
√ |
|
Compares two expressions to determine if they are equal. If they are equal, it returns null; otherwise, it returns the first expression's value. |
√ |
× |
|
Catches abnormal information, allowing the system to continue executing queries and parsing operations. |
√ |
√ |
Vector calculation functions
Expression |
Description |
SQL Support |
SPL Support |
Cosine similarity values range from -1 to 1:
|
Yes |
No |
|
Computes the dot product of two vectors. |
Yes |
No |
|
Computes the Euclidean distance between two vectors. |
Yes |
No |
|
Calculates the vector norm, which is equivalent to its length. |
Yes |
No |
|
Computes the sum of all elements in a vector. |
Yes |
No |
|
Computes the average value of a vector. |
Yes |
No |
|
Computes the variance of vector elements, indicating their dispersion around the mean. |
Yes |
No |
|
Computes the standard deviation of vector elements, reflecting how much they deviate from the mean. A higher standard deviation indicates greater spread, while a lower one indicates elements are closer to the mean. |
Yes |
No |
|
Computes the sum of two vectors. Computes the sum of two vectors. This operation is part of linear transformations that include vector addition, subtraction, and scaling. |
Yes |
No |
|
Computes the difference between two vectors. Computes the difference between two vectors. This operation is part of linear transformations that include vector addition, subtraction, and scaling. |
Yes |
No |
|
Enables linear transformations through vector addition, subtraction, and scaling. |
Yes |
No |