> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# barrier (Python)

> Prevent filter pushdown and control predicate evaluation order in complex spatial joins.

Prevent filter pushdown and control predicate evaluation order in complex spatial joins.
This function creates an optimization barrier by evaluating boolean expressions at runtime.

Example:

```python theme={"system"}
df.where(barrier('rating > 4.0 AND stars >= 4',
                'rating', col('r.rating'),
                'stars', col('h.stars')))
```

## Signature

```python theme={"system"}
from sedona.spark.sql.st_functions import barrier

barrier(expression: ColumnOrName, *args) -> Column
```

## Parameters

<ParamField path="expression" type="ColumnOrName" required>
  Boolean expression string to evaluate
</ParamField>

<ParamField path="args">
  Variable name and value pairs (var\_name1, var\_value1, var\_name2, var\_value2, ...)
</ParamField>

## Returns

<ResponseField name="return" type="Column">
  Boolean result of the expression evaluation
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.