renatoh commented on code in PR #3163:
URL: https://github.com/apache/solr/pull/3163#discussion_r1945462495


##########
solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java:
##########
@@ -863,6 +868,26 @@ protected Map<Object, Object> readMap(DataInputInputStream 
dis, int sz) throws I
     return m;
   }
 
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  protected Map<?, Object> 
readMapAsSimpleOrderedMapForStringKeys(DataInputInputStream dis, int sz)
+      throws IOException {
+    Map m = null;
+    for (int i = 0; i < sz; i++) {
+      Object key = readVal(dis);
+
+      if (m == null) {
+        if (key instanceof String) {
+          m = new SimpleOrderedMap<>(sz);
+        } else {
+          m = newMap(sz);
+        }
+      }
+      Object val = readVal(dis);
+      m.put(key, val);
+    }
+    return m;
+  }
+

Review Comment:
   @dsmiley  FYI, this is marked as drafted.
   We cannot simply create a SimpleOrderedMap since the key of the Map can also 
me something other than a String e.g. an Integer. The only way I can think of 
to overcome that is to read the first key and then do an instanceof check on 
it. Pretty ugly considering I have to use a raw Map.
   



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

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to