# \[PARSE\_SYNTAX\_ERROR\] for ExpectColumnValuesToBeUnique when column name has space in it (PySpark)

**URL:** <https://discourse.greatexpectations.io/t/parse-syntax-error-for-expectcolumnvaluestobeunique-when-column-name-has-space-in-it-pyspark/2402>\
**Category:** GX Core Support\
**Tags:** help-wanted\
**Created:** [October 2, 2026, 2:26am UTC](https://discourse.greatexpectations.io/t/parse-syntax-error-for-expectcolumnvaluestobeunique-when-column-name-has-space-in-it-pyspark/2402 "2026-10-02T02:26:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KK1259](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@KK1259](https://discourse.greatexpectations.io/u/KK1259)\
**Post date:** [October 2, 2026, 2:26am UTC](https://discourse.greatexpectations.io/t/parse-syntax-error-for-expectcolumnvaluestobeunique-when-column-name-has-space-in-it-pyspark/2402/1 "2026-10-02T02:26:46Z")

</div>

**GX Version** = 1.23.2

**Expectation** = ExpectColumnValuesToBeUnique

**Data Source** = Pyspark (context.data\_sources.add\_spark(name=data\_source\_name))

**Asset** = add\_dataframe\_asset

**Column** = “Incident Number”

**Error** = [PARSE\_SYNTAX\_ERROR] Syntax error at or near ‘IS’. SQLSTATE: 42601 (line 1, pos 16)

> \*\*  
> expect\_column\_values\_to\_be\_unique raised an exception:  
> `[PARSE_SYNTAX_ERROR] Syntax error at or near 'IS'. SQLSTATE: 42601 (line 1, pos 16) == SQL == Incident Number IS NOT NULL ----------------^^^`\*\*
> 
> [Show exception traceback…](#section-3-content-block-2-cell-1-2-content-2-collapse-body-cb4f1f59-fa17-4f78-b9eb-c6714d66f533)
> 
> `Traceback (most recent call last):`  
> `File "/usr/local/lib/python3.12/dist-packages/great_expectations/execution_engine/execution_engine.py", line 577, in _process_direct_and_bundled_metric_computation_configurations`  
> `metric_computation_configuration.metric_fn( # type: ignore[misc] # F not callable`  
> `File "/usr/local/lib/python3.12/dist-packages/great_expectations/expectations/metrics/map_metric_provider/map_condition_auxilliary_methods.py", line 633, in _spark_map_condition_unexpected_count_value`  
> `df = execution_engine.get_domain_records(domain_kwargs=domain_kwargs)`  
> `^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`  
> `File "/usr/local/lib/python3.12/dist-packages/great_expectations/execution_engine/sparkdf_execution_engine.py", line 740, in get_domain_records`  
> `data = data.filter(filter_condition.condition)`  
> `^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`  
> `File "/usr/local/lib/python3.12/dist-packages/pyspark/sql/classic/dataframe.py", line 1010, in filter`  
> `jdf = self._jdf.filter(condition)`  
> `^^^^^^^^^^^^^^^^^^^^^^^^^^^`  
> `File "/usr/local/lib/python3.12/dist-packages/py4j/java_gateway.py", line 1362, in __call__ `  
> `return_value = get_return_value(`  
> `^^^^^^^^^^^^^^^^^`  
> `File "/usr/local/lib/python3.12/dist-packages/pyspark/errors/exceptions/captured.py", line 288, in deco`  
> `raise converted from None`  
> `pyspark.errors.exceptions.captured.ParseException:`  
> `[PARSE_SYNTAX_ERROR] Syntax error at or near 'IS'. SQLSTATE: 42601 (line 1, pos 16)`
> 
> `== SQL ==`  
> `Incident Number IS NOT NULL`  
> `----------------^^^`
> 
> `The above exception was the direct cause of the following exception:`
> 
> `Traceback (most recent call last):`  
> `File "/usr/local/lib/python3.12/dist-packages/great_expectations/validator/validation_graph.py", line 290, in _resolve`  
> `self._execution_engine.resolve_metrics(`  
> `File "/usr/local/lib/python3.12/dist-packages/great_expectations/execution_engine/execution_engine.py", line 294, in resolve_metrics`  
> `return self._process_direct_and_bundled_metric_computation_configurations(`  
> `^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`  
> `File "/usr/local/lib/python3.12/dist-packages/great_expectations/execution_engine/execution_engine.py", line 582, in _process_direct_and_bundled_metric_computation_configurations`  
> `raise gx_exceptions.MetricResolutionError(`  
> `great_expectations.exceptions.exceptions.MetricResolutionError:`  
> `[PARSE_SYNTAX_ERROR] Syntax error at or near 'IS'. SQLSTATE: 42601 (line 1, pos 16)`
> 
> `== SQL ==`  
> `Incident Number IS NOT NULL`  
> `----------------^^^`

**Note** : When the space is removed from the column name this expectation works fine

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/greatexpectations/original/1X/0c0abc8907c9915ebae72e91db924a5a15c64fd8.png)

---

<div class="post-metadata">

**Author:** ![joshstauffer](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@joshstauffer](https://discourse.greatexpectations.io/u/joshstauffer)\
**Post date:** [October 2, 2026, 9:26am UTC](https://discourse.greatexpectations.io/t/parse-syntax-error-for-expectcolumnvaluestobeunique-when-column-name-has-space-in-it-pyspark/2402/2 "2026-10-02T09:26:33Z")

</div>

Hi @KK1259, thanks for the bug report. This is a GX bug - i’ve filed [an issue](https://github.com/fivetran/great_expectations/issues/12283) to track the fix. As a workaround until that lands, you can rename your column to a plain identifier prior to validation:

```python
 df = df.withColumnRenamed("Incident Number", "Incident_Number")

```

The bug also affects identifiers with `-`. Thanks again for reporting this bug!
