Skip to content

Commit 187d53e

Browse files
committed
Remove unused code for pre-computed hashes in TableFunctionProcessorNode
1 parent a2e1474 commit 187d53e

File tree

12 files changed

+7
-56
lines changed

12 files changed

+7
-56
lines changed

core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/ImplementTableFunctionSource.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public Result apply(TableFunctionNode node, Captures captures, Context context)
165165
Optional.empty(),
166166
ImmutableSet.of(),
167167
0,
168-
Optional.empty(),
169168
node.getHandle()));
170169
}
171170

@@ -187,7 +186,6 @@ public Result apply(TableFunctionNode node, Captures captures, Context context)
187186
sourceProperties.specification(),
188187
ImmutableSet.of(),
189188
0,
190-
Optional.empty(),
191189
node.getHandle()));
192190
}
193191
Map<String, SourceWithProperties> sources = mapSourcesByName(node.getSources(), node.getTableArgumentProperties());
@@ -282,7 +280,6 @@ public Result apply(TableFunctionNode node, Captures captures, Context context)
282280
Optional.of(new DataOrganizationSpecification(finalPartitionBy, finalOrderBy)),
283281
ImmutableSet.of(),
284282
0,
285-
Optional.empty(),
286283
node.getHandle()));
287284
}
288285

core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PruneTableFunctionProcessorColumns.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ protected Optional<PlanNode> pushDownProjectOff(Context context, TableFunctionPr
8181
node.getSpecification(),
8282
node.getPrePartitioned(),
8383
node.getPreSorted(),
84-
node.getHashSymbol(),
8584
node.getHandle()));
8685
}
8786
}

core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PruneTableFunctionProcessorSourceColumns.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ public Result apply(TableFunctionProcessorNode node, Captures captures, Context
7777
specification.orderingScheme().ifPresent(orderingScheme -> requiredInputs.addAll(orderingScheme.orderBy()));
7878
});
7979

80-
node.getHashSymbol().ifPresent(requiredInputs::add);
81-
8280
Optional<Map<Symbol, Symbol>> updatedMarkerSymbols = node.getMarkerSymbols()
8381
.map(mapping -> filterKeys(mapping, requiredInputs.build()::contains));
8482

@@ -97,7 +95,6 @@ public Result apply(TableFunctionProcessorNode node, Captures captures, Context
9795
node.getSpecification(),
9896
node.getPrePartitioned(),
9997
node.getPreSorted(),
100-
node.getHashSymbol(),
10198
node.getHandle())))
10299
.orElse(Result.empty());
103100
}

core/trino-main/src/main/java/io/trino/sql/planner/optimizations/AddExchanges.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ else if (!isNodePartitionedOn(child.getProperties(), partitionBy)) {
472472
}
473473
else {
474474
child = withDerivedProperties(
475-
partitionedExchange(idAllocator.getNextId(), REMOTE, child.getNode(), partitionBy, node.getHashSymbol()),
475+
partitionedExchange(idAllocator.getNextId(), REMOTE, child.getNode(), partitionBy, Optional.empty()),
476476
child.getProperties());
477477
}
478478
}

core/trino-main/src/main/java/io/trino/sql/planner/optimizations/AddLocalExchanges.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ public PlanWithProperties visitTableFunctionProcessor(TableFunctionProcessorNode
546546
node.getSpecification(),
547547
prePartitionedInputs,
548548
preSortedOrderPrefix,
549-
node.getHashSymbol(),
550549
node.getHandle());
551550

552551
return deriveProperties(result, child.getProperties());

core/trino-main/src/main/java/io/trino/sql/planner/optimizations/SymbolMapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ public TableFunctionProcessorNode map(TableFunctionProcessorNode node, PlanNode
436436
.map(this::map)
437437
.collect(toImmutableSet()),
438438
newSpecification.map(SpecificationWithPreSortedPrefix::preSorted).orElse(node.getPreSorted()),
439-
node.getHashSymbol().map(this::map),
440439
node.getHandle());
441440
}
442441

core/trino-main/src/main/java/io/trino/sql/planner/optimizations/UnaliasSymbolReferences.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ public PlanAndMappings visitTableFunctionProcessor(TableFunctionProcessorNode no
365365
Optional.empty(),
366366
ImmutableSet.of(),
367367
0,
368-
node.getHashSymbol().map(mapper::map),
369368
node.getHandle()),
370369
mapping);
371370
}

core/trino-main/src/main/java/io/trino/sql/planner/plan/TableFunctionProcessorNode.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public class TableFunctionProcessorNode
6666
private final Optional<DataOrganizationSpecification> specification;
6767
private final Set<Symbol> prePartitioned;
6868
private final int preSorted;
69-
private final Optional<Symbol> hashSymbol;
7069

7170
private final TableFunctionHandle handle;
7271

@@ -83,7 +82,6 @@ public TableFunctionProcessorNode(
8382
@JsonProperty("specification") Optional<DataOrganizationSpecification> specification,
8483
@JsonProperty("prePartitioned") Set<Symbol> prePartitioned,
8584
@JsonProperty("preSorted") int preSorted,
86-
@JsonProperty("hashSymbol") Optional<Symbol> hashSymbol,
8785
@JsonProperty("handle") TableFunctionHandle handle)
8886
{
8987
super(id);
@@ -112,7 +110,6 @@ public TableFunctionProcessorNode(
112110
.orElse(0) >= preSorted,
113111
"the number of pre-sorted symbols cannot be greater than the number of all ordering symbols");
114112
checkArgument(preSorted == 0 || partitionBy.equals(prePartitioned), "to specify pre-sorted symbols, it is required that all partitioning symbols are pre-partitioned");
115-
this.hashSymbol = requireNonNull(hashSymbol, "hashSymbol is null");
116113
this.handle = requireNonNull(handle, "handle is null");
117114
}
118115

