Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve overlapping fields performance #2495

Merged
merged 7 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/main/java/graphql/util/Anonymizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -741,17 +741,6 @@ public TraversalControl visitDirective(Directive directive, TraverserContext<Nod
return changeNode(context, directive.transform(builder -> builder.name(newName)));
}

// @Override
// public TraversalControl visitStringValue(StringValue node, TraverserContext<Node> context) {
// return changeNode(context, node.transform(builder -> builder.value("stringValue" + stringValueCounter.getAndIncrement())));
// }
//
// @Override
// public TraversalControl visitIntValue(IntValue node, TraverserContext<Node> context) {
// return changeNode(context, node.transform(builder -> builder.value(BigInteger.valueOf(intValueCounter.getAndIncrement()))));
// }
//

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this meant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleting commented out code .. not directly related to this PR

@Override
public TraversalControl visitOperationDefinition(OperationDefinition node, TraverserContext<Node> context) {
if (node.getName() != null) {
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/graphql/util/FpKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
Expand Down Expand Up @@ -276,6 +278,16 @@ public static <T> List<T> filterList(Collection<T> list, Predicate<T> filter) {
.collect(Collectors.toList());
}

public static <T> Set<T> filterSet(Set<T> input, Predicate<T> filter) {
LinkedHashSet<T> result = new LinkedHashSet<>();
for (T t : input) {
if (filter.test(t)) {
result.add(t);
}
}
return result;
}

/**
* Used in simple {@link Map#computeIfAbsent(Object, java.util.function.Function)} cases
*
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/graphql/validation/AbstractRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import graphql.language.VariableReference;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static graphql.validation.ValidationError.newValidationError;
Expand Down Expand Up @@ -51,7 +52,7 @@ public ValidationUtil getValidationUtil() {
return validationUtil;
}

public void addError(ValidationErrorType validationErrorType, List<? extends Node<?>> locations, String description) {
public void addError(ValidationErrorType validationErrorType, Collection<? extends Node<?>> locations, String description) {
List<SourceLocation> locationList = new ArrayList<>();
for (Node<?> node : locations) {
locationList.add(node.getSourceLocation());
Expand Down
Loading