public static Set<HivePrivilegeInfo> toGrants(List<PrivilegeGrantInfo> userGrants) { if (userGrants == null) { return ImmutableSet.of(); } ImmutableSet.Builder<HivePrivilegeInfo> privileges = ImmutableSet.builder(); for (PrivilegeGrantInfo userGrant : userGrants) { privileges.addAll(parsePrivilege(userGrant)); } return privileges.build(); }
public ImmutableSet<InjectionPoint> getInjectionPoints() { ImmutableList<SingleMemberInjector> localMemberInjectors = memberInjectors; if (localMemberInjectors != null) { ImmutableSet.Builder<InjectionPoint> builder = ImmutableSet.builder(); for (SingleMemberInjector memberInjector : localMemberInjectors) { builder.add(memberInjector.getInjectionPoint()); } return builder.build(); } return ImmutableSet.of(); }
@ConfigDescription("The types of control queries allowed to run [CREATE, READ, MODIFY]") @Config("control.query-types") public VerifierConfig setControlQueryTypes(String types) { if (Strings.isNullOrEmpty(types)) { this.controlQueryTypes = ImmutableSet.of(); return this; } ImmutableSet.Builder<QueryType> builder = ImmutableSet.builder(); for (String value : Splitter.on(',').trimResults().omitEmptyStrings().split(types)) { builder.add(QueryType.valueOf(value.toUpperCase())); } this.controlQueryTypes = builder.build(); return this; }
@ConfigDescription("The types of control queries allowed to run [CREATE, READ, MODIFY]") @Config("test.query-types") public VerifierConfig setTestQueryTypes(String types) { if (Strings.isNullOrEmpty(types)) { this.testQueryTypes = ImmutableSet.of(); return this; } ImmutableSet.Builder<QueryType> builder = ImmutableSet.builder(); for (String value : Splitter.on(',').trimResults().omitEmptyStrings().split(types)) { builder.add(QueryType.valueOf(value.toUpperCase())); } this.testQueryTypes = builder.build(); return this; }
static ImmutableSet<File> getClassPathFromManifest(File jarFile, @Nullable Manifest manifest) { if (manifest == null) { return ImmutableSet.of(); ImmutableSet.Builder<File> builder = ImmutableSet.builder(); String classpathAttribute = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH.toString()); builder.add(toFile(url)); return builder.build();
/** Returns all top level classes whose package name is {@code packageName}. */ public ImmutableSet<ClassInfo> getTopLevelClasses(String packageName) { checkNotNull(packageName); ImmutableSet.Builder<ClassInfo> builder = ImmutableSet.builder(); for (ClassInfo classInfo : getTopLevelClasses()) { if (classInfo.getPackageName().equals(packageName)) { builder.add(classInfo); } } return builder.build(); }
@Override public Set<PlanFragmentId> visitUnion(UnionNode node, PlanFragmentId currentFragmentId) { ImmutableSet.Builder<PlanFragmentId> allSources = ImmutableSet.builder(); // Link the source fragments together, so we only schedule one at a time. Set<PlanFragmentId> previousSources = ImmutableSet.of(); for (PlanNode subPlanNode : node.getSources()) { Set<PlanFragmentId> currentSources = subPlanNode.accept(this, currentFragmentId); allSources.addAll(currentSources); addEdges(previousSources, currentSources); previousSources = currentSources; } return allSources.build(); }
public Set<String> getIncomingChannels(Plugin plugin) { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } synchronized (incomingLock) { Set<PluginMessageListenerRegistration> registrations = incomingByPlugin.get(plugin); if (registrations != null) { Builder<String> builder = ImmutableSet.builder(); for (PluginMessageListenerRegistration registration : registrations) { builder.add(registration.getChannel()); } return builder.build(); } else { return ImmutableSet.of(); } } }
private static Set<String> globalUniqueNodes(StageInfo stageInfo) { if (stageInfo == null) { return ImmutableSet.of(); } ImmutableSet.Builder<String> nodes = ImmutableSet.builder(); for (TaskInfo task : stageInfo.getTasks()) { // todo add nodeId to TaskInfo URI uri = task.getTaskStatus().getSelf(); nodes.add(uri.getHost() + ":" + uri.getPort()); } for (StageInfo subStage : stageInfo.getSubStages()) { nodes.addAll(globalUniqueNodes(subStage)); } return nodes.build(); }
@Override public Set<Class<?>> getFunctions() { return ImmutableSet.<Class<?>>builder() .add(LearnClassifierAggregation.class) .add(LearnVarcharClassifierAggregation.class) .add(LearnRegressorAggregation.class) .add(LearnLibSvmClassifierAggregation.class) .add(LearnLibSvmVarcharClassifierAggregation.class) .add(LearnLibSvmRegressorAggregation.class) .add(EvaluateClassifierPredictionsAggregation.class) .add(MLFunctions.class) .addAll(ML_FEATURE_FUNCTIONS) .build(); } }