[
https://issues.apache.org/jira/browse/DRILL-8013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17524108#comment-17524108
]
ASF GitHub Bot commented on DRILL-8013:
---------------------------------------
vvysotskyi opened a new pull request, #2521:
URL: https://github.com/apache/drill/pull/2521
# [DRILL-8013](https://issues.apache.org/jira/browse/DRILL-8013): Drill
attempts to push "$SUM0" to JDBC storage plugin for AVG
## Description
Added `DrillCalciteSqlSumEmptyIsZeroAggFunctionWrapper` that extends
`SqlSumEmptyIsZeroAggFunction` and wraps `SqlSumEmptyIsZeroAggFunction` only in
order to enable functionality added in CALCITE-1174 (`When generating SQL,
translate SUM0(x) to COALESCE(SUM(x), 0)`)
## Documentation
NA
## Testing
Added unit test.
> Drill attempts to push "$SUM0" to JDBC storage plugin for AVG
> -------------------------------------------------------------
>
> Key: DRILL-8013
> URL: https://issues.apache.org/jira/browse/DRILL-8013
> Project: Apache Drill
> Issue Type: Bug
> Components: Storage - JDBC
> Affects Versions: 1.19.0
> Reporter: James Turton
> Assignee: Vova Vysotskyi
> Priority: Major
>
> When running a query that includes the AVG aggregate against a JDBC data
> source, Drill transforms AVG into SUM0 / COUNT. COUNT is pushed down to the
> source correctly but SUM0 is pushed down as "$SUM0" instead of SUM, causing a
> syntax error. More info is visible at the link below.
>
> http://mail-archives.apache.org/mod_mbox/drill-user/202110.mbox/%3ccags_q5dguiisdhk7lzxeytup322+ttxlayskdxhimj0g-qs...@mail.gmail.com%3E
--
This message was sent by Atlassian Jira
(v8.20.1#820001)