@@ -9,20 +9,19 @@ namespace gs {
99
1010bool CypherReadApp::Query (const GraphDBSession& graph, Decoder& input,
1111 Encoder& output) {
12- auto txn = graph.GetReadTransaction ();
13- std::string_view _bytes = input.get_bytes ();
14- uint8_t type = static_cast <uint8_t >(_bytes.back ());
15- std::string_view bytes = std::string_view (_bytes.data (), _bytes.size () - 1 );
12+ std::string_view r_bytes = input.get_bytes ();
13+ uint8_t type = static_cast <uint8_t >(r_bytes.back ());
14+ std::string_view bytes = std::string_view (r_bytes.data (), r_bytes.size () - 1 );
1615 if (type == Schema::ADHOC_READ_PLUGIN_ID) {
17- auto txn = graph.GetReadTransaction ();
18-
1916 physical::PhysicalPlan plan;
2017 if (!plan.ParseFromString (std::string (bytes))) {
2118 LOG (ERROR) << " Parse plan failed..." ;
2219 return false ;
2320 }
2421
2522 LOG (INFO) << " plan: " << plan.DebugString ();
23+ auto txn = graph.GetReadTransaction ();
24+
2625 gs::runtime::GraphReadInterface gri (txn);
2726 auto ctx = runtime::PlanParser::get ()
2827 .parse_read_pipeline (graph.schema (),
@@ -69,6 +68,7 @@ bool CypherReadApp::Query(const GraphDBSession& graph, Decoder& input,
6968 query, runtime::PlanParser::get ().parse_read_pipeline (
7069 db_.schema (), gs::runtime::ContextMeta (), plan));
7170 }
71+ auto txn = graph.GetReadTransaction ();
7272
7373 gs::runtime::GraphReadInterface gri (txn);
7474 auto ctx = pipeline_cache_.at (query).Execute (gri, runtime::Context (),
0 commit comments