You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/12/30 01:28:41 UTC

[GitHub] [druid] jasonk000 commented on a change in pull request #12105: perf: indexing: Introduce a bulk getValuesInto function to read values

jasonk000 commented on a change in pull request #12105:
URL: https://github.com/apache/druid/pull/12105#discussion_r776540734



##########
File path: processing/src/main/java/org/apache/druid/segment/DimensionDictionary.java
##########
@@ -84,6 +84,19 @@ public T getValue(int id)
     }
   }
 
+  public void getValuesInto(int[] ids, T[] values)
+  {
+    lock.readLock().lock();
+    try {
+      for (int i = 0; i < ids.length; i++) {

Review comment:
       Good point on checking array lengths match.
   
   I did explore returning value only (that's my internal impl actually), but it requires wider changes. Specifically, since Java erases generics, it's impossible to do `new T[]`. So, we have to either do something like:
   ```
   StringDimensionIndexer() constructor {
   super(String.class);
   }
   
   // and then propagate this Class<T> to DimensionDictionary, and in DimensionDictionary, do a:
   
   T[] out = (T[]) Array.newInstance(typeFromConstructor, keys.length);
   ```
   To me, both are viable and work fine, this approach seems less invasive.
   
   What do you suggest?




-- 
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: commits-unsubscribe@druid.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org