public static boolean in(Object objectValue, ObjectOpenCustomHashSet<?> set) { return set.contains(objectValue); }
private void heapify() { pQueueSize = 0; while (pQueueSize < pQueue.length) { pQueueSize++; ObjectHeaps.upHeap(pQueue, pQueueSize, pQueueSize - 1, ROW_ITERATOR_COMPARATOR); } }
public long getGlobalStat(final String statName) { return globalStats.getLong(statName); }
public StringToIdMap() { _valueToIdMap = new Object2IntOpenHashMap<>(); _valueToIdMap.defaultReturnValue(INVALID_KEY); _idToValueMap = new ObjectArrayList<>(); }
@Override public GroupKey next() { Object2IntMap.Entry<IntArray> entry = _iterator.next(); _groupKey._groupId = entry.getIntValue(); _groupKey._stringKey = getGroupKey(entry.getKey()); return _groupKey; }
/** * Returns true if at least one tier in target replica assignment exists in cluster but does not have enough replicas. */ private boolean loadingInProgress(final DruidCluster druidCluster) { for (final Object2IntMap.Entry<String> entry : targetReplicants.object2IntEntrySet()) { final String tier = entry.getKey(); // if there are replicants loading in cluster if (druidCluster.hasTier(tier) && entry.getIntValue() > currentReplicants.getOrDefault(tier, 0)) { return true; } } return false; }
SettableColumnSelectorFactory(AggregatorFactory[] aggregatorFactories) { columnIndexMap = new Object2IntArrayMap<>(aggregatorFactories.length); columnIndexMap.defaultReturnValue(UNKNOWN_COLUMN_INDEX); for (int i = 0; i < aggregatorFactories.length; i++) { columnIndexMap.put(aggregatorFactories[i].getName(), i); } }
private int checkAndGetColumnIndex(String columnName) { final int columnIndex = columnIndexMap.getInt(columnName); Preconditions.checkState( columnIndex != UNKNOWN_COLUMN_INDEX, "Cannot find a proper column index for column[%s]", columnName ); return columnIndex; }
public DimensionDictionary() { this.lock = new ReentrantReadWriteLock(); valueToId.defaultReturnValue(-1); }
public void forEachTieredStat(final String statName, final ObjLongConsumer<String> consumer) { final Object2LongOpenHashMap<String> theStat = perTierStats.get(statName); if (theStat != null) { for (final Object2LongMap.Entry<String> entry : theStat.object2LongEntrySet()) { consumer.accept(entry.getKey(), entry.getLongValue()); } } }
private CoordinatorStats makeStats(int numCompactionTasks, CompactionSegmentIterator iterator) { final CoordinatorStats stats = new CoordinatorStats(); stats.addToGlobalStat(COMPACT_TASK_COUNT, numCompactionTasks); remainingSegmentSizeBytes = iterator.remainingSegmentSizeBytes(); iterator.remainingSegmentSizeBytes().object2LongEntrySet().fastForEach( entry -> { final String dataSource = entry.getKey(); final long numSegmentsWaitCompact = entry.getLongValue(); stats.addToDataSourceStat(SEGMENT_SIZE_WAIT_COMPACT, dataSource, numSegmentsWaitCompact); } ); return stats; }
@Override public void reset() { if (enableRuntimeDictionaryGeneration) { dictionary.clear(); reverseDictionary.clear(); rankOfDictionaryIds = null; currentEstimatedSize = 0; } }
public void addToTieredStat(final String statName, final String tier, final long value) { perTierStats.computeIfAbsent(statName, ignored -> new Object2LongOpenHashMap<>()) .addTo(tier, value); }
public CoordinatorStats() { perTierStats = new HashMap<>(); perDataSourceStats = new HashMap<>(); globalStats = new Object2LongOpenHashMap<>(); }
@Nullable public long getRemainingSegmentSizeBytes(String dataSource) { return remainingSegmentSizeBytes.getLong(dataSource); } }
public void addToGlobalStat(final String statName, final long value) { globalStats.addTo(statName, value); }
public void forEachDataSourceStat(String statName, ObjLongConsumer<String> consumer) { final Object2LongOpenHashMap<String> stat = perDataSourceStats.get(statName); if (stat != null) { for (Entry<String> entry : stat.object2LongEntrySet()) { consumer.accept(entry.getKey(), entry.getLongValue()); } } }
public void addToDataSourceStat(String statName, String dataSource, long value) { perDataSourceStats.computeIfAbsent(statName, k -> new Object2LongOpenHashMap<>()) .addTo(dataSource, value); }
/** * * @param statName the name of the statistics * @param tier the tier * @return the value for the statistics {@code statName} under {@code tier} tier * @throws NullPointerException if {@code statName} is not found */ public long getTieredStat(final String statName, final String tier) { return perTierStats.get(statName).getLong(tier); }