|
14 | 14 | package com.facebook.presto.operator;
|
15 | 15 |
|
16 | 16 | import com.facebook.presto.common.Page;
|
| 17 | +import com.facebook.presto.common.block.Block; |
17 | 18 | import com.facebook.presto.common.block.BlockBuilder;
|
18 | 19 | import com.facebook.presto.common.type.Type;
|
19 | 20 | import com.facebook.presto.operator.SetBuilderOperator.SetSupplier;
|
@@ -136,18 +137,21 @@ public void addInput(Page page)
|
136 | 137 | {
|
137 | 138 | requireNonNull(page, "page is null");
|
138 | 139 | checkState(!finishing, "Operator is finishing");
|
| 140 | + // use an effectively-final local variable instead of the non-final instance field inside of the loop |
| 141 | + ChannelSet channelSet = this.channelSet; |
139 | 142 | checkState(channelSet != null, "Set has not been built yet");
|
140 | 143 | checkState(outputPage == null, "Operator still has pending output");
|
141 | 144 |
|
142 | 145 | // create the block builder for the new boolean column
|
143 | 146 | // we know the exact size required for the block
|
144 | 147 | BlockBuilder blockBuilder = BOOLEAN.createFixedSizeBlockBuilder(page.getPositionCount());
|
145 | 148 |
|
146 |
| - Page probeJoinPage = page.extractChannel(probeJoinChannel); |
| 149 | + Page probeJoinPage = page.getLoadedPage(probeJoinChannel); |
| 150 | + Block probeJoinNulls = probeJoinPage.getBlock(0).mayHaveNull() ? probeJoinPage.getBlock(0) : null; |
147 | 151 |
|
148 | 152 | // update hashing strategy to use probe cursor
|
149 | 153 | for (int position = 0; position < page.getPositionCount(); position++) {
|
150 |
| - if (probeJoinPage.getBlock(0).isNull(position)) { |
| 154 | + if (probeJoinNulls != null && probeJoinNulls.isNull(position)) { |
151 | 155 | if (channelSet.isEmpty()) {
|
152 | 156 | BOOLEAN.writeBoolean(blockBuilder, false);
|
153 | 157 | }
|
|
0 commit comments