You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2021/06/09 08:57:00 UTC

[jira] [Commented] (IGNITE-14443) Calcite integration. SqlFirstLastValueAggFunction support

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

Aleksey Plekhanov commented on IGNITE-14443:
--------------------------------------------

{{FIRST_VALUE}}/\{{LAST_VALUE}} aggregates are windows functions and can't be used without windows support. I've tried to make it work without windows (in attached PR) but looks like it makes little sense since it's hard to influence the underlying input ordering and hard to predict what entries {{FIRST_VALUE}}/\{{LAST_VALUE}} will return (especially in a distributed environment) without knowledge of the internal implementation. For example, in query:
{code:java}
select first_value(name) from (select * from person order by id)
{code}
Clause {{ORDER BY id}} is eliminated by the optimizer and there are no guarantees that first by id name will be returned. To ensure ordering {{OVER (ORDER BY id)}} clause can be used when windows function will be supported. 

I think without windows support {{ANY_VALUE}} aggregate can be used in most cases.

> Calcite integration. SqlFirstLastValueAggFunction support
> ---------------------------------------------------------
>
>                 Key: IGNITE-14443
>                 URL: https://issues.apache.org/jira/browse/IGNITE-14443
>             Project: Ignite
>          Issue Type: New Feature
>          Components: sql
>    Affects Versions: 3.0.0-alpha1
>            Reporter: Pavel Vinokurov
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We need to support aggregation functions, especially SqlFirstLastValueAggFunction that allows simplify and optimize the wide range of sql queries.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)