SQL-Grid不支持AggregationFunction

时间:2017-09-12 08:49:23

标签: ignite

我有以下sql句子:

select a.age,floor(a.score) score,count(1) cnt,group_concat(a.id) ids from test_table a group by a.age,floor(a.score) having count(a.id)>10 order by a.age asc,floor(a.score) asc

它可以在IGNITE_H2_DEBUG_CONSOLE中执行,但使用SqlFieldsQuery获得以下异常:

Exception in thread "main" javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: null
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:1823)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:795)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:765)
    at com.xxx.ignite.test2.TestBinaryQuery.query(TestBinaryQuery.java:194)
    at com.xxx.ignite.test2.TestBinaryQuery.main(TestBinaryQuery.java:78)
Caused by: class org.apache.ignite.IgniteCheckedException: null
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2316)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:1820)
    ... 4 more
Caused by: java.lang.UnsupportedOperationException
    at org.apache.ignite.internal.processors.query.h2.sql.GridSqlAggregateFunction.getSQL(GridSqlAggregateFunction.java:84)
    at org.apache.ignite.internal.processors.query.h2.sql.GridSqlAlias.getSQL(GridSqlAlias.java:80)
    at org.apache.ignite.internal.processors.query.h2.sql.GridSqlSelect.getSQL(GridSqlSelect.java:141)
    at org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.split(GridSqlQuerySplitter.java:199)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryDistributedSqlFields(IgniteH2Indexing.java:1307)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$5.applyx(GridQueryProcessor.java:1815)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$5.applyx(GridQueryProcessor.java:1813)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2293)
    ... 5 more

我尝试过发现不支持的操作是group_concat。 Custom-SQL-Functions也不像Spark中的UDAF那样进行聚合。它在将来的版本中是否受支持?

1 个答案:

答案 0 :(得分:1)

当前版本不支持自定义聚合功能,但计划在将来支持它们。 这是一张票: https://issues.apache.org/jira/browse/IGNITE-2177