You are viewing documentation about an older version (1.16.0). View latest version

snowflake.snowpark.functions.array_intersection

snowflake.snowpark.functions.array_intersection(array1: Union[Column, str], array2: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L3678-L3702)

Returns an array that contains the matching elements in the two input arrays.

The function is NULL-safe, meaning it treats NULLs as known values for comparing equality.

Parameters:
  • array1 – An ARRAY that contains elements to be compared.

  • array2 – An ARRAY that contains elements to be compared.

Example::
>>> from snowflake.snowpark import Row
>>> df = session.create_dataframe([Row([1, 2], [1, 3])], schema=["a", "b"])
>>> df.select(array_intersection("a", "b").alias("result")).show()
------------
|"RESULT"  |
------------
|[         |
|  1       |
|]         |
------------
Copy
Language: English