@@ -176,12 +173,6 @@ public int getPreSorted()
176173
return preSorted;
177174
}
178175

179-
@JsonProperty
180-
public Optional<Symbol> getHashSymbol()
181-
{
182-
return hashSymbol;
183-
}
184-
185176
@JsonProperty
186177
public TableFunctionHandle getHandle()
187178
{
@@ -233,7 +224,6 @@ public PlanNode replaceChildren(List<PlanNode> newSources)
233224
specification,
234225
prePartitioned,
235226
preSorted,
236-
hashSymbol,
237227
handle);
238228
}
239229
}

core/trino-main/src/main/java/io/trino/sql/planner/planprinter/PlanPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ public Void visitTableFunctionProcessor(TableFunctionProcessorNode node, Context
19671967
specification.orderingScheme().ifPresent(orderingScheme -> descriptor.put("orderBy", formatOrderingScheme(orderingScheme, node.getPreSorted())));
19681968
});
19691969

1970-
addNode(node, "TableFunctionProcessor", descriptor.put("hash", formatHash(node.getHashSymbol())).buildOrThrow(), context);
1970+
addNode(node, "TableFunctionProcessor", descriptor.buildOrThrow(), context);
19711971

19721972
return processChildren(node, new Context(context.isInitialPlan()));
19731973
}

core/trino-main/src/test/java/io/trino/sql/planner/assertions/TableFunctionProcessorMatcher.java

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,14 @@ public class TableFunctionProcessorMatcher
4848
private final List<List<String>> requiredSymbols;
4949
private final Optional<Map<String, String>> markerSymbols;
5050
private final Optional<ExpectedValueProvider<DataOrganizationSpecification>> specification;
51-
private final Optional<String> hashSymbol;
5251

5352
private TableFunctionProcessorMatcher(
5453
String name,
5554
List<String> properOutputs,
5655
List<List<String>> passThroughSymbols,
5756
List<List<String>> requiredSymbols,
5857
Optional<Map<String, String>> markerSymbols,
59-
Optional<ExpectedValueProvider<DataOrganizationSpecification>> specification,
60-
Optional<String> hashSymbol)
58+
Optional<ExpectedValueProvider<DataOrganizationSpecification>> specification)
6159
{
6260
this.name = requireNonNull(name, "name is null");
6361
this.properOutputs = ImmutableList.copyOf(properOutputs);
@@ -69,7 +67,6 @@ private TableFunctionProcessorMatcher(
6967
.collect(toImmutableList());
7068
this.markerSymbols = markerSymbols.map(ImmutableMap::copyOf);
7169
this.specification = requireNonNull(specification, "specification is null");
72-
this.hashSymbol = requireNonNull(hashSymbol, "hashSymbol is null");
7370
}
7471

7572
@Override
@@ -145,12 +142,6 @@ public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session ses
145142
}
146143
}
147144

148-
if (hashSymbol.isPresent()) {
149-
if (!hashSymbol.map(symbolAliases::get).equals(tableFunctionProcessorNode.getHashSymbol().map(Symbol::toSymbolReference))) {
150-
return NO_MATCH;
151-
}
152-
}
153-
154145
ImmutableMap.Builder<String, Reference> properOutputsMapping = ImmutableMap.builder();
155146
for (int i = 0; i < properOutputs.size(); i++) {
156147
properOutputsMapping.put(properOutputs.get(i), tableFunctionProcessorNode.getProperOutputs().get(i).toSymbolReference());
@@ -173,7 +164,6 @@ public String toString()
173164
.add("requiredSymbols", requiredSymbols)
174165
.add("markerSymbols", markerSymbols)
175166
.add("specification", specification)
176-
.add("hashSymbol", hashSymbol)
177167
.toString();
178168
}
179169

@@ -186,7 +176,6 @@ public static class Builder
186176
private List<List<String>> requiredSymbols = ImmutableList.of();
187177
private Optional<Map<String, String>> markerSymbols = Optional.empty();
188178
private Optional<ExpectedValueProvider<DataOrganizationSpecification>> specification = Optional.empty();
189-
private Optional<String> hashSymbol = Optional.empty();
190179

191180
public Builder()
192181
{
@@ -234,17 +223,11 @@ public Builder specification(ExpectedValueProvider<DataOrganizationSpecification
234223
return this;
235224
}
236225

237-
public Builder hashSymbol(String hashSymbol)
238-
{
239-
this.hashSymbol = Optional.of(hashSymbol);
240-
return this;
241-
}
242-
243226
public PlanMatchPattern build()
244227
{
245228
PlanMatchPattern[] sources = source.map(sourcePattern -> new PlanMatchPattern[] {sourcePattern}).orElse(new PlanMatchPattern[] {});
246229
return node(TableFunctionProcessorNode.class, sources)
247-
.with(new TableFunctionProcessorMatcher(name, properOutputs, passThroughSymbols, requiredSymbols, markerSymbols, specification, hashSymbol));
230+
.with(new TableFunctionProcessorMatcher(name, properOutputs, passThroughSymbols, requiredSymbols, markerSymbols, specification));
248231
}
249232
}
250233
}

0 commit comments

Comments
 (0)