Reza Taroosheh created IGNITE-29199:
---------------------------------------

             Summary: Local IndexQuery returns binary objects on a cache that 
is not in keep-binary mode
                 Key: IGNITE-29199
                 URL: https://issues.apache.org/jira/browse/IGNITE-29199
             Project: Ignite
          Issue Type: Bug
            Reporter: Reza Taroosheh
            Assignee: Reza Taroosheh
             Fix For: 2.19


A local {{IndexQuery}} ({{setLocal(true)}}) returns keys and values as 
{{BinaryObject}} on a cache that is not in keep-binary mode. Reading an entry 
as the cache's own type throws {{ClassCastException}}. The same query without 
{{setLocal}}, and a local {{ScanQuery}} on the same cache, return the cache's 
own classes.

Steps:
# Create a cache {{IgniteCache<ItemKey, Item>}} with a sorted index on an 
{{Item}} field, without {{withKeepBinary()}}.
# Put some entries.
# Run {{cache.query(new IndexQuery<ItemKey, Item>(Item.class, 
IDX).setLocal(true)).getAll()}} and read {{getValue()}} as {{Item}}.

Actual: keys and values are {{BinaryObjectImpl}}, and reading the value as 
{{Item}} throws {{ClassCastException}}.
Expected: {{ItemKey}} and {{Item}}, as with the distributed {{IndexQuery}}.

Reproduced on 2.17.0 and 2.18.0 (reported on the dev list), and on master in 
{{IndexQueryLimitTest}} with {{setLocal(true)}}.

Cause: {{IndexQueryProcessor#queryLocal}} unwraps each row with {{keepBinary = 
true}}. The caller's {{keepBinary}} is used only for the objects passed to the 
filter. The distributed path deserializes rows in the query future 
({{GridCacheQueryFutureAdapter}}), while the local path skips this step.

Compatibility: fixing this changes the type a local {{IndexQuery}} returns on a 
cache that is not in keep-binary mode. Code that relies on getting 
{{BinaryObject}} from it would need to use {{withKeepBinary()}}, which is the 
documented way to get binary objects.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to