You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2019/01/23 13:56:00 UTC

[jira] [Comment Edited] (CALCITE-2799) Allow alias in having clause for aggregate functions

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

Vladimir Sitnikov edited comment on CALCITE-2799 at 1/23/19 1:55 PM:
---------------------------------------------------------------------

[~arina], do you intend to change default Calcite behavior?
Do you intend to have new behavior for MySQL mode only?

For instance, can you please clarify what output do you expect for the following SQL?
{code:sql}select x+10 as x
  from (values(1),(2)) as t(x)
 group by x
having x>1{code}


was (Author: vladimirsitnikov):
[~arina], do you intend to change default Calcite behavior?
Do you intend have new behavior for MySQL mode only?

For instance, can you please clarify what output do you expect for the following SQL?
{code:sql}select x+10 as x
  from (values(1),(2)) as t(x)
 group by x
having x>1{code}

> Allow alias in having clause for aggregate functions
> ----------------------------------------------------
>
>                 Key: CALCITE-2799
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2799
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.18.0
>            Reporter: Arina Ielchiieva
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.19.0
>
>
> Currently alias is not allowed in having for aggregate functions. 
> MySql supports such cases and taking into account that alias in having clause is allowed only for the following conformance levels: MYSQL_5, LENIENT, BABEL, it makes sense to allow alias in having for aggregate functions.
> {noformat}
>  /**
>    * Whether to allow aliases from the {@code SELECT} clause to be used as
>    * column names in the {@code HAVING} clause.
>    *
>    * <p>Among the built-in conformance levels, true in
>    * {@link SqlConformanceEnum#BABEL},
>    * {@link SqlConformanceEnum#LENIENT},
>    * {@link SqlConformanceEnum#MYSQL_5};
>    * false otherwise.
>    */
>   boolean isHavingAlias();
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)