Skip to content

Commit

Permalink
Add defensive copy for Constraint.predicateColumns
Browse files Browse the repository at this point in the history
In order to maintain class immutability.
  • Loading branch information
findepi committed Feb 26, 2022
1 parent 75802d1 commit c0bc23d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void testExplicitPropertyMappings()
.put("query.min-schedule-split-batch-size", "9")
.put("query.max-concurrent-queries", "10")
.put("query.max-queued-queries", "15")
.put("query.initial-hash-partitions", "16")
.put("query.hash-partition-count", "16")
.put("query.manager-executor-pool-size", "11")
.put("query.remote-task.min-error-duration", "30s")
.put("query.remote-task.max-error-duration", "60s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private Constraint(TupleDomain<ColumnHandle> summary, Optional<Predicate<Map<Col
{
this.summary = requireNonNull(summary, "summary is null");
this.predicate = requireNonNull(predicate, "predicate is null");
this.predicateColumns = requireNonNull(predicateColumns, "predicateColumns is null");
this.predicateColumns = requireNonNull(predicateColumns, "predicateColumns is null").map(Set::copyOf);

if (predicateColumns.isPresent() && predicate.isEmpty()) {
throw new IllegalArgumentException("predicateColumns cannot be present when predicate is not present");
Expand Down

0 comments on commit c0bc23d

Please sign in to comment.