f6529cd4c3
Summary: Merge branch 'dev' into clique_1 Started implementing clique. Merge branch 'dev' into clique_1 Add multilne query reload. Clique 1# implementation. Merge branch 'dev' into clique_1 Clique #1 and #2 implemented. Add delete all query. Remove unique from clique. Reviewers: florijan, mislav.bradac, buda Reviewed By: florijan, mislav.bradac, buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D73
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "query/plan_interface.hpp"
|
|
#include "storage/edge_accessor.hpp"
|
|
#include "storage/vertex_accessor.hpp"
|
|
#include "using.hpp"
|
|
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
// Query: MATCH (g:garment {garment_id: 1234}) RETURN g
|
|
|
|
class CPUPlan : public PlanInterface<Stream> {
|
|
public:
|
|
bool run(GraphDbAccessor &db_accessor, const TypedValueStore<> &args,
|
|
Stream &stream) {
|
|
stream.write_field("g");
|
|
for (auto vertex : db_accessor.vertices()) {
|
|
if (vertex.has_label(db_accessor.label("garment"))) {
|
|
auto prop = vertex.PropsAt(db_accessor.property("garment_id"));
|
|
if (prop.type_ == TypedValue::Type::Null) continue;
|
|
auto cmp = prop == args.at(0);
|
|
if (cmp.type_ != TypedValue::Type::Bool) continue;
|
|
if (cmp.Value<bool>() != true) continue;
|
|
stream.write_vertex_record(vertex);
|
|
}
|
|
}
|
|
stream.write_meta("r");
|
|
db_accessor.transaction_.commit();
|
|
return true;
|
|
}
|
|
~CPUPlan() {}
|
|
};
|
|
|
|
extern "C" PlanInterface<Stream> *produce() { return new CPUPlan(); }
|
|
|
|
extern "C" void destruct(PlanInterface<Stream> *p) { delete p; }
|