Skip to content

Commit

Permalink
Indicate progress only if limit is applied
Browse files Browse the repository at this point in the history
The code was always returning an indication that it could benefit
from the limit pushdown even if that wasn't the case. This could
cause the optimizer to loop indefinitely in some cases.
  • Loading branch information
martint committed Apr 12, 2019
1 parent 03bb0a4 commit f27fddb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,12 @@ public Optional<LimitApplicationResult<ConnectorTableHandle>> applyLimit(Connect
{
MemoryTableHandle table = (MemoryTableHandle) handle;

if (!table.getLimit().isPresent() || limit < table.getLimit().getAsLong()) {
table = new MemoryTableHandle(table.getId(), OptionalLong.of(limit));
if (table.getLimit().isPresent() && table.getLimit().getAsLong() <= limit) {
return Optional.empty();
}

return Optional.of(new LimitApplicationResult<>(table, true));
return Optional.of(new LimitApplicationResult<>(
new MemoryTableHandle(table.getId(), OptionalLong.of(limit)),
true));
}
}

0 comments on commit f27fddb

Please sign in to comment.