View Source Ecto.Druid.Query (ecto_druid v0.5.0)

Summary

Functions

Absolute value.

Arc cosine of expr.

Returns any value of expr including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).

Returns any value of expr including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).

Returns any value of expr including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).

Counts distinct values of expr using an approximate algorithm. The expr can be a regular column or a prebuilt sketch column.

Usage note: consider using APPROX_COUNT_DISTINCT_DS_HLL instead, which offers better accuracy in many cases. Counts distinct values of expr using Druid's built-in "cardinality" or "hyperUnique" aggregators, which implement a variant of HyperLogLog. The expr can be a string, a number, or a prebuilt hyperUnique column. Results are always approximate, regardless of the value of useApproximateCountDistinct.

Counts distinct values of expr, which can be a regular column or a Theta sketch column. Results are always approximate, regardless of the value of useApproximateCountDistinct. The size parameter is described in the Theta sketch documentation. See also COUNT(DISTINCT expr).

Counts distinct values of expr, which can be a regular column or a Theta sketch column. Results are always approximate, regardless of the value of useApproximateCountDistinct. The size parameter is described in the Theta sketch documentation. See also COUNT(DISTINCT expr).

Deprecated. Use APPROX_QUANTILE_DS instead, which provides a superior distribution-independent algorithm with formal error guarantees.

Deprecated. Use APPROX_QUANTILE_DS instead, which provides a superior distribution-independent algorithm with formal error guarantees.

Computes approximate quantiles on numeric or Quantiles sketch expressions. The probability value should be between 0 and 1, exclusive. The k parameter is described in the Quantiles sketch documentation.

Computes approximate quantiles on numeric or Quantiles sketch expressions. The probability value should be between 0 and 1, exclusive. The k parameter is described in the Quantiles sketch documentation.

Computes approximate quantiles on numeric or fixed buckets histogram expressions. probability should be between 0 and 1, exclusive. The numBuckets, lowerLimit, upperLimit, and outlierHandlingMode parameters are described in the fixed buckets histogram documentation. Load the approximate histogram extension to use this function.

Computes approximate quantiles on numeric or fixed buckets histogram expressions. probability should be between 0 and 1, exclusive. The numBuckets, lowerLimit, upperLimit, and outlierHandlingMode parameters are described in the fixed buckets histogram documentation. Load the approximate histogram extension to use this function.

Constructs a SQL ARRAY literal from the expression arguments, using the type of the first argument as the output array type.

Collects all values of expr into an ARRAY, including null values, with size in bytes limit on aggregation size (default of 1024 bytes). If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

Collects all values of expr into an ARRAY, including null values, with size in bytes limit on aggregation size (default of 1024 bytes). If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

Appends expr to arr, the resulting array type determined by the type of arr.

Concatenates arr2 to arr1. The resulting array type is determined by the type of arr1.

Concatenates all array expr into a single ARRAY, with size in bytes limit on aggregation size (default of 1024 bytes). Input expr must be an array. Null expr will be ignored, but any null values within an expr will be included in the resulting array. If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_CONCAT_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

Concatenates all array expr into a single ARRAY, with size in bytes limit on aggregation size (default of 1024 bytes). Input expr must be an array. Null expr will be ignored, but any null values within an expr will be included in the resulting array. If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_CONCAT_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

If expr is a scalar type, returns 1 if arr contains expr. If expr is an array, returns 1 if arr contains all elements of expr. Otherwise returns 0.

Returns length of the array expression.

Returns the array element at the 0-based index supplied, or null for an out of range index.

Returns the 0-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

Returns the array element at the 1-based index supplied, or null for an out of range index.

Returns the 1-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

Returns 1 if arr1 and arr2 have any elements in common, else 0.

Adds expr to the beginning of arr, the resulting array type determined by the type of arr.

Returns the subarray of arr from the 0-based index start (inclusive) to end (exclusive). Returns null, if start is less than 0, greater than length of arr, or greater than end.

Converts an ARRAY of any type into a multi-value string VARCHAR.

Joins all elements of arr by the delimiter specified by str.

Arc sine of expr.

Angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).

Arc tangent of expr.

Performs a bitwise AND operation on all input values. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Performs a bitwise OR operation on all input values. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Performs a bitwise XOR operation on all input values. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Returns the result of expr1 & expr2.

Returns the result of ~expr.

Converts the bits of an IEEE 754 floating-point double value to a long.

Converts a long to the IEEE 754 floating-point double specified by the bits stored in the long.

Returns the result of expr1 [PIPE] expr2.

Returns the result of expr1 << expr2.

Returns the result of expr1 >> expr2.

Returns the result of expr1 ^ expr2.

Computes a bloom filter from values produced by expr, with numEntries maximum number of distinct values before false positive rate increases. See bloom filter extension documentation for additional details. Empty base64 encoded bloom filter

Returns true if the value of expr is contained in the base64-serialized Bloom filter. See the Bloom filter extension documentation for additional details. See the BLOOM_FILTER function for computing Bloom filters.

Alternate form of TRIM(BOTH chars FROM expr).

Alternate form of TRIM(BOTH chars FROM expr).

Ceiling.

Rounds up a timestamp, returning it as a new timestamp. Unit can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

Alias for LENGTH.

Alias for LENGTH.

Returns the first value that is neither NULL nor empty string.

Concats a list of expressions.

Returns true if the str is a substring of expr.

Trigonometric cosine of an angle expr.

Trigonometric cotangent of an angle expr.

Current date in the connection's time zone.

Current timestamp in the connection's time zone.

Rounds down a timestamp, returning it as a new timestamp. Unit can be 'milliseconds', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year', 'decade', 'century', or 'millennium'.

Decodes a Base64-encoded string into a complex data type, where dataType is the complex data type and expr is the Base64-encoded string to decode. The hyperUnique and serializablePairLongString data types are supported by default. You can enable support for the following complex data types by loading their extensions: druid-bloom-filter: bloom druid-datasketches: arrayOfDoublesSketch, HLLSketch, KllDoublesSketch, KllFloatsSketch, quantilesDoublesSketch, thetaSketch druid-histogram: approximateHistogram, fixedBucketsHistogram druid-stats: variance druid-compressed-big-decimal: compressedBigDecimal druid-momentsketch: momentSketch druid-tdigestsketch: tDigestSketch

Decodes a Base64-encoded string into a UTF-8 encoded string.

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Applies DISTINCT modifier to expr.

Returns the result of integer division of x by y

Returns a string representing approximation to the Cumulative Distribution Function given a list of split points that define the edges of the bins from a quantiles sketch. expr must return a quantiles sketch.

Returns the quantile estimate corresponding to fraction from a quantiles sketch. expr must return a quantiles sketch.

Returns a string representing an array of quantile estimates corresponding to a list of fractions from a quantiles sketch. expr must return a quantiles sketch.

Returns a string representing an approximation to the histogram given a list of split points that define the histogram bins from a quantiles sketch. expr must return a quantiles sketch.

Returns a string summary of a quantiles sketch, useful for debugging. expr must return a quantiles sketch.

Creates a Quantiles sketch on the values of expr, which can be a regular column or a column containing quantiles sketches. The k parameter is described in the Quantiles sketch documentation.

Creates a Quantiles sketch on the values of expr, which can be a regular column or a column containing quantiles sketches. The k parameter is described in the Quantiles sketch documentation.

Returns an approximation to the rank of a given value that is the fraction of the distribution less than that value from a quantiles sketch. expr must return a quantiles sketch.

Creates a Theta sketch on the values of expr, which can be a regular column or a column containing Theta sketches. The size parameter is described in the Theta sketch documentation.

Creates a Theta sketch on the values of expr, which can be a regular column or a column containing Theta sketches. The size parameter is described in the Theta sketch documentation.

Creates a Tuple sketch on the values of expr, which can be a regular column or a column containing tuple sketches. The k parameter is described in the Tuple sketch documentation.

Creates a Tuple sketch on the values of expr, which can be a regular column or a column containing tuple sketches. The k parameter is described in the Tuple sketch documentation.

Returns an intersection of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

Returns an intersection of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

Computes approximate sums of the values contained within a Tuple sketch column which contains an array of double values as its Summary Object.

Returns a set difference of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Object are preserved as is. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

Returns a set difference of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Object are preserved as is. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

Returns a union of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

Returns a union of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

Returns the earliest value of expr. If expr comes from a relation with a timestamp column (like __time in a Druid datasource), the "earliest" is taken from the row with the overall earliest non-null value of the timestamp column. If the earliest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows. If expr does not come from a relation with a timestamp, then it is simply the first value encountered.

Returns the earliest value of expr. If expr comes from a relation with a timestamp column (like __time in a Druid datasource), the "earliest" is taken from the row with the overall earliest non-null value of the timestamp column. If the earliest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows. If expr does not come from a relation with a timestamp, then it is simply the first value encountered.

Returns the earliest value of expr. The earliest value of expr is taken from the row with the overall earliest non-null value of timestampExpr. If the earliest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

Returns the earliest value of expr. The earliest value of expr is taken from the row with the overall earliest non-null value of timestampExpr. If the overall earliest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

e to the power of expr.

Extracts a time part from expr, returning it as a number. Unit can be EPOCH, MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR, DAY, DOW (day of week), ISODOW (ISO day of week), DOY (day of year), WEEK (week of year), MONTH, QUARTER, YEAR, ISOYEAR, DECADE, CENTURY or MILLENNIUM. Units must be provided unquoted, like EXTRACT(HOUR FROM __time).

Floor.

Rounds down a timestamp, returning it as a new timestamp. Unit can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

Evaluates zero or more expressions and returns the maximum value based on comparisons as described above.

Returns a number to indicate which groupBy dimension is included in a row, when using GROUPING SETS. Refer to additional documentation on how to infer this number.

Returns the distinct count estimate from an HLL sketch. expr must return an HLL sketch. The optional round boolean parameter will round the estimate if set to true, with a default of false.

Returns the distinct count estimate from an HLL sketch. expr must return an HLL sketch. The optional round boolean parameter will round the estimate if set to true, with a default of false.

Returns the distinct count estimate and error bounds from an HLL sketch. expr must return an HLL sketch. An optional numStdDev argument can be provided.

Returns the distinct count estimate and error bounds from an HLL sketch. expr must return an HLL sketch. An optional numStdDev argument can be provided.

