rlike

calista.core.functions.rlike(col_name: str, pattern: str) ConditionExpression

Create a condition to check if a column value matches a regex.

Args:

col_name (str): The name of the column. pattern (str): Regex pattern to apply.

Returns:

ConditionExpression: The condition to check if a column value matches a regex.

Example

>>> from calista import CalistaEngine
>>> from calista.core.functions import rlike
>>>
>>> calista_table = CalistaEngine(engine = "spark").load_from_dict({"NAME": ["1", None, "john", None]})
>>> my_rule = rlike(col_name="NAME", pattern="^[a-zA-Z ]$")
>>> print(calista_table.analyze(rule_name="My Rule Name", condition=my_rule))
rule_name : My Rule Name
total_row_count : 4
valid_row_count : 1
valid_row_count_pct : 25.0
timestamp : 2024-01-01 00:00:00.000000