From 359424d32d0865a3dedf8a819dcbe690b25e3a03 Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 5 Jul 2023 01:03:16 -0700 Subject: [PATCH] Cleanup a symbol table access. --- .../textplan/converter/PlanPrinterVisitor.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/substrait/textplan/converter/PlanPrinterVisitor.cpp b/src/substrait/textplan/converter/PlanPrinterVisitor.cpp index c95eb90f..3243769d 100644 --- a/src/substrait/textplan/converter/PlanPrinterVisitor.cpp +++ b/src/substrait/textplan/converter/PlanPrinterVisitor.cpp @@ -760,12 +760,10 @@ std::any PlanPrinterVisitor::visitReadRelation( return ""; } - auto mainSymbol = symbolTable_->lookupSymbolByLocationAndType( - PROTO_LOCATION(relation), SymbolType::kRelation); - - auto symbols = symbolTable_->lookupSymbolsByLocation(PROTO_LOCATION(*msg)); - if (!symbols.empty()) { - text << " source " << symbols[0]->name << ";\n"; + auto source = symbolTable_->lookupSymbolByLocationAndType( + PROTO_LOCATION(*msg), SymbolType::kSource); + if (source != nullptr) { + text << " source " << source->name << ";\n"; } if (relation.has_base_schema()) {