[ 
https://issues.apache.org/jira/browse/CALCITE-5280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609241#comment-17609241
 ] 

Julian Hyde commented on CALCITE-5280:
--------------------------------------

I believe the flaw is in SQL's specification, not the particular 
implementation. Before you can resolve overloaded functions, you have to deduce 
types, but before you deduce types, you have to know whether a query is an 
aggregate query, which means finding whether it contains aggregate functions. 
And therefore you have to identify aggregate functions on the basis of name 
alone, not on their overloads.

It was foolish for the spatial SQL folks to define a function that has both 
aggregate and non-aggregate variants. In the short term, let's put an end to 
that foolery, and rename either the aggregate {{ST_Union}} or the non-aggregate 
{{ST_Union}} to something else.

Yes, you can also log a feature request to make the validation and function 
resolution process more robust in the presence of overloaded aggregate 
functions. (Maybe the {{ST_Union}} aggregate function would not cause a query 
to be an aggregate query the way the {{SUM}} aggregate function does: while 
"{{SELECT SUM\(x) FROM t}}" is an aggregate query, "{{SELECT ST_Union\(x) FROM 
t}}" is not; you'd have to write "{{SELECT ST_Union\(x) FROM t GROUP BY ()}}".) 
But we'd do that feature independently from spatial work, and considering the 
bigger impact.

> Implement geometry aggregate functions
> --------------------------------------
>
>                 Key: CALCITE-5280
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5280
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Bertil Chapuis
>            Assignee: Bertil Chapuis
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Geometry aggregate functions (ST_Accum, ST_Collect, and ST_Union) are 
> currently missing in Calcite. Using an AggregateFunctionImpl looks be pretty 
> straightforward, but many aggregate function implement SqlAggFunction 
> directly.
> [~julianhyde] What would be the best way to implement them?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to