You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "alexanderkoek (via GitHub)" <gi...@apache.org> on 2026/01/07 17:44:08 UTC
[I] query with json_value using returing clause no longer works [superset]
alexanderkoek opened a new issue, #36954:
URL: https://github.com/apache/superset/issues/36954
### Bug description
I have a dataset defined that extracts the data from a json structure in druid with an unnest operation. This statement used to work in superset version 4, but now it fails with the error message:
**Unable to parse SQL**: Error parsing near 'returning' at line 2:62
json_value(Histogram, concat('$[''',duration,''']') returning BIGINT) as aantal,
However, if I submit my query directly to druid, it delivers the data just fine.
If I leave the "returning BIGINT" clause out, the query also works in superset, but now the data type is incorrectly set to STRING.
The only way to get now the correct data type is by surrounding the json_value function with an explicit cast.
Why is the "returning BIGINT" clause in json_value not working any more?
### Screenshots/recordings
_No response_
### Superset version
5.0.0
### Python version
3.10
### Node version
18 or greater
### Browser
Chrome
### Additional context
2026-01-07 13:22:31,714:WARNING:superset.views.error_handling:SupersetErrorException
Traceback (most recent call last):
File "/app/superset/sql/parse.py", line 267, in _parse
return sqlglot.parse(script, dialect=dialect)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/__init__.py", line 102, in parse
return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/dialects/dialect.py", line 991, in parse
return self.parser(**opts).parse(self.tokenize(sql), sql)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1507, in parse
return self._parse(
^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1576, in _parse
expressions.append(parse_method(self))
^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1817, in _parse_statement
expression = self._parse_set_operations(expression) if expression else self._parse_select()
^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 3118, in _parse_select
projections = self._parse_projections()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 3058, in _parse_projections
return self._parse_expressions()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 6997, in _parse_expressions
return self._parse_csv(self._parse_expression)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 6956, in _parse_csv
parse_result = parse_method()
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4636, in _parse_expression
return self._parse_alias(self._parse_assignment())
^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4639, in _parse_assignment
this = self._parse_disjunction()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4660, in _parse_disjunction
return self._parse_tokens(self._parse_conjunction, self.DISJUNCTION)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 6965, in _parse_tokens
this = parse_method()
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4663, in _parse_conjunction
return self._parse_tokens(self._parse_equality, self.CONJUNCTION)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 6965, in _parse_tokens
this = parse_method()
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4666, in _parse_equality
return self._parse_tokens(self._parse_comparison, self.EQUALITY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 6965, in _parse_tokens
this = parse_method()
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4669, in _parse_comparison
return self._parse_tokens(self._parse_range, self.COMPARISON)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 6965, in _parse_tokens
this = parse_method()
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4672, in _parse_range
this = this or self._parse_bitwise()
^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4828, in _parse_bitwise
this = self._parse_term()
^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4862, in _parse_term
this = self._parse_factor()
^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4885, in _parse_factor
this = parse_method()
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4910, in _parse_unary
return self._parse_at_time_zone(self._parse_type())
^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 4962, in _parse_type
this = self._parse_column()
^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 5255, in _parse_column
this = self._parse_column_reference()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 5264, in _parse_column_reference
this = self._parse_field()
^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 5461, in _parse_field
field = self._parse_primary() or self._parse_function(
^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 5484, in _parse_function
func = self._parse_function_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 5587, in _parse_function_call
self._match_r_paren(this)
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 7768, in _match_r_paren
self.raise_error("Expecting )")
File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1620, in raise_error
raise error
sqlglot.errors.ParseError: Expecting ). Line 2, Col: 62.
llocationApproachId, SignaalGroep, duration,
json_value(Histogram, concat('$[''',duration,''']') [4mreturning[0m BIGINT) as aantal, AantalVertrek,
safe_divide(json_value(Histogram, concat('$[''',duration,''']')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
return f(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/views/base_api.py", line 120, in wraps
duration, response = time_function(f, self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/utils/core.py", line 1369, in time_function
response = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/utils/log.py", line 304, in wrapper
value = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/app/superset/charts/data/api.py", line 260, in data
return self._get_data_response(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/utils/log.py", line 304, in wrapper
value = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/app/superset/charts/data/api.py", line 423, in _get_data_response
result = command.run(force_cached=force_cached)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/commands/chart/data/get_data_command.py", line 45, in run
payload = self._query_context.get_payload(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/common/query_context.py", line 102, in get_payload
return self._processor.get_payload(cache_query_context, force_cached)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/common/query_context_processor.py", line 752, in get_payload
query_results = [
^
File "/app/superset/common/query_context_processor.py", line 753, in <listcomp>
get_query_results(
File "/app/superset/common/query_actions.py", line 227, in get_query_results
return result_func(query_context, query_obj, force_cached)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/common/query_actions.py", line 103, in _get_full
payload = query_context.get_df_payload(query_obj, force_cached=force_cached)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/common/query_context.py", line 123, in get_df_payload
return self._processor.get_df_payload(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/common/query_context_processor.py", line 162, in get_df_payload
query_result = self.get_query_result(query_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/common/query_context_processor.py", line 265, in get_query_result
result = query_context.datasource.query(query_object.to_dict())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/connectors/sqla/models.py", line 1716, in query
query_str_ext = self.get_query_str_extended(query_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/models/helpers.py", line 887, in get_query_str_extended
sqlaq = self.get_sqla_query(**query_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/models/helpers.py", line 1742, in get_sqla_query
tbl, cte = self.get_from_clause(template_processor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/connectors/sqla/models.py", line 1482, in get_from_clause
return super().get_from_clause(template_processor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/models/helpers.py", line 1090, in get_from_clause
from_sql = self.get_rendered_sql(template_processor) + "\n"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/models/helpers.py", line 1069, in get_rendered_sql
script = SQLScript(sql, engine=self.db_engine_spec.engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/sql/parse.py", line 670, in __init__
self.statements = statement_class.split_script(script, engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/sql/parse.py", line 327, in split_script
ast = cls._parse(remainder, engine)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/superset/sql/parse.py", line 270, in _parse
raise SupersetParseError(
superset.exceptions.SupersetParseError: Error parsing near 'returning' at line 2:62
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "kaya-abdullah (via GitHub)" <gi...@apache.org>.
kaya-abdullah commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-6088383000
Opened the upstream issue for the Postgres side: tobymao/sqlglot#8579
It has a minimal repro and the approach I'd take (keep the jsonpath as written, so '$.a' doesn't come back as 'a'). I have the patch ready and will open the PR there once the maintainers are fine with it. When it lands I can follow up here with a Postgres regression test and the sqlglot bump.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "alexanderkoek (via GitHub)" <gi...@apache.org>.
alexanderkoek commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-3720035653
Both postgresql and druid have a standard [ RETURNING data_type ] clause for the json_value function
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "kaya-abdullah (via GitHub)" <gi...@apache.org>.
kaya-abdullah commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-6072247045
I looked into this on current master, since it came up as a candidate for closing.
**Druid works on master.** sqlglot parses `JSON_VALUE ... RETURNING` for the Druid dialect since 30.12.0 (tobymao/sqlglot#7771). The `7.0` branch requires `sqlglot>=30.17.0` and master `>=30.19.0`, so the query from the report goes through `SQLScript(sql, "druid")` without errors:
```sql
SELECT JSON_VALUE(Histogram, CONCAT('$[''', duration, ''']') RETURNING BIGINT) AS aantal FROM t
```
No released version has it yet: 6.x still pins `sqlglot<29`, so the fix ships with 7.0. With sqlglot 30.11.0 the same call fails with the error from the report.
**Postgres still fails** on master with `Error parsing near 'returning'`. Postgres 17 accepts the clause, but sqlglot's Postgres dialect does not register `JSON_VALUE` yet, so that part needs an upstream change in sqlglot.
I can open a small PR here with a regression test for the Druid case, similar to #40142, so a future sqlglot upgrade cannot break it silently. Since the reported case is Druid, that PR could close this issue, with the Postgres gap left to sqlglot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-3930586397
@alexanderkoek curious what you think of Dosu's response. CC @betodealmeida to see if he has any ideas as well, but this one might be out of our hands, and need to be closed as a "won't fix" and address it upstream and/or add some documentation to help others if/when they run into this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-5123541502
Sounds like this really is a sqlglot dialect gap rather than something we can special-case cleanly, the `RETURNING` clause on `json_value` isn't something our SQL validator understands for either Druid or Postgres. Given nothing new since I asked @betodealmeida, I'm inclined to close this as a parser limitation to raise upstream with sqlglot rather than something Superset can fix directly.
Any interest in opening that PR, anyone? Tempted to, perhaps, once I get some other ones merged there that I'm currently working through.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-6111742710
Thanks @kaya-abdullah, nice work chasing this all the way upstream. Looks like the Postgres side already landed on sqlglot `main` too (tobymao/sqlglot#8579), so once that's in a release it's just a dep bump on our end. With #45131 merged and the Druid case working on `master` (so 7.0 onward), I'm going to close this one as resolved.
The Postgres regression test you offered would be very welcome once that sqlglot release is out, just reference this issue from the PR. Happy to reopen if anyone's still hitting it after that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #36954: query with json_value using returing clause no longer works
URL: https://github.com/apache/superset/issues/36954
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-3800991091
<!-- Answer -->
The root cause is that Superset's SQL parser (sqlglot) doesn't recognize the `RETURNING` clause in the `json_value` function, so it throws a parse error before the query reaches Druid or PostgreSQL. This limitation appeared after Superset switched to sqlglot for SQL parsing, and similar issues have been reported for other dialect-specific SQL extensions and JSON function clauses (like Trino's `OMIT QUOTES` or TimescaleDB hyperfunctions) [example](https://github.com/apache/superset/issues/32028) [example](https://github.com/apache/superset/issues/31768).
Current workarounds are: use an explicit `CAST` instead of the `RETURNING` clause, run queries in SQLLab (where parsing is less strict), or ask your DBAs to create a view that avoids the problematic syntax [example](https://github.com/apache/superset/discussions/33436).
A long-term fix would require sqlglot to add support for this syntax. If you want this resolved natively, you may want to track or upvote a feature request in the sqlglot repository.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6befaa3c-df3f-4657-9009-8ca2bf0cbcca?feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=The%20root%20cause%20is%20that%20Superset%27s%20SQL%20parser%20%28sqlglot%29%20doesn%27t%20recognize%20the%20%60RETURNING%60%20clause%20in%20the%20%60json_value%60%20function%2C%20so%20it%20throws%20a%20parse%20error%20before%20the%20query%20reaches%20Druid%20or%20PostgreSQL.%20This%20limitation%20appeared%20after%20Superset%20switched%20to%20sqlglot%20for%20SQL%20parsing%2C%20and%20similar%20issues%20have%20been%20reported%20for%20other%20dialect-specific%20SQL%20extensions%20and%20JSON%20function%20clauses%20%28like%20Trino%27s%20%60OMIT%20QUOTES%60%20or%20TimescaleDB%20hyperfunctions%29%20%5Bexample%5D%28https%3A//github.com/apache/superset/issues/32028%29%20%5Bexample%5D%28https%3A//github.com/apache/superset/issues/31768%29.%0A%0ACurrent%20wor
karounds%20are%3A%20use%20an%20explicit%20%60CAST%60%20instead%20of%20the%20%60RETURNING%60%20clause%2C%20run%20queries%20in%20SQLLab%20%28where%20parsing%20is%20less%20strict%29%2C%20or%20ask%20your%20DBAs%20to%20create%20a%20view%20that%20avoids%20the%20problematic%20syntax%20%5Bexample%5D%28https%3A//github.com/apache/superset/discussions/33436%29.%0A%0AA%20long-term%20fix%20would%20require%20sqlglot%20to%20add%20support%20for%20this%20syntax.%20If%20you%20want%20this%20resolved%20natively%2C%20you%20may%20want%20to%20track%20or%20upvote%20a%20feature%20request%20in%20the%20sqlglot%20repository.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36954)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] query with json_value using returing clause no longer works [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #36954:
URL: https://github.com/apache/superset/issues/36954#issuecomment-3800977077
@dosu any ideas?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org