Skip to content

Commit 5c050fb

Browse files
elonazoulayPraveen2112
authored andcommitted
Remove unnecessary check in toPredicate
1 parent da47478 commit 5c050fb

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotQueryBuilder.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,14 @@ public static Optional<String> getFilterClause(TupleDomain<ColumnHandle> tupleDo
109109
ImmutableList.Builder<String> conjunctsBuilder = ImmutableList.builder();
110110
checkState((forHavingClause && timePredicate.isEmpty()) || !forHavingClause, "Unexpected time predicate with having clause");
111111
timePredicate.ifPresent(conjunctsBuilder::add);
112-
if (!tupleDomain.equals(TupleDomain.all())) {
113-
Map<ColumnHandle, Domain> domains = tupleDomain.getDomains().orElseThrow();
114-
for (Map.Entry<ColumnHandle, Domain> entry : domains.entrySet()) {
115-
PinotColumnHandle pinotColumnHandle = (PinotColumnHandle) entry.getKey();
116-
// If this is for a having clause, only include aggregate columns.
117-
// If this is for a where clause, only include non-aggregate columns.
118-
// i.e. (forHavingClause && isAggregate) || (!forHavingClause && !isAggregate)
119-
if (forHavingClause == pinotColumnHandle.isAggregate()) {
120-
toPredicate(pinotColumnHandle, entry.getValue()).ifPresent(conjunctsBuilder::add);
121-
}
112+
Map<ColumnHandle, Domain> domains = tupleDomain.getDomains().orElseThrow();
113+
for (Map.Entry<ColumnHandle, Domain> entry : domains.entrySet()) {
114+
PinotColumnHandle pinotColumnHandle = (PinotColumnHandle) entry.getKey();
115+
// If this is for a having clause, only include aggregate columns.
116+
// If this is for a where clause, only include non-aggregate columns.
117+
// i.e. (forHavingClause && isAggregate) || (!forHavingClause && !isAggregate)
118+
if (forHavingClause == pinotColumnHandle.isAggregate()) {
119+
toPredicate(pinotColumnHandle, entry.getValue()).ifPresent(conjunctsBuilder::add);
122120
}
123121
}
124122
List<String> conjuncts = conjunctsBuilder.build();

0 commit comments

Comments
 (0)