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

Numeric filter values passed as strings in DuckDB dialect #9281

Open
igorlukanin opened this issue Feb 26, 2025 · 1 comment
Open

Numeric filter values passed as strings in DuckDB dialect #9281

igorlukanin opened this issue Feb 26, 2025 · 1 comment
Labels
bug Something isn't working driver:duckdb help wanted Community contributions are welcome.

Comments

@igorlukanin
Copy link
Member

Describe the bug
For a filter on a numeric member, the generated SQL for DuckDB would contain the filter value as VARCHAR. That would not be correct SQL for DuckDB, and it would not run.

For other dialects, Cube is able to cast numeric filter values to correct numeric types.

To Reproduce
Steps to reproduce the behavior:

  1. Use DuckDB, build a query with a filter on a numeric member
  2. Run it, it will fail
  3. Check the generated SQL, it will contain the filter value as VARCHAR
Error: Binder Error: Cannot compare values of type BIGINT and type VARCHAR - an explicit cast is required
...WHERE ("base_orders__count" >= ?)...

Expected behavior
Cube generates SQL where the filter value is cast to a proper numeric type.

Version:
v1.2.0

Additional context
Compare to SQ generated for BigQuery and Athena:

...WHERE ("base_orders__count" >= CAST(? AS FLOAT64))...
...WHERE ("base_orders__count" >= CAST(? AS DOUBLE))...
@igorlukanin igorlukanin added bug Something isn't working driver:duckdb help wanted Community contributions are welcome. labels Feb 26, 2025
Copy link

If you are interested in working on this issue, please go ahead and provide PR for that.
We'd be happy to review it and merge it.
If this is the first time you are contributing a Pull Request to Cube, please check our contribution guidelines.
You can also post any questions while contributing in the #contributors channel in the Cube Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working driver:duckdb help wanted Community contributions are welcome.
Projects
None yet
Development

No branches or pull requests

1 participant