This topic contains all functions supported by GoogleSQL for Spanner.
Function list
| Name | Summary | 
|---|---|
| ABS | Computes the absolute value of X. | 
| ACOS | Computes the inverse cosine of X. | 
| ACOSH | Computes the inverse hyperbolic cosine of X. | 
| ADDDATE | Alias for DATE_ADD. | 
| ANY_VALUE | Gets an expression for some row. | 
| APPROX_COSINE_DISTANCE | Computes the approximate cosine distance between two vectors. | 
| APPROX_DOT_PRODUCT | Computes the approximate dot product of two vectors. | 
| APPROX_EUCLIDEAN_DISTANCE | Computes the approximate Euclidean distance between two vectors. | 
| ARRAY | Produces an array with one element for each row in a subquery. | 
| ARRAY_AGG | Gets an array of values. | 
| ARRAY_CONCAT | Concatenates one or more arrays with the same element type into a single array. | 
| ARRAY_CONCAT_AGG | Concatenates arrays and returns a single array as a result. | 
| ARRAY_FILTER | Takes an array, filters out unwanted elements, and returns the results in a new array. | 
| ARRAY_FIRST | Gets the first element in an array. | 
| ARRAY_INCLUDES | Checks if there is an element in the array that is equal to a search value. | 
| ARRAY_INCLUDES_ALL | Checks if all search values are in an array. | 
| ARRAY_INCLUDES_ANY | Checks if any search values are in an array. | 
| ARRAY_IS_DISTINCT | Checks if an array contains no repeated elements. | 
| ARRAY_LAST | Gets the last element in an array. | 
| ARRAY_LENGTH | Gets the number of elements in an array. | 
| ARRAY_MAX | Gets the maximum non- NULLvalue in an array. | 
| ARRAY_MIN | Gets the minimum non- NULLvalue in an array. | 
| ARRAY_REVERSE | Reverses the order of elements in an array. | 
| ARRAY_SLICE | Produces an array containing zero or more consecutive elements from an input array. | 
| ARRAY_TO_STRING | Produces a concatenation of the elements in an array as a STRINGvalue. | 
| ARRAY_TRANSFORM | Transforms the elements of an array, and returns the results in a new array. | 
| ASIN | Computes the inverse sine of X. | 
| ASINH | Computes the inverse hyperbolic sine of X. | 
| ATAN | Computes the inverse tangent of X. | 
| ATAN2 | Computes the inverse tangent of X/Y, using the signs ofXandYto determine the quadrant. | 
| ATANH | Computes the inverse hyperbolic tangent of X. | 
| AVG | Gets the average of non- NULLvalues. | 
| BIT_AND | Performs a bitwise AND operation on an expression. | 
| BIT_COUNT | Gets the number of bits that are set in an input expression. | 
| BIT_OR | Performs a bitwise OR operation on an expression. | 
| BIT_REVERSE | Reverses the bits in an integer. | 
| BIT_XOR | Performs a bitwise XOR operation on an expression. | 
| BOOL | Converts a JSON boolean to a SQL BOOLvalue. | 
| BOOL_ARRAY | Converts a JSON array of booleans to a
    SQL ARRAY<BOOL>value. | 
| BYTE_LENGTH | Gets the number of BYTESin aSTRINGorBYTESvalue. | 
| CAST | Convert the results of an expression to the given type. | 
| CEIL | Gets the smallest integral value that isn't less than X. | 
| CEILING | Synonym of CEIL. | 
| CHAR_LENGTH | Gets the number of characters in a STRINGvalue. | 
| CHARACTER_LENGTH | Synonym for CHAR_LENGTH. | 
| CODE_POINTS_TO_BYTES | Converts an array of extended ASCII code points to a BYTESvalue. | 
| CODE_POINTS_TO_STRING | Converts an array of extended ASCII code points to a STRINGvalue. | 
| CONCAT | Concatenates one or more STRINGorBYTESvalues into a single result. | 
| COS | Computes the cosine of X. | 
| COSH | Computes the hyperbolic cosine of X. | 
| COSINE_DISTANCE | Computes the cosine distance between two vectors. | 
| COUNT | Gets the number of rows in the input, or the number of rows with an
    expression evaluated to any value other than NULL. | 
| COUNTIF | Gets the number of TRUEvalues for an expression. | 
| CURRENT_DATE | Returns the current date as a DATEvalue. | 
| CURRENT_TIMESTAMP | Returns the current date and time as a TIMESTAMPobject. | 
| DATE | Constructs a DATEvalue. | 
| DATE_ADD | Adds a specified time interval to a DATEvalue. | 
| DATE_DIFF | Gets the number of unit boundaries between two DATEvalues
    at a particular time granularity. | 
