You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexey Goncharuk (JIRA)" <ji...@apache.org> on 2016/06/29 22:33:40 UTC

[jira] [Resolved] (IGNITE-3397) Query with SUM and AVG fails if data type is integer

     [ https://issues.apache.org/jira/browse/IGNITE-3397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Goncharuk resolved IGNITE-3397.
--------------------------------------
    Resolution: Duplicate

Linking to the issue with the root cause. The workaround for this issue is to use {{java.lang.Short}} and {{java.lang.Integer}} in configuration.

> Query with SUM and AVG fails if data type is integer
> ----------------------------------------------------
>
>                 Key: IGNITE-3397
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3397
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 1.6
>            Reporter: Sergey Kozlov
>            Priority: Critical
>         Attachments: examples.zip
>
>
> 1. Extract everything from attached zip file into examples directory
> 2. Run {{CacheQueryFailures query4}}. It fails:
> {noformat}
> [15:32:35] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=3.5GB]
> >>> initialize 300 keys
> >>> run query4, type: SqlFieldsQuery, query SELECT SUM(intCol), AVG(intCol) FROM AllTypes WHERE shortCol >= ?
> [15:32:35] Ignite node stopped OK [uptime=00:00:00:485]
> Exception in thread "main" javax.cache.CacheException: class org.apache.ignite.IgniteException: Failed to parse query: SELECT SUM(intCol), AVG(intCol) FROM AllTypes WHERE shortCol >= ?
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:682)
> 	at org.apache.ignite.examples.datagrid.CacheQueryFailures.runQuery(CacheQueryFailures.java:117)
> 	at org.apache.ignite.examples.datagrid.CacheQueryFailures.main(CacheQueryFailures.java:83)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> Caused by: class org.apache.ignite.IgniteException: Failed to parse query: SELECT SUM(intCol), AVG(intCol) FROM AllTypes WHERE shortCol >= ?
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:811)
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:673)
> 	... 7 more
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to parse query: SELECT SUM(intCol), AVG(intCol) FROM AllTypes WHERE shortCol >= ?
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1787)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:804)
> 	... 8 more
> Caused by: javax.cache.CacheException: Failed to parse query: SELECT SUM(intCol), AVG(intCol) FROM AllTypes WHERE shortCol >= ?
> 	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1058)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:806)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:804)
> 	at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1769)
> 	... 9 more
> Caused by: org.h2.jdbc.JdbcSQLException: SUM или AVG на недопустимом типе данных "SUM(INTCOL)"
> SUM or AVG on wrong data type for "SUM(INTCOL)"; SQL statement:
> SELECT SUM(intCol), AVG(intCol) FROM AllTypes WHERE shortCol >= ? [90015-175]
> 	at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
> 	at org.h2.message.DbException.get(DbException.java:172)
> 	at org.h2.message.DbException.get(DbException.java:149)
> 	at org.h2.expression.Aggregate.optimize(Aggregate.java:408)
> 	at org.h2.command.dml.Select.prepare(Select.java:810)
> 	at org.h2.command.Parser.prepareCommand(Parser.java:240)
> 	at org.h2.engine.Session.prepareLocal(Session.java:436)
> 	at org.h2.engine.Session.prepareCommand(Session.java:379)
> 	at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1138)
> 	at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:70)
> 	at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:267)
> 	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:366)
> 	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1055)
> 	... 13 more
> Process finished with exit code 1
> {noformat}
> Same query works fine if data type is Double



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)