|
3 | 3 | import io.substrait.extension.SimpleExtension; |
4 | 4 | import io.substrait.isthmus.SubstraitRelNodeConverter.Context; |
5 | 5 | import io.substrait.plan.Plan; |
6 | | -import io.substrait.relation.NamedScan; |
7 | 6 | import io.substrait.relation.Rel; |
8 | | -import io.substrait.relation.RelCopyOnWriteVisitor; |
9 | | -import io.substrait.type.NamedStruct; |
10 | 7 | import io.substrait.util.EmptyVisitationContext; |
11 | 8 | import java.util.ArrayList; |
12 | | -import java.util.HashMap; |
13 | 9 | import java.util.List; |
14 | | -import java.util.Map; |
15 | | -import java.util.Optional; |
16 | 10 | import org.apache.calcite.jdbc.CalciteSchema; |
17 | 11 | import org.apache.calcite.prepare.Prepare; |
18 | 12 | import org.apache.calcite.rel.RelNode; |
@@ -229,29 +223,4 @@ private Pair<Integer, RelDataType> renameFields( |
229 | 223 | return Pair.of(currentIndex, type); |
230 | 224 | } |
231 | 225 | } |
232 | | - |
233 | | - private static class NamedStructGatherer extends RelCopyOnWriteVisitor<RuntimeException> { |
234 | | - Map<List<String>, NamedStruct> tableMap; |
235 | | - |
236 | | - private NamedStructGatherer() { |
237 | | - super(); |
238 | | - this.tableMap = new HashMap<>(); |
239 | | - } |
240 | | - |
241 | | - public static Map<List<String>, NamedStruct> gatherTables(Rel rel) { |
242 | | - NamedStructGatherer visitor = new NamedStructGatherer(); |
243 | | - rel.accept(visitor, EmptyVisitationContext.INSTANCE); |
244 | | - return visitor.tableMap; |
245 | | - } |
246 | | - |
247 | | - @Override |
248 | | - public Optional<Rel> visit(NamedScan namedScan, EmptyVisitationContext context) { |
249 | | - Optional<Rel> result = super.visit(namedScan, context); |
250 | | - |
251 | | - List<String> tableName = namedScan.getNames(); |
252 | | - tableMap.put(tableName, namedScan.getInitialSchema()); |
253 | | - |
254 | | - return result; |
255 | | - } |
256 | | - } |
257 | 226 | } |
0 commit comments