| DATE_FROM_UNIX_DATE | Interprets an INT64expression as the number of days
    since 1970-01-01. | 
| DATE_SUB | Subtracts a specified time interval from a DATEvalue. | 
| DATE_TRUNC | Truncates a DATEvalue at a particular granularity. | 
| DEBUG_TOKENLIST | Displays a human-readable representation of tokens present in the TOKENLISTvalue for debugging purposes. | 
| DESTINATION_NODE_ID | Gets a unique identifier of a graph edge's destination node. | 
| DIV | Divides integer Xby integerY. | 
| DOT_PRODUCT | Computes the dot product of two vectors. | 
| FLOAT64 | Converts a JSON number to a SQL FLOAT64value. | 
| FLOAT64_ARRAY | Converts a JSON array of numbers to a SQL ARRAY<FLOAT64>value. | 
| EDGES | Gets the edges in a graph path. The resulting array retains the original order in the graph path. | 
| ELEMENT_ID | Gets a graph element's unique identifier. | 
| ENDS_WITH | Checks if a STRINGorBYTESvalue is the suffix
    of another value. | 
| ERROR | Produces an error with a custom error message. | 
| EXP | Computes eto the power ofX. | 
| EXTRACT | Extracts part of a date from a DATEvalue. | 
| EXTRACT | Extracts part of an INTERVALvalue. | 
| EXTRACT | Extracts part of a TIMESTAMPvalue. | 
| EUCLIDEAN_DISTANCE | Computes the Euclidean distance between two vectors. | 
| FARM_FINGERPRINT | Computes the fingerprint of a STRINGorBYTESvalue, using the FarmHash Fingerprint64 algorithm. | 
| FLOAT32 | Converts a JSON number to a SQL FLOAT32value. | 
| FLOAT32_ARRAY | Converts a JSON array of numbers to a SQL ARRAY<FLOAT32>value. | 
| FLOOR | Gets the largest integral value that isn't greater than X. | 
| FORMAT_DATE | Formats a DATEvalue according to a specified format string. | 
| FORMAT_TIMESTAMP | Formats a TIMESTAMPvalue according to the specified
    format string. | 
| FORMAT | Formats data and produces the results as a STRINGvalue. | 
| FROM_BASE32 | Converts a base32-encoded STRINGvalue into aBYTESvalue. | 
| FROM_BASE64 | Converts a base64-encoded STRINGvalue into aBYTESvalue. | 
| FROM_HEX | Converts a hexadecimal-encoded STRINGvalue into aBYTESvalue. | 
| GENERATE_ARRAY | Generates an array of values in a range. | 
| GENERATE_DATE_ARRAY | Generates an array of dates in a range. | 
| GENERATE_UUID | Produces a random universally unique identifier (UUID) as a STRINGvalue. | 
| GET_INTERNAL_SEQUENCE_STATE | Gets the current sequence internal counter before bit reversal. | 
| GET_NEXT_SEQUENCE_VALUE | Takes in a sequence identifier and returns the next value. This function is only allowed in read-write transactions. | 
| GREATEST | Gets the greatest value among X1,...,XN. | 
| IEEE_DIVIDE | Divides XbyY, but doesn't generate errors for
    division by zero or overflow. | 
| INT64 | Converts a JSON number to a SQL INT64value. | 
| INT64_ARRAY | Converts a JSON array of numbers to a
    SQL ARRAY<INT64>value. | 
| IS_ACYCLIC | Checks if a graph path has a repeating node. | 
| IS_FIRST | Returns trueif this row is in the firstkrows (1-based) within the window. | 
| IS_INF | Checks if Xis positive or negative infinity. | 
| IS_NAN | Checks if Xis aNaNvalue. | 
| IS_SIMPLE | Checks if a graph path is simple. | 
| IS_TRAIL | Checks if a graph path has a repeating edge. | 
| JSON_ARRAY | Creates a JSON array. | 
| JSON_ARRAY_APPEND | Appends JSON data to the end of a JSON array. | 
| JSON_ARRAY_INSERT | Inserts JSON data into a JSON array. | 
| JSON_CONTAINS | Checks if a JSON document contains another JSON document. | 
| JSON_KEYS | Extracts unique JSON keys from a JSON expression. | 
| JSON_OBJECT | Creates a JSON object. | 
| JSON_QUERY | Extracts a JSON value and converts it to a SQL
    JSON-formatted STRINGorJSONvalue. | 
| JSON_QUERY_ARRAY | Extracts a JSON array and converts it to
    a SQL ARRAY<JSON-formatted STRING>orARRAY<JSON>value. | 
| JSON_REMOVE | Produces JSON with the specified JSON data removed. | 
| JSON_SET | Inserts or replaces JSON data. | 
| JSON_STRIP_NULLS | Removes JSON nulls from JSON objects and JSON arrays. | 
| JSON_TYPE | Gets the JSON type of the outermost JSON value and converts the name of
    this type to a SQL STRINGvalue. | 
| JSON_VALUE | Extracts a JSON scalar value and converts it to a SQL STRINGvalue. | 
| JSON_VALUE_ARRAY | Extracts a JSON array of scalar values and converts it to a SQL ARRAY<STRING>value. | 
| JUSTIFY_DAYS | Normalizes the day part of an INTERVALvalue. | 
| JUSTIFY_HOURS | Normalizes the time part of an INTERVALvalue. | 
| JUSTIFY_INTERVAL | Normalizes the day and time parts of an INTERVALvalue. | 
| LABELS | Gets the labels associated with a graph element. | 
| LAX_BOOL | Attempts to convert a JSON value to a SQL BOOLvalue. | 
| LAX_FLOAT64 | Attempts to convert a JSON value to a
    SQL FLOAT64value. | 
| LAX_INT64 | Attempts to convert a JSON value to a SQL INT64value. | 
| LAX_STRING | Attempts to convert a JSON value to a SQL STRINGvalue. | 
| LCASE | Alias for LOWER. | 
| LEAST | Gets the least value among X1,...,XN. | 
| LENGTH | Gets the length of a STRINGorBYTESvalue. | 
| LN | Computes the natural logarithm of X. | 
| LOG | Computes the natural logarithm of Xor the logarithm ofXto baseY. | 
| LOG10 | Computes the natural logarithm of Xto base 10. | 
| LOGICAL_AND | Gets the logical AND of all non- NULLexpressions. | 
| LOGICAL_OR | Gets the logical OR of all non- NULLexpressions. | 
| LOWER | Formats alphabetic characters in a STRINGvalue as
    lowercase.Formats ASCII characters in a BYTESvalue as
    lowercase. | 
| LPAD | Prepends a STRINGorBYTESvalue with a pattern. | 
| LTRIM | Identical to the TRIMfunction, but only removes leading
    characters. | 
| MAKE_INTERVAL | Constructs an INTERVALvalue. | 
| MAX | Gets the maximum non- NULLvalue. | 
| MIN | Gets the minimum non- NULLvalue. | 
| ML.PREDICT | Apply ML computations defined by a model to each row of an input relation. | 
| MOD | Gets the remainder of the division of XbyY. | 
| NET.HOST | Gets the hostname from a URL. | 
| NET.IP_FROM_STRING | Converts an IPv4 or IPv6 address from a STRINGvalue to
    aBYTESvalue in network byte order. | 
| NET.IP_NET_MASK | Gets a network mask. | 
| NET.IP_TO_STRING | Converts an IPv4 or IPv6 address from a BYTESvalue in
    network byte order to aSTRINGvalue. | 
| NET.IP_TRUNC | Converts a BYTESIPv4 or IPv6 address in
    network byte order to aBYTESsubnet address. | 
| NET.IPV4_FROM_INT64 | Converts an IPv4 address from an INT64value to aBYTESvalue in network byte order. | 
| NET.IPV4_TO_INT64 | Converts an IPv4 address from a BYTESvalue in network
    byte order to anINT64value. | 
| NET.PUBLIC_SUFFIX | Gets the public suffix from a URL. | 
| NET.REG_DOMAIN | Gets the registered or registrable domain from a URL. | 
| NET.SAFE_IP_FROM_STRING | Similar to the NET.IP_FROM_STRING, but returnsNULLinstead of producing an error if the input is invalid. | 
| NODES | Gets the nodes in a graph path. The resulting array retains the original order in the graph path. | 
| NORMALIZE | Case-sensitively normalizes the characters in a STRINGvalue. | 
| NORMALIZE_AND_CASEFOLD | Case-insensitively normalizes the characters in a STRINGvalue. | 
| OCTET_LENGTH | Alias for BYTE_LENGTH. | 
| PARSE_DATE | Converts a STRINGvalue to aDATEvalue. | 
| PARSE_JSON | Converts a JSON-formatted STRINGvalue to aJSONvalue. | 
| PARSE_TIMESTAMP | Converts a STRINGvalue to aTIMESTAMPvalue. | 
| PATH | Creates a graph path from a list of graph elements. | 
| PATH_FIRST | Gets the first node in a graph path. | 
| PATH_LAST | Gets the last node in a graph path. | 
| PATH_LENGTH | Gets the number of edges in a graph path. | 
| PENDING_COMMIT_TIMESTAMP | Write a pending commit timestamp. | 
| POW | Produces the value of Xraised to the power ofY. | 
| POWER | Synonym of POW. | 
| PROPERTY_NAMES | Gets the property names associated with a graph element. | 
| REGEXP_CONTAINS | Checks if a value is a partial match for a regular expression. | 
| REGEXP_EXTRACT | Produces a substring that matches a regular expression. | 
| REGEXP_EXTRACT_ALL | Produces an array of all substrings that match a regular expression. | 
| REGEXP_REPLACE | Produces a STRINGvalue where all substrings that match a
    regular expression are replaced with a specified value. | 
