Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

SQL-API: Column concatenation failing #8430

Closed
ZiggiZagga opened this issue Jul 3, 2024 · 3 comments
Closed

SQL-API: Column concatenation failing #8430

ZiggiZagga opened this issue Jul 3, 2024 · 3 comments
Assignees
Labels
api:sql Issues related to SQL API question The issue is a question. Please use Stack Overflow for questions.

Comments

@ZiggiZagga
Copy link

Failed SQL
select 'Some Prefix'||some_column from some_cube

Error
Error during rewrite: Can't detect Cube query and it may be not supported yet.

Logical Plan
Error during planning

Version:
v0.35.54

Additional context
This query works:
select some_column||'Some Suffix' from some_cube

@igorlukanin
Copy link
Member

igorlukanin commented Jul 5, 2024

Hi @ZiggiZagga 👋

I see that you have CUBESQL_SQL_PUSH_DOWN set to false (or not set at all). It means that Cube can only use post-processing (and push-down queries are not enabled). You can read more about this terminology on the docs: https://cube.dev/docs/product/apis-integrations/sql-api#fundamentals, https://cube.dev/docs/product/apis-integrations/sql-api/query-format#post-processing-and-pushdown

To make this query work with post-processing, you can rewrite is as follows:

Screenshot 2024-07-05 at 17 05 40

Alternatively, you can set CUBESQL_SQL_PUSH_DOWN to true and run a query like this:

Screenshot 2024-07-05 at 17 02 15

There are slight differences in query semantics between these two variants, you can read more in the blog: https://cube.dev/blog/query-push-down-in-cubes-semantic-layer

@igorlukanin igorlukanin added question The issue is a question. Please use Stack Overflow for questions. api:sql Issues related to SQL API labels Jul 5, 2024
@igorlukanin igorlukanin self-assigned this Jul 5, 2024
@ZiggiZagga
Copy link
Author

Hi @igorlukanin,

Thank you! I set CUBESQL_SQL_PUSH_DOWN to true, and the query now works. Unfortunately, I can't use the Cube SQL API for now because I am having problems with CTEs in LEFT JOIN or IN conditions. Issues have already been filed (#8422 and #8413). I will keep an eye on the progress of these issues and hopefully consider using the SQL API again in the near future.

@ZiggiZagga
Copy link
Author

Works when CUBESQL_SQL_PUSH_DOWN is set to true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:sql Issues related to SQL API question The issue is a question. Please use Stack Overflow for questions.
Projects
None yet
Development

No branches or pull requests

2 participants