MINHASH

functionsupportedCore SQL functions

docs.snowflake.com ↗

Aggregate functionsWindow functions

Returns a MinHash state containing an array of size k constructed by applying k number of different hash functions to the input rows and keeping the minimum of each hash function. This MinHash state can then be input to the APPROXIMATE_SIMILARITY function to estimate the similarity with one or more other MinHash states. For more information about MinHash states, see Estimating Similarity of Two or More Sets.

Syntax

supportedpartialnot supportednot scored

Aggregate function

MINHASH( <k> , [ DISTINCT ] expr+ )

MINHASH( <k> , * )

Window function

MINHASH( <k> , [ DISTINCT ] expr+ ) OVER ( [ PARTITION BY <expr1> ] )

MINHASH( <k> , * ) OVER ( [ PARTITION BY <expr1> ] )

Parameters

NameRequiredDescription
krequiredThe number of hash functions to create. The larger the value, the better the approximation; however, this value has a linear impact on the computation time for estimating similarity using APPROXIMATE_SIMILARITY. The suggested value is 100. The maximum value is 1024.
exprrequiredOne or more expressions (typically column names) that determine the values to hash.
*requiredHash all columns in the input rows.

Usage notes

See also

Referenced by