| REPEAT | Produces a STRINGorBYTESvalue that consists of
    an original value, repeated. | 
| REPLACE | Replaces all occurrences of a pattern with another pattern in a STRINGorBYTESvalue. | 
| REPLACE_FIELDS | Replaces the values in one or more protocol buffer fields. | 
| REVERSE | Reverses a STRINGorBYTESvalue. | 
| ROUND | Rounds Xto the nearest integer or roundsXtoNdecimal places after the decimal point. | 
| RPAD | Appends a STRINGorBYTESvalue with a pattern. | 
| RTRIM | Identical to the TRIMfunction, but only removes trailing
    characters. | 
| SAFE_ADD | Equivalent to the addition operator ( X + Y), but returnsNULLif overflow occurs. | 
| SAFE_CAST | Similar to the CASTfunction, but returnsNULLwhen a runtime error is produced. | 
| SAFE_CONVERT_BYTES_TO_STRING | Converts a BYTESvalue to aSTRINGvalue and
    replace any invalid UTF-8 characters with the Unicode replacement character,U+FFFD. | 
| SAFE_DIVIDE | Equivalent to the division operator ( X / Y), but returnsNULLif an error occurs. | 
| SAFE_MULTIPLY | Equivalent to the multiplication operator ( X * Y),
    but returnsNULLif overflow occurs. | 
| SAFE_NEGATE | Equivalent to the unary minus operator ( -X), but returnsNULLif overflow occurs. | 
| SAFE_SUBTRACT | Equivalent to the subtraction operator ( X - Y), but
    returnsNULLif overflow occurs. | 
| SAFE_TO_JSON | Similar to the `TO_JSON` function, but for each unsupported field in the input argument, produces a JSON null instead of an error. | 
| SCORE | Calculates a relevance score of a TOKENLISTfor a full-text
    search query. The higher the score, the stronger the match. | 
| SCORE_NGRAMS | Calculates a relevance score of a TOKENLISTfor a fuzzy search.
    The higher the score, the stronger the match. | 
| SEARCH | Returns TRUEif a full-text search query matches tokens. | 
| SEARCH_NGRAMS | Checks whether enough n-grams match the tokens in a fuzzy search. | 
| SEARCH_SUBSTRING | Returns TRUEif a substring query matches tokens. | 
| SHA1 | Computes the hash of a STRINGorBYTESvalue, using the SHA-1 algorithm. | 
| SHA256 | Computes the hash of a STRINGorBYTESvalue, using the SHA-256 algorithm. | 
| SHA512 | Computes the hash of a STRINGorBYTESvalue, using the SHA-512 algorithm. | 
| SIGN | Produces -1 , 0, or +1 for negative, zero, and positive arguments respectively. | 
| SIN | Computes the sine of X. | 
| SINH | Computes the hyperbolic sine of X. | 
| SNIPPET | Gets a list of snippets that match a full-text search query. | 
| SOURCE_NODE_ID | Gets a unique identifier of a graph edge's source node. | 
| SOUNDEX | Gets the Soundex codes for words in a STRINGvalue. | 
| SPLIT | Splits a STRINGorBYTESvalue, using a delimiter. | 
| SPLIT_SUBSTR | Returns the substring from an input string that's determined by a delimiter, a location that indicates the first split of the substring to return, and the number of splits to include. | 
| SQRT | Computes the square root of X. | 
| STARTS_WITH | Checks if a STRINGorBYTESvalue is a
    prefix of another value. | 
