Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP DO NOT REVIEW] GEODE-9004: Fix issues with map indexes but allow map index to be use… #6238

Conversation

albertogpz
Copy link
Contributor

…d with != conditions except for * case

commit 16150cd
Author: Alberto Gomez alberto.gomez@est.tech
Date: Sat Mar 27 09:45:41 2021 +0100

Allow map index to be used with != conditions except for * case

commit 8a8e629
Author: Alberto Gomez alberto.gomez@est.tech
Date: Wed Mar 31 10:30:19 2021 +0200

GEODE-9004: Update some comments in test cases after review

commit 1784eac
Author: Alberto Gomez alberto.gomez@est.tech
Date: Tue Mar 30 18:03:30 2021 +0200

GEODE-9004_1: Update after review. Fixed queries with non-compact indexes and added comments in test cases

commit d1fe48a
Author: Alberto Gomez alberto.gomez@est.tech
Date: Mon Mar 29 17:18:15 2021 +0200

GEODE-9004: Add comments to test cases and small update

commit 150e73e
Author: Alberto Gomez alberto.gomez@est.tech
Date: Fri Mar 26 12:53:45 2021 +0100

GEODE-9004: Fix issues in queries targeting a Map field

Queries in which map fields are involved
in the condition, sometimes do not return the same entries
if map indexes are used, compared to when map indexes
are not used.

Diferences were found when the condition on the
map field was of type '!=' and also when the condition
on the map field was comparing the value with null.

Example1:
Running a query with the following condition:
positions['SUN'] = null

in a region with the following entries:
entry1.positions=null
entry2.positions={'a'=>'b'}
entry3.positions={'SUN'=>null}

- will return entry1 and entry3 if there are no
  indexes defined.
- will return no entries if the following index is defined:
  positions['SUN','c']
- will return entry3 if the following index is defined:
  positions[*]

Example2:
Running a query with the following condition:
positions['SUN'] != '3'

in a region with the following entries:
entry1.positions=null
entry2.positions={'a'=>'b'}
entry3.positions={'SUN'=>'4'}
entry4.positions={'SUN'=>'3'}
entry5.positions={'SUN'=>null}

- will return all entries except for entry4 if:
  there are no indexes defined.
- will return entry3 if the following index is defined:
  positions['SUN','c']
- will return entry3 and entry5 if the following index is defined:
  positions[*]

In order to have the same results for these
queries no matter if indexes are used,
the following changes have been made:
- When running queries, the result of getting the
value from a Map that does not contain the key used
to access the value will be
considered UNDEFINED instead of null.
This will imply that queries where the condition is
positions['SUN'] = null will not return entries
that do not have the 'SUN' key in the positions Map.

- Queries with map indexes will not be able to use
the indexes if the query is of type '!=' against
any of the indexed map fields.
Example:
for index positions['SUN', 'ERIC'] or
positions[*]
the following query will not use indexes:
positions['SUN'] != '44'

These changes must be documented accordingly
in the corresponding indexes section.

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?

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 dev@geode.apache.org.

@albertogpz albertogpz force-pushed the GEODE-9004_1_indexWithSeveralKeysAndNotEquals_squashed branch from 522acfa to 6deadc9 Compare April 6, 2021 10:10
…d with != conditions except for * case

commit 16150cd
Author: Alberto Gomez <alberto.gomez@est.tech>
Date:   Sat Mar 27 09:45:41 2021 +0100

    Allow map index to be used with != conditions except for * case

commit 8a8e629
Author: Alberto Gomez <alberto.gomez@est.tech>
Date:   Wed Mar 31 10:30:19 2021 +0200

    GEODE-9004: Update some comments in test cases after review

commit 1784eac
Author: Alberto Gomez <alberto.gomez@est.tech>
Date:   Tue Mar 30 18:03:30 2021 +0200

    GEODE-9004_1: Update after review. Fixed queries with non-compact indexes and added comments in test cases

commit d1fe48a
Author: Alberto Gomez <alberto.gomez@est.tech>
Date:   Mon Mar 29 17:18:15 2021 +0200

    GEODE-9004: Add comments to test cases and small update

commit 150e73e
Author: Alberto Gomez <alberto.gomez@est.tech>
Date:   Fri Mar 26 12:53:45 2021 +0100

    GEODE-9004: Fix issues in queries targeting a Map field

    Queries in which map fields are involved
    in the condition, sometimes do not return the same entries
    if map indexes are used, compared to when map indexes
    are not used.

    Diferences were found when the condition on the
    map field was of type '!=' and also when the condition
    on the map field was comparing the value with null.

    Example1:
    Running a query with the following condition:
    positions['SUN'] = null

    in a region with the following entries:
    entry1.positions=null
    entry2.positions={'a'=>'b'}
    entry3.positions={'SUN'=>null}

    - will return entry1 and entry3 if there are no
      indexes defined.
    - will return no entries if the following index is defined:
      positions['SUN','c']
    - will return entry3 if the following index is defined:
      positions[*]

    Example2:
    Running a query with the following condition:
    positions['SUN'] != '3'

    in a region with the following entries:
    entry1.positions=null
    entry2.positions={'a'=>'b'}
    entry3.positions={'SUN'=>'4'}
    entry4.positions={'SUN'=>'3'}
    entry5.positions={'SUN'=>null}

    - will return all entries except for entry4 if:
      there are no indexes defined.
    - will return entry3 if the following index is defined:
      positions['SUN','c']
    - will return entry3 and entry5 if the following index is defined:
      positions[*]

    In order to have the same results for these
    queries no matter if indexes are used,
    the following changes have been made:
    - When running queries, the result of getting the
    value from a Map that does not contain the key used
    to access the value will be
    considered UNDEFINED instead of null.
    This will imply that queries where the condition is
    positions['SUN'] = null will not return entries
    that do not have the 'SUN' key in the positions Map.

    - Queries with map indexes will not be able to use
    the indexes if the query is of type '!=' against
    any of the indexed map fields.
    Example:
    for index positions['SUN', 'ERIC'] or
    positions[*]
    the following query will not use indexes:
    positions['SUN'] != '44'

    These changes must be documented accordingly
    in the corresponding indexes section.
@albertogpz albertogpz force-pushed the GEODE-9004_1_indexWithSeveralKeysAndNotEquals_squashed branch from 6deadc9 to b041880 Compare April 6, 2021 10:22
@albertogpz albertogpz closed this May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant