Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Arithmetic Operations in SQL SELECT Clause During SQL to DSL Conversion #6221

Closed
xinghui opened this issue Aug 9, 2024 · 2 comments
Assignees
Labels
customer Feature asks from customer sql Support for SQL databases (ie. MySQL)

Comments

@xinghui
Copy link

xinghui commented Aug 9, 2024

Issue Description:

I'm currently working on a feature that involves converting SQL to DSL using Cadence. However, I noticed that the following SQL query is not supported:

SELECT field2 + field3 FROM index234
When attempting to execute this query, I receive the following error:

esql: *sqlparser.AliasedExpr not supported in select body

It would be highly beneficial if Cadence could support arithmetic operations (such as addition, subtraction, multiplication, and division) within the SELECT clause of SQL queries. This enhancement would greatly expand the flexibility and functionality of SQL to DSL conversions.

Thank you for considering this feature request!

@demirkayaender
Copy link
Contributor

Where do you use this query in Cadence?

@ibarrajo ibarrajo added customer Feature asks from customer sql Support for SQL databases (ie. MySQL) labels Sep 19, 2024
@ibarrajo
Copy link
Contributor

Hi @xinghui !

Cadence uses a database (usually Cassandra or MySQL) internally as the persistance layer for workflows. I'm not aware of a use case were Cadence ingests and processes SQL queries. We do surface Elastic Search syntax for use in advanced visibility queries. It uses https://github.com/xwb1989/sqlparser within the ESQL module:
https://github.com/uber/cadence/blob/811ffe70505f8410473471f0465cac1cf706d869/common/elasticsearch/esql/README.md

From the docs, it looks like the query should be supported, could you provide an example of your query that caused the error? Because from the error it sounds like you might be aliasing a field in the select statement

@ibarrajo ibarrajo self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer Feature asks from customer sql Support for SQL databases (ie. MySQL)
Projects
None yet
Development

No branches or pull requests

3 participants