xiong duan created CALCITE-6866:
-----------------------------------

             Summary: 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


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)

Reply via email to