Returns a human-readable string representation of an HLL sketch for debugging. expr must return an HLL sketch.

Returns a union of HLL sketches, where each input expression must return an HLL sketch. The lgK and tgtHllType can be optionally specified as the first parameter; if provided, both optional parameters must be specified.

Returns a union of HLL sketches, where each input expression must return an HLL sketch. The lgK and tgtHllType can be optionally specified as the first parameter; if provided, both optional parameters must be specified.

Format a number in human-readable IEC format.

Format a number in human-readable IEC format.

Format a number in human-readable SI format.

Format a number in human-readable SI format.

Format a number in human-readable SI format.

Format a number in human-readable SI format.

Returns true if the str is a substring of expr. The match is case-insensitive.

Returns true if the address belongs to the subnet literal, else false. If address is not a valid IPv4 address, then false is returned. This function is more efficient if address is an integer instead of a string.

Parses address into an IPv4 address stored as an integer . If address is an integer that is a valid IPv4 address, then it is passed through. Returns null if address cannot be represented as an IPv4 address.

Converts address into an IPv4 address dotted-decimal string. If address is a string that is a valid IPv4 address, then it is passed through. Returns null if address cannot be represented as an IPv4 address.

Returns 1 if the IPv6 address belongs to the subnet literal, else 0. If address is not a valid IPv6 address, then 0 is returned.

Returns an array of field names from expr at the specified path.

Constructs a new COMPLEX<json> object. The KEY expressions must evaluate to string types. The VALUE expressions can be composed of any input type, including other COMPLEX<json> values. JSON_OBJECT can accept colon-separated key-value pairs. The following syntax is equivalent: JSON_OBJECT(expr1:expr2[, expr3:expr4, ...]).

Returns an array of all paths which refer to literal values in expr in JSONPath format.

Extracts a COMPLEX<json> value from expr, at the specified path.

Extracts an ARRAY<COMPLEX<json>> value from expr at the specified path. If value is not an ARRAY, it gets translated into a single element ARRAY containing the value at path. The primary use of this function is to extract arrays of objects to use as inputs to other array functions.

Extracts a literal value from expr at the specified path. If you specify RETURNING and an SQL type name (such as VARCHAR, BIGINT, DOUBLE, etc) the function plans the query using the suggested type. Otherwise, it attempts to infer the type based on the context. If it can't infer the type, it defaults to VARCHAR.

Extracts a literal value from expr at the specified path. If you specify RETURNING and an SQL type name (such as VARCHAR, BIGINT, DOUBLE, etc) the function plans the query using the suggested type. Otherwise, it attempts to infer the type based on the context. If it can't infer the type, it defaults to VARCHAR.

Returns the latest value of expr The expr must come from a relation with a timestamp column (like __time in a Druid datasource) and the "latest" is taken from the row with the overall latest non-null value of the timestamp column. If the latest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows.

Returns the latest value of expr The expr must come from a relation with a timestamp column (like __time in a Druid datasource) and the "latest" is taken from the row with the overall latest non-null value of the timestamp column. If the latest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows.

Returns the latest value of expr The latest value of expr is taken from the row with the overall latest non-null value of timestampExpr. If the overall latest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

Returns the latest value of expr The latest value of expr is taken from the row with the overall latest non-null value of timestampExpr. If the overall latest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

Evaluates zero or more expressions and returns the minimum value based on comparisons as described above.

Returns the leftmost length characters from expr.

Returns the leftmost length characters from expr.

Length of expr in UTF-16 code units.

Synonym for STRING_AGG. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Synonym for STRING_AGG. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Synonym for STRING_AGG. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Logarithm (base e).

Logarithm (base 10).

Look up expr in a registered query-time lookup table. Note that lookups can also be queried directly using the lookup schema. Optional constant replaceMissingValueWith can be passed as a third argument to be returned when value is missing from lookup.

Look up expr in a registered query-time lookup table. Note that lookups can also be queried directly using the lookup schema. Optional constant replaceMissingValueWith can be passed as a third argument to be returned when value is missing from lookup.

Returns expr in all lowercase.

Returns a string of length from expr left-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

Returns a string of length from expr left-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

Alternate form of TRIM(LEADING chars FROM expr).

Alternate form of TRIM(LEADING chars FROM expr).

Converts a number of milliseconds since the epoch (1970-01-01 00:00:00 UTC) into a timestamp.

Modulo (remainder of x divided by y).

Appends expr to arr, the resulting array type determined by the type of arr.

Concatenates arr2 to arr1. The resulting array type is determined by the type of arr1.

If expr is a scalar type, returns 1 if arr contains expr. If expr is an array, returns 1 if arr contains all elements of expr. Otherwise returns 0.

Filters multi-value expr to include no values contained in array arr.

Filters multi-value expr to include only values contained in array arr.

Returns length of the array expression.

Returns the array element at the 0-based index supplied, or null for an out of range index.

Returns the 0-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

Returns the array element at the 1-based index supplied, or null for an out of range index.

Returns the 1-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

Returns 1 if arr1 and arr2 have any elements in common, else 0.

Adds expr to the beginning of arr, the resulting array type determined by the type of arr.

Returns the subarray of arr from the 0-based index start(inclusive) to end(exclusive), or null, if start is less than 0, greater than length of arr or greater than end.

Converts a multi-value string from a VARCHAR to a VARCHAR ARRAY.

Joins all elements of arr by the delimiter specified by str.

Returns NULL if value1 and value2 match, else returns value1.

Returns value1 if value1 is not null, otherwise value2.

Parses expr into a COMPLEX<json> object. This operator deserializes JSON values when processing them, translating stringified JSON into a nested structure. If the input is not a VARCHAR or it is invalid JSON, this function will result in an error.

Parses a string into a long (BIGINT) with the given radix, or 10 (decimal) if a radix is not provided.

Parses a string into a long (BIGINT) with the given radix, or 10 (decimal) if a radix is not provided.

Constant Pi.

Returns the index of needle within haystack, with indexes starting from 1. The search will begin at fromIndex, or 1 if fromIndex is not specified. If needle is not found, returns 0.

Returns the index of needle within haystack, with indexes starting from 1. The search will begin at fromIndex, or 1 if fromIndex is not specified. If needle is not found, returns 0.

expr raised to the power of power.

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

Apply regular expression pattern to expr and extract a capture group, or NULL if there is no match. If index is unspecified or zero, returns the first substring that matched the pattern. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern. Note: when druid.generic.useDefaultValueForNull = true, it is not possible to differentiate an empty-string match from a non-match (both will return NULL).

Apply regular expression pattern to expr and extract a capture group, or NULL if there is no match. If index is unspecified or zero, returns the first substring that matched the pattern. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern. Note: when druid.generic.useDefaultValueForNull = true, it is not possible to differentiate an empty-string match from a non-match (both will return NULL).

Returns whether expr matches regular expression pattern. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern. Similar to LIKE, but uses regexps instead of LIKE patterns. Especially useful in WHERE clauses.

Replaces all occurrences of regular expression pattern within expr with replacement. The replacement string may refer to capture groups using $1, $2, etc. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern.

Repeats expr N times.

Replaces pattern with replacement in expr, and returns the result.

Reverses expr.

Returns the rightmost length characters from expr.

Returns the rightmost length characters from expr.

ROUND(x, y) would return the value of the x rounded to the y decimal places.

ROUND(x, y) would return the value of the x rounded to the y decimal places.

Returns a string of length from expr right-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

Returns a string of length from expr right-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

Alternate form of TRIM(TRAILING chars FROM expr).

Alternate form of TRIM(TRAILING chars FROM expr).

Returns the division of x by y guarded on division by 0.

Trigonometric sine of an angle expr.

Searched CASE.

Square root.

Computes standard deviation sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Computes standard deviation population of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Computes standard deviation sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Collects all values (or all distinct values) of expr into a single STRING, ignoring null values. Each value is joined by an optional separator, which must be a literal STRING. If the separator is not provided, strings are concatenated without a separator. An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order.

Collects all values (or all distinct values) of expr into a single STRING, ignoring null values. Each value is joined by an optional separator, which must be a literal STRING. If the separator is not provided, strings are concatenated without a separator. An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order.

Collects all values (or all distinct values) of expr into a single STRING, ignoring null values. Each value is joined by an optional separator, which must be a literal STRING. If the separator is not provided, strings are concatenated without a separator. An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order.

Returns a string formatted in the manner of Java's String.format.

Splits str1 into an array on the delimiter specified by str2, which is a regular expression.

Splits str1 into an array on the delimiter specified by str2, which is a regular expression.

Alias for LENGTH.

Returns the index of needle within haystack, with indexes starting from 1. If needle is not found, returns 0.

Alias for SUBSTRING.

Alias for SUBSTRING.

Returns a substring of expr starting at index, with a max length, both measured in UTF-16 code units.

Returns a substring of expr starting at index, with a max length, both measured in UTF-16 code units.

Trigonometric tangent of an angle expr.

Builds a T-Digest sketch on values produced by expr. Compression parameter (default value 100) determines the accuracy and size of the sketch Higher compression means higher accuracy but more space to store sketches.

Builds a T-Digest sketch on values produced by expr. Compression parameter (default value 100) determines the accuracy and size of the sketch Higher compression means higher accuracy but more space to store sketches.

Builds a T-Digest sketch on values produced by expr and returns the value for the quantile. Compression parameter (default value 100) determines the accuracy and size of the sketch. Higher compression means higher accuracy but more space to store sketches.

Builds a T-Digest sketch on values produced by expr and returns the value for the quantile. Compression parameter (default value 100) determines the accuracy and size of the sketch. Higher compression means higher accuracy but more space to store sketches.

Two argument version of CONCAT.

Returns the distinct count estimate from a theta sketch. expr must return a theta sketch.

Returns the distinct count estimate and error bounds from a theta sketch. expr must return a theta sketch.

Returns an intersection of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

Returns an intersection of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

Returns a set difference of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

Returns a set difference of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

Returns a union of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

Returns a union of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

