Pavel Pereslegin created IGNITE-24588:
-----------------------------------------

             Summary: Sql. Fail to read column with quoted identifier using 
client kv view.
                 Key: IGNITE-24588
                 URL: https://issues.apache.org/jira/browse/IGNITE-24588
             Project: Ignite
          Issue Type: Bug
          Components: sql
            Reporter: Pavel Pereslegin


Consider the following example

{code:java}
    IgniteClient client = IgniteClient.builder()
            .addresses("127.0.0.1:" + 
unwrapIgniteImpl(CLUSTER.node(0)).clientAddress().port())
            .build();
    
    sql("CREATE TABLE T (\"_KEY\" INT PRIMARY KEY, val INT)");
    
    KeyValueView<Tuple, Tuple> kvView = 
client.tables().table("t").keyValueView();
    
    Tuple key = Tuple.create().set("\"_KEY\"", 0);
    
    NullableValue<Tuple> nullable = kvView.getNullable(null, key); // Error: 
Malformed identifier [identifier=_KEY, pos=0]
    
    assertNull(nullable);
{code}

fails with the following

{noformat}
Caused by: java.lang.IllegalArgumentException: Malformed identifier 
[identifier=_KEY, pos=0]
        at 
org.apache.ignite.lang.util.IgniteNameUtils$Tokenizer.throwMalformedIdentifierException(IgniteNameUtils.java:278)
        at 
org.apache.ignite.lang.util.IgniteNameUtils$Tokenizer.nextToken(IgniteNameUtils.java:204)
        at 
org.apache.ignite.lang.util.IgniteNameUtils.parseIdentifier(IgniteNameUtils.java:45)
        at org.apache.ignite.table.TupleImpl.columnIndex(TupleImpl.java:131)
        at org.apache.ignite.table.TupleImpl.valueOrDefault(TupleImpl.java:145)
        at 
org.apache.ignite.internal.client.table.ClientTupleSerializer.getColocationHash(ClientTupleSerializer.java:450)
        at 
org.apache.ignite.internal.client.table.ClientTupleSerializer.lambda$getPartitionAwarenessProvider$0(ClientTupleSerializer.java:423)
        at 
org.apache.ignite.internal.client.table.PartitionAwarenessProvider.getObjectHashCode(PartitionAwarenessProvider.java:68)
        at 
org.apache.ignite.internal.client.table.ClientTable.getPreferredNodeName(ClientTable.java:713)
        at 
org.apache.ignite.internal.client.table.ClientTable.lambda$doSchemaOutInOpAsync$8(ClientTable.java:466)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2237)
        at 
org.apache.ignite.internal.client.table.ClientTable.doSchemaOutInOpAsync(ClientTable.java:464)
        at 
org.apache.ignite.internal.client.table.ClientTable.doSchemaOutInOpAsync(ClientTable.java:425)
        at 
org.apache.ignite.internal.client.table.ClientKeyValueBinaryView.getNullableAsync(ClientKeyValueBinaryView.java:132)
        ... 11 more
{noformat}

At first glance, it seems that this issue is related to the 
ClientTupleSerializer, and we should quote the identifier 
({{quoteIfNeeded(name)}}) before passing it to the tuple's valueOrDefault 
method (at least in the getColocationHash() and writeTupleRaw() methods).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to