Details
Description
In the case provided incorrect charset name for type will be thrown internal error which NPE causes.
Let's provide user-friendly errors for such cases.
Use incorrect charset name:
CREATE TABLE test (c1 CHAR CHARACTER SET UTF_8);
Result:
Caused by: org.apache.ignite.sql.SqlException: IGN-CMN-65535 TraceId:382210fe-335d-4df2-b8fc-149c13b7f5e5 UTF_8 at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:765) at org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:699) at org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:525) at org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:634) at org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:476) at org.apache.ignite.internal.sql.api.IgniteSqlImpl.execute(IgniteSqlImpl.java:206) at org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.lambda$execute$1(PublicApiThreadingIgniteSql.java:65) at org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144) at org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102) at org.apache.ignite.internal.sql.api.PublicApiThreadingIgniteSql.execute(PublicApiThreadingIgniteSql.java:65) at org.apache.ignite.internal.sql.sqllogic.ScriptContext.executeQuery(ScriptContext.java:85) at org.apache.ignite.internal.sql.sqllogic.Statement.execute(Statement.java:110) ... 5 more Caused by: java.util.concurrent.CompletionException: org.apache.ignite.sql.SqlException: IGN-CMN-65535 TraceId:382210fe-335d-4df2-b8fc-149c13b7f5e5 UTF_8 at org.apache.ignite.internal.sql.api.IgniteSqlImpl.lambda$executeAsyncInternal$5(IgniteSqlImpl.java:379) at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:990) at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:974) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773) at org.apache.ignite.internal.sql.engine.exec.QueryTaskExecutorImpl.lambda$execute$0(QueryTaskExecutorImpl.java:83) ... 3 more Caused by: org.apache.ignite.sql.SqlException: IGN-CMN-65535 TraceId:382210fe-335d-4df2-b8fc-149c13b7f5e5 UTF_8 at org.apache.ignite.internal.lang.SqlExceptionMapperUtil.mapToPublicSqlException(SqlExceptionMapperUtil.java:61) ... 9 more Caused by: org.apache.ignite.lang.IgniteException: IGN-CMN-65535 TraceId:382210fe-335d-4df2-b8fc-149c13b7f5e5 UTF_8 at org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:118) at org.apache.ignite.internal.lang.SqlExceptionMapperUtil.mapToPublicSqlException(SqlExceptionMapperUtil.java:51) ... 9 more Caused by: java.lang.NullPointerException: UTF_8 at java.base/java.util.Objects.requireNonNull(Objects.java:233) at org.apache.calcite.sql.SqlBasicTypeNameSpec.deriveType(SqlBasicTypeNameSpec.java:220) at org.apache.calcite.sql.SqlDataTypeSpec.deriveType(SqlDataTypeSpec.java:234) at org.apache.ignite.internal.sql.engine.prepare.IgnitePlanner.convert(IgnitePlanner.java:229) at org.apache.ignite.internal.sql.engine.prepare.ddl.DdlSqlToCommandConverter.convertCreateTable(DdlSqlToCommandConverter.java:334) at org.apache.ignite.internal.sql.engine.prepare.ddl.DdlSqlToCommandConverter.convert(DdlSqlToCommandConverter.java:182) at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.prepareDdl(PrepareServiceImpl.java:245) at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.prepareAsync0(PrepareServiceImpl.java:230) at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.prepareAsync(PrepareServiceImpl.java:210) at org.apache.ignite.internal.sql.engine.SqlQueryProcessor.lambda$executeParsedStatement$16(SqlQueryProcessor.java:648) at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187) at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309) at org.apache.ignite.internal.sql.engine.SqlQueryProcessor.executeParsedStatement(SqlQueryProcessor.java:636) at org.apache.ignite.internal.sql.engine.SqlQueryProcessor.lambda$querySingle$10(SqlQueryProcessor.java:567) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ... 6 more
Attachments
Issue Links
- Discovered while testing
-
IGNITE-21953 Cover SQL E021-01(Character string types. CHARACTER data type) feature by tests
- Resolved
- relates to
-
IGNITE-22138 Sql. Get rid ability to set CHARACTER SET for character strings
- Open