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

Xurenhe commented on CALCITE-4743:
----------------------------------

[~julianhyde] Thanks for your reply.
I will follow [CALCITE-4597|https://issues.apache.org/jira/browse/CALCITE-4597]

> Convert rel to sql fail, when meeting aggregate of no-group and no-aggcall.
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-4743
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4743
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Xurenhe
>            Priority: Major
>         Attachments: image-2021-08-17-20-27-45-801.png
>
>
> Hi, all.
> Here, Aggregate of of no-group and no-agg-call coverting to sql is fail.
> For example:
> {code:java}
>   @Test void testAggregateWithNoGroupAndNoAggCall() {
>     final RelBuilder builder = relBuilder();
>     final RelNode relRoot = builder.scan("EMP")
>         .aggregate(builder.groupKey())
>         .project(ImmutableList.of(builder.literal("hello")), 
> ImmutableList.of("constant_field"))
>         .build();
>     String expected = "SELECT 'hello' AS \"constant_field\"\n"
>         + "FROM \"scott\".\"EMP\"";
>     relFn(b -> relRoot).ok(expected);
>   }
> {code}
> This case will return sql: 
> {code:sql}
> SELECT 'hello' AS "constant_field"
> FROM "scott"."EMP"
> GROUP BY ()
> {code}
> --------------------------------------
> Should we use a switch of dialect to control this conversion, which is code 
> of `org.apache.calcite.rel.rel2sql.RelToSqlConverter#buildAggregate`?
>  !image-2021-08-17-20-27-45-801.png|thumbnail! 



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

Reply via email to