| STDDEV | An alias of the STDDEV_SAMPfunction. | 
| STDDEV_SAMP | Computes the sample (unbiased) standard deviation of the values. | 
| STRING(JSON) | Converts a JSON string to a SQL STRINGvalue. | 
| STRING_ARRAY | Converts a JSON array of strings to a SQL ARRAY<STRING>value. | 
| STRING(Timestamp) | Converts a TIMESTAMPvalue to aSTRINGvalue. | 
| STRING_AGG | Concatenates non- NULLSTRINGorBYTESvalues. | 
| STRPOS | Finds the position of the first occurrence of a subvalue inside another value. | 
| SUBDATE | Alias for DATE_SUB. | 
| SUBSTR | Gets a portion of a STRINGorBYTESvalue. | 
| SUBSTRING | Alias for SUBSTR | 
| SUM | Gets the sum of non- NULLvalues. | 
| TAN | Computes the tangent of X. | 
| TANH | Computes the hyperbolic tangent of X. | 
| TIMESTAMP | Constructs a TIMESTAMPvalue. | 
| TIMESTAMP_ADD | Adds a specified time interval to a TIMESTAMPvalue. | 
| TIMESTAMP_DIFF | Gets the number of unit boundaries between two TIMESTAMPvalues
    at a particular time granularity. | 
| TIMESTAMP_MICROS | Converts the number of microseconds since
    1970-01-01 00:00:00 UTC to a TIMESTAMP. | 
| TIMESTAMP_MILLIS | Converts the number of milliseconds since
    1970-01-01 00:00:00 UTC to a TIMESTAMP. | 
| TIMESTAMP_SECONDS | Converts the number of seconds since
    1970-01-01 00:00:00 UTC to a TIMESTAMP. | 
| TIMESTAMP_SUB | Subtracts a specified time interval from a TIMESTAMPvalue. | 
| TIMESTAMP_TRUNC | Truncates a TIMESTAMPvalue at a particular granularity. | 
| TO_BASE32 | Converts a BYTESvalue to a
    base32-encodedSTRINGvalue. | 
| TO_BASE64 | Converts a BYTESvalue to a
    base64-encodedSTRINGvalue. | 
| TO_CODE_POINTS | Converts a STRINGorBYTESvalue into an array of
    extended ASCII code points. | 
| TO_HEX | Converts a BYTESvalue to a
    hexadecimalSTRINGvalue. | 
| TO_JSON | Converts a SQL value to a JSON value. | 
| TO_JSON_STRING | Converts a JSONvalue to a
    SQL JSON-formattedSTRINGvalue. | 
| TOKEN | Constructs an exact match TOKENLISTvalue by tokenizing aBYTEorSTRINGvalue verbatim to accelerate
    exact match expressions in SQL. | 
| TOKENIZE_BOOL | Constructs a boolean TOKENLISTvalue by tokenizing aBOOLvalue to accelerate boolean match expressions in SQL. | 
| TOKENIZE_FULLTEXT | Constructs a full-text TOKENLISTvalue by tokenizing text
  for full-text matching. | 
| TOKENIZE_JSON | Constructs a JSON TOKENLISTvalue by tokenizing aJSONvalue to accelerate JSON predicate expressions in SQL. | 
| TOKENIZE_NGRAMS | Constructs an n-gram TOKENLISTvalue by tokenizing
    aSTRINGvalue for matching n-grams. | 
| TOKENIZE_NUMBER | Constructs a numeric TOKENLISTvalue by tokenizing numeric
    values to accelerate numeric comparison expressions in SQL. | 
| TOKENIZE_SUBSTRING | Constructs a substring TOKENLISTvalue by tokenizing text for
    substring matching. | 
| TOKENLIST_CONCAT | Constructs a TOKENLISTvalue by concatenating one or moreTOKENLISTvalues. | 
| TRIM | Removes the specified leading and trailing Unicode code points or bytes
    from a STRINGorBYTESvalue. | 
| TRUNC | Rounds a number like ROUND(X)orROUND(X, N),
    but always rounds towards zero and never overflows. | 
| UCASE | Alias for UPPER. | 
| UNIX_DATE | Converts a DATEvalue to the number of days since 1970-01-01. | 
| UNIX_MICROS | Converts a TIMESTAMPvalue to the number of microseconds since
    1970-01-01 00:00:00 UTC. | 
| UNIX_MILLIS | Converts a TIMESTAMPvalue to the number of milliseconds
    since 1970-01-01 00:00:00 UTC. | 
| UNIX_SECONDS | Converts a TIMESTAMPvalue to the number of seconds since
    1970-01-01 00:00:00 UTC. | 
| UPPER | Formats alphabetic characters in a STRINGvalue as
    uppercase.Formats ASCII characters in a BYTESvalue as
    uppercase. | 
| VAR_SAMP | Computes the sample (unbiased) variance of the values. | 
| VARIANCE | An alias of VAR_SAMP. |