Skip to content

Commit 40b055c

Browse files
committed
Revert "Skip total count if select result is empty"
This reverts commit 7ca1394.
1 parent d57f9f7 commit 40b055c

File tree

3 files changed

+1
-14
lines changed

3 files changed

+1
-14
lines changed

schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaQueryDataFetcher.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import graphql.schema.DataFetcher;
3535
import graphql.schema.DataFetchingEnvironment;
3636
import graphql.schema.GraphQLScalarType;
37-
import java.util.Collection;
3837
import java.util.LinkedHashMap;
3938
import java.util.List;
4039
import java.util.Map;
@@ -118,12 +117,7 @@ public PagedResult<Object> get(DataFetchingEnvironment environment) {
118117
}
119118

120119
if (totalSelection.isPresent() || pagesSelection.isPresent()) {
121-
final var selectResult = pagedResult.getSelect();
122-
123-
final long total = recordsSelection.isEmpty() ||
124-
selectResult.filter(Predicate.not(Collection::isEmpty)).isPresent()
125-
? queryFactory.queryTotalCount(environment, restrictedKeys)
126-
: 0L;
120+
final Long total = queryFactory.queryTotalCount(environment, restrictedKeys);
127121

128122
pagedResult.withTotal(total);
129123
}

schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/PagedResult.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.LinkedHashMap;
2121
import java.util.List;
2222
import java.util.Map;
23-
import java.util.Optional;
2423

2524
public class PagedResult<T> {
2625

@@ -136,10 +135,6 @@ public Builder<T> withSelect(List<T> select) {
136135
return this;
137136
}
138137

139-
public Optional<List<T>> getSelect() {
140-
return Optional.ofNullable(select);
141-
}
142-
143138
/**
144139
* Builder method for select parameter.
145140
* @param select field to set

schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/ResultStreamWrapper.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
6363
return System.identityHashCode(proxy);
6464
} else if ("spliterator".equals(method.getName())) {
6565
return stream.spliterator();
66-
} else if ("isEmpty".equals(method.getName())) {
67-
return size == 0;
6866
}
6967
throw new UnsupportedOperationException(method + " is not supported");
7068
}

0 commit comments

Comments
 (0)