diff --git a/ci/images/tugraph-compile-arm64v8-centos7-Dockerfile b/ci/images/tugraph-compile-arm64v8-centos7-Dockerfile index cdc440ef6..81a6442be 100644 --- a/ci/images/tugraph-compile-arm64v8-centos7-Dockerfile +++ b/ci/images/tugraph-compile-arm64v8-centos7-Dockerfile @@ -329,7 +329,7 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/graphar/Gr # tabulate # if it is not accessible, replace it with the link below # https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz -RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-1.5.tar.gz \ +RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-d553e5.tar.gz \ && tar zxf tabulate-1.5.tar.gz && cp -rf tabulate-1.5/include/tabulate /usr/local/include \ && rm -rf /tabulate* diff --git a/ci/images/tugraph-compile-centos7-Dockerfile b/ci/images/tugraph-compile-centos7-Dockerfile index addc07d24..183c6e6ca 100644 --- a/ci/images/tugraph-compile-centos7-Dockerfile +++ b/ci/images/tugraph-compile-centos7-Dockerfile @@ -334,7 +334,7 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/graphar/Gr # tabulate # if it is not accessible, replace it with the link below # https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz -RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-1.5.tar.gz \ +RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-d553e5.tar.gz \ && tar zxf tabulate-1.5.tar.gz && cp -rf tabulate-1.5/include/tabulate /usr/local/include \ && rm -rf /tabulate* diff --git a/ci/images/tugraph-compile-centos8-Dockerfile b/ci/images/tugraph-compile-centos8-Dockerfile index 815a62a4b..3df854acc 100644 --- a/ci/images/tugraph-compile-centos8-Dockerfile +++ b/ci/images/tugraph-compile-centos8-Dockerfile @@ -325,7 +325,7 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/graphar/Gr # tabulate # if it is not accessible, replace it with the link below # https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz -RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-1.5.tar.gz \ +RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-d553e5.tar.gz \ && tar zxf tabulate-1.5.tar.gz && cp -rf tabulate-1.5/include/tabulate /usr/local/include \ && rm -rf /tabulate* diff --git a/ci/images/tugraph-compile-ubuntu18.04-Dockerfile b/ci/images/tugraph-compile-ubuntu18.04-Dockerfile index 97fa4062a..3a9926c16 100644 --- a/ci/images/tugraph-compile-ubuntu18.04-Dockerfile +++ b/ci/images/tugraph-compile-ubuntu18.04-Dockerfile @@ -326,7 +326,7 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/graphar/Gr # tabulate # if it is not accessible, replace it with the link below # https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz -RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-1.5.tar.gz \ +RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-d553e5.tar.gz \ && tar zxf tabulate-1.5.tar.gz && cp -rf tabulate-1.5/include/tabulate /usr/local/include \ && rm -rf /tabulate* diff --git a/src/cypher/execution_plan/execution_plan.cpp b/src/cypher/execution_plan/execution_plan.cpp index 9be992f60..e3e65b8fd 100644 --- a/src/cypher/execution_plan/execution_plan.cpp +++ b/src/cypher/execution_plan/execution_plan.cpp @@ -1455,7 +1455,9 @@ int ExecutionPlan::Execute(RTContext *ctx) { const ResultInfo &ExecutionPlan::GetResultInfo() const { return _result_info; } std::string ExecutionPlan::DumpPlan(int indent, bool statistics) const { - std::string s = statistics ? "Profile statistics:\n" : "Execution Plan:\n"; + std::string s; + s.append(FMA_FMT("ReadOnly:{}\n", ReadOnly())); + s.append(statistics ? "Profile statistics:\n" : "Execution Plan:\n"); OpBase::DumpStream(_root, indent, statistics, s); return s; } diff --git a/src/import/import_v3.cpp b/src/import/import_v3.cpp index e428f487d..37db2add4 100644 --- a/src/import/import_v3.cpp +++ b/src/import/import_v3.cpp @@ -1155,6 +1155,7 @@ void Importer::RocksdbToLmdb() { EdgeId out_last_eid = -1, in_last_eid = -1; size_t total_size = 0; VertexId pre_vid = InvalidVid; + EdgeUid last_uid(-1, -1, 0, -1, -1); auto throw_kvs_to_lmdb = [&lmdb_writer, &pending_tasks, this, &stage, i] (std::vector> kvs, @@ -1243,6 +1244,7 @@ void Importer::RocksdbToLmdb() { in_last_dst = -1; out_last_eid = -1; in_last_eid = -1; + last_uid = {-1, -1, 0, -1, -1}; }; while (true) { @@ -1318,19 +1320,15 @@ void Importer::RocksdbToLmdb() { uid.lid = labelId; uid.dst = vertexId; uid.tid = tid; - if (edge_property.empty()) { - uid.eid = 0; + if (last_uid.src == uid.src && + last_uid.lid == uid.lid && + last_uid.dst == uid.dst && + last_uid.tid == uid.tid) { + uid.eid = last_uid.eid + 1; } else { - auto& last = edge_property.back(); - if (std::get<1>(last).src == uid.src && - std::get<1>(last).lid == uid.lid && - std::get<1>(last).dst == uid.dst && - std::get<1>(last).tid == uid.tid) { - uid.eid = std::get<1>(last).eid + 1; - } else { - uid.eid = 0; - } + uid.eid = 0; } + last_uid = uid; edge_property.emplace_back( labelId, uid, Value::MakeCopy(val.data(), val.size())); outs.emplace_back(labelId, tid, vertexId, import_v2::DenseString()); diff --git a/test/cypher_plan_validate.json b/test/cypher_plan_validate.json index eaa696843..30b911832 100644 --- a/test/cypher_plan_validate.json +++ b/test/cypher_plan_validate.json @@ -8,107 +8,107 @@ "vid": [ { "query": "MATCH (n) WHERE id(n)=10 RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node By Id Seek[10,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node By Id Seek[10,]\n", "res": 1 }, { "query": "MATCH (n) WHERE id(n) IN [1,2,4] RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node By Id Seek[1,2,4,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node By Id Seek[1,2,4,]\n", "res": 3 }, { "query": "MATCH (n) WHERE id(n)=1 OR id(n)=3 OR id(n)=4 OR id(n)=18 OR id(n)=1111 RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node By Id Seek[1,3,4,18,1111,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node By Id Seek[1,3,4,18,1111,]\n", "res": 4 }, { "query": "MATCH (n) WHERE id(n)=1 OR id(n)=3 AND id(n)=4 OR id(n)=18 OR id(n)=1111 RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Filter [((({id(false,n) = 1}||({id(false,n) = 3}&&{id(false,n) = 4}))||{id(false,n) = 18})||{id(false,n) = 1111})]\n All Node Scan [n]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Filter [((({id(false,n) = 1}||({id(false,n) = 3}&&{id(false,n) = 4}))||{id(false,n) = 18})||{id(false,n) = 1111})]\n All Node Scan [n]\n", "res": 2 } ], "uid": [ { "query": "MATCH (n) where n.name=\"Rachel Kempson\" RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,]\n", "res": 1 }, { "query": "MATCH (n) where n.name in [\"Rachel Kempson\",\"Dennis Quaid\",\"none\"] RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,Dennis Quaid,none,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,Dennis Quaid,none,]\n", "res": 2 }, { "query": "MATCH (n) where n.name =\"Rachel Kempson\" or n.name= \"Dennis Quaid\" or n.name=\"none\" RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,Dennis Quaid,none,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,Dennis Quaid,none,]\n", "res": 2 }, { "query": "MATCH (n) where n.name = \"Rachel Kempson\" and n.name = \"Dennis Quaid\" or n.name = \"Vanessa Redgrave\" RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Filter [(({n.name = Rachel Kempson}&&{n.name = Dennis Quaid})||{n.name = Vanessa Redgrave})]\n All Node Scan [n]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Filter [(({n.name = Rachel Kempson}&&{n.name = Dennis Quaid})||{n.name = Vanessa Redgrave})]\n All Node Scan [n]\n", "res": 1 }, { "query": "MATCH (n) where n.name = \"Rachel Kempson\" or n.name = \"Dennis Quaid\" or n.name = \"Vanessa Redgrave\" RETURN n", - "plan": "Execution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,Dennis Quaid,Vanessa Redgrave,]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Node Index Seek [n] name IN [Rachel Kempson,Dennis Quaid,Vanessa Redgrave,]\n", "res": 3 } ], "list": [ { "query": "MATCH (n) RETURN id(n),label(n),properties(n);", - "plan": "Execution Plan:\nProduce Results\n Project [id(n),label(n),properties(n)]\n All Node Scan [n]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [id(n),label(n),properties(n)]\n All Node Scan [n]\n", "res": 21 } ], "parallel_traversal": [ { "query": "MATCH (n:Person) return count(n)", - "plan": "Execution Plan:\nProduce Results\n Traversal [n]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Traversal [n]\n", "res": 1 }, { "query": "MATCH (n:Person) where n.birthyear > 1900 and n.birthyear < 2000 return count(n) ", - "plan": "Execution Plan:\nProduce Results\n Traversal [n]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Traversal [n]\n", "res": 1 }, { "query": "MATCH (n:Person) return n.birthyear, count(n)", - "plan": "Execution Plan:\nProduce Results\n Traversal [n]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Traversal [n]\n", "res": 13 }, { "query": "MATCH (f:Film)<-[:ACTED_IN]-(p:Person)-[:BORN_IN]->(c:City) return c.name, count(f)", - "plan": "Execution Plan:\nProduce Results\n Traversal [f<--p-->c]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Traversal [f<--p-->c]\n", "res": 3 } ], "issue148": [ { "query": "WITH 'a' as a UNWIND ['a', 'b'] as k RETURN a, k", - "plan": "Execution Plan:\nProduce Results\n Project [a,k]\n Cartesian Product\n Unwind [[a,b],k]\n Project [a]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [a,k]\n Cartesian Product\n Unwind [[a,b],k]\n Project [a]\n", "res": 2 }, { "query": "WITH 'a' as a UNWIND ['b']+a as k RETURN a, k", - "plan": "Execution Plan:\nProduce Results\n Project [a,k]\n Apply\n Unwind [([b],a,+),k]\n Argument [a]\n Project [a]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Project [a,k]\n Apply\n Unwind [([b],a,+),k]\n Argument [a]\n Project [a]\n", "res": 2 } ], "schema_rewrite": [ { "query": "MATCH p=(n1)-[r1]->(n2)-[r2]->(m:Person) return count(p)", - "plan": "Execution Plan:\nProduce Results\n Aggregate [count(p)]\n Expand(All) [n2 --> m ]\n Expand(All) [n1 --> n2 ]\n Node By Label Scan [n1:Person]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Aggregate [count(p)]\n Expand(All) [n2 --> m ]\n Expand(All) [n1 --> n2 ]\n Node By Label Scan [n1:Person]\n", "res": 1 }, { "query": "MATCH p1=(n1)-[r1]->(n2)-[r2]->(m1:City),p2=(n3)-[r3]->(m2:Film) return count(p1)", - "plan": "Execution Plan:\nProduce Results\n Aggregate [count(p1)]\n Cartesian Product\n Expand(All) [n2 --> m1 ]\n Expand(All) [n1 --> n2 ]\n Node By Label Scan [n1:Person]\n Expand(All) [n3 --> m2 ]\n Node By Label Scan [n3:Person]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Aggregate [count(p1)]\n Cartesian Product\n Expand(All) [n2 --> m1 ]\n Expand(All) [n1 --> n2 ]\n Node By Label Scan [n1:Person]\n Expand(All) [n3 --> m2 ]\n Node By Label Scan [n3:Person]\n", "res": 1 }, { "query": "MATCH p1=(n1)-[r1]->(n2)-[r2]->(m1:City) with count(p1) as cp match p1=(n1)-[r1]->(m1:Film) return count(p1)", - "plan": "Execution Plan:\nProduce Results\n Aggregate [count(p1)]\n Apply\n Expand(All) [n1 --> m1 ]\n Node By Label Scan Dynamic [n1:Person]\n Argument [cp]\n Aggregate [cp]\n Expand(All) [n2 --> m1 ]\n Expand(All) [n1 --> n2 ]\n Node By Label Scan [n1:Person]\n", + "plan": "ReadOnly:1\nExecution Plan:\nProduce Results\n Aggregate [count(p1)]\n Apply\n Expand(All) [n1 --> m1 ]\n Node By Label Scan Dynamic [n1:Person]\n Argument [cp]\n Aggregate [cp]\n Expand(All) [n2 --> m1 ]\n Expand(All) [n1 --> n2 ]\n Node By Label Scan [n1:Person]\n", "res": 1 } ] diff --git a/test/test_lgraph_cli.cpp b/test/test_lgraph_cli.cpp index bdc206b43..b1209e777 100644 --- a/test/test_lgraph_cli.cpp +++ b/test/test_lgraph_cli.cpp @@ -102,6 +102,7 @@ created 0 vertices, created 1 edges. n (:person {int16:16,float:1.11,double:100.98,int8:8,string:"foo bar",int32:32,int64:64,bool:true,datetime:1493632800000000000,date:17289}) @plan +ReadOnly:1 Execution Plan: Produce Results Project [n] @@ -156,7 +157,7 @@ p ["n"] ["(:person {int16:16,float:1.11,double:100.98,int8:8,string:\"foo bar\",int32:32,int64:64,bool:true,datetime:1493632800000000000,date:17289})"] ["@plan"] -["Execution Plan:\nProduce Results\n Project [n]\n Expand(All) [n --> m ]\n Node By Label Scan [n:person]\n"] +["ReadOnly:1\nExecution Plan:\nProduce Results\n Project [n]\n Expand(All) [n --> m ]\n Node By Label Scan [n:person]\n"] ["r"] ["[:is_friend {message:\"hi..\"}]"] ["@profile"] @@ -228,6 +229,7 @@ p +-------------------------------------------+ | @plan | +-------------------------------------------+ +| ReadOnly:1 | | Execution Plan: | | Produce Results | | Project [n] |