[ 
https://issues.apache.org/jira/browse/GEODE-9018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17299071#comment-17299071
 ] 

ASF GitHub Bot commented on GEODE-9018:
---------------------------------------

albertogpz commented on a change in pull request #6110:
URL: https://github.com/apache/geode/pull/6110#discussion_r591784419



##########
File path: 
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/CompactRangeIndexJUnitTest.java
##########
@@ -442,6 +445,48 @@ public void doTestHook(final SPOTS spot, final 
DefaultQuery _ignored,
     }
   }
 
+  /**
+   * Tests adding entries to compact range index where there are undefined and 
null values
+   * for the key
+   */
+  @Test
+  public void testNullAndUndefinedValuesForMapKeyInCompactRangeIndex() throws 
Exception {
+    index = utils.createIndex("indexName", "positions['SUN']", SEPARATOR + 
"exampleRegion");
+    Region<Object, Object> region = 
utils.getCache().getRegion("exampleRegion");
+
+    // create objects
+    Portfolio p1 = new Portfolio(1);
+    p1.positions = new HashMap<>();
+    p1.positions.put("SUN", "yes");
+    region.put("KEY-" + 1, p1);
+
+    // null value for positions['SUN']

Review comment:
       ok

##########
File path: 
geode-core/src/test/java/org/apache/geode/cache/query/internal/types/ExtendedNumericComparatorTest.java
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.query.internal.types;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Comparator;
+
+import org.junit.Test;
+
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.internal.index.IndexManager;
+
+public class ExtendedNumericComparatorTest {
+  Comparator comparator = TypeUtils.getExtendedNumericComparator();

Review comment:
       ok




----------------------------------------------------------------
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]


> ExtendedNumericComparator does not compare correctly NULL and UNDEFINED
> -----------------------------------------------------------------------
>
>                 Key: GEODE-9018
>                 URL: https://issues.apache.org/jira/browse/GEODE-9018
>             Project: Geode
>          Issue Type: Bug
>          Components: querying
>            Reporter: Alberto Gomez
>            Assignee: Alberto Gomez
>            Priority: Major
>              Labels: pull-request-available
>
> The compareTo method of ExtendedNumericComparator does not compare correctly 
> UNDEFINED and NULL.
> UNDEFINED should always be smaller than anything but it is not always so when 
> compared with NULL.
> compareTo(NULL, UNDEFINED) returns 1, which is correct
> but
> compareTo(UNDEFINED, NULL) returns 1, and it should return -1.
> This could provoke that queries with indexes do not return the right results 
> when these values are involved.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to