[
https://issues.apache.org/jira/browse/CALCITE-5270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-5270:
---------------------------------
Description:
JDBC adapter should not generate {{FILTER (WHERE)}} in the Firebolt dialect,
because Firebolt does not support filter clauses in aggregate functions. For
example, {{COUNT(*) FILTER (WHERE a = 2)}} throws
{code:java}
Invalid operation error: SQL query not valid.
SQL query:
==========
SELECT COUNT FILTER (WHERE a = 2) FROM <table>
^=== ERROR HERE!
==========
{code}
The fix is for {{supportsAggregateFunctionFilter}} to return false. The
[dialect
implementation|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/dialect/FireboltSqlDialect.java]
should override the {{supportsAggregateFunctionFilter}} method it currently
inherits from the base [{{SqlDialect}}
class|https://github.com/apache/calcite/blob/b9c2099ea92a575084b55a206efc5dd341c0df62/core/src/main/java/org/apache/calcite/sql/SqlDialect.java#L758].
See [Firebolt SQL
reference|https://docs.firebolt.io/sql-reference/functions-reference/].
was:
Firebolt does not support filter clauses in aggregate functions. e.g.
{{COUNT(\*) FILTER (WHERE a = 2)}} throws
{code:java}
Invalid operation error: SQL query not valid.
SQL query:
==========
SELECT COUNT FILTER (WHERE a = 2) FROM <table>
^=== ERROR HERE!
==========
{code}
The [dialect
implementation|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/dialect/FireboltSqlDialect.java]
should override the {{supportsAggregateFunctionFilter}} method it currently
inherits from the base [{{SqlDialect}}
class|https://github.com/apache/calcite/blob/b9c2099ea92a575084b55a206efc5dd341c0df62/core/src/main/java/org/apache/calcite/sql/SqlDialect.java#L758]
Firebolt SQL reference:
[https://docs.firebolt.io/sql-reference/functions-reference/]
> JDBC adapter should not generate FILTER (WHERE) in Firebolt dialect
> -------------------------------------------------------------------
>
> Key: CALCITE-5270
> URL: https://issues.apache.org/jira/browse/CALCITE-5270
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.31.0
> Reporter: TJ Banghart
> Assignee: TJ Banghart
> Priority: Trivial
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> JDBC adapter should not generate {{FILTER (WHERE)}} in the Firebolt dialect,
> because Firebolt does not support filter clauses in aggregate functions. For
> example, {{COUNT(*) FILTER (WHERE a = 2)}} throws
> {code:java}
> Invalid operation error: SQL query not valid.
> SQL query:
> ==========
> SELECT COUNT FILTER (WHERE a = 2) FROM <table>
> ^=== ERROR HERE!
> ==========
> {code}
> The fix is for {{supportsAggregateFunctionFilter}} to return false. The
> [dialect
> implementation|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/dialect/FireboltSqlDialect.java]
> should override the {{supportsAggregateFunctionFilter}} method it currently
> inherits from the base [{{SqlDialect}}
> class|https://github.com/apache/calcite/blob/b9c2099ea92a575084b55a206efc5dd341c0df62/core/src/main/java/org/apache/calcite/sql/SqlDialect.java#L758].
> See [Firebolt SQL
> reference|https://docs.firebolt.io/sql-reference/functions-reference/].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)