use of it.unimi.dsi.fastutil.objects.Object2IntMap in project druid by druid-io.
the class ListFilteredDimensionSpecDimensionSelectorTest method testAllowList.
private void testAllowList(boolean unknownCardinality, boolean validIdLookup, boolean nameLookupPossibleInAdvance, Class<? extends DimensionSelector> expectedDimensionSelectorClass) {
RowSupplier rowSupplier = new RowSupplier();
NonnullPair<Object2IntMap<String>, Int2ObjectMap<String>> dictionaries = createDictionaries(data);
DimensionSelector selector = targetWithAllowList.decorate(new StringDimensionSelectorForTest(rowSupplier, dictionaries.lhs, dictionaries.rhs, unknownCardinality, validIdLookup, nameLookupPossibleInAdvance));
Assert.assertSame(expectedDimensionSelectorClass, selector.getClass());
assertAllowListFiltering(rowSupplier, selector);
}
use of it.unimi.dsi.fastutil.objects.Object2IntMap in project druid by druid-io.
the class ListFilteredDimensionSpecDimensionSelectorTest method testDenyList.
private void testDenyList(boolean unknownCardinality, boolean validIdLookup, boolean nameLookupPossibleInAdvance, Class<? extends DimensionSelector> expectedDimensionSelectorClass) {
RowSupplier rowSupplier = new RowSupplier();
NonnullPair<Object2IntMap<String>, Int2ObjectMap<String>> dictionaries = createDictionaries(data);
DimensionSelector selector = targetWithDenyList.decorate(new StringDimensionSelectorForTest(rowSupplier, dictionaries.lhs, dictionaries.rhs, unknownCardinality, validIdLookup, nameLookupPossibleInAdvance));
Assert.assertSame(expectedDimensionSelectorClass, selector.getClass());
assertDenyListFiltering(rowSupplier, selector);
}
use of it.unimi.dsi.fastutil.objects.Object2IntMap in project pinot by linkedin.
the class PinotLLCRealtimeSegmentManager method updateFlushThresholdForSegmentMetadata.
void updateFlushThresholdForSegmentMetadata(LLCRealtimeSegmentZKMetadata segmentZKMetadata, ZNRecord partitionAssignment, int tableFlushSize) {
// Only update the flush threshold if there is a valid table flush size
if (tableFlushSize < 1) {
return;
}
// Gather list of instances for this partition
Object2IntMap<String> partitionCountForInstance = new Object2IntLinkedOpenHashMap<>();
String segmentPartitionId = new LLCSegmentName(segmentZKMetadata.getSegmentName()).getPartitionRange();
for (String instanceName : partitionAssignment.getListField(segmentPartitionId)) {
partitionCountForInstance.put(instanceName, 0);
}
// Find the maximum number of partitions served for each instance that is serving this segment
int maxPartitionCountPerInstance = 1;
for (Map.Entry<String, List<String>> partitionAndInstanceList : partitionAssignment.getListFields().entrySet()) {
for (String instance : partitionAndInstanceList.getValue()) {
if (partitionCountForInstance.containsKey(instance)) {
int partitionCountForThisInstance = partitionCountForInstance.getInt(instance);
partitionCountForThisInstance++;
partitionCountForInstance.put(instance, partitionCountForThisInstance);
if (maxPartitionCountPerInstance < partitionCountForThisInstance) {
maxPartitionCountPerInstance = partitionCountForThisInstance;
}
}
}
}
// Configure the segment size flush limit based on the maximum number of partitions allocated to a replica
int segmentFlushSize = (int) (((float) tableFlushSize) / maxPartitionCountPerInstance);
segmentZKMetadata.setSizeThresholdToFlushSegment(segmentFlushSize);
}
Aggregations