Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions isthmus/src/main/java/io/substrait/isthmus/SubstraitToCalcite.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
import io.substrait.extension.SimpleExtension;
import io.substrait.isthmus.SubstraitRelNodeConverter.Context;
import io.substrait.plan.Plan;
import io.substrait.relation.NamedScan;
import io.substrait.relation.Rel;
import io.substrait.relation.RelCopyOnWriteVisitor;
import io.substrait.type.NamedStruct;
import io.substrait.util.EmptyVisitationContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.calcite.jdbc.CalciteSchema;
import org.apache.calcite.prepare.Prepare;
import org.apache.calcite.rel.RelNode;
Expand Down Expand Up @@ -229,29 +223,4 @@ private Pair<Integer, RelDataType> renameFields(
return Pair.of(currentIndex, type);
}
}

private static class NamedStructGatherer extends RelCopyOnWriteVisitor<RuntimeException> {
Map<List<String>, NamedStruct> tableMap;

private NamedStructGatherer() {
super();
this.tableMap = new HashMap<>();
}

public static Map<List<String>, NamedStruct> gatherTables(Rel rel) {
NamedStructGatherer visitor = new NamedStructGatherer();
rel.accept(visitor, EmptyVisitationContext.INSTANCE);
return visitor.tableMap;
}

@Override
public Optional<Rel> visit(NamedScan namedScan, EmptyVisitationContext context) {
Optional<Rel> result = super.visit(namedScan, context);

List<String> tableName = namedScan.getNames();
tableMap.put(tableName, namedScan.getInitialSchema());

return result;
}
}
}