Mathematical functions, or arithmetic functions, perform numeric calculations that are typically more complex than basic addition, subtraction, multiplication, and division. For example, these functions include trigonometric, logarithmic, and base conversion operations.
The mathematical functions operate mainly on these data types:
Functions that perform bitwise operations are explained in
Function reference:
Impala supports the following mathematical functions:
Usage notes: Use this function to ensure all return values are positive. This is different than
the
Return type:
Return type:
Return type:
Return type:
Return type:
Return type: Same as the input value
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Usage notes: You can use either the
Return type:
Return type: Same as the input type
Return type:
Because this function operates on
The following examples show equivalent operations with the
The following examples show operations with the
Return type:
You might use the return value in an application where you perform load balancing, bucketing, or some other technique to divide processing or storage.
Because the result can be any 64-bit value, to restrict the value to a particular range, you can use an
expression that includes the
This function implements the same algorithm that Impala uses internally for hashing, on systems where the CRC32 instructions are not available.
This function implements the
Similar input values of different types could produce different hash values, for example the same
numeric value represented as
For short argument values, the high-order bits of the result have relatively low entropy:
Added in: Impala 1.2.2
Return type:
inf, signifying infinity.
Return type:
NaN, signifying
not a number.
Return type:
Return type:
Return type:
Return type:
Return type:
Return type: The same as the integral type being checked.
Usage notes: Use the corresponding
Return type: The same as the integral type being checked.
Usage notes: Use the corresponding
Because this function works with
The following examples show how the
Return type:
You might use the return value in an application where you perform load balancing, bucketing, or some other technique to divide processing or storage. This function provides a good performance for all kinds of keys such as number, ascii string and UTF-8. It can be recommended as general-purpose hashing function.
Regarding comparison of murmur_hash with fnv_hash, murmur_hash is based on Murmur2 hash algorithm and fnv_hash
function is based on FNV-1a hash algorithm. Murmur2 and FNV-1a can show very good randomness and performance
compared with well known other hash algorithms, but Murmur2 slightly show better randomness and performance than FNV-1a.
See
Similar input values of different types could produce different hash values, for example the same
numeric value represented as
For short argument values, the high-order bits of the result have relatively higher entropy than fnv_hash:
Added in: Impala 2.12.0
Usage notes: Use
Return type:
Return type:
The following examples show how the
Usage notes: Use
Return type:
Typically used in combination with the
Return type:
Return type:
Return type:
Return type:
Usage notes: Currently, the random sequence is reset after each query, and multiple calls to
The following examples show how
Return type: Same as the input type
Typically used in combination with the
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Arguments:
With a single floating-point argument, removes all fractional digits, leaving an
integer value. The optional second argument specifies the number of fractional digits
to include in the return value, and only applies when the argument type is
Scale argument: The scale argument applies only when truncating
Return type: Same as the input type
Added in: The
You can also pass a
The
The following examples demonstrate the
The following examples demonstrate using
Return type: