|
62 | 62 | import static io.trino.server.protocol.spooling.SpooledMetadataBlockSerde.serialize;
|
63 | 63 | import static io.trino.server.protocol.spooling.SpoolingSessionProperties.getInitialSegmentSize;
|
64 | 64 | import static io.trino.server.protocol.spooling.SpoolingSessionProperties.getMaxSegmentSize;
|
| 65 | +import static io.trino.server.protocol.spooling.SpoolingSessionProperties.isInliningEnabled; |
65 | 66 | import static java.util.Objects.requireNonNull;
|
66 | 67 | import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
67 | 68 | import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
@@ -153,6 +154,7 @@ static class OutputSpoolingOperator
|
153 | 154 | private final AtomicLong inlinedSegmentsCount = new AtomicLong();
|
154 | 155 | private final long maxSegmentSize;
|
155 | 156 | private final long minSegmentSize;
|
| 157 | + private final boolean inliningEnabled; |
156 | 158 |
|
157 | 159 | enum State
|
158 | 160 | {
|
@@ -187,6 +189,7 @@ public OutputSpoolingOperator(OperatorContext operatorContext, QueryDataEncoder
|
187 | 189 |
|
188 | 190 | this.minSegmentSize = getInitialSegmentSize(operatorContext.getSession()).toBytes();
|
189 | 191 | this.maxSegmentSize = getMaxSegmentSize(operatorContext.getSession()).toBytes();
|
| 192 | + this.inliningEnabled = isInliningEnabled(operatorContext.getSession()); |
190 | 193 | this.aggregatedMemoryContext = operatorContext.newAggregateUserMemoryContext();
|
191 | 194 | this.queryDataEncoder = requireNonNull(queryDataEncoder, "queryDataEncoder is null");
|
192 | 195 | this.spoolingManager = requireNonNull(spoolingManager, "spoolingManager is null");
|
@@ -282,7 +285,7 @@ private Page spoolOrInline(boolean lastPage)
|
282 | 285 | long rows = reduce(partition, Page::getPositionCount);
|
283 | 286 | long size = reduce(partition, Page::getSizeInBytes);
|
284 | 287 |
|
285 |
| - if (lastPage && isLastPartition && size < SPOOLING_THRESHOLD) { |
| 288 | + if (lastPage && inliningEnabled && isLastPartition && size < SPOOLING_THRESHOLD) { |
286 | 289 | // If the last partition is small enough, inline it to save the overhead of spooling
|
287 | 290 | spooledMetadataBuilder.addAll(inline(partition));
|
288 | 291 | continue;
|
|
0 commit comments