5a42e15c4a
Squashed messages from 9 commits: 9. Properties now uses PropertyFamily and contained classes. Fetching,seting,clearing properties can be done with PropertyFamilyKey or PropertyTypeKey. Hierarchy of newly added clases is: Vertices -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags} Edges -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags} PropertyFamilyKey -> PropertyType PropertyTypeKey -> PropertyType PropertyType t0,t1; let t0!=t1 be true let t0.family==t1.family be true then next is true PropertyTypeKey{&t0}!=PropertyTypeKey{&t1} PropertyFamilyKey{&t0}==PropertyFamilyKey{&t1} PropertyFamilyKey{&t0}==PropertyTypeKey{&t1} PropertyTypeKey{&t0}==PropertyFamilyKey{&t1} 8. Intermedate commit. Noticed that integration queries throw SEGFAULT. 7. Defined interface for indexes. Fixed three memory leaks. Fixed integration_queries test which now passes. 6. Commit which return Xorshift128plus to valid shape. 5. Tmp commit. 4. Label Index is compiling. 3. tmp 2. Vertex::Accessor now updates Label index. 1. Applied changes for code review.
43 lines
1.6 KiB
C++
43 lines
1.6 KiB
C++
#include "query_engine/hardcode/queries.hpp"
|
|
#include "storage/edges.cpp"
|
|
#include "storage/edges.hpp"
|
|
#include "storage/vertices.cpp"
|
|
#include "storage/vertices.hpp"
|
|
#include "utils/assert.hpp"
|
|
|
|
int main(void)
|
|
{
|
|
Db db;
|
|
|
|
auto query_functions = load_queries(db);
|
|
|
|
auto stripper = make_query_stripper(TK_LONG, TK_FLOAT, TK_STR, TK_BOOL);
|
|
|
|
// TODO: put all queries into a file
|
|
std::vector<std::string> queries = {
|
|
"CREATE (n:LABEL {name: \"TEST1\"}) RETURN n",
|
|
"CREATE (n:LABEL {name: \"TEST2\"}) RETURN n",
|
|
"CREATE (n:LABEL {name: \"TEST3\"}) RETURN n",
|
|
"CREATE (n:ACCOUNT {id: 2322, name: \"TEST\", country: \"Croatia\", "
|
|
"created_at: 2352352}) RETURN n",
|
|
"MATCH (n {id: 0}) RETURN n", "MATCH (n {id: 1}) RETURN n",
|
|
"MATCH (n {id: 2}) RETURN n", "MATCH (n {id: 3}) RETURN n",
|
|
"MATCH (a {id:0}), (p {id: 1}) CREATE (a)-[r:IS]->(p) RETURN r",
|
|
"MATCH (a {id:1}), (p {id: 2}) CREATE (a)-[r:IS]->(p) RETURN r",
|
|
"MATCH ()-[r]-() WHERE ID(r)=0 RETURN r",
|
|
"MATCH ()-[r]-() WHERE ID(r)=1 RETURN r",
|
|
"MATCH (n: {id: 0}) SET n.name = \"TEST100\" RETURN n",
|
|
"MATCH (n: {id: 1}) SET n.name = \"TEST101\" RETURN n",
|
|
"MATCH (n: {id: 0}) SET n.name = \"TEST102\" RETURN n",
|
|
"MATCH (n:LABEL) RETURN n"};
|
|
|
|
for (auto &query : queries) {
|
|
auto stripped = stripper.strip(query);
|
|
auto result = query_functions[stripped.hash](stripped.arguments);
|
|
permanent_assert(result == true,
|
|
"Result retured from query function is not true");
|
|
}
|
|
|
|
return 0;
|
|
}
|