leventov commented on a change in pull request #4551: Fixes and improvements to 
SQL metadata caching.
URL: https://github.com/apache/incubator-druid/pull/4551#discussion_r247864745
 
 

 ##########
 File path: sql/src/main/java/io/druid/sql/calcite/schema/DruidSchema.java
 ##########
 @@ -59,42 +58,66 @@
 import io.druid.sql.calcite.view.DruidViewMacro;
 import io.druid.sql.calcite.view.ViewManager;
 import io.druid.timeline.DataSegment;
-import org.apache.calcite.schema.Function;
 import org.apache.calcite.schema.Table;
 import org.apache.calcite.schema.impl.AbstractSchema;
 import org.joda.time.DateTime;
 
+import java.io.IOException;
+import java.util.Comparator;
 import java.util.EnumSet;
-import java.util.List;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
 
 @ManageLifecycle
 public class DruidSchema extends AbstractSchema
 {
+  // Newest segments first, so they override older ones.
 
 Review comment:
   It also might be that based on how often `buildDruidTable()` is called 
compared to some other methods in `DruidSchema` that it's better to use HashMap 
for segmentMetadataInfo's values, and perform more work in `buildDruidTable()`, 
like having `Map<String, Pair<DataSegment, ValueType>> columnTypes`, iterating 
over `segmentMap.entrySet()` and use `columnTypes.compute()` with replacement 
decided comparing `DataSegment` objects.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to