You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/10/26 22:04:34 UTC

[solr] branch branch_9x updated: SOLR-10918: Fix IntPointField hashing for HLL (#1137)

This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new ed5f0e232ef SOLR-10918: Fix IntPointField hashing for HLL (#1137)
ed5f0e232ef is described below

commit ed5f0e232ef6112d8bc457b4b67225314119ffdd
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Oct 26 18:00:23 2022 -0400

    SOLR-10918: Fix IntPointField hashing for HLL (#1137)
    
    (cherry picked from commit 282fb99e1481c2366dbf8446acaad8ba482229fd)
---
 solr/CHANGES.txt                                     |  2 ++
 .../handler/component/SortedNumericStatsValues.java  |  2 ++
 .../TestDistributedStatsComponentCardinality.java    | 20 ++++++++------------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 193d5dc73fe..6a0ae81ce4c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -55,6 +55,8 @@ Bug Fixes
 
 * SOLR-16477: Collection RENAME api creates broken alias (Alex Deparvu via Kevin Risden)
 
+* SOLR-10918: Fix IntPointField hashing for HLL (Houston Putman)
+
 Build
 ---------------------
 * Upgrade forbiddenapis to 3.4 (Uwe Schindler)
diff --git a/solr/core/src/java/org/apache/solr/handler/component/SortedNumericStatsValues.java b/solr/core/src/java/org/apache/solr/handler/component/SortedNumericStatsValues.java
index ed090f2bd9b..67d41861d83 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SortedNumericStatsValues.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SortedNumericStatsValues.java
@@ -58,6 +58,8 @@ public class SortedNumericStatsValues implements StatsValues {
   private Number toCorrectType(long value) {
     switch (numberType) {
       case INTEGER:
+        return (int) value;
+      case DATE:
       case LONG:
         return value;
       case FLOAT:
diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java b/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
index 25542df1234..a17c51879f3 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
@@ -157,18 +157,14 @@ public class TestDistributedStatsComponentCardinality extends BaseDistributedSea
 
       Map<String, FieldStatsInfo> stats = rsp.getFieldStatsInfo();
 
-      if (Boolean.getBoolean(NUMERIC_POINTS_SYSPROP)) {
-        // SOLR-10918: can't rely on exact match with pre-hashed values when using points
-      } else {
-        for (String f : STAT_FIELDS) {
-          // regardless of log2m and regwidth, the estimated cardinality of the
-          // hashed vs prehashed values should be exactly the same for each field
-
-          assertEquals(
-              f + ": hashed vs prehashed, real=" + numMatches + ", p=" + p,
-              stats.get(f).getCardinality().longValue(),
-              stats.get(f + "_prehashed_l").getCardinality().longValue());
-        }
+      for (String f : STAT_FIELDS) {
+        // regardless of log2m and regwidth, the estimated cardinality of the
+        // hashed vs prehashed values should be exactly the same for each field
+
+        assertEquals(
+            f + ": hashed vs prehashed, real=" + numMatches + ", p=" + p,
+            stats.get(f).getCardinality().longValue(),
+            stats.get(f + "_prehashed_l").getCardinality().longValue());
       }
 
       for (String f : STAT_FIELDS) {