Collection attributes indexed with [any] causes wrong SqlQuery results if first data inserted to map has no value for the attribute or the collection is empty #14358
Labels
Module: IMap
Module: Query
Priority: High
Source: Internal
PR or issue was opened by an employee
Team: Core
Type: Defect
Milestone
Please see: https://stackoverflow.com/questions/54095774/hazelcast-not-working-correctly-with-sqlpredicate-and-index-on-optional-field
The problem here, when initializing
TypeConverter
inside the index, if the indexed property is in a collection and whenThen
QueryableEntry.getConverter
returnsIDENTITY_CONVERTER
. This causes wrong converter type initialization and causing SqlPredicate to return wrong results.Suggested Fix:
from
getConverter
method:The only case
attributeType
is null is when theattribute
is the type ofMultiResult
and either all values in it is null or it is an instance ofImmutableMultiResut
which means Collection itself is null or empty. In this case, we should returnNULL_CONVERTER
instead ofIDENTITY_CONVERTER
so that index can continue to find correct TypeConverter with next entry.Simple reproducer:
The text was updated successfully, but these errors were encountered: