[
https://issues.apache.org/jira/browse/GEODE-9004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295890#comment-17295890
]
ASF GitHub Bot commented on GEODE-9004:
---------------------------------------
albertogpz opened a new pull request #6096:
URL: https://github.com/apache/geode/pull/6096
Several changes have been made to solve issues
found when running queries targeting a Map field
with and without indexes in the Map field.
- For queries without an index in the Map field
the behavior has been changed so that
for queries like "positions['SUN'] = null" instead
of returning those entries fulfiling
that condition and also those entries
where the Map does not contain the 'SUN' key
or the Map is null, it now returns
only entries where the Map contains the
'SUN' key and the value is equal to null.
- As a consequence of the above, queries
without an index in the Map field like
"positions['SUN'] != null" will now return
any entry that does not contain
the positions field Map with the 'SUN' key
and with value equal to null.
- For queries with an index in the Map field,
either specifying several keys or '*'
the behavior has been modified (fixed) so that
"!=" conditions targeting the indexed
Map fields return the same entries returned
when the index is not present. Prior to this
change, only entries containing the Map
were returned but if the Map was not
present in the entry then that entry was
not returned.
- Indexes for a field Map
specifying just one key, e.g.
positions['SUN'] have been changed
internally from Range indexes
to Map indexes in order to align
the behavior with Map indexes
(those that specified more than
one key or '*' for a Map field)
so that the space taken by this type
of index is equivalent to the
one taken by one specifying
more than one key for the Map.
This has also solved some wrong
behavior of these indexes that
sometimes did not return the expected
number of entries.
The drawback of this change is that
"!=" queries for the map field
will not make use of the index.
Thank you for submitting a contribution to Apache Geode.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced in
the commit message?
- [ ] Has your PR been rebased against the latest commit within the target
branch (typically `develop`)?
- [ ] Is your initial contribution a single, squashed commit?
- [ ] Does `gradlew build` run cleanly?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
### Note:
Please ensure that once the PR is submitted, check Concourse for build
issues and
submit an update to your PR as soon as possible. If you need help, please
send an
email to [email protected].
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Issues with queries targeting a map field
> -----------------------------------------
>
> Key: GEODE-9004
> URL: https://issues.apache.org/jira/browse/GEODE-9004
> Project: Geode
> Issue Type: Bug
> Components: querying
> Reporter: Alberto Gomez
> Assignee: Alberto Gomez
> Priority: Major
>
> When defining indexes on a map field several issues have been found:
> * If the index is defined for one specific key in the map, e.g.
> positions['SUN'], then an index entry is created for every entry, no matter
> if the entry contains the 'SUN' key in its map or not. This makes the index
> take a lot of memory (unnecessarily?).
> * If the index is specified for more than one keys in the map or for all
> ('*'), then queries in which the where contains a != condition for the map,
> e.g. "p.positions['SUN'] != '3'" return less values than those returned when
> the query is run without the index.
> * If the index is specified for more than one keys in the map or for all
> ('*'), then queries in which the where contains a "= null" condition for the
> map, e.g. "p.positions['SUN'] = null" return less values than those returned
> when the query is run without the index.
> * If the index is defined for one specific key in the map, e.g.
> positions['SUN'], queries in which the where contains a != condition for the
> map or a " = null" condition sometimes return less values than those returned
> when the query is run without the index.
> Apart from the above, looking at the indexes documentation, it seems that Map
> indexes are only those indexes for which more than one key or '*' is
> specified for the Map. But if just one key is specified for the Map in the
> index, then the index is not a Map index but a range index. This should be
> clarified.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)