Skip to main content

ilike

Returns true if str matches pattern with escape case-insensitively, null if any arguments are null, false otherwise. The default escape character is the ''.

For the corresponding Databricks SQL function, see ilike operator.

Syntax​

Python
from pyspark.sql import functions as dbf

dbf.ilike(str=<str>, pattern=<pattern>, escapeChar=<escapeChar>)

Parameters​

Parameter

Type

Description

str

pyspark.sql.Column or str

A string.

pattern

pyspark.sql.Column or str

A string pattern where _ matches any one character and % matches zero or more characters.

escapeChar

pyspark.sql.Column (optional)

An escape character. The default escape character is the ''.

Parameter

Type

Description

str

pyspark.sql.Column or str

A string.

pattern

pyspark.sql.Column or str

A string pattern where _ matches any one character and % matches zero or more characters.

escapeChar

pyspark.sql.Column (optional)

An escape character. The default escape character is the ''.

Examples​

Python
from pyspark.sql import functions as dbf
df = spark.createDataFrame([("Spark", "_park")], ['a', 'b'])
df.select(dbf.ilike(df.a, df.b).alias('r')).collect()
Output
[Row(r=True)]