ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Kondakov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-6772) SQL exception messages are not descriptive
Date Wed, 10 Jan 2018 07:06:00 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-6772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319796#comment-16319796
] 

Roman Kondakov commented on IGNITE-6772:
----------------------------------------

[~vozerov], [~ptupitsyn], I made a small fix for this problem, please review. [TC tests|https://ci.ignite.apache.org/viewQueued.html?itemId=1030457]
are OK except some flaky tests in Queries2 suite and .NET tests which depends on the old error
messages. [~ptupitsyn], I think we need to fix these .NET tests.

> SQL exception messages are not descriptive
> ------------------------------------------
>
>                 Key: IGNITE-6772
>                 URL: https://issues.apache.org/jira/browse/IGNITE-6772
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Pavel Tupitsyn
>            Assignee: Roman Kondakov
>              Labels: usability
>             Fix For: 2.4
>
>
> Top level SQL exception messages are cryptic and not descriptive. Real details are buried
deep inside inner exceptions.
> For example, when there is a typo in table name, exception looks like this:
> {code}
> class org.apache.ignite.IgniteCheckedException: Failed to parse query: SELECT "persons-sql"."PERSON"._KEY,
"persons-sql"."PERSON"._VAL from Person1, "orgs-sql".Organization where Person.OrgId = "orgs-sql".Organization._key
and "orgs-sql".Organization.Name = ?
>   at org.apache.ignite.internal.processors.platform.utils.PlatformUtils.unwrapQueryException(PlatformUtils.java:510)
>   at org.apache.ignite.internal.processors.platform.cache.PlatformCache.runQuery(PlatformCache.java:1219)
>   at org.apache.ignite.internal.processors.platform.cache.PlatformCache.processInStreamOutObject(PlatformCache.java:875)
>   at org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutObject(PlatformTargetProxyImpl.java:77)
> Caused by: javax.cache.CacheException: class org.apache.ignite.internal.processors.query.IgniteSQLException:
Failed to parse query: SELECT "persons-sql"."PERSON"._KEY, "persons-sql"."PERSON"._VAL from
Person1, "orgs-sql".Organization where Person.OrgId = "orgs-sql".Organization._key and "orgs-sql".Organization.Name
= ?
>   at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:807)
>   at org.apache.ignite.internal.processors.platform.cache.PlatformCache.runQuery(PlatformCache.java:1213)
>   ... 2 more
> Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed
to parse query: SELECT "persons-sql"."PERSON"._KEY, "persons-sql"."PERSON"._VAL from Person1,
"orgs-sql".Organization where Person.OrgId = "orgs-sql".Organization._key and "orgs-sql".Organization.Name
= ?
>   at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryDistributedSqlFields(IgniteH2Indexing.java:1293)
>   at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryDistributedSql(IgniteH2Indexing.java:1198)
>   at org.apache.ignite.internal.processors.query.GridQueryProcessor$8.applyx(GridQueryProcessor.java:1957)
>   at org.apache.ignite.internal.processors.query.GridQueryProcessor$8.applyx(GridQueryProcessor.java:1955)
>   at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>   at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2293)
>   at org.apache.ignite.internal.processors.query.GridQueryProcessor.queryDistributedSql(GridQueryProcessor.java:1954)
>   at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySql(GridQueryProcessor.java:1934)
>   at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:792)
>   ... 3 more
> Caused by: org.h2.jdbc.JdbcSQLException: Table "PERSON1" not found; SQL statement:
> SELECT "persons-sql"."PERSON"._KEY, "persons-sql"."PERSON"._VAL from Person1, "orgs-sql".Organization
where Person.OrgId = "orgs-sql".Organization._key and "orgs-sql".Organization.Name = ? [42102-195]
>   at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
>   at org.h2.message.DbException.get(DbException.java:179)
>   at org.h2.message.DbException.get(DbException.java:155)
>   at org.h2.command.Parser.readTableOrView(Parser.java:5506)
>   at org.h2.command.Parser.readTableFilter(Parser.java:1260)
>   at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1940)
>   at org.h2.command.Parser.parseSelectSimple(Parser.java:2089)
>   at org.h2.command.Parser.parseSelectSub(Parser.java:1934)
>   at org.h2.command.Parser.parseSelectUnion(Parser.java:1749)
>   at org.h2.command.Parser.parseSelect(Parser.java:1737)
>   at org.h2.command.Parser.parsePrepared(Parser.java:448)
>   at org.h2.command.Parser.parse(Parser.java:320)
>   at org.h2.command.Parser.parse(Parser.java:292)
>   at org.h2.command.Parser.prepareCommand(Parser.java:257)
>   at org.h2.engine.Session.prepareLocal(Session.java:573)
>   at org.h2.engine.Session.prepareCommand(Session.java:514)
>   at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1204)
>   at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
>   at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:288)
>   at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:398)
>   at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryDistributedSqlFields(IgniteH2Indexing.java:1273)
> {code}
> As we can see, top level message is {{Failed to parse query}}, but the real problem that
user needs to know is {{Table "PERSON1" not found}}. We should make sure that top level message
includes the useful information and not some internal implementation details.
> Make sure to add unit tests for common SQL query problems:
> * Incorrect table name
> * Incorrect column name
> * Syntax error (shoukd include character index)
> Error messages are part of the API.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message