This topic describes the functions and operators that are involved in SQL analysis.
Aggregate functions
Function | Description |
Returns a random not-null value of the x field. | |
Returns the average of the values of the x field. | |
Returns the result of the bitwise AND operation on the values of the x field. | |
Returns the result of the bitwise OR operation on the values of the x field. | |
Checks whether all logs meet the specified condition. If all logs meet the specified condition, the function returns true. This function is equivalent to the every function. | |
Checks whether a log that meets the specified condition exists. If a log that meets the specified condition exists, the function returns true. | |
Returns the checksum of the values of the x field. | |
Returns the number of logs. | |
Returns the number of logs. This function is equivalent to the count(*) function. | |
Returns the number of logs whose value of the x field is not null. | |
Returns the number of logs that meet the specified condition. | |
Checks whether all logs meet the specified condition. If all logs meet the specified condition, the function returns true. This function is equivalent to the bool_and function. | |
Returns the geometric mean of the values of the x field. | |
Returns the excess kurtosis of the values of the x field. | |
Returns the union of the specified maps. If multiple input maps have the same key, the value of the key in the returned union is extracted from one of the maps at random. | |
Returns the maximum value of the x field. | |
Returns the n largest values of the x field. The function returns an array. | |
Returns the value of the x field that corresponds to the maximum value of the y field. | |
Returns the values of the x field that correspond to the n largest values of the y field. The function returns an array. | |
Returns the minimum value of the x field. | |
Returns the n smallest values of the x field. The function returns an array. | |
Returns the value of the x field that corresponds to the minimum value of the y field. | |
Returns the values of the x field that correspond to the n smallest values of the y field. The function returns an array. | |
Returns the skewness of the values of the x field. | |
Returns the sum of the values of the x field. |
String functions
Function | Description |
Converts an ASCII code to characters. | |
Converts characters to an ASCII code. | |
Concatenates multiple strings into one string. | |
Decodes a binary string into a UTF-8 encoded string. Invalid UTF-8 sequences are replaced with the default replacement character U+FFFD. | |
Decodes a binary string into a UTF-8 encoded string. Invalid UTF-8 sequences are replaced with a custom string. | |
Returns the length of a string. | |
Returns the minimum edit distance between x and y. | |
Converts the characters in a string to lowercase letters. | |
Left pads a string to a specified length by using a specified character and returns the result string. | |
Removes spaces from the start of a string. | |
Normalizes a string to normalization form C (NFC). | |
Returns the position of a specified substring in a string. | |
Replaces the matched characters in a string with specified characters. | |
Removes the matched characters from a string. | |
Returns a string in reverse order. | |
Right pads a string to a specified length by using a specified character and returns the result string. | |
Removes spaces from the end of a string. | |
Splits a string by using a specified delimiter and returns a set of substrings. | |
Splits a string by using a specified delimiter and returns a set of substrings. The number of substrings that can be generated is specified by limit. | |
Splits a string by using a specified delimiter and returns the substring at a specified position. | |
Splits a string by using the first specified delimiter, and then splits the string by using the second specified delimiter. | |
Returns the position of a specified substring in a string. This function is equivalent to the position(sub_string in x) function. | |
Returns the substring at a specified position in a string. The length of the substring is specified. | |
Returns the substring at a specified position in a string. | |
Converts a string to a UTF-8 representation. | |
Removes spaces from the start and end of a string. | |
Converts the characters in a string to uppercase letters. |
Date and time functions
Function | Description |
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 timestamp expression to a datetime expression in a specified format. | |
Converts a datetime string to a timestamp expression in a specified format. | |
Converts a date expression in the ISO 8601 format to a common date expression. | |
Converts a datetime expression in the ISO 8601 format to a timestamp expression. | |
Converts a UNIX timestamp to a timestamp expression that does not contain a time zone. | |
Converts a UNIX timestamp to a timestamp expression that contains a time zone. | |
Converts a UNIX timestamp to a timestamp expression that contains a time zone. In the timestamp expression, the values for hours and minutes indicate the offset of the time zone. | |
Returns the local time. | |
Returns the local date and time. | |
Returns the current date and time. This function is equivalent to the current_timestamp function. | |
Converts a date expression or a timestamp expression to a datetime expression in the ISO 8601 format. | |
Converts a timestamp expression to a UNIX timestamp. | |
Returns the day of the month from a datetime expression. This function is equivalent to the day_of_month function. | |
Returns the day of the month from a datetime expression. This function is equivalent to the day function. | |
Returns the day of the week from a datetime expression. This function is equivalent to the dow function. | |
Returns the day of the year from a datetime expression. This function is equivalent to the doy function. | |
Returns the day of the week from a datetime expression. This function is equivalent to the day_of_week function. | |
Returns the day of the year from a datetime expression. This function is equivalent to the day_of_year function. | |
Returns the specified field from a datetime expression. The field can be a date or a time. | |
Returns the hour of the day from a datetime expression. The 24-hour clock is used. | |
Returns the minute of the hour from a datetime expression. | |
Returns the month of the year from a datetime expression. | |
Returns the quarter of the year on which a specified date falls. | |
Returns the second of the minute from a datetime expression. | |
Returns the offset of the time zone in hours. | |
Returns the offset of the time zone in minutes. | |
Returns the week of the year on which a specified date falls. This function is equivalent to the week_of_year function. | |
Returns the week of the year on which a specified date falls. This function is equivalent to the week function. | |
Returns the year of a specified date. | |
Returns the year of a specified date from a time expression that is specified in the ISO week date system. This function is equivalent to the yow function. | |
Returns the year of a specified date from a time expression that is specified in the ISO week date system. This function is equivalent to the year_of_week function. | |
Truncates a datetime expression based on the time unit that you specify. The expression can be truncated based on the millisecond, second, minute, hour, day, month, or year. | |
Adds N to the value of the x field based on the unit that you specify. | |
Returns the difference between two time expressions. For example, you can calculate the difference between x and y based on a specified time unit. | |
Adds a value to the field that has no value returned in the specified time window. |
JSON functions
Function | Description |
Checks whether a JSON array contains a specified value. | |
Returns the element that corresponds to an index in a JSON array. | |
Returns the number of elements in a JSON array. | |
Returns a set of JSON values from a JSON object or a JSON array. | |
Returns a set of scalar values from a JSON object or a JSON array. The scalar values can be of the string, integer, or Boolean type. This function is similar to the json_extract function. | |
Converts JSON data to a string. | |
Converts a string to JSON data. | |
Returns the number of elements in a JSON object or a JSON array. |
Regular expression functions
Function | Description |
Extracts the substrings that match a specified regular expression from a specified string and returns an array of all matched substrings. | |
Extracts the substrings that match a specified regular expression from a specified string and returns an array of substrings that match the nth capturing group in the regular expression. | |
Extracts the first substring that matches a specified regular expression from a specified string and returns the substring. | |
Extracts the substrings that match a specified regular expression from a specified string and returns the first substring that matches the nth capturing group in the regular expression. | |
Checks whether a specified string matches a specified regular expression. | |
Removes the substrings that match a specified regular expression from a specified string and returns the substrings that remain. | |
Replaces the substrings that match a specified regular expression in a specified string and returns the result string. | |
Splits a specified string into multiple substrings by using a specified regular expression and returns an array of the substrings. |
Interval-valued comparison and periodicity-valued comparison functions
Function | Description |
Compares the calculation result of the current time period with the calculation result of a time period n seconds before. | |
Compares the calculation result of the current time period with the calculation results of time periods n1, n2, and n3 seconds before. | |
Compares the calculation result of the current time period with the calculation result of a time period n seconds before. Important The query and analysis results of the ts_compare function must be grouped by the time column by using the GROUP BY clause. | |
Compares the calculation result of the current time period with the calculation results of time periods n1, n2, and n3 seconds before. |
Array functions and operators
Function | Description |
Is used to retrieve the element at position x from an array. | |
Returns an array that is created from all values in x. | |
Removes duplicate elements from an array. | |
Returns the difference of two arrays. | |
Returns the intersection of two arrays. | |
Concatenates the elements of an array by using a specified delimiter and returns a string. If the array contains a null element, the null element is ignored. | |
Concatenates the elements of an array by using a specified delimiter and returns a string. If the array contains a null element, the null element is replaced with null_replacement. | |
Returns the maximum value in an array. | |
Returns the minimum value in an array. | |
Returns the position of a specified element in an array. Positions start from 1. If the specified element does not exist, the function returns 0. | |
Removes a specified element from an array. | |
Returns an array of elements that are sorted in ascending order. If the array contains a null element, the null element is placed at the end. | |
Transposes a matrix and returns a new two-dimensional array that is created from the elements in the matrix. The elements are located by using the same indexes. | |
Returns the union of two arrays. | |
Returns the number of elements in an array. | |
Returns the concatenation of multiple arrays. | |
Checks whether an array contains a specified element. If the array contains the specified element, the function returns true. | |
Returns the element at position y in an array. | |
Filters elements in an array based on a lambda expression and returns elements that meet the expression. | |
Transforms a two-dimensional array into a one-dimensional array. | |
Sums each element in an array by using a lambda expression and returns the result. | |
Returns an array of elements that are sorted in reverse order. | |
Returns an array of elements within a specified range. The elements are consecutive and incremental. The incremental step is 1, which is the default value. | |
Returns an array of elements within a specified range. The elements are incremental. The incremental step is a custom value. | |
Returns a random permutation of elements in an array. | |
Returns a subset of an array. | |
Transforms each element in an array by using a lambda expression. | |
Merges multiple arrays into a two-dimensional array. Elements that have the same position in the input arrays form a new array in the two-dimensional array. | |
Merges two arrays into a single array by using a lambda expression. |
Map functions and operators
Function | Description |
Is used to retrieve the value of a key from a map. | |
Returns the size of a map. | |
Returns the value of a key in a map. | |
Groups query and analysis results and returns data in the JSON format. | |
Groups query and analysis results and returns data in multiple rows and multiple columns. | |
Returns an empty map. | |
Returns a map that is created by using two arrays. | |
Returns a map that is created by using x and y. x is the key in the map. y is the value of the key in the map. If y has multiple values, a random value is extracted as the value of the key. | |
Returns the union of multiple maps. | |
Filters elements in a map based on a lambda expression and returns a new map. | |
Returns an array that consists of all the keys of a map. | |
Returns an array that consists of all the values of a map. | |
Returns a multimap that is created by using x and y. x is the key in the multimap. y is the value of the key in the multimap, and the value is of the array type. If y has multiple values, all the values are extracted as the values of the key. |
Mathematical calculation functions
Function | Description |
Calculates the absolute value of x. | |
Calculates the arc cosine of x. | |
Calculates the arc sine of x. | |
Calculates the arc tangent of x. | |
Calculates the arc tangent of x divided by y. | |
Calculates the cube root of x. | |
Rounds x up to the nearest integer. This 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 an angle in radians to its equivalent in degrees. | |
Returns the value of e, which is the base of the natural logarithm. | |
Raises e to the power of x. | |
Rounds x down to the nearest integer. | |
Converts x to a base-y number. | |
Calculates the natural logarithm of x. | |
Returns a value that represents positive infinity. | |
Determines whether x is Not a Number (NaN). | |
Calculates the base-2 logarithm of x. | |
Calculates the base-10 logarithm of x. | |
Calculates the base-y logarithm of x. | |
Calculates the remainder of x divided by y. | |
Returns a value that is NaN. | |
Returns the value of π to 15 decimal places. | |
Raises x to the power of y. This function is an alias of the power function. | |
Raises x to the power of y. | |
Converts an angle in degrees to its equivalent in radians. | |
Returns a random number. | |
Returns a random number in the range [0,1). | |
Returns a random number in the range [0,x). | |
Rounds x to the nearest integer. | |
Rounds x to the nearest decimal with n decimal places. | |
Returns the sign of x. Valid values: 1, 0, and -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 base-y string. | |
Removes the fractional part of x. | |
Divides a numeric range into buckets of equal width and returns the bucket number of x. | |
Returns the bucket number of x in the range of buckets that are specified by an array. |
Mathematical statistics functions
Function | Description |
Returns the coefficient of correlation between x and y. The return value is in the range of [0,1]. | |
Returns the population covariance of x and y. | |
Returns the sample covariance of x and y. | |
Returns the sample standard deviation of x. This function is equivalent to the stddev_samp function. | |
Returns the sample standard deviation of x. | |
Returns the population standard deviation of x. | |
Returns the sample variance of x. This function is equivalent to the var_samp function. | |
Returns the sample variance of x. | |
Returns the population variance of x. | |
Returns the y-intercept of the line for the linear equation that is determined by the | |
Returns the slope of the line for the linear equation that is determined by the | |
Returns a value for the beta distribution. The function uses the following formula: P(N <= v; α, β) where α and β are parameters for the beta CDF. | |
Returns a value for the binomial distribution. The function uses the following formula: P(N <= v; x, y) where x indicates the number of trials, and y indicates the probability of success (POS) of a trial. | |
Returns a value for the Cauchy distribution. The function uses the following formula: P(N <= v; x, y) where x is the location parameter indicating the peak of the distribution, and y is the scale parameter. | |
Returns a value for the chi-square distribution. The function uses the following formula: P(N <= v; k) where k indicates the degree of freedom. | |
Returns a value for the inverse of the beta distribution. p indicates the result of the beta CDF, which uses the P(N <= v; α, β) formula. The inverse inverse_beta_cdf function calculates v. | |
Returns a value for the inverse of the binomial distribution. p indicates the result of the binomial CDF, which uses the P(N <= v; x, y) formula. The inverse inverse_binomial_cdf function calculates v. | |
Returns a value for the inverse of the Cauchy distribution. p indicates the result of the Cauchy CDF, which uses the P(N <= v; x, y) formula. The inverse inverse_cauchy_cdf function calculates v. | |
Returns a value for the inverse of the chi-square distribution. p indicates the result of the chi-square CDF, which uses the P(N <= v; k) formula. The inverse inverse_chi_squared_cdf function calculates v. | |
Returns a value for the inverse of the Laplace distribution. p indicates the result of the Laplace CDF, which uses the P(N <= v; μ, b) formula. The inverse inverse_laplace_cdf function calculates v. | |
Returns a value for the inverse of the normal distribution. p indicates the result of the normal CDF, which uses the P(N < v; x, y) formula. The inverse inverse_normal_cdf function calculates v. | |
Returns a value for the inverse of the Poisson distribution. p indicates the result of the Poisson CDF, which uses the P(N <= v; λ) formula. The inverse inverse_poisson_cdf function calculates v. | |
Returns a value for the inverse of the Weibull distribution. p indicates the result of the Weibull CDF, which uses the P(N <= v; x, y) formula. The inverse inverse_weibull_cdf function calculates v. | |
Returns a value for the Laplace distribution. The function uses the following formula: P(N <= v; μ, b) where μ is the location parameter, and b is the scale parameter. | |
Returns a value for the normal distribution. The function uses the following formula: P(N < v; x, y) where x indicates the mean value for the normal distribution, and y indicates the standard deviation for the normal distribution. | |
Returns a value for the Poisson distribution. The function uses the following formula: P(N <= v; λ) where λ indicates the average probability of random events. | |
Returns a value for the Weibull distribution. The function uses the following formula: P(N <= v; x, y) where x is the scale parameter, and y is the shape parameter. |
Data type conversion functions
Function | Description |
Converts x from one data type to another. If the cast function fails to convert a value, the query that calls this function is terminated. | |
Converts x from one data type to another. If the try_cast function fails to convert a value, the function returns NULL. The query that calls this function can process the NULL value and continue to run. Note A log may contain dirty data. When you query logs, we recommend that you use the try_cast function. This way, conversion failures do not cause your queries to fail. | |
Returns the data type of x. |
Window functions
Function | Description |
You can use all aggregate functions as window functions. For more information about aggregate functions, see Aggregate function. | |
Calculates the cumulative distribution of each value in a partition. The result is obtained by using division. The numerator is the number of rows whose field values are smaller than or equal to the field value of the specified row. The specified row is also counted. The denominator is the total number of rows in the partition. The calculation is based on the order of the rows in the partition. The return value is in the range of (0,1]. | |
Calculates the rank of each value of a specified field in a partition. If two values are the same, they are assigned the same rank. The ranks are consecutive. For example, if two values are assigned the same rank of 1, the next rank is 2. | |
Divides the rows in each partition into n groups based on a specified order. | |
Calculates the percentage ranking of each row in a partition. | |
Calculates the rank of each value of a specified field in a partition. If two values are the same, they are assigned the same rank. The ranks are not consecutive. For example, if two values are assigned the same rank of 1, the next rank is 3. | |
Calculates the rank of each value of a specified field in a partition. Each value is assigned a unique rank. The ranks start from 1. For example, if three values are the same, they are assigned the ranks of 1, 2, and 3. | |
Returns the value of a specified field in the first row of each partition. | |
Returns the value of a specified field in the last row of each partition. | |
Returns the value of a specified field in the row that is at the specified offset before the current row in a partition. If no row exists at the specified offset before the current row, the value that is specified by default_value is returned. | |
Returns the value of a specified field in the row that is at the specified offset after the current row in a partition. If no row exists at the specified offset after the current row, the value that is specified by default_value is returned. | |
Returns the value of a specified field in the row that is at the specified offset from the beginning of a partition. |
IP functions
Function | Description |
Identifies the city to which an IP address belongs. The function returns the Chinese name of a city. | |
Identifies the city to which an IP address belongs. The function returns the administrative region code of a city. | |
Identifies the longitude and latitude of the city to which an IP address belongs. The function returns the longitude and latitude of a city. Each city has only one set of coordinates. | |
Identifies the country or region to which an IP address belongs. The function returns the Chinese name of a country or region. | |
Identifies the country or region to which an IP address belongs. The function returns the code of a country or region. | |
Identifies the country or region to which an IP address belongs. The function returns the code of a country or region. | |
Checks whether an IP address is a private or a public address. | |
Identifies the longitude and latitude of the location to which an IP address belongs. | |
Identifies the Internet service provider (ISP) of an IP address. | |
Identifies the state to which an IP address belongs. The function returns the Chinese name of a state. | |
Identifies the state to which an IP address belongs. The function returns the administrative region code of a state. | |
Returns the prefix of an IP address. | |
Checks whether a CIDR block is a subnet of a specified CIDR block. | |
Checks whether an IP address is in a specified CIDR block. | |
Returns the largest IP address in a CIDR block. | |
Returns the smallest IP address in a CIDR block. | |
Returns the range of a CIDR block. | |
Identifies the city to which an IPv6 address belongs. | |
Identifies the administrative division code of the city to which an IPv6 address belongs. | |
Identifies the longitude and latitude of the city to which an IPv6 address belongs. | |
Identifies the country or region to which an IPv6 address belongs. | |
Identifies the code of the country or region to which an IPv6 address belongs. | |
Checks whether an IPv6 address is a private or public address. | |
Identifies the Internet service provider (ISP) of an IPv6 address. | |
Identifies the province to which an IPv6 address belongs. | |
Identifies the administrative division code of the province to which an IPv6 address belongs. |
URL functions
Function | Description |
Encodes a URL. | |
Decodes a URL. | |
Extracts the fragment from a URL. | |
Extracts the host from a URL. | |
Extracts the value of a specified parameter in the query string from a URL. | |
Extracts the path from a URL. | |
Extracts the port number from a URL. | |
Extracts the protocol from a URL. | |
Extracts the query string from a URL. |
Approximate functions
Function | Description |
Estimates the number of distinct values in the x field. The standard error is 2.3%, which is the default value. | |
Estimates the number of distinct values in the x field. The standard error is a custom value. | |
Sorts the values of x in ascending order and returns the value that is approximately at the specified percentile. | |
Sorts the values of x in ascending order and returns the values that are approximately at percentile01 and percentile02. | |
Sorts the values of x in ascending order based on the products of the values of x and the weight and returns the value of x that is approximately at the specified percentile. | |
Sorts the values of x in ascending order based on the products of the values of x and the weight and returns the value of x that are approximately at percentile01 and percentile02. | |
Sorts the values of x in ascending order based on the products of the values of x and the weight and returns the value of x that is approximately at the specified percentile. You can configure the accuracy of the returned results. | |
Returns the approximate histogram of x based on the number of histogram columns that are specified by the bucket parameter. The returned result is of the JSON type. | |
Returns the approximate histogram of x based on the number of histogram columns that are specified by the bucket parameter. The returned result is of the JSON type. You can specify a weight for x. | |
Returns the approximate histogram of x based on the number of histogram columns that are specified by the bucket parameter. The returned result contains multiple rows and columns. |
Binary functions
Function | Description |
Decodes a Base64-encoded string into a binary number. | |
Decodes a Base64-encoded string into a binary number by using URL reserved characters. | |
Converts a binary number in big endian to a bigint value. | |
Converts a hexadecimal number to a binary number. | |
Returns the length of a binary number. | |
Computes the MD5 hash value for a binary number. | |
Encodes a binary number into a Base64 string representation. | |
Encodes a binary number into a Base64 string representation by using URL reserved characters. | |
Converts a binary number to a hexadecimal number. | |
Encodes a bigint value into a binary number in big endian. | |
Computes the SHA-1 hash value for a binary number. | |
Computes the SHA-256 hash value for a binary number. | |
Computes the SHA-512 hash value for a binary number. | |
Computes the xxhash64 hash value for a binary number. |
Bitwise functions
Function | Description |
Returns the number of bits 1 in x in binary representation. | |
Returns the result of the bitwise AND operation on x and y in binary representation. | |
Returns the result of the bitwise NOT operation on x in binary representation. | |
Returns the result of the bitwise OR operation on x and y in binary representation. | |
Returns the result of the bitwise XOR operation on x and y in binary representation. |
Geospatial functions
Function | Description |
Returns the well-known text (WKT) representation of a geometry. | |
Returns a geometry from the specified WKT representation. | |
Returns a line string from the specified WKT representation. | |
Returns a polygon from the specified WKT representation. | |
Returns a point from the specified WKT representation. | |
Returns the closure of the combinatorial boundary of a geometry. | |
Returns a geometry that represents all points whose distance from the specified geometry is less than or equal to the specified distance. | |
Returns a geometry that represents the point set difference of two specified geometries. | |
Returns the bounding rectangular polygon of a geometry. | |
Returns a line string that represents the exterior ring of a geometry. | |
Returns a geometry that represents the point set intersection of two specified geometries. | |
Returns a geometry that represents the point set symmetric difference of two specified geometries. | |
Returns true if no points of the second geometry lie in the exterior of the first geometry and at least one point of the interior of the first geometry lies in the interior of the second geometry. | |
Returns true if two specified geometries have several interior points in common. | |
Returns true if two specified geometries do not share any portion of the two-dimensional space. | |
Returns true if two specified geometries represent the same geometry. | |
Returns true if two specified geometries share a portion of the two-dimensional space. | |
Returns true if two specified geometries share space and have the same dimension but are not completely contained by each other. | |
Returns true if two specified geometries have a spatial relationship. | |
Returns true if two specified geometries have at least one point in common but their interiors do not intersect. | |
Returns true if the first geometry is completely inside the second geometry. | |
Calculates the projected area of a geometry on a two-dimensional plane by using the Euclidean distance method. | |
Returns the point value that represents the mathematical centroid of a geometry. | |
Returns the coordinate dimension of a geometry. | |
Returns the inherent dimension of a geometry. The inherent dimension must be less than or equal to the coordinate dimension. | |
Returns the minimum distance between two geometries. | |
Returns the last point of a line string. | |
Returns true if the start point of a line string coincides with the end point. | |
Returns true if a geometry is empty. | |
Returns true if a line string is closed and simple. | |
Calculates the projected length of a line string on a two-dimensional plane by using the Euclidean distance method. If multiple line strings exist, the function returns the sum of the lengths of the multiple line strings. | |
Returns the number of points in a geometry. | |
Returns the number of interior rings in a geometry. | |
Returns the first point of a line string. | |
Returns the X coordinate of a specified point. | |
Returns the maximum first X coordinate of a geometry. | |
Returns the minimum first X coordinate of a geometry. | |
Returns the Y coordinate of a specified point. | |
Returns the maximum first Y coordinate of a geometry. | |
Returns the minimum first Y coordinate of a geometry. | |
Returns a Bing tile based on the X coordinate, Y coordinate, and zoom level. | |
Returns a Bing tile based on the quadtree key. | |
Returns a Bing tile based on the latitude, longitude, and zoom level. | |
Returns the X and Y coordinates of a Bing tile. | |
Returns the polygon format of a Bing tile. | |
Returns the quadtree key of a Bing tile. | |
Returns the zoom level of a Bing tile. |
Geo functions
Function | Description |
Encodes latitudes and longitudes by using the Geohash algorithm. |
Color functions
Function | Description |
Returns a part of an ANSI bar chart. You can configure the width parameter to specify the width of the ANSI bar chart. However, you cannot configure the high_color or low_color parameter to specify the colors for the chart. The default values of the high_color and low_color parameters are used. The default value of the low_color parameter is red and the default value of the high_color parameter is green. In addition, you can configure the x parameter to specify the length of the part that is returned by the function. | |
Returns a part of an ANSI bar chart. You can configure the width parameter to specify the width of the ANSI bar chart. You can also configure the high_color and low_color parameters to specify the custom colors for the chart. In addition, you can configure the x parameter to specify the length of the part that is returned by the function. | |
Converts a color string to a color type. | |
Returns a color between high_color and low_color based on the portions of high_color and low_color. The portions are determined by the proportion of x between high and low. | |
Returns a color between high_color and low_color based on the portions of high_color and low_color. The portions are determined by y. | |
Returns results by using color rendering. If the Boolean expression evaluates to true, the function returns a green tick. If the Boolean expression evaluates to false, the function returns a red cross. | |
Returns results by using custom color rendering. | |
Returns a color value based on an RGB value. |
HyperLogLog functions
Function | Description |
Estimates the number of distinct values in the x field. 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 |
Is used to compare x with y. If the specified condition is met, true is returned. | |
If x meets all conditions, true is returned. | |
If x meets one of the conditions, true is returned. | |
If x is between y and z, true is returned. | |
(x IS DISTINCT FROM y) If x is not equal to y, true is returned. | |
(x IS NOT DISTINCT FROM y) If x is equal to y, true is returned. | |
Is used to match a specified character pattern in a string. The string is case-sensitive. | |
If x meets one of the conditions, true is returned. | |
Is used to obtain the greater value of x and y. | |
Is used to obtain the smaller value of x and y. | |
(x IS NULL) If x is null, true is returned. | |
(x IS NOT NULL) If x is not null, true is returned. |
Logical operators
Operator | Description |
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. |
Unit conversion functions
Function | Description |
Converts a measurement from the current unit to the optimal unit. The system automatically determines the optimal unit and returns a measurement in the optimal unit. The returned result is of the string type. For example, you can convert 1,024 KB to 1 MB and 1,024 MB to 1 GB. | |
Converts a measurement from the current unit to a specified unit. The returned result is of the string type. | |
Converts a measurement in byte to a measurement in a specified unit. The returned result is of the string type. | |
Converts a measurement from the current unit to a measurement in byte. The returned result is of the decimal type. | |
Converts a measurement from the current unit to a measurement in byte. The returned result is of the double type. | |
Converts a measurement from the current unit to a measurement in KB. The returned result is of the double type. | |
Converts a measurement from the current unit to a measurement in MB. The returned result is of the double type. | |
Converts a measurement from the current unit to a measurement in GB. The returned result is of the double type. | |
Converts a measurement from the current unit to a measurement in TB. The returned result is of the double type. | |
Converts a measurement from the current unit to a measurement in PB. The returned result is of the double type. | |
Converts a time interval in seconds to a readable string. | |
Converts a time interval to a time interval in the | |
Converts a time interval to a time interval in days. | |
Converts a time interval to a time interval in hours. | |
Converts a time interval to a time interval in microseconds. | |
Converts a time interval to a time interval in milliseconds. | |
Converts a time interval to a time interval in minutes. | |
Converts a time interval from the current unit to the optimal unit. The system automatically determines the optimal unit and returns a time interval in the optimal unit. | |
Converts a time interval to a time interval in nanoseconds. | |
Converts a time interval to a time interval in seconds. |
Window funnel functions
Function | Description |
Searches the event chain in the sliding time window and counts the maximum number of consecutive events that occurred in the event chain. |
Lambda expressions
Simple Log Service allows you to define a lambda expression in an analytic statement and pass the expression to a specified function. For more information, see Lambda expressions.
Conditional expressions
Expression | Description |
Categorizes data by using conditions. | |
Categorizes data by using conditions. | |
Returns the first not-null value based on multiple expressions. | |
Compares the values of two expressions. If the values of the two expressions are equal, null is returned. Otherwise, the value of the first expression is returned. | |
Evaluates an expression to capture errors. This helps the system continue to query and analyze data. |