Refine search
public GroupByMergedQueryRunner( ExecutorService exec, Supplier<GroupByQueryConfig> configSupplier, QueryWatcher queryWatcher, NonBlockingPool<ByteBuffer> bufferPool, Iterable<QueryRunner<T>> queryables ) { this.exec = MoreExecutors.listeningDecorator(exec); this.queryWatcher = queryWatcher; this.queryables = Iterables.unmodifiableIterable(Iterables.filter(queryables, Predicates.notNull())); this.configSupplier = configSupplier; this.bufferPool = bufferPool; }
/** * Split each element of an Iterable<String> at commas. * @param input Iterable over strings. * @return An Iterable over string which breaks down each input element at comma boundaries */ @Nonnull public static List<String> splitAtCommasAndTrim(Iterable<String> input) { if(input==null) { return Collections.emptyList(); } Iterable<String> nonEmptyInputs = Iterables.filter(input, Predicates.notNull()); return Lists.newArrayList(Iterables.concat(Iterables.transform(nonEmptyInputs, COMMA_SPLITTER))); }
public GroupByMergingQueryRunnerV2( GroupByQueryConfig config, ExecutorService exec, QueryWatcher queryWatcher, Iterable<QueryRunner<Row>> queryables, int concurrencyHint, BlockingPool<ByteBuffer> mergeBufferPool, int mergeBufferSize, ObjectMapper spillMapper, String processingTmpDir ) { this.config = config; this.exec = MoreExecutors.listeningDecorator(exec); this.queryWatcher = queryWatcher; this.queryables = Iterables.unmodifiableIterable(Iterables.filter(queryables, Predicates.notNull())); this.concurrencyHint = concurrencyHint; this.mergeBufferPool = mergeBufferPool; this.spillMapper = spillMapper; this.processingTmpDir = processingTmpDir; this.mergeBufferSize = mergeBufferSize; }
@Override public Set<String> getRoleNames(User user) { final Set<String> roleIds = user.getRoleIds(); if (roleIds.isEmpty()) { return Collections.emptySet(); } Map<String, Role> idMap; try { idMap = roleService.loadAllIdMap(); } catch (NotFoundException e) { LOG.error("Unable to load role ID map. Using empty map.", e); idMap = Collections.emptyMap(); } return ImmutableSet.copyOf( Iterables.filter( Collections2.transform(roleIds, Roles.roleIdToNameFunction(idMap)), Predicates.notNull() ) ); }
public void removeOldTasks() { DateTime oldestAllowedTask = DateTime.now().minus(infoCacheTime.toMillis()); for (TaskInfo taskInfo : filter(transform(tasks.asMap().values(), SqlTask::getTaskInfo), notNull())) { TaskId taskId = taskInfo.getTaskStatus().getTaskId(); try { DateTime endTime = taskInfo.getStats().getEndTime(); if (endTime != null && endTime.isBefore(oldestAllowedTask)) { tasks.asMap().remove(taskId); } } catch (RuntimeException e) { log.warn(e, "Error while inspecting age of complete task %s", taskId); } } }
for (Expression expression : filter(equalitySet, not(derivedExpressions::contains))) { Expression scopeRewritten = rewriteExpression(expression, symbolScope, false); if (scopeRewritten != null) { for (Expression expression : filter(scopeExpressions, not(equalTo(matchingCanonical)))) { scopeEqualities.add(new ComparisonExpression(ComparisonExpression.Operator.EQUAL, matchingCanonical, expression)); for (Expression expression : filter(scopeComplementExpressions, not(equalTo(complementCanonical)))) { scopeComplementEqualities.add(new ComparisonExpression(ComparisonExpression.Operator.EQUAL, complementCanonical, expression)); connectingExpressions.add(complementCanonical); connectingExpressions.addAll(scopeStraddlingExpressions); connectingExpressions = ImmutableList.copyOf(filter(connectingExpressions, Predicates.notNull())); Expression connectingCanonical = getCanonical(connectingExpressions); if (connectingCanonical != null) {
/** * Combine multiple lists into one. * * @param list1 The first list to combine. * @param list2 The second list to combine. * @param list3 The third list to combine. * @param list4 The fourth list to combine. * @param list5 The fifth list to combine. * @param list6 The sixth list to combine. * @param list7 The seventh list to combine. * @return A new list with all input lists combined. */ public static List<?> combine(Iterable list1, Iterable list2, Iterable list3, Iterable list4, Iterable list5, Iterable list6, Iterable list7) { Iterable<Iterable<?>> nonNullLists = Iterables.filter( Lists.<Iterable<?>>newArrayList(list1, list2, list3, list4, list5, list6, list7), Predicates.notNull()); return ImmutableList.copyOf(Iterables.concat(nonNullLists)); }
public void setOutputValues(Iterable<?> objects) { if (objects == null) { this.outputValues = ImmutableList.of(); currentView.setOutputValues(ImmutableList.of()); } else { Iterable<?> nonNulls = Iterables.filter(objects, Predicates.notNull()); this.outputValues = ImmutableList.copyOf(nonNulls); currentView.setOutputValues(ImmutableList.copyOf(this.outputValues)); } }
/** * @param channelFilter {@link Predicate} to use to determine whether or not a socket shall be * considered. * @return Channels matching the given {@link Predicate}. */ public Iterable<SocketChannel> matchingChannels(final Predicate<SocketChannel> channelFilter) { return Iterables.filter( Lists.newArrayList(channels), Predicates.and(Predicates.notNull(), channelFilter)); } }
public static Iterable<? extends String> toStringIdsWithoutNulls(final Collection<? extends IssueConstant> issueConstants) { return Iterables.transform(Iterables.filter(issueConstants, Predicates.<IssueConstant>notNull()), new Function<IssueConstant, String>() { @Override public String apply(final IssueConstant input) { return input.getId(); } }); }