Skip to content

Commit

Permalink
perfm: create array only when it is necessary at dynamic query of doc…
Browse files Browse the repository at this point in the history
…ument and column

Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Aug 21, 2023
1 parent 79688c9 commit 85da543
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ public ColumnQuery get() {
if (limit.isPresent()) {
long skip = limit.map(l -> l.startAt() - 1).orElse(query.skip());
long max = limit.map(Limit::maxResults).orElse((int) query.limit());
List<Sort> sorts = new ArrayList<>();
sorts.addAll(query.sorts());
sorts.addAll(special.sorts());
List<Sort> sorts = query.sorts();
if (!special.sorts().isEmpty()) {
sorts = new ArrayList<>(query.sorts());
sorts.addAll(special.sorts());
}
return new MappingColumnQuery(sorts, max,
skip,
query.condition().orElse(null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ public DocumentQuery get() {
if (limit.isPresent()) {
long skip = limit.map(l -> l.startAt() - 1).orElse(query.skip());
long max = limit.map(Limit::maxResults).orElse((int) query.limit());
List<Sort> sorts = new ArrayList<>();
sorts.addAll(query.sorts());
sorts.addAll(special.sorts());
List<Sort> sorts = query.sorts();
if (!special.sorts().isEmpty()) {
sorts = new ArrayList<>(query.sorts());
sorts.addAll(special.sorts());
}
return new MappingDocumentQuery(sorts, max,
skip,
query.condition().orElse(null),
Expand Down

0 comments on commit 85da543

Please sign in to comment.