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

Alexey Popov commented on IGNITE-7851:
--------------------------------------

[~isapego], [~skalashnikov]
Please review the changes.

I force the key type assignment for QueryEntity in .NET code if it is not 
passed. Java code does not have similar CacheConfiguration constructor, so it 
is better to fix at .NET side.

> .NET: linq query throws "Hexadecimal string with odd number of characters" 
> exception
> ------------------------------------------------------------------------------------
>
>                 Key: IGNITE-7851
>                 URL: https://issues.apache.org/jira/browse/IGNITE-7851
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms, sql
>    Affects Versions: 2.3
>            Reporter: Alexey Popov
>            Assignee: Alexey Popov
>            Priority: Major
>         Attachments: FirstOrDefaultKeyIssue.zip
>
>
> Simple linq query with .Key throws an exception
> {code}
>                 var models = cache.AsCacheQueryable();
>                 var entry = models.FirstOrDefault(m => m.Key == @"TST-1/1");
> {code}
> Apache.Ignite.Core.Common.IgniteException: Hexadecimal string with odd number 
> of characters: "TST-1/1" [90003-195] ---> 
> Apache.Ignite.Core.Common.JavaException: class 
> org.apache.ignite.IgniteCheckedException: Hexadecimal string with odd number 
> of characters: "TST-1/1" [90003-195]
>         at 
> org.apache.ignite.internal.processors.platform.utils.PlatformUtils.unwrapQueryException(PlatformUtils.java:519)
>         at 
> org.apache.ignite.internal.processors.platform.cache.PlatformCache.runFieldsQuery(PlatformCache.java:1240)
>         at 
> org.apache.ignite.internal.processors.platform.cache.PlatformCache.processInStreamOutObject(PlatformCache.java:877)
>         at 
> org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutObject(PlatformTargetProxyImpl.java:79)
> Caused by: javax.cache.CacheException: class 
> org.apache.ignite.IgniteCheckedException: Hexadecimal string with odd number 
> of characters: "TST-1/1" [90003-195]
>         at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:1917)
>         at 
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:585)
>         at 
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:368)
>         at 
> org.apache.ignite.internal.processors.platform.cache.PlatformCache.runFieldsQuery(PlatformCache.java:1234)
>         ... 2 more
> Caused by: class org.apache.ignite.IgniteCheckedException: Hexadecimal string 
> with odd number of characters: "TST-1/1" [90003-195]
>         at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2468)
>         at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:1914)
>         ... 5 more
> Caused by: org.h2.message.DbException: Hexadecimal string with odd number of 
> characters: "TST-1/1" [90003-195]
>         at org.h2.message.DbException.get(DbException.java:179)
>         at org.h2.message.DbException.get(DbException.java:155)
>         at org.h2.util.StringUtils.convertHexToBytes(StringUtils.java:930)
>         at org.h2.value.Value.convertTo(Value.java:957)
>         at 
> org.apache.ignite.internal.processors.query.h2.H2Utils.convert(H2Utils.java:262)
>         at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.bindPartitionInfoParameter(IgniteH2Indexing.java:2520)
>         at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.calculateQueryPartitions(IgniteH2Indexing.java:2480)
>         at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeTwoStepsQuery(IgniteH2Indexing.java:1556)
>         at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryDistributedSqlFields(IgniteH2Indexing.java:1500)
>         at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor$5.applyx(GridQueryProcessor.java:1909)
>         at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor$5.applyx(GridQueryProcessor.java:1907)
>         at 
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>         at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2445)
>         ... 6 more
> Caused by: org.h2.jdbc.JdbcSQLException: Hexadecimal string with odd number 
> of characters: "TST-1/1" [90003-195]
>         at 
> org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
>         ... 19 more
>    --- End of inner exception stack trace ---
>    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* 
> target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* 
> errMsgChars, Int32 errMsgCharsLen, SByte* stackTraceChars, Int32 
> stackTraceCharsLen, Void* errData, Int32 errDataLen)
>    at 
> Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInStreamOutObject(Void*
>  ctx, Void* target, Int32 opType, Int64 memPtr)
>    at Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutObject(Int32 type, 
> Action`1 writeAction)
>    at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.QueryFields[T](SqlFieldsQuery 
> qry, Func`3 readerFunc)
>    at 
> Apache.Ignite.Linq.Impl.CacheFieldsQueryExecutor.ExecuteSingle[T](QueryModel 
> queryModel, Boolean returnDefaultWhenEmpty)
>    at 
> Remotion.Linq.Clauses.StreamedData.StreamedSingleValueInfo.ExecuteSingleQueryModel[T](QueryModel
>  queryModel, IQueryExecutor executor)
>    at 
> Remotion.Linq.Clauses.StreamedData.StreamedSingleValueInfo.ExecuteQueryModel(QueryModel
>  queryModel, IQueryExecutor executor)
>    at 
> Apache.Ignite.Linq.Impl.CacheFieldsQueryProvider.Execute[TResult](Expression 
> expression)
>    at FirstOrDefaultKeyIssue.Program.Main(String[] args) in 
> c:\users\gridgain\source\repos\FirstOrDefaultKeyIssue\FirstOrDefaultKeyIssue\Program.cs:line
>  44
> Simple reproducer is attached.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to