Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns true if str matches pattern with escape, null if any arguments are null, false otherwise. The default escape character is the ''.
For the corresponding Databricks SQL function, see like operator.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.like(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 ''. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([("Spark", "_park")], ['a', 'b'])
df.select(dbf.like(df.a, df.b).alias('r')).collect()
[Row(r=True)]