[
https://issues.apache.org/jira/browse/CALCITE-6866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17952510#comment-17952510
]
xiong duan commented on CALCITE-6866:
-------------------------------------
Fixed in
[b603c23|https://github.com/apache/calcite/commit/b603c2306d9e98031d3732fc306649397d0464e3].
Thanks for the contribution [~xuzifu666] .
> PostgreSQLDialect support to unparse LISTAGG aggregate function
> ---------------------------------------------------------------
>
> Key: CALCITE-6866
> URL: https://issues.apache.org/jira/browse/CALCITE-6866
> Project: Calcite
> Issue Type: Bug
> Reporter: xiong duan
> Assignee: Yu Xu
> Priority: Major
> Labels: pull-request-available
>
> The unit test in RelToSqlConverterTest:
> {code:java}
> @Test void testPostgresqlLISTAGG() {
> final String query = "SELECT \"product_class_id\","
> + "LISTAGG(DISTINCT CAST(\"brand_name\" AS VARCHAR), ',') "
> + "FROM \"foodmart\".\"product\" group by \"product_class_id\"";
> sql(query).withPostgresql().ok("SELECT \"product_class_id\",
> LISTAGG(DISTINCT CAST(\"brand_name\" AS VARCHAR), ',')\n"
> + "FROM \"foodmart\".\"product\"\nGROUP BY \"product_class_id\"");
> } {code}
> The generated SQL throws an exception in PG:
> {code:java}
> SELECT "sex", LISTAGG(DISTINCT CAST("patient"."id" AS VARCHAR), ',') AS
> "list"FROM "patient"GROUP BY "sex" {code}
> LISTAGG should be STRING_AGG.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)