Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-22023

Sql. Support Json aggregate functions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • sql
    • Docs Required, Release Notes Required

    Description

      JSON aggregate functions (json_objectagg and json_arrayagg) are supported in calcite, but they fail in Ignite 3 with "Illegal aggregate function" exception.

      // CREATE TABLE t(id INT PRIMARY KEY, val INT);
      // INSERT INTO t VALUES (1, 1);
      
      assertQuery("SELECT JSON_OBJECTAGG(id: val) FROM t")
              .returns("{\"1\":1}")
              .check();
      
      Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to line 1, column 30: Illegal aggregate function. JSON_OBJECTAGG_NULL_ON_NULL is unsupported at the moment
      	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:507)
      	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:948)
      	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:933)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5517)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateAggregateFunction(IgniteSqlValidator.java:823)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateAggregateParams(IgniteSqlValidator.java:537)
      	at org.apache.calcite.sql.SqlAggFunction.validateCall(SqlAggFunction.java:137)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateCall(SqlValidatorImpl.java:6232)
      	at org.apache.calcite.sql.SqlCall.validate(SqlCall.java:143)
      	at org.apache.calcite.sql.SqlNode.validateExpr(SqlNode.java:275)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateExpr(SqlValidatorImpl.java:4714)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4679)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3840)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateSelect(IgniteSqlValidator.java:466)
      	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:61)
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:88)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1154)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1125)
      	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:282)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1091)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:797)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validate(IgniteSqlValidator.java:179)
      	at org.apache.ignite.internal.sql.engine.prepare.IgnitePlanner.validateAndGetTypeMetadata(IgnitePlanner.java:283)
      	at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.lambda$prepareQuery$3(PrepareServiceImpl.java:315)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
      	... 3 more
      Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Illegal aggregate function. JSON_OBJECTAGG_NULL_ON_NULL is unsupported at the moment
      	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:507)
      	at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:601)
      	... 27 more
      
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              xtern Pavel Pereslegin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: