# GX validation Result returns broken query "unexpected\_index\_query"

**URL:** https://discourse.greatexpectations.io/t/gx-validation-result-returns-broken-query-unexpected-index-query/2039
**Category:** GX Core Support
**Tags:** databricks
**Created:** [December 20, 2024, 12:44pm UTC](https://discourse.greatexpectations.io/t/gx-validation-result-returns-broken-query-unexpected-index-query/2039 "2024-12-20T12:44:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jyoti\_Thakkar](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@Jyoti\_Thakkar](https://discourse.greatexpectations.io/u/Jyoti_Thakkar)
#### Post date: [December 20, 2024, 12:44pm UTC](https://discourse.greatexpectations.io/t/gx-validation-result-returns-broken-query-unexpected-index-query/2039/1 "2024-12-20T12:44:20Z")

</div>

Using GX 1.2.3 version

we have set result\_format as “COMPLETE” and unexpected\_index\_query to true, we want to use unexpected\_index\_query to get the error records from dataframe. It seems that it is returning broken query and escaping double quotes.

Example : return unexpected index query by GX : df.filter(F.expr(NOT(city IS NOT NULL)))

and when i execute this query it is giving error syntax error. Invalid syntax

**Expected behavior**  
Executing Query should result into getting error records from dataframe

---

<div class="post-metadata">

### Author: ![adeola](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@adeola](https://discourse.greatexpectations.io/u/adeola)
#### Post date: [January 28, 2025, 5:44pm UTC](https://discourse.greatexpectations.io/t/gx-validation-result-returns-broken-query-unexpected-index-query/2039/2 "2025-01-28T17:44:39Z")

</div>

Hi @Jyoti_Thakkar, could you share the query you’re receiving? We’re aware that regex and string values aren’t being quoted automatically and may need manual adjustments to ensure they’re properly quoted (we’re trying to see how we can prioritize adjusting this) However, aside from strings and regex, the rest of the query should be accurate.

---

<div class="post-metadata">

### Author: ![Jyoti\_Thakkar](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@Jyoti\_Thakkar](https://discourse.greatexpectations.io/u/Jyoti_Thakkar)
#### Post date: [April 11, 2025, 6:51am UTC](https://discourse.greatexpectations.io/t/gx-validation-result-returns-broken-query-unexpected-index-query/2039/3 "2025-04-11T06:51:25Z")

</div>

> [@Jyoti\_Thakkar](#):
>
> df.filter(F.expr(NOT(city IS NOT NULL)))

df.filter(F.expr(NOT(city IS NOT NULL)))

---

<div class="post-metadata">

### Author: ![Jyoti\_Thakkar](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@Jyoti\_Thakkar](https://discourse.greatexpectations.io/u/Jyoti_Thakkar)
#### Post date: [October 27, 2025, 8:26am UTC](https://discourse.greatexpectations.io/t/gx-validation-result-returns-broken-query-unexpected-index-query/2039/4 "2025-10-27T08:26:11Z")

</div>

df.filter(F.expr(NOT(city IS NOT NULL)))

Any update on above query ?