Rounds up a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_CEIL(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to CEIL but is more flexible.

Rounds up a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_CEIL(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to CEIL but is more flexible.

Rounds up a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_CEIL(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to CEIL but is more flexible.

Extracts a time part from expr, returning it as a number. Unit can be EPOCH, SECOND, MINUTE, HOUR, DAY (day of month), DOW (day of week), DOY (day of year), WEEK (week of week year), MONTH (1 through 12), QUARTER (1 through 4), or YEAR. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to EXTRACT but is more flexible. Unit and time zone must be literals, and must be provided quoted, like TIME_EXTRACT(time, 'HOUR') or TIME_EXTRACT(time, 'HOUR', 'America/Los_Angeles').

Extracts a time part from expr, returning it as a number. Unit can be EPOCH, SECOND, MINUTE, HOUR, DAY (day of month), DOW (day of week), DOY (day of year), WEEK (week of week year), MONTH (1 through 12), QUARTER (1 through 4), or YEAR. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to EXTRACT but is more flexible. Unit and time zone must be literals, and must be provided quoted, like TIME_EXTRACT(time, 'HOUR') or TIME_EXTRACT(time, 'HOUR', 'America/Los_Angeles').

Rounds down a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_FLOOR(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to FLOOR but is more flexible.

Rounds down a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_FLOOR(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to FLOOR but is more flexible.

Rounds down a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_FLOOR(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to FLOOR but is more flexible.

Formats a timestamp as a string with a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. Pattern and time zone must be literals.

Formats a timestamp as a string with a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. Pattern and time zone must be literals.

Formats a timestamp as a string with a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. Pattern and time zone must be literals.

Returns whether a timestamp is contained within a particular interval. The interval must be a literal string containing any ISO8601 interval, such as '2001-01-01/P1D' or '2001-01-01T01:00:00/2001-01-02T01:00:00'. The start instant of the interval is inclusive and the end instant is exclusive.

Parses a string into a timestamp using a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00', and will be used as the time zone for strings that do not include a time zone offset. Pattern and time zone must be literals. Strings that cannot be parsed as timestamps will be returned as NULL.

Parses a string into a timestamp using a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00', and will be used as the time zone for strings that do not include a time zone offset. Pattern and time zone must be literals. Strings that cannot be parsed as timestamps will be returned as NULL.

Parses a string into a timestamp using a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00', and will be used as the time zone for strings that do not include a time zone offset. Pattern and time zone must be literals. Strings that cannot be parsed as timestamps will be returned as NULL.

Shifts a timestamp by a period (step times), returning it as a new timestamp. Period can be any ISO8601 period. Step may be negative. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'.

Shifts a timestamp by a period (step times), returning it as a new timestamp. Period can be any ISO8601 period. Step may be negative. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'.

Converts a timestamp into a number of milliseconds since the epoch.

Equivalent to timestamp + count * INTERVAL '1' UNIT.

Returns the (signed) number of unit between timestamp1 and timestamp2. Unit can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

Serializes expr into a JSON string.

Returns expr with characters removed from the leading, trailing, or both ends of expr if they are in chars. If chars is not provided, it defaults to '' (a space). If the directional argument is not provided, it defaults to BOTH.

Returns expr with characters removed from the leading, trailing, or both ends of expr if they are in chars. If chars is not provided, it defaults to '' (a space). If the directional argument is not provided, it defaults to BOTH.

Alias for TRUNCATE.

Alias for TRUNCATE.

Truncate expr to a specific number of decimal digits.

Truncate expr to a specific number of decimal digits.

Parses expr into a COMPLEX<json> object. This operator deserializes JSON values when processing them, translating stringified JSON into a nested structure. If the input is not a VARCHAR or it is invalid JSON, this function will result in a NULL value.

Returns expr in all uppercase.

Computes variance population of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Computes variance sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Computes variance sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

Functions

abs(expr)

(macro)
@spec abs(Macro.t()) :: Macro.t()

Absolute value.

acos(expr)

(macro)
@spec acos(Macro.t()) :: Macro.t()

Arc cosine of expr.

any_value(expr)

(macro)
@spec any_value(Macro.t()) :: Macro.t()

Returns any value of expr including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValue is omitted; it defaults to 1024. aggregateMultipleValues is an optional boolean flag controls the behavior of aggregating a multi-value dimension. aggregateMultipleValues is set as true by default and returns the stringified array in case of a multi-value dimension. By setting it to false, function will return first value instead. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

any_value(expr, max_bytes_per_value)

(macro)
@spec any_value(Macro.t(), Macro.t()) :: Macro.t()

Returns any value of expr including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValue is omitted; it defaults to 1024. aggregateMultipleValues is an optional boolean flag controls the behavior of aggregating a multi-value dimension. aggregateMultipleValues is set as true by default and returns the stringified array in case of a multi-value dimension. By setting it to false, function will return first value instead. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

any_value(expr, max_bytes_per_value, aggregate_multiple_values)

(macro)
@spec any_value(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns any value of expr including null. This aggregator can simplify and optimize the performance by returning the first encountered value (including null).

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValue is omitted; it defaults to 1024. aggregateMultipleValues is an optional boolean flag controls the behavior of aggregating a multi-value dimension. aggregateMultipleValues is set as true by default and returns the stringified array in case of a multi-value dimension. By setting it to false, function will return first value instead. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

approx_count_distinct(expr)

(macro)
@spec approx_count_distinct(Macro.t()) :: Macro.t()

Counts distinct values of expr using an approximate algorithm. The expr can be a regular column or a prebuilt sketch column.

The specific algorithm depends on the value of druid.sql.approxCountDistinct.function. By default, this is APPROX_COUNT_DISTINCT_BUILTIN. If the DataSketches extension is loaded, you can set it to APPROX_COUNT_DISTINCT_DS_HLL or APPROX_COUNT_DISTINCT_DS_THETA.

When run on prebuilt sketch columns, the sketch column type must match the implementation of this function. For example: when druid.sql.approxCountDistinct.function is set to APPROX_COUNT_DISTINCT_BUILTIN, this function runs on prebuilt hyperUnique columns, but not on prebuilt HLLSketchBuild columns.

approx_count_distinct_builtin(expr)

(macro)
@spec approx_count_distinct_builtin(Macro.t()) :: Macro.t()

Usage note: consider using APPROX_COUNT_DISTINCT_DS_HLL instead, which offers better accuracy in many cases. Counts distinct values of expr using Druid's built-in "cardinality" or "hyperUnique" aggregators, which implement a variant of HyperLogLog. The expr can be a string, a number, or a prebuilt hyperUnique column. Results are always approximate, regardless of the value of useApproximateCountDistinct.

approx_count_distinct_ds_theta(column)

(macro)
@spec approx_count_distinct_ds_theta(Macro.t()) :: Macro.t()

Counts distinct values of expr, which can be a regular column or a Theta sketch column. Results are always approximate, regardless of the value of useApproximateCountDistinct. The size parameter is described in the Theta sketch documentation. See also COUNT(DISTINCT expr).

approx_count_distinct_ds_theta(column, sketch_size)

(macro)
@spec approx_count_distinct_ds_theta(Macro.t(), Macro.t()) :: Macro.t()

Counts distinct values of expr, which can be a regular column or a Theta sketch column. Results are always approximate, regardless of the value of useApproximateCountDistinct. The size parameter is described in the Theta sketch documentation. See also COUNT(DISTINCT expr).

approx_quantile(expr, probability)

(macro)
@spec approx_quantile(Macro.t(), Macro.t()) :: Macro.t()

Deprecated. Use APPROX_QUANTILE_DS instead, which provides a superior distribution-independent algorithm with formal error guarantees.

Computes approximate quantiles on numeric or approxHistogram expressions. probability should be between 0 and 1, exclusive. resolution is the number of centroids to use for the computation. Higher resolutions will give more precise results but also have higher overhead. If not provided, the default resolution is 50. Load the approximate histogram extension to use this function.

approx_quantile(expr, probability, resolution)

(macro)
@spec approx_quantile(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Deprecated. Use APPROX_QUANTILE_DS instead, which provides a superior distribution-independent algorithm with formal error guarantees.

Computes approximate quantiles on numeric or approxHistogram expressions. probability should be between 0 and 1, exclusive. resolution is the number of centroids to use for the computation. Higher resolutions will give more precise results but also have higher overhead. If not provided, the default resolution is 50. Load the approximate histogram extension to use this function.

approx_quantile_ds(expr, probability)

(macro)
@spec approx_quantile_ds(Macro.t(), Macro.t()) :: Macro.t()

Computes approximate quantiles on numeric or Quantiles sketch expressions. The probability value should be between 0 and 1, exclusive. The k parameter is described in the Quantiles sketch documentation.

approx_quantile_ds(expr, probability, sketch_size)

(macro)
@spec approx_quantile_ds(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Computes approximate quantiles on numeric or Quantiles sketch expressions. The probability value should be between 0 and 1, exclusive. The k parameter is described in the Quantiles sketch documentation.

approx_quantile_fixed_buckets(expr, probability, num_buckets, lower_limit, upper_limit)

(macro)
@spec approx_quantile_fixed_buckets(
  Macro.t(),
  Macro.t(),
  Macro.t(),
  Macro.t(),
  Macro.t()
) :: Macro.t()

Computes approximate quantiles on numeric or fixed buckets histogram expressions. probability should be between 0 and 1, exclusive. The numBuckets, lowerLimit, upperLimit, and outlierHandlingMode parameters are described in the fixed buckets histogram documentation. Load the approximate histogram extension to use this function.

approx_quantile_fixed_buckets(expr, probability, num_buckets, lower_limit, upper_limit, outlier_handling_mode)

(macro)
@spec approx_quantile_fixed_buckets(
  Macro.t(),
  Macro.t(),
  Macro.t(),
  Macro.t(),
  Macro.t(),
  Macro.t()
) ::
  Macro.t()

Computes approximate quantiles on numeric or fixed buckets histogram expressions. probability should be between 0 and 1, exclusive. The numBuckets, lowerLimit, upperLimit, and outlierHandlingMode parameters are described in the fixed buckets histogram documentation. Load the approximate histogram extension to use this function.

array(exprs)

(macro)
@spec array(Macro.t()) :: Macro.t()

Constructs a SQL ARRAY literal from the expression arguments, using the type of the first argument as the output array type.

array_agg(expr)

(macro)
@spec array_agg(Macro.t()) :: Macro.t()

Collects all values of expr into an ARRAY, including null values, with size in bytes limit on aggregation size (default of 1024 bytes). If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

array_agg(expr, size)

(macro)
@spec array_agg(Macro.t(), Macro.t()) :: Macro.t()

Collects all values of expr into an ARRAY, including null values, with size in bytes limit on aggregation size (default of 1024 bytes). If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

array_append(arr, expr)

(macro)
@spec array_append(Macro.t(), Macro.t()) :: Macro.t()

Appends expr to arr, the resulting array type determined by the type of arr.

array_concat(arr1, arr2)

(macro)
@spec array_concat(Macro.t(), Macro.t()) :: Macro.t()

Concatenates arr2 to arr1. The resulting array type is determined by the type of arr1.

array_concat_agg(expr)

(macro)
@spec array_concat_agg(Macro.t()) :: Macro.t()

Concatenates all array expr into a single ARRAY, with size in bytes limit on aggregation size (default of 1024 bytes). Input expr must be an array. Null expr will be ignored, but any null values within an expr will be included in the resulting array. If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_CONCAT_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

array_concat_agg(expr, size)

(macro)
@spec array_concat_agg(Macro.t(), Macro.t()) :: Macro.t()

Concatenates all array expr into a single ARRAY, with size in bytes limit on aggregation size (default of 1024 bytes). Input expr must be an array. Null expr will be ignored, but any null values within an expr will be included in the resulting array. If the aggregated array grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the ARRAY_CONCAT_AGG expression is not currently supported, and the ordering of results within the output array may vary depending on processing order.

array_contains(arr, expr)

(macro)
@spec array_contains(Macro.t(), Macro.t()) :: Macro.t()

If expr is a scalar type, returns 1 if arr contains expr. If expr is an array, returns 1 if arr contains all elements of expr. Otherwise returns 0.

array_length(arr)

(macro)
@spec array_length(Macro.t()) :: Macro.t()

Returns length of the array expression.

array_offset(arr, long)

(macro)
@spec array_offset(Macro.t(), Macro.t()) :: Macro.t()

Returns the array element at the 0-based index supplied, or null for an out of range index.

array_offset_of(arr, expr)

(macro)
@spec array_offset_of(Macro.t(), Macro.t()) :: Macro.t()

Returns the 0-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

array_ordinal(arr, long)

(macro)
@spec array_ordinal(Macro.t(), Macro.t()) :: Macro.t()

Returns the array element at the 1-based index supplied, or null for an out of range index.

array_ordinal_of(arr, expr)

(macro)
@spec array_ordinal_of(Macro.t(), Macro.t()) :: Macro.t()

Returns the 1-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

array_overlap(arr1, arr2)

(macro)
@spec array_overlap(Macro.t(), Macro.t()) :: Macro.t()

Returns 1 if arr1 and arr2 have any elements in common, else 0.

array_prepend(expr, arr)

(macro)
@spec array_prepend(Macro.t(), Macro.t()) :: Macro.t()

Adds expr to the beginning of arr, the resulting array type determined by the type of arr.

array_slice(arr, start, stop)

(macro)
@spec array_slice(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns the subarray of arr from the 0-based index start (inclusive) to end (exclusive). Returns null, if start is less than 0, greater than length of arr, or greater than end.

array_to_mv(arr)

(macro)
@spec array_to_mv(Macro.t()) :: Macro.t()

Converts an ARRAY of any type into a multi-value string VARCHAR.

array_to_string(arr, str)

(macro)
@spec array_to_string(Macro.t(), Macro.t()) :: Macro.t()

Joins all elements of arr by the delimiter specified by str.

asin(expr)

(macro)
@spec asin(Macro.t()) :: Macro.t()

Arc sine of expr.

atan2(y, x)

(macro)
@spec atan2(Macro.t(), Macro.t()) :: Macro.t()

Angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).

atan(expr)

(macro)
@spec atan(Macro.t()) :: Macro.t()

Arc tangent of expr.

bit_and(expr)

(macro)
@spec bit_and(Macro.t()) :: Macro.t()

Performs a bitwise AND operation on all input values. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

bit_or(expr)

(macro)
@spec bit_or(Macro.t()) :: Macro.t()

Performs a bitwise OR operation on all input values. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

bit_xor(expr)

(macro)
@spec bit_xor(Macro.t()) :: Macro.t()

Performs a bitwise XOR operation on all input values. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

bitwise_and(x, y)

(macro)
@spec bitwise_and(Macro.t(), Macro.t()) :: Macro.t()

Returns the result of expr1 & expr2.

bitwise_complement(expr)

(macro)
@spec bitwise_complement(Macro.t()) :: Macro.t()

Returns the result of ~expr.

bitwise_convert_double_to_long_bits(expr)

(macro)
@spec bitwise_convert_double_to_long_bits(Macro.t()) :: Macro.t()

Converts the bits of an IEEE 754 floating-point double value to a long.

bitwise_convert_long_bits_to_double(expr)

(macro)
@spec bitwise_convert_long_bits_to_double(Macro.t()) :: Macro.t()

Converts a long to the IEEE 754 floating-point double specified by the bits stored in the long.

bitwise_or(x, y)

(macro)
@spec bitwise_or(Macro.t(), Macro.t()) :: Macro.t()

Returns the result of expr1 [PIPE] expr2.

bitwise_shift_left(x, y)

(macro)
@spec bitwise_shift_left(Macro.t(), Macro.t()) :: Macro.t()

Returns the result of expr1 << expr2.

bitwise_shift_right(x, y)

(macro)
@spec bitwise_shift_right(Macro.t(), Macro.t()) :: Macro.t()

Returns the result of expr1 >> expr2.

bitwise_xor(x, y)

(macro)
@spec bitwise_xor(Macro.t(), Macro.t()) :: Macro.t()

Returns the result of expr1 ^ expr2.

bloom_filter(expr, num_entries)

(macro)
@spec bloom_filter(Macro.t(), Macro.t()) :: Macro.t()

Computes a bloom filter from values produced by expr, with numEntries maximum number of distinct values before false positive rate increases. See bloom filter extension documentation for additional details. Empty base64 encoded bloom filter

bloom_filter_test(expr, serialized_filter)

(macro)
@spec bloom_filter_test(Macro.t(), Macro.t()) :: Macro.t()

Returns true if the value of expr is contained in the base64-serialized Bloom filter. See the Bloom filter extension documentation for additional details. See the BLOOM_FILTER function for computing Bloom filters.

btrim(expr)

(macro)
@spec btrim(Macro.t()) :: Macro.t()

Alternate form of TRIM(BOTH chars FROM expr).

btrim(expr, chars)

(macro)
@spec btrim(Macro.t(), Macro.t()) :: Macro.t()

Alternate form of TRIM(BOTH chars FROM expr).

ceil(expr)

(macro)
@spec ceil(Macro.t()) :: Macro.t()

Ceiling.

ceil(timestamp_expr, unit)

(macro)
@spec ceil(Macro.t(), Macro.t()) :: Macro.t()

Rounds up a timestamp, returning it as a new timestamp. Unit can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

char_length(expr)

(macro)
@spec char_length(Macro.t()) :: Macro.t()

Alias for LENGTH.

character_length(expr)

(macro)
@spec character_length(Macro.t()) :: Macro.t()

Alias for LENGTH.

coalesce(exprs)

(macro)
@spec coalesce(Macro.t()) :: Macro.t()

Returns the first value that is neither NULL nor empty string.

concat(exprs)

(macro)
@spec concat(Macro.t()) :: Macro.t()

Concats a list of expressions.

contains_string(expr, str)

(macro)
@spec contains_string(Macro.t(), Macro.t()) :: Macro.t()

Returns true if the str is a substring of expr.

cos(expr)

(macro)
@spec cos(Macro.t()) :: Macro.t()

Trigonometric cosine of an angle expr.

cot(expr)

(macro)
@spec cot(Macro.t()) :: Macro.t()

Trigonometric cotangent of an angle expr.

current_date()

(macro)
@spec current_date() :: Macro.t()

Current date in the connection's time zone.

current_timestamp()

(macro)
@spec current_timestamp() :: Macro.t()

Current timestamp in the connection's time zone.

date_trunc(unit, timestamp_expr)

(macro)
@spec date_trunc(Macro.t(), Macro.t()) :: Macro.t()

Rounds down a timestamp, returning it as a new timestamp. Unit can be 'milliseconds', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year', 'decade', 'century', or 'millennium'.

decode_base64_complex(data_type, expr)

(macro)
@spec decode_base64_complex(Macro.t(), Macro.t()) :: Macro.t()

Decodes a Base64-encoded string into a complex data type, where dataType is the complex data type and expr is the Base64-encoded string to decode. The hyperUnique and serializablePairLongString data types are supported by default. You can enable support for the following complex data types by loading their extensions: druid-bloom-filter: bloom druid-datasketches: arrayOfDoublesSketch, HLLSketch, KllDoublesSketch, KllFloatsSketch, quantilesDoublesSketch, thetaSketch druid-histogram: approximateHistogram, fixedBucketsHistogram druid-stats: variance druid-compressed-big-decimal: compressedBigDecimal druid-momentsketch: momentSketch druid-tdigestsketch: tDigestSketch

druid-bloom-filter: bloom druid-datasketches: arrayOfDoublesSketch, HLLSketch, KllDoublesSketch, KllFloatsSketch, quantilesDoublesSketch, thetaSketch druid-histogram: approximateHistogram, fixedBucketsHistogram druid-stats: variance druid-compressed-big-decimal: compressedBigDecimal druid-momentsketch: momentSketch druid-tdigestsketch: tDigestSketch

decode_base64_utf8(expr)

(macro)
@spec decode_base64_utf8(Macro.t()) :: Macro.t()

Decodes a Base64-encoded string into a UTF-8 encoded string.

degrees(expr)

(macro)
@spec degrees(Macro.t()) :: Macro.t()

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

distinct(expr)

(macro)
@spec distinct(Macro.t()) :: Macro.t()

Applies DISTINCT modifier to expr.

div(x, y)

(macro)
@spec div(Macro.t(), Macro.t()) :: Macro.t()

Returns the result of integer division of x by y

ds_cdf(expr, split_points)

(macro)
@spec ds_cdf(Macro.t(), Macro.t()) :: Macro.t()

Returns a string representing approximation to the Cumulative Distribution Function given a list of split points that define the edges of the bins from a quantiles sketch. expr must return a quantiles sketch.

ds_get_quantile(expr, fraction)

(macro)
@spec ds_get_quantile(Macro.t(), Macro.t()) :: Macro.t()

Returns the quantile estimate corresponding to fraction from a quantiles sketch. expr must return a quantiles sketch.

ds_get_quantiles(expr, fractions)

(macro)
@spec ds_get_quantiles(Macro.t(), Macro.t()) :: Macro.t()

Returns a string representing an array of quantile estimates corresponding to a list of fractions from a quantiles sketch. expr must return a quantiles sketch.

ds_histogram(expr, split_points)

(macro)
@spec ds_histogram(Macro.t(), Macro.t()) :: Macro.t()

Returns a string representing an approximation to the histogram given a list of split points that define the histogram bins from a quantiles sketch. expr must return a quantiles sketch.

ds_quantile_summary(expr)

(macro)
@spec ds_quantile_summary(Macro.t()) :: Macro.t()

Returns a string summary of a quantiles sketch, useful for debugging. expr must return a quantiles sketch.

ds_quantiles_sketch(expr)

(macro)
@spec ds_quantiles_sketch(Macro.t()) :: Macro.t()

Creates a Quantiles sketch on the values of expr, which can be a regular column or a column containing quantiles sketches. The k parameter is described in the Quantiles sketch documentation.

ds_quantiles_sketch(expr, sketch_size)

(macro)
@spec ds_quantiles_sketch(Macro.t(), Macro.t()) :: Macro.t()

Creates a Quantiles sketch on the values of expr, which can be a regular column or a column containing quantiles sketches. The k parameter is described in the Quantiles sketch documentation.

ds_rank(expr, value)

(macro)
@spec ds_rank(Macro.t(), Macro.t()) :: Macro.t()

Returns an approximation to the rank of a given value that is the fraction of the distribution less than that value from a quantiles sketch. expr must return a quantiles sketch.

ds_theta(column)

(macro)
@spec ds_theta(Macro.t()) :: Macro.t()

Creates a Theta sketch on the values of expr, which can be a regular column or a column containing Theta sketches. The size parameter is described in the Theta sketch documentation.

ds_theta(column, sketch_size)

(macro)
@spec ds_theta(Macro.t(), Macro.t()) :: Macro.t()

Creates a Theta sketch on the values of expr, which can be a regular column or a column containing Theta sketches. The size parameter is described in the Theta sketch documentation.

ds_tuple_doubles(expr)

(macro)
@spec ds_tuple_doubles(Macro.t()) :: Macro.t()

Creates a Tuple sketch on the values of expr, which can be a regular column or a column containing tuple sketches. The k parameter is described in the Tuple sketch documentation.

ds_tuple_doubles(expr, nominal_entries)

(macro)
@spec ds_tuple_doubles(Macro.t(), Macro.t()) :: Macro.t()

Creates a Tuple sketch on the values of expr, which can be a regular column or a column containing tuple sketches. The k parameter is described in the Tuple sketch documentation.

ds_tuple_doubles_intersect(exprs)

(macro)
@spec ds_tuple_doubles_intersect(Macro.t()) :: Macro.t()

Returns an intersection of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

ds_tuple_doubles_intersect(exprs, nominal_entries)

(macro)
@spec ds_tuple_doubles_intersect(Macro.t(), Macro.t()) :: Macro.t()

Returns an intersection of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

ds_tuple_doubles_metrics_sum_estimate(expr)

(macro)
@spec ds_tuple_doubles_metrics_sum_estimate(Macro.t()) :: Macro.t()

Computes approximate sums of the values contained within a Tuple sketch column which contains an array of double values as its Summary Object.

ds_tuple_doubles_not(exprs)

(macro)
@spec ds_tuple_doubles_not(Macro.t()) :: Macro.t()

Returns a set difference of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Object are preserved as is. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

ds_tuple_doubles_not(exprs, nominal_entries)

(macro)
@spec ds_tuple_doubles_not(Macro.t(), Macro.t()) :: Macro.t()

Returns a set difference of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Object are preserved as is. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

ds_tuple_doubles_union(exprs)

(macro)
@spec ds_tuple_doubles_union(Macro.t()) :: Macro.t()

Returns a union of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

ds_tuple_doubles_union(exprs, nominal_entries)

(macro)
@spec ds_tuple_doubles_union(Macro.t(), Macro.t()) :: Macro.t()

Returns a union of tuple sketches, where each input expression must return a tuple sketch which contains an array of double values as its Summary Object. The values contained in the Summary Objects are summed when combined. If the last value of the array is a numeric literal, Druid assumes that the value is an override parameter for nominal entries.

earliest(expr)

(macro)
@spec earliest(Macro.t()) :: Macro.t()

Returns the earliest value of expr. If expr comes from a relation with a timestamp column (like __time in a Druid datasource), the "earliest" is taken from the row with the overall earliest non-null value of the timestamp column. If the earliest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows. If expr does not come from a relation with a timestamp, then it is simply the first value encountered.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

earliest(expr, max_bytes_per_value)

(macro)
@spec earliest(Macro.t(), Macro.t()) :: Macro.t()

Returns the earliest value of expr. If expr comes from a relation with a timestamp column (like __time in a Druid datasource), the "earliest" is taken from the row with the overall earliest non-null value of the timestamp column. If the earliest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows. If expr does not come from a relation with a timestamp, then it is simply the first value encountered.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

earliest_by(expr, timestamp_expr)

(macro)
@spec earliest_by(Macro.t(), Macro.t()) :: Macro.t()

Returns the earliest value of expr. The earliest value of expr is taken from the row with the overall earliest non-null value of timestampExpr. If the earliest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024.

Use EARLIEST instead of EARLIEST_BY on a table that has rollup enabled and was created with any variant of EARLIEST, LATEST, EARLIEST_BY, or LATEST_BY. In these cases, the intermediate type already stores the timestamp, and Druid ignores the value passed in timestampExpr. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

earliest_by(expr, timestamp_expr, max_bytes_per_value)

(macro)
@spec earliest_by(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns the earliest value of expr. The earliest value of expr is taken from the row with the overall earliest non-null value of timestampExpr. If the overall earliest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024.

Use EARLIEST instead of EARLIEST_BY on a table that has rollup enabled and was created with any variant of EARLIEST, LATEST, EARLIEST_BY, or LATEST_BY. In these cases, the intermediate type already stores the timestamp, and Druid ignores the value passed in timestampExpr. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

exp(expr)

(macro)
@spec exp(Macro.t()) :: Macro.t()

e to the power of expr.

extern(input_source, input_format, row_signature)

(macro)
@spec extern(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

extract(unit, timestamp_expr)

(macro)
@spec extract(Macro.t(), Macro.t()) :: Macro.t()

Extracts a time part from expr, returning it as a number. Unit can be EPOCH, MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR, DAY, DOW (day of week), ISODOW (ISO day of week), DOY (day of year), WEEK (week of year), MONTH, QUARTER, YEAR, ISOYEAR, DECADE, CENTURY or MILLENNIUM. Units must be provided unquoted, like EXTRACT(HOUR FROM __time).

floor(expr)

(macro)
@spec floor(Macro.t()) :: Macro.t()

Floor.

floor(timestamp_expr, unit)

(macro)
@spec floor(Macro.t(), Macro.t()) :: Macro.t()

Rounds down a timestamp, returning it as a new timestamp. Unit can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

greatest(exprs)

(macro)
@spec greatest(Macro.t()) :: Macro.t()

Evaluates zero or more expressions and returns the maximum value based on comparisons as described above.

grouping(exprs)

(macro)
@spec grouping(Macro.t()) :: Macro.t()

Returns a number to indicate which groupBy dimension is included in a row, when using GROUPING SETS. Refer to additional documentation on how to infer this number.

hll_sketch_estimate(expr)

(macro)
@spec hll_sketch_estimate(Macro.t()) :: Macro.t()

Returns the distinct count estimate from an HLL sketch. expr must return an HLL sketch. The optional round boolean parameter will round the estimate if set to true, with a default of false.

hll_sketch_estimate(expr, round)

(macro)
@spec hll_sketch_estimate(Macro.t(), Macro.t()) :: Macro.t()

Returns the distinct count estimate from an HLL sketch. expr must return an HLL sketch. The optional round boolean parameter will round the estimate if set to true, with a default of false.

hll_sketch_estimate_with_error_bounds(expr)

(macro)
@spec hll_sketch_estimate_with_error_bounds(Macro.t()) :: Macro.t()

Returns the distinct count estimate and error bounds from an HLL sketch. expr must return an HLL sketch. An optional numStdDev argument can be provided.

hll_sketch_estimate_with_error_bounds(expr, num_std_dev)

(macro)
@spec hll_sketch_estimate_with_error_bounds(Macro.t(), Macro.t()) :: Macro.t()

Returns the distinct count estimate and error bounds from an HLL sketch. expr must return an HLL sketch. An optional numStdDev argument can be provided.

hll_sketch_to_string(expr)

(macro)
@spec hll_sketch_to_string(Macro.t()) :: Macro.t()

Returns a human-readable string representation of an HLL sketch for debugging. expr must return an HLL sketch.

hll_sketch_union(exprs)

(macro)
@spec hll_sketch_union(Macro.t()) :: Macro.t()

Returns a union of HLL sketches, where each input expression must return an HLL sketch. The lgK and tgtHllType can be optionally specified as the first parameter; if provided, both optional parameters must be specified.

hll_sketch_union(lg_k, tgt_hll_type, exprs)

(macro)
@spec hll_sketch_union(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns a union of HLL sketches, where each input expression must return an HLL sketch. The lgK and tgtHllType can be optionally specified as the first parameter; if provided, both optional parameters must be specified.

human_readable_binary_byte_format(value)

(macro)
@spec human_readable_binary_byte_format(Macro.t()) :: Macro.t()

Format a number in human-readable IEC format.

human_readable_binary_byte_format(value, precision)

(macro)
@spec human_readable_binary_byte_format(Macro.t(), Macro.t()) :: Macro.t()

Format a number in human-readable IEC format.

human_readable_decimal_byte_format(value)

(macro)
@spec human_readable_decimal_byte_format(Macro.t()) :: Macro.t()

Format a number in human-readable SI format.

human_readable_decimal_byte_format(value, precision)

(macro)
@spec human_readable_decimal_byte_format(Macro.t(), Macro.t()) :: Macro.t()

Format a number in human-readable SI format.

human_readable_decimal_format(value)

(macro)
@spec human_readable_decimal_format(Macro.t()) :: Macro.t()

Format a number in human-readable SI format.

human_readable_decimal_format(value, precision)

(macro)
@spec human_readable_decimal_format(Macro.t(), Macro.t()) :: Macro.t()

Format a number in human-readable SI format.

icontains_string(expr, str)

(macro)
@spec icontains_string(Macro.t(), Macro.t()) :: Macro.t()

Returns true if the str is a substring of expr. The match is case-insensitive.

interval(value, unit)

(macro)

ipv4_match(address, subnet)

(macro)
@spec ipv4_match(Macro.t(), Macro.t()) :: Macro.t()

Returns true if the address belongs to the subnet literal, else false. If address is not a valid IPv4 address, then false is returned. This function is more efficient if address is an integer instead of a string.

ipv4_parse(address)

(macro)
@spec ipv4_parse(Macro.t()) :: Macro.t()

Parses address into an IPv4 address stored as an integer . If address is an integer that is a valid IPv4 address, then it is passed through. Returns null if address cannot be represented as an IPv4 address.

ipv4_stringify(address)

(macro)
@spec ipv4_stringify(Macro.t()) :: Macro.t()

Converts address into an IPv4 address dotted-decimal string. If address is a string that is a valid IPv4 address, then it is passed through. Returns null if address cannot be represented as an IPv4 address.

ipv6_match(address, subnet)

(macro)
@spec ipv6_match(Macro.t(), Macro.t()) :: Macro.t()

Returns 1 if the IPv6 address belongs to the subnet literal, else 0. If address is not a valid IPv6 address, then 0 is returned.

json_keys(expr, path)

(macro)
@spec json_keys(Macro.t(), Macro.t()) :: Macro.t()

Returns an array of field names from expr at the specified path.

json_object(kv_pairs)

(macro)

Constructs a new COMPLEX<json> object. The KEY expressions must evaluate to string types. The VALUE expressions can be composed of any input type, including other COMPLEX<json> values. JSON_OBJECT can accept colon-separated key-value pairs. The following syntax is equivalent: JSON_OBJECT(expr1:expr2[, expr3:expr4, ...]).

json_paths(expr)

(macro)
@spec json_paths(Macro.t()) :: Macro.t()

Returns an array of all paths which refer to literal values in expr in JSONPath format.

json_query(expr, path)

(macro)
@spec json_query(Macro.t(), Macro.t()) :: Macro.t()

Extracts a COMPLEX<json> value from expr, at the specified path.

json_query_array(expr, path)

(macro)
@spec json_query_array(Macro.t(), Macro.t()) :: Macro.t()

Extracts an ARRAY<COMPLEX<json>> value from expr at the specified path. If value is not an ARRAY, it gets translated into a single element ARRAY containing the value at path. The primary use of this function is to extract arrays of objects to use as inputs to other array functions.

json_value(expr, path)

(macro)
@spec json_value(Macro.t(), Macro.t()) :: Macro.t()

Extracts a literal value from expr at the specified path. If you specify RETURNING and an SQL type name (such as VARCHAR, BIGINT, DOUBLE, etc) the function plans the query using the suggested type. Otherwise, it attempts to infer the type based on the context. If it can't infer the type, it defaults to VARCHAR.

json_value(expr, path, type)

(macro)
@spec json_value(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Extracts a literal value from expr at the specified path. If you specify RETURNING and an SQL type name (such as VARCHAR, BIGINT, DOUBLE, etc) the function plans the query using the suggested type. Otherwise, it attempts to infer the type based on the context. If it can't infer the type, it defaults to VARCHAR.

latest(expr)

(macro)
@spec latest(Macro.t()) :: Macro.t()

Returns the latest value of expr The expr must come from a relation with a timestamp column (like __time in a Druid datasource) and the "latest" is taken from the row with the overall latest non-null value of the timestamp column. If the latest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

latest(expr, max_bytes_per_value)

(macro)
@spec latest(Macro.t(), Macro.t()) :: Macro.t()

Returns the latest value of expr The expr must come from a relation with a timestamp column (like __time in a Druid datasource) and the "latest" is taken from the row with the overall latest non-null value of the timestamp column. If the latest non-null value of the timestamp column appears in multiple rows, the expr may be taken from any of those rows.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

latest_by(expr, timestamp_expr)

(macro)
@spec latest_by(Macro.t(), Macro.t()) :: Macro.t()

Returns the latest value of expr The latest value of expr is taken from the row with the overall latest non-null value of timestampExpr. If the overall latest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024.

Use LATEST instead of LATEST_BY on a table that has rollup enabled and was created with any variant of EARLIEST, LATEST, EARLIEST_BY, or LATEST_BY. In these cases, the intermediate type already stores the timestamp, and Druid ignores the value passed in timestampExpr. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

latest_by(expr, timestamp_expr, max_bytes_per_value)

(macro)
@spec latest_by(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns the latest value of expr The latest value of expr is taken from the row with the overall latest non-null value of timestampExpr. If the overall latest non-null value of timestampExpr appears in multiple rows, the expr may be taken from any of those rows.

If expr is a string or complex type maxBytesPerValue amount of space is allocated for the aggregation. Strings longer than this limit are truncated. The maxBytesPerValue parameter should be set as low as possible, since high values will lead to wasted memory. If maxBytesPerValueis omitted; it defaults to 1024.

Use LATEST instead of LATEST_BY on a table that has rollup enabled and was created with any variant of EARLIEST, LATEST, EARLIEST_BY, or LATEST_BY. In these cases, the intermediate type already stores the timestamp, and Druid ignores the value passed in timestampExpr. null or 0/'' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

least(exprs)

(macro)
@spec least(Macro.t()) :: Macro.t()

Evaluates zero or more expressions and returns the minimum value based on comparisons as described above.

left(expr)

(macro)
@spec left(Macro.t()) :: Macro.t()

Returns the leftmost length characters from expr.

left(expr, length)

(macro)
@spec left(Macro.t(), Macro.t()) :: Macro.t()

Returns the leftmost length characters from expr.

length(expr)

(macro)
@spec length(Macro.t()) :: Macro.t()

Length of expr in UTF-16 code units.

listagg(expr)

(macro)
@spec listagg(Macro.t()) :: Macro.t()

Synonym for STRING_AGG. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

listagg(expr, separator)

(macro)
@spec listagg(Macro.t(), Macro.t()) :: Macro.t()

Synonym for STRING_AGG. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

listagg(expr, separator, size)

(macro)
@spec listagg(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Synonym for STRING_AGG. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

ln(expr)

(macro)
@spec ln(Macro.t()) :: Macro.t()

Logarithm (base e).

log10(expr)

(macro)
@spec log10(Macro.t()) :: Macro.t()

Logarithm (base 10).

lookup(expr, lookup_name)

(macro)
@spec lookup(Macro.t(), Macro.t()) :: Macro.t()

Look up expr in a registered query-time lookup table. Note that lookups can also be queried directly using the lookup schema. Optional constant replaceMissingValueWith can be passed as a third argument to be returned when value is missing from lookup.

lookup(expr, lookup_name, replace_missing_value_with)

(macro)
@spec lookup(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Look up expr in a registered query-time lookup table. Note that lookups can also be queried directly using the lookup schema. Optional constant replaceMissingValueWith can be passed as a third argument to be returned when value is missing from lookup.

lower(expr)

(macro)
@spec lower(Macro.t()) :: Macro.t()

Returns expr in all lowercase.

lpad(expr, length)

(macro)
@spec lpad(Macro.t(), Macro.t()) :: Macro.t()

Returns a string of length from expr left-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

lpad(expr, length, chars)

(macro)
@spec lpad(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns a string of length from expr left-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

ltrim(expr)

(macro)
@spec ltrim(Macro.t()) :: Macro.t()

Alternate form of TRIM(LEADING chars FROM expr).

ltrim(expr, chars)

(macro)
@spec ltrim(Macro.t(), Macro.t()) :: Macro.t()

Alternate form of TRIM(LEADING chars FROM expr).

millis_to_timestamp(millis_expr)

(macro)
@spec millis_to_timestamp(Macro.t()) :: Macro.t()

Converts a number of milliseconds since the epoch (1970-01-01 00:00:00 UTC) into a timestamp.

mod(x, y)

(macro)
@spec mod(Macro.t(), Macro.t()) :: Macro.t()

Modulo (remainder of x divided by y).

mv_append(arr, expr)

(macro)
@spec mv_append(Macro.t(), Macro.t()) :: Macro.t()

Appends expr to arr, the resulting array type determined by the type of arr.

mv_concat(arr1, arr2)

(macro)
@spec mv_concat(Macro.t(), Macro.t()) :: Macro.t()

Concatenates arr2 to arr1. The resulting array type is determined by the type of arr1.

mv_contains(arr, expr)

(macro)
@spec mv_contains(Macro.t(), Macro.t()) :: Macro.t()

If expr is a scalar type, returns 1 if arr contains expr. If expr is an array, returns 1 if arr contains all elements of expr. Otherwise returns 0.

mv_filter_none(expr, arr)

(macro)
@spec mv_filter_none(Macro.t(), Macro.t()) :: Macro.t()

Filters multi-value expr to include no values contained in array arr.

mv_filter_only(expr, arr)

(macro)
@spec mv_filter_only(Macro.t(), Macro.t()) :: Macro.t()

Filters multi-value expr to include only values contained in array arr.

mv_length(arr)

(macro)
@spec mv_length(Macro.t()) :: Macro.t()

Returns length of the array expression.

mv_offset(arr, long)

(macro)
@spec mv_offset(Macro.t(), Macro.t()) :: Macro.t()

Returns the array element at the 0-based index supplied, or null for an out of range index.

mv_offset_of(arr, expr)

(macro)
@spec mv_offset_of(Macro.t(), Macro.t()) :: Macro.t()

Returns the 0-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

mv_ordinal(arr, long)

(macro)
@spec mv_ordinal(Macro.t(), Macro.t()) :: Macro.t()

Returns the array element at the 1-based index supplied, or null for an out of range index.

mv_ordinal_of(arr, expr)

(macro)
@spec mv_ordinal_of(Macro.t(), Macro.t()) :: Macro.t()

Returns the 1-based index of the first occurrence of expr in the array. If no matching elements exist in the array, returns null or -1 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode).

mv_overlap(arr1, arr2)

(macro)
@spec mv_overlap(Macro.t(), Macro.t()) :: Macro.t()

Returns 1 if arr1 and arr2 have any elements in common, else 0.

mv_prepend(expr, arr)

(macro)
@spec mv_prepend(Macro.t(), Macro.t()) :: Macro.t()

Adds expr to the beginning of arr, the resulting array type determined by the type of arr.

mv_slice(arr, start, stop)

(macro)
@spec mv_slice(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns the subarray of arr from the 0-based index start(inclusive) to end(exclusive), or null, if start is less than 0, greater than length of arr or greater than end.

mv_to_array(str)

(macro)
@spec mv_to_array(Macro.t()) :: Macro.t()

Converts a multi-value string from a VARCHAR to a VARCHAR ARRAY.

mv_to_string(arr, str)

(macro)
@spec mv_to_string(Macro.t(), Macro.t()) :: Macro.t()

Joins all elements of arr by the delimiter specified by str.

nullif(value1, value2)

(macro)
@spec nullif(Macro.t(), Macro.t()) :: Macro.t()

Returns NULL if value1 and value2 match, else returns value1.

nvl(value1, value2)

(macro)
@spec nvl(Macro.t(), Macro.t()) :: Macro.t()

Returns value1 if value1 is not null, otherwise value2.

parse_json(expr)

(macro)
@spec parse_json(Macro.t()) :: Macro.t()

Parses expr into a COMPLEX<json> object. This operator deserializes JSON values when processing them, translating stringified JSON into a nested structure. If the input is not a VARCHAR or it is invalid JSON, this function will result in an error.

parse_long(string)

(macro)
@spec parse_long(Macro.t()) :: Macro.t()

Parses a string into a long (BIGINT) with the given radix, or 10 (decimal) if a radix is not provided.

parse_long(string, radix)

(macro)
@spec parse_long(Macro.t(), Macro.t()) :: Macro.t()

Parses a string into a long (BIGINT) with the given radix, or 10 (decimal) if a radix is not provided.

pi()

(macro)
@spec pi() :: Macro.t()

Constant Pi.

position(needle, haystack)

(macro)
@spec position(Macro.t(), Macro.t()) :: Macro.t()

Returns the index of needle within haystack, with indexes starting from 1. The search will begin at fromIndex, or 1 if fromIndex is not specified. If needle is not found, returns 0.

position(needle, haystack, from_index)

(macro)
@spec position(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns the index of needle within haystack, with indexes starting from 1. The search will begin at fromIndex, or 1 if fromIndex is not specified. If needle is not found, returns 0.

power(expr, power)

(macro)
@spec power(Macro.t(), Macro.t()) :: Macro.t()

expr raised to the power of power.

radians(expr)

(macro)
@spec radians(Macro.t()) :: Macro.t()

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

regexp_extract(expr, pattern)

(macro)
@spec regexp_extract(Macro.t(), Macro.t()) :: Macro.t()

Apply regular expression pattern to expr and extract a capture group, or NULL if there is no match. If index is unspecified or zero, returns the first substring that matched the pattern. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern. Note: when druid.generic.useDefaultValueForNull = true, it is not possible to differentiate an empty-string match from a non-match (both will return NULL).

regexp_extract(expr, pattern, index)

(macro)
@spec regexp_extract(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Apply regular expression pattern to expr and extract a capture group, or NULL if there is no match. If index is unspecified or zero, returns the first substring that matched the pattern. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern. Note: when druid.generic.useDefaultValueForNull = true, it is not possible to differentiate an empty-string match from a non-match (both will return NULL).

regexp_like(expr, pattern)

(macro)
@spec regexp_like(Macro.t(), Macro.t()) :: Macro.t()

Returns whether expr matches regular expression pattern. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern. Similar to LIKE, but uses regexps instead of LIKE patterns. Especially useful in WHERE clauses.

regexp_replace(expr, pattern, replacement)

(macro)
@spec regexp_replace(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Replaces all occurrences of regular expression pattern within expr with replacement. The replacement string may refer to capture groups using $1, $2, etc. The pattern may match anywhere inside expr; if you want to match the entire string instead, use the ^ and $ markers at the start and end of your pattern.

repeat(expr, n)

(macro)
@spec repeat(Macro.t(), Macro.t()) :: Macro.t()

Repeats expr N times.

replace(expr, pattern, replacement)

(macro)
@spec replace(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Replaces pattern with replacement in expr, and returns the result.

reverse(expr)

(macro)
@spec reverse(Macro.t()) :: Macro.t()

Reverses expr.

right(expr)

(macro)
@spec right(Macro.t()) :: Macro.t()

Returns the rightmost length characters from expr.

right(expr, length)

(macro)
@spec right(Macro.t(), Macro.t()) :: Macro.t()

Returns the rightmost length characters from expr.

round(expr)

(macro)
@spec round(Macro.t()) :: Macro.t()

ROUND(x, y) would return the value of the x rounded to the y decimal places.

round(expr, digits)

(macro)
@spec round(Macro.t(), Macro.t()) :: Macro.t()

ROUND(x, y) would return the value of the x rounded to the y decimal places.

rpad(expr, length)

(macro)
@spec rpad(Macro.t(), Macro.t()) :: Macro.t()

Returns a string of length from expr right-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

rpad(expr, length, chars)

(macro)
@spec rpad(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns a string of length from expr right-padded with chars. If length is shorter than the length of expr, the result is expr which is truncated to length. The result will be null if either expr or chars is null. If chars is an empty string, no padding is added, however expr may be trimmed if necessary.

rtrim(expr)

(macro)
@spec rtrim(Macro.t()) :: Macro.t()

Alternate form of TRIM(TRAILING chars FROM expr).

rtrim(expr, chars)

(macro)
@spec rtrim(Macro.t(), Macro.t()) :: Macro.t()

Alternate form of TRIM(TRAILING chars FROM expr).

safe_divide(x, y)

(macro)
@spec safe_divide(Macro.t(), Macro.t()) :: Macro.t()

Returns the division of x by y guarded on division by 0.

sin(expr)

(macro)
@spec sin(Macro.t()) :: Macro.t()

Trigonometric sine of an angle expr.

sql_case(clauses)

(macro)

Searched CASE.

sql_case(expr, clauses)

(macro)

Simple CASE.

sqrt(expr)

(macro)
@spec sqrt(Macro.t()) :: Macro.t()

Square root.

stddev(expr)

(macro)
@spec stddev(Macro.t()) :: Macro.t()

Computes standard deviation sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

stddev_pop(expr)

(macro)
@spec stddev_pop(Macro.t()) :: Macro.t()

Computes standard deviation population of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

stddev_samp(expr)

(macro)
@spec stddev_samp(Macro.t()) :: Macro.t()

Computes standard deviation sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

string_agg(expr)

(macro)
@spec string_agg(Macro.t()) :: Macro.t()

Collects all values (or all distinct values) of expr into a single STRING, ignoring null values. Each value is joined by an optional separator, which must be a literal STRING. If the separator is not provided, strings are concatenated without a separator. An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order.

string_agg(expr, separator)

(macro)
@spec string_agg(Macro.t(), Macro.t()) :: Macro.t()

Collects all values (or all distinct values) of expr into a single STRING, ignoring null values. Each value is joined by an optional separator, which must be a literal STRING. If the separator is not provided, strings are concatenated without a separator. An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order.

An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

string_agg(expr, separator, size)

(macro)
@spec string_agg(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Collects all values (or all distinct values) of expr into a single STRING, ignoring null values. Each value is joined by an optional separator, which must be a literal STRING. If the separator is not provided, strings are concatenated without a separator. An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order.

An optional size in bytes can be supplied to limit aggregation size (default of 1024 bytes). If the aggregated string grows larger than the maximum size in bytes, the query will fail. Use of ORDER BY within the STRING_AGG expression is not currently supported, and the ordering of results within the output string may vary depending on processing order. null or '' if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

string_format(pattern, args)

(macro)
@spec string_format(Macro.t(), Macro.t()) :: Macro.t()

Returns a string formatted in the manner of Java's String.format.

string_to_array(str1, str2)

(macro)
@spec string_to_array(Macro.t(), Macro.t()) :: Macro.t()

Splits str1 into an array on the delimiter specified by str2, which is a regular expression.

string_to_mv(str1, str2)

(macro)
@spec string_to_mv(Macro.t(), Macro.t()) :: Macro.t()

Splits str1 into an array on the delimiter specified by str2, which is a regular expression.

strlen(expr)

(macro)
@spec strlen(Macro.t()) :: Macro.t()

Alias for LENGTH.

strpos(haystack, needle)

(macro)
@spec strpos(Macro.t(), Macro.t()) :: Macro.t()

Returns the index of needle within haystack, with indexes starting from 1. If needle is not found, returns 0.

substr(expr, index)

(macro)
@spec substr(Macro.t(), Macro.t()) :: Macro.t()

Alias for SUBSTRING.

substr(expr, index, length)

(macro)
@spec substr(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Alias for SUBSTRING.

substring(expr, index)

(macro)
@spec substring(Macro.t(), Macro.t()) :: Macro.t()

Returns a substring of expr starting at index, with a max length, both measured in UTF-16 code units.

substring(expr, index, length)

(macro)
@spec substring(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns a substring of expr starting at index, with a max length, both measured in UTF-16 code units.

table(source)

(macro)
@spec table(Macro.t()) :: Macro.t()

tan(expr)

(macro)
@spec tan(Macro.t()) :: Macro.t()

Trigonometric tangent of an angle expr.

tdigest_generate_sketch(expr)

(macro)
@spec tdigest_generate_sketch(Macro.t()) :: Macro.t()

Builds a T-Digest sketch on values produced by expr. Compression parameter (default value 100) determines the accuracy and size of the sketch Higher compression means higher accuracy but more space to store sketches.

tdigest_generate_sketch(expr, compression)

(macro)
@spec tdigest_generate_sketch(Macro.t(), Macro.t()) :: Macro.t()

Builds a T-Digest sketch on values produced by expr. Compression parameter (default value 100) determines the accuracy and size of the sketch Higher compression means higher accuracy but more space to store sketches.

tdigest_quantile(expr, quantile_fraction)

(macro)
@spec tdigest_quantile(Macro.t(), Macro.t()) :: Macro.t()

Builds a T-Digest sketch on values produced by expr and returns the value for the quantile. Compression parameter (default value 100) determines the accuracy and size of the sketch. Higher compression means higher accuracy but more space to store sketches.

tdigest_quantile(expr, quantile_fraction, compression)

(macro)
@spec tdigest_quantile(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Builds a T-Digest sketch on values produced by expr and returns the value for the quantile. Compression parameter (default value 100) determines the accuracy and size of the sketch. Higher compression means higher accuracy but more space to store sketches.

textcat(expr1, expr2)

(macro)
@spec textcat(Macro.t(), Macro.t()) :: Macro.t()

Two argument version of CONCAT.

theta_sketch_estimate(expr)

(macro)
@spec theta_sketch_estimate(Macro.t()) :: Macro.t()

Returns the distinct count estimate from a theta sketch. expr must return a theta sketch.

theta_sketch_estimate_with_error_bounds(expr, error_bounds_std_dev)

(macro)
@spec theta_sketch_estimate_with_error_bounds(Macro.t(), Macro.t()) :: Macro.t()

Returns the distinct count estimate and error bounds from a theta sketch. expr must return a theta sketch.

theta_sketch_intersect(exprs)

(macro)
@spec theta_sketch_intersect(Macro.t()) :: Macro.t()

Returns an intersection of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

theta_sketch_intersect(size, exprs)

(macro)
@spec theta_sketch_intersect(Macro.t(), Macro.t()) :: Macro.t()

Returns an intersection of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

theta_sketch_not(exprs)

(macro)
@spec theta_sketch_not(Macro.t()) :: Macro.t()

Returns a set difference of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

theta_sketch_not(size, exprs)

(macro)
@spec theta_sketch_not(Macro.t(), Macro.t()) :: Macro.t()

Returns a set difference of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

theta_sketch_union(exprs)

(macro)
@spec theta_sketch_union(Macro.t()) :: Macro.t()

Returns a union of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

theta_sketch_union(size, exprs)

(macro)
@spec theta_sketch_union(Macro.t(), Macro.t()) :: Macro.t()

Returns a union of theta sketches, where each input expression must return a theta sketch. The size can be optionally specified as the first parameter.

time_ceil(timestamp_expr, period)

(macro)
@spec time_ceil(Macro.t(), Macro.t()) :: Macro.t()

Rounds up a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_CEIL(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to CEIL but is more flexible.

time_ceil(timestamp_expr, period, origin)

(macro)
@spec time_ceil(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Rounds up a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_CEIL(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to CEIL but is more flexible.

time_ceil(timestamp_expr, period, origin, timezone)

(macro)
@spec time_ceil(Macro.t(), Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Rounds up a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_CEIL(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to CEIL but is more flexible.

time_extract(timestamp_expr, unit)

(macro)
@spec time_extract(Macro.t(), Macro.t()) :: Macro.t()

Extracts a time part from expr, returning it as a number. Unit can be EPOCH, SECOND, MINUTE, HOUR, DAY (day of month), DOW (day of week), DOY (day of year), WEEK (week of week year), MONTH (1 through 12), QUARTER (1 through 4), or YEAR. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to EXTRACT but is more flexible. Unit and time zone must be literals, and must be provided quoted, like TIME_EXTRACT(time, 'HOUR') or TIME_EXTRACT(time, 'HOUR', 'America/Los_Angeles').

time_extract(timestamp_expr, unit, timezone)

(macro)
@spec time_extract(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Extracts a time part from expr, returning it as a number. Unit can be EPOCH, SECOND, MINUTE, HOUR, DAY (day of month), DOW (day of week), DOY (day of year), WEEK (week of week year), MONTH (1 through 12), QUARTER (1 through 4), or YEAR. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to EXTRACT but is more flexible. Unit and time zone must be literals, and must be provided quoted, like TIME_EXTRACT(time, 'HOUR') or TIME_EXTRACT(time, 'HOUR', 'America/Los_Angeles').

time_floor(timestamp_expr, period)

(macro)
@spec time_floor(Macro.t(), Macro.t()) :: Macro.t()

Rounds down a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_FLOOR(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to FLOOR but is more flexible.

time_floor(timestamp_expr, period, origin)

(macro)
@spec time_floor(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Rounds down a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_FLOOR(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to FLOOR but is more flexible.

time_floor(timestamp_expr, period, origin, timezone)

(macro)
@spec time_floor(Macro.t(), Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Rounds down a timestamp, returning it as a new timestamp. Period can be any ISO8601 period, like P3M (quarters) or PT12H (half-days). Specify origin as a timestamp to set the reference time for rounding. For example, TIME_FLOOR(__time, 'PT1H', TIMESTAMP '2016-06-27 00:30:00') measures an hourly period from 00:30-01:30 instead of 00:00-01:00. See Period granularities for details on the default starting boundaries. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. This function is similar to FLOOR but is more flexible.

time_format(timestamp_expr)

(macro)
@spec time_format(Macro.t()) :: Macro.t()

Formats a timestamp as a string with a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. Pattern and time zone must be literals.

time_format(timestamp_expr, pattern)

(macro)
@spec time_format(Macro.t(), Macro.t()) :: Macro.t()

Formats a timestamp as a string with a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. Pattern and time zone must be literals.

time_format(timestamp_expr, pattern, timezone)

(macro)
@spec time_format(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Formats a timestamp as a string with a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'. Pattern and time zone must be literals.

time_in_interval(timestamp_expr, interval)

(macro)
@spec time_in_interval(Macro.t(), Macro.t()) :: Macro.t()

Returns whether a timestamp is contained within a particular interval. The interval must be a literal string containing any ISO8601 interval, such as '2001-01-01/P1D' or '2001-01-01T01:00:00/2001-01-02T01:00:00'. The start instant of the interval is inclusive and the end instant is exclusive.

time_parse(string_expr)

(macro)
@spec time_parse(Macro.t()) :: Macro.t()

Parses a string into a timestamp using a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00', and will be used as the time zone for strings that do not include a time zone offset. Pattern and time zone must be literals. Strings that cannot be parsed as timestamps will be returned as NULL.

time_parse(string_expr, pattern)

(macro)
@spec time_parse(Macro.t(), Macro.t()) :: Macro.t()

Parses a string into a timestamp using a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00', and will be used as the time zone for strings that do not include a time zone offset. Pattern and time zone must be literals. Strings that cannot be parsed as timestamps will be returned as NULL.

time_parse(string_expr, pattern, timezone)

(macro)
@spec time_parse(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Parses a string into a timestamp using a given Joda DateTimeFormat pattern, or ISO8601 (e.g. 2000-01-02T03:04:05Z) if the pattern is not provided. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00', and will be used as the time zone for strings that do not include a time zone offset. Pattern and time zone must be literals. Strings that cannot be parsed as timestamps will be returned as NULL.

time_shift(timestamp_expr, period, step)

(macro)
@spec time_shift(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Shifts a timestamp by a period (step times), returning it as a new timestamp. Period can be any ISO8601 period. Step may be negative. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'.

time_shift(timestamp_expr, period, step, timezone)

(macro)
@spec time_shift(Macro.t(), Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Shifts a timestamp by a period (step times), returning it as a new timestamp. Period can be any ISO8601 period. Step may be negative. The time zone, if provided, should be a time zone name like 'America/Los_Angeles' or offset like '-08:00'.

timestamp_to_millis(timestamp_expr)

(macro)
@spec timestamp_to_millis(Macro.t()) :: Macro.t()

Converts a timestamp into a number of milliseconds since the epoch.

timestampadd(unit, count, timestamp)

(macro)
@spec timestampadd(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Equivalent to timestamp + count * INTERVAL '1' UNIT.

timestampdiff(unit, timestamp1, timestamp2)

(macro)
@spec timestampdiff(Macro.t(), Macro.t(), Macro.t()) :: Macro.t()

Returns the (signed) number of unit between timestamp1 and timestamp2. Unit can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

to_json_string(expr)

(macro)
@spec to_json_string(Macro.t()) :: Macro.t()

Serializes expr into a JSON string.

trim(expr)

(macro)
@spec trim(Macro.t()) :: Macro.t()

Returns expr with characters removed from the leading, trailing, or both ends of expr if they are in chars. If chars is not provided, it defaults to '' (a space). If the directional argument is not provided, it defaults to BOTH.

trim(chars, expr)

(macro)
@spec trim(Macro.t(), Macro.t()) :: Macro.t()

Returns expr with characters removed from the leading, trailing, or both ends of expr if they are in chars. If chars is not provided, it defaults to '' (a space). If the directional argument is not provided, it defaults to BOTH.

trunc(expr)

(macro)
@spec trunc(Macro.t()) :: Macro.t()

Alias for TRUNCATE.

trunc(expr, digits)

(macro)
@spec trunc(Macro.t(), Macro.t()) :: Macro.t()

Alias for TRUNCATE.

truncate(expr)

(macro)
@spec truncate(Macro.t()) :: Macro.t()

Truncate expr to a specific number of decimal digits.

truncate(expr, digits)

(macro)
@spec truncate(Macro.t(), Macro.t()) :: Macro.t()

Truncate expr to a specific number of decimal digits.

try_parse_json(expr)

(macro)
@spec try_parse_json(Macro.t()) :: Macro.t()

Parses expr into a COMPLEX<json> object. This operator deserializes JSON values when processing them, translating stringified JSON into a nested structure. If the input is not a VARCHAR or it is invalid JSON, this function will result in a NULL value.

upper(expr)

(macro)
@spec upper(Macro.t()) :: Macro.t()

Returns expr in all uppercase.

var_pop(expr)

(macro)
@spec var_pop(Macro.t()) :: Macro.t()

Computes variance population of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

var_samp(expr)

(macro)
@spec var_samp(Macro.t()) :: Macro.t()

Computes variance sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)

variance(expr)

(macro)
@spec variance(Macro.t()) :: Macro.t()

Computes variance sample of expr. See stats extension documentation for additional details. null or 0 if druid.generic.useDefaultValueForNull=true (deprecated legacy mode)