remove almost all debug info;move time and size to end
This commit is contained in:
parent
5a37cf17d7
commit
bf1c5614b8
|
@ -104,7 +104,6 @@ Database::load()
|
|||
}
|
||||
|
||||
(this->kvstore)->open();
|
||||
cout << "finish load" << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -142,17 +141,17 @@ Database::query(const string _query, ResultSet& _result_set, FILE* _fp)
|
|||
//_parser.sparqlParser(_query, _sparql_q);
|
||||
|
||||
long tv_parse = Util::get_cur_time();
|
||||
cout << "after Parsing, used " << (tv_parse - tv_begin) << endl;
|
||||
//cout << "after Parsing, used " << (tv_parse - tv_begin) << endl;
|
||||
//cout << "after Parsing..." << endl << _sparql_q.triple_str() << endl;
|
||||
|
||||
general_evaluation.getSPARQLQuery().encodeQuery(this->kvstore, general_evaluation.getSPARQLQueryVarset());
|
||||
//_sparql_q.encodeQuery(this->kvstore);
|
||||
|
||||
//cout << "sparqlSTR:\t" << _sparql_q.to_str() << endl;
|
||||
cout << "sparqlSTR:\t" << general_evaluation.getSPARQLQuery().to_str() << endl;
|
||||
//cout << "sparqlSTR:\t" << general_evaluation.getSPARQLQuery().to_str() << endl;
|
||||
|
||||
long tv_encode = Util::get_cur_time();
|
||||
cout << "after Encode, used " << (tv_encode - tv_parse) << "ms." << endl;
|
||||
//cout << "after Encode, used " << (tv_encode - tv_parse) << "ms." << endl;
|
||||
|
||||
//_result_set.select_var_num = _sparql_q.getQueryVarNum();
|
||||
|
||||
|
@ -160,7 +159,7 @@ Database::query(const string _query, ResultSet& _result_set, FILE* _fp)
|
|||
(this->vstree)->retrieve(general_evaluation.getSPARQLQuery());
|
||||
|
||||
long tv_retrieve = Util::get_cur_time();
|
||||
cout << "after Retrieve, used " << (tv_retrieve - tv_encode) << "ms." << endl;
|
||||
//cout << "after Retrieve, used " << (tv_retrieve - tv_encode) << "ms." << endl;
|
||||
|
||||
this->join = new Join(kvstore);
|
||||
//this->join->join(_sparql_q);
|
||||
|
@ -168,7 +167,7 @@ Database::query(const string _query, ResultSet& _result_set, FILE* _fp)
|
|||
delete this->join;
|
||||
|
||||
long tv_join = Util::get_cur_time();
|
||||
cout << "after Join, used " << (tv_join - tv_retrieve) << "ms." << endl;
|
||||
//cout << "after Join, used " << (tv_join - tv_retrieve) << "ms." << endl;
|
||||
|
||||
general_evaluation.generateEvaluationPlan(general_evaluation.getQueryTree().getPatternGroup());
|
||||
general_evaluation.doEvaluationPlan();
|
||||
|
@ -176,9 +175,8 @@ Database::query(const string _query, ResultSet& _result_set, FILE* _fp)
|
|||
//this->getFinalResult(_sparql_q, _result_set);
|
||||
|
||||
long tv_final = Util::get_cur_time();
|
||||
cout << "after finalResult, used " << (tv_final - tv_join) << "ms." << endl;
|
||||
//cout << "after finalResult, used " << (tv_final - tv_join) << "ms." << endl;
|
||||
|
||||
cout << "Total time used: " << (tv_final - tv_begin) << "ms." << endl;
|
||||
|
||||
//testing...
|
||||
cout << "final result is : " << endl;
|
||||
|
@ -194,6 +192,14 @@ Database::query(const string _query, ResultSet& _result_set, FILE* _fp)
|
|||
#ifdef DEBUG_PRECISE
|
||||
fprintf(stderr, "the query function exits!\n");
|
||||
#endif
|
||||
cout << "Total time used: " << (tv_final - tv_begin) << "ms." << endl;
|
||||
SPARQLquery& _sparql_query = general_evaluation.getSPARQLQuery();
|
||||
int basic_query_num = _sparql_query.getBasicQueryNum();
|
||||
//join each basic query
|
||||
for(int i=0; i < basic_query_num; i++)
|
||||
{
|
||||
cout<<"Final result size: "<<_sparql_query.getBasicQuery(i).getResultList().size()<<endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -207,7 +213,6 @@ Database::insert(const string& _insert_rdf_file)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
cout << "finish loading" << endl;
|
||||
|
||||
long tv_load = Util::get_cur_time();
|
||||
|
||||
|
|
|
@ -122,23 +122,23 @@ Join::join_sparql(SPARQLquery& _sparql_query)
|
|||
//join each basic query
|
||||
for(int i=0; i < basic_query_num; i++)
|
||||
{
|
||||
printf("Basic query %d\n", i);
|
||||
//printf("Basic query %d\n", i);
|
||||
this->init(&(_sparql_query.getBasicQuery(i)));
|
||||
long begin = Util::get_cur_time();
|
||||
this->filter_before_join();
|
||||
long after_filter = Util::get_cur_time();
|
||||
printf("after filter_before_join: used %ld ms\n", after_filter-begin);
|
||||
//printf("after filter_before_join: used %ld ms\n", after_filter-begin);
|
||||
this->add_literal_candidate();
|
||||
long after_add_literal = Util::get_cur_time();
|
||||
printf("after add_literal_candidate: used %ld ms\n", after_add_literal-after_filter);
|
||||
//printf("after add_literal_candidate: used %ld ms\n", after_add_literal-after_filter);
|
||||
this->join();
|
||||
long after_joinbasic = Util::get_cur_time();
|
||||
printf("after join_basic : used %ld ms\n", after_joinbasic-after_add_literal);
|
||||
//printf("after join_basic : used %ld ms\n", after_joinbasic-after_add_literal);
|
||||
//this->only_pre_filter_after_join(this->basic_query);
|
||||
//long after_pre_filter_after_join = Util::get_cur_time();
|
||||
//printf("after only_pre_filter_after_join : used %ld ms\n", after_pre_filter_after_join-after_joinbasic);
|
||||
|
||||
printf("Final result size: %lu\n", this->basic_query->getResultList().size());
|
||||
//printf("Final result size: %lu\n", this->basic_query->getResultList().size());
|
||||
this->clear();
|
||||
}
|
||||
|
||||
|
@ -160,15 +160,12 @@ Join::join()
|
|||
switch(method)
|
||||
{
|
||||
case 0:
|
||||
printf("use multi-join here!\n");
|
||||
this->multi_join();
|
||||
break;
|
||||
case 1:
|
||||
printf("use index-join here!\n");
|
||||
this->index_join();
|
||||
break;
|
||||
default:
|
||||
printf("ERROR: no method found!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -591,22 +588,18 @@ Join::multi_join()
|
|||
//and then visit eles below top in stack is not ok,
|
||||
//so choose STL stack
|
||||
this->mystack.push(this->start_id);
|
||||
printf("now to start the stack loop\n");
|
||||
while(!this->mystack.empty())
|
||||
{
|
||||
int id = this->mystack.top();
|
||||
printf("the current id: %d\n", id);
|
||||
//int id = mystack[top];
|
||||
int maxi = this->choose_next_node(dealed_triple, id);
|
||||
if(maxi == -1) //all edges of this node are dealed
|
||||
{
|
||||
printf("the node is totally dealed: %d\n", id);
|
||||
//top--;
|
||||
this->mystack.pop();
|
||||
continue;
|
||||
}
|
||||
int id2 = this->basic_query->getEdgeNeighborID(id, maxi);
|
||||
printf("the next node id to join: %d\n", id2);
|
||||
|
||||
//pre_id == -1 means we cannot find such predicate in rdf file, so the result set of this sparql should be empty.
|
||||
//note that we cannot support to query sparqls with predicate variables ?p.
|
||||
|
@ -648,10 +641,6 @@ Join::multi_join()
|
|||
//the can_list of var representing literals is not valid,
|
||||
//must use kvstore->get...() to join
|
||||
bool is_literal = this->is_literal_var(id2);
|
||||
if(is_literal)
|
||||
printf("this var may contain literals: %d\n", id2);
|
||||
else
|
||||
printf("this var not contain literals: %d\n", id2);
|
||||
|
||||
bool flag = false;
|
||||
bool if_prepare = this->if_prepare_idlist(can_list_size, is_literal);
|
||||
|
@ -661,7 +650,6 @@ Join::multi_join()
|
|||
//needed if place can_list in the outer loop to join
|
||||
if(if_prepare)
|
||||
{
|
||||
printf("this edge uses prepared-join way\n");
|
||||
this->acquire_all_id_lists(id_lists, id_lists_len, can_list, edges, dealed_triple, id2, can_list_size);
|
||||
flag = this->new_join_with_multi_vars_prepared(id_lists, id_lists_len, edges, can_list, can_list_size);
|
||||
//need to release id_lists if using acquire_all_id_lists() firstly
|
||||
|
@ -675,14 +663,12 @@ Join::multi_join()
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("this edge uses not-prepared-join way\n");
|
||||
flag = this->new_join_with_multi_vars_not_prepared(edges, can_list, can_list_size, id2, is_literal);
|
||||
}
|
||||
|
||||
//if current_table is empty, ends directly
|
||||
if(!flag)
|
||||
{
|
||||
printf("the result is already empty!!\n");
|
||||
//break;
|
||||
return; //to avoid later invalid copy
|
||||
}
|
||||
|
@ -701,9 +687,7 @@ Join::multi_join()
|
|||
this->add_id_pos_mapping(id2);
|
||||
this->mystack.push(id2);
|
||||
}
|
||||
printf("now end the stack loop\n");
|
||||
|
||||
printf("now to filter through only_pre_filter_after_join\n");
|
||||
this->only_pre_filter_after_join();
|
||||
|
||||
//copy to result list, adjust the vars order
|
||||
|
@ -772,24 +756,24 @@ Join::index_join()
|
|||
void
|
||||
Join::filter_before_join()
|
||||
{
|
||||
printf("*****IIIIIIN filter_before_join\n");
|
||||
//printf("*****IIIIIIN filter_before_join\n");
|
||||
|
||||
for(int i = 0; i < this->var_num; i++)
|
||||
{
|
||||
printf("\tVar%d %s\n", i, this->basic_query->getVarName(i).c_str());
|
||||
//printf("\tVar%d %s\n", i, this->basic_query->getVarName(i).c_str());
|
||||
IDList &can_list = this->basic_query->getCandidateList(i);
|
||||
printf("\t\tsize of canlist before filter: %d\n", can_list.size());
|
||||
//printf("\t\tsize of canlist before filter: %d\n", can_list.size());
|
||||
//NOTICE:must sort before using binary search.
|
||||
can_list.sort();
|
||||
|
||||
long begin = Util::get_cur_time();
|
||||
this->literal_edge_filter(i);
|
||||
long after_literal_edge_filter = Util::get_cur_time();
|
||||
printf("\t\tliteral_edge_filter: used %ld ms\n", after_literal_edge_filter-begin);
|
||||
//printf("\t\tliteral_edge_filter: used %ld ms\n", after_literal_edge_filter-begin);
|
||||
// this->preid_filter(this->basic_query, i);
|
||||
// long after_preid_filter = Util::get_cur_time();
|
||||
// cout << "\t\tafter_preid_filter: used " << (after_preid_filter-after_literal_edge_filter) << " ms" << endl;
|
||||
printf("\t\t[%d] after filter, candidate size = %d\n\n\n", i, can_list.size());
|
||||
//printf("\t\t[%d] after filter, candidate size = %d\n\n\n", i, can_list.size());
|
||||
|
||||
//debug
|
||||
// {
|
||||
|
@ -804,7 +788,7 @@ Join::filter_before_join()
|
|||
// cout << can_list.to_str() << endl;
|
||||
// }
|
||||
}
|
||||
printf("OOOOOOUT filter_before_join\n");
|
||||
//printf("OOOOOOUT filter_before_join\n");
|
||||
}
|
||||
|
||||
//decrease the candidates of _var_i using its constant neighbors
|
||||
|
@ -817,7 +801,6 @@ Join::literal_edge_filter(int _var_i)
|
|||
for(int j = 0; j < var_degree; j ++)
|
||||
{
|
||||
int neighbor_id = this->basic_query->getEdgeNeighborID(_var_i, j);
|
||||
printf("\t\t\tneighbor_id=%d\n", neighbor_id);
|
||||
if(neighbor_id != -1) //variables in join not considered here
|
||||
{
|
||||
continue;
|
||||
|
@ -945,7 +928,6 @@ Join::preid_filter(int _var_i)
|
|||
{
|
||||
int neighbor_id = this->basic_query->getEdgeNeighborID(_var_i, j);
|
||||
// continue;
|
||||
cout << "\t\t\tneighbor_id=" << neighbor_id << endl;
|
||||
if (neighbor_id != -1)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -1053,7 +1053,6 @@ void KVstore::flush(){
|
|||
|
||||
void KVstore::open()
|
||||
{
|
||||
cout << "open KVstore" << endl;
|
||||
|
||||
this->open(this->entity2id, KVstore::s_entity2id, KVstore::READ_WRITE_MODE);
|
||||
this->open(this->id2entity, KVstore::s_id2entity, KVstore::READ_WRITE_MODE);
|
||||
|
|
|
@ -23,12 +23,6 @@ main(int argc, char * argv[])
|
|||
#endif
|
||||
//system("clock");
|
||||
cout << "gload..." << endl;
|
||||
{
|
||||
cout << "argc: " << argc << "\t";
|
||||
cout << "DB_store:" << argv[1] << "\t";
|
||||
cout << "RDF_data: " << argv[2] << "\t";
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
string _db_path = string(argv[1]);
|
||||
string _rdf = string(argv[2]);
|
||||
|
|
|
@ -51,16 +51,10 @@ main(int argc, char * argv[])
|
|||
cerr << "error: lack of DB_store to be queried" << endl;
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
cout << "argc: " << argc << "\t";
|
||||
cout << "DB_store:" << argv[1] << "\t";
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
string db_folder = string(argv[1]);
|
||||
Database _db(db_folder);
|
||||
_db.load();
|
||||
cout << "finish loading" << endl;
|
||||
|
||||
// read query from file.
|
||||
if (argc >= 3)
|
||||
|
@ -87,7 +81,6 @@ main(int argc, char * argv[])
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
printf("query is:\n%s\n\n", query.c_str());
|
||||
ResultSet _rs;
|
||||
_db.query(query, _rs, stdout);
|
||||
if (argc >= 4)
|
||||
|
@ -193,8 +186,6 @@ main(int argc, char * argv[])
|
|||
free(buf);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
printf("%s\n", q);
|
||||
//query = getQueryFromFile(p);
|
||||
query = Util::getQueryFromFile(q);
|
||||
if(query.empty())
|
||||
|
@ -206,8 +197,6 @@ main(int argc, char * argv[])
|
|||
fclose(fp);
|
||||
continue;
|
||||
}
|
||||
printf("query is:\n");
|
||||
printf("%s\n\n", query.c_str());
|
||||
ResultSet _rs;
|
||||
_db.query(query, _rs, fp);
|
||||
//test...
|
||||
|
|
|
@ -53,8 +53,6 @@ int QueryParser::printNode(pANTLR3_BASE_TREE node, int dep)
|
|||
int hasErrorNode = 0;
|
||||
if (treeType == 0) hasErrorNode = 1;
|
||||
|
||||
for (int i=0; i < dep; i++) printf(" ");
|
||||
printf("%d: %s\n",treeType,s);
|
||||
|
||||
for (unsigned int i = 0; i < node->getChildCount(node); i++)
|
||||
{
|
||||
|
@ -67,7 +65,6 @@ int QueryParser::printNode(pANTLR3_BASE_TREE node, int dep)
|
|||
|
||||
void QueryParser::parseTree(pANTLR3_BASE_TREE node, QueryTree& querytree)
|
||||
{
|
||||
printf("parseTree\n");
|
||||
|
||||
for (unsigned int i = 0; i < node->getChildCount(node); i++)
|
||||
{
|
||||
|
@ -140,7 +137,6 @@ void QueryParser::parseTree(pANTLR3_BASE_TREE node, QueryTree& querytree)
|
|||
}
|
||||
void QueryParser::parsePrologue(pANTLR3_BASE_TREE node)
|
||||
{
|
||||
printf("parsePrologue\n");
|
||||
|
||||
for (unsigned int i = 0; i < node->getChildCount(node); i++)
|
||||
{
|
||||
|
@ -153,7 +149,6 @@ void QueryParser::parsePrologue(pANTLR3_BASE_TREE node)
|
|||
}
|
||||
void QueryParser::parsePrefix(pANTLR3_BASE_TREE node)
|
||||
{
|
||||
printf("parsePrefix\n");
|
||||
|
||||
string key;
|
||||
string value;
|
||||
|
@ -183,11 +178,9 @@ void QueryParser::replacePrefix(string& str)
|
|||
//blank node
|
||||
if (prefix == "_:") return;
|
||||
|
||||
cout << "prefix: " << prefix << endl;
|
||||
if (_prefix_map.find(prefix) != _prefix_map.end())
|
||||
{
|
||||
str=_prefix_map[prefix].substr(0, _prefix_map[prefix].length() - 1) + str.substr(sep + 1 ,str.length() - sep - 1) + ">";
|
||||
cout << "str: " << str << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -199,7 +192,6 @@ void QueryParser::replacePrefix(string& str)
|
|||
|
||||
void QueryParser::parseSelectClause(pANTLR3_BASE_TREE node, QueryTree& querytree)
|
||||
{
|
||||
printf("parseSelectClause\n");
|
||||
|
||||
for (unsigned int i = 0; i < node->getChildCount(node); i++)
|
||||
{
|
||||
|
@ -221,7 +213,6 @@ void QueryParser::parseSelectClause(pANTLR3_BASE_TREE node, QueryTree& querytree
|
|||
|
||||
void QueryParser::parseSelectVar(pANTLR3_BASE_TREE node, QueryTree& querytree)
|
||||
{
|
||||
printf("parseSelectVar\n");
|
||||
|
||||
string var = "";
|
||||
for (unsigned int i = 0; i < node->getChildCount(node); i++)
|
||||
|
@ -238,7 +229,6 @@ void QueryParser::parseSelectVar(pANTLR3_BASE_TREE node, QueryTree& querytree)
|
|||
|
||||
void QueryParser::parseGroupPattern(pANTLR3_BASE_TREE node, QueryTree::PatternGroup& patterngroup)
|
||||
{
|
||||
printf("parseGroupPattern\n");
|
||||
|
||||
for (unsigned int i = 0; i < node->getChildCount(node); i++)
|
||||
{
|
||||
|
@ -280,7 +270,6 @@ void QueryParser::parseGroupPattern(pANTLR3_BASE_TREE node, QueryTree::PatternGr
|
|||
|
||||
void QueryParser::parsePattern(pANTLR3_BASE_TREE node, QueryTree::PatternGroup& patterngroup)
|
||||
{
|
||||
printf("parsePattern\n");
|
||||
|
||||
string subject = "";
|
||||
string predicate = "";
|
||||
|
@ -516,7 +505,6 @@ void QueryParser::parseFilterTree(pANTLR3_BASE_TREE node, QueryTree::PatternGrou
|
|||
|
||||
void QueryParser::parseVarInExpressionList(pANTLR3_BASE_TREE node, QueryTree::FilterTree& filter, unsigned int begin)
|
||||
{
|
||||
printf("parseVarInExpressionList\n");
|
||||
|
||||
for (unsigned int i = begin; i < node->getChildCount(node); i++)
|
||||
{
|
||||
|
@ -551,7 +539,6 @@ void QueryParser::parseVarInExpressionList(pANTLR3_BASE_TREE node, QueryTree::Fi
|
|||
|
||||
void QueryParser::parseExistsGroupPattern(pANTLR3_BASE_TREE node, QueryTree::PatternGroup& patterngroup, QueryTree::FilterTree& filter)
|
||||
{
|
||||
printf("parseExistsGroupPattern\n");
|
||||
|
||||
pANTLR3_BASE_TREE childNode=(pANTLR3_BASE_TREE) node->getChild(node, 0);
|
||||
|
||||
|
@ -653,86 +640,10 @@ void QueryParser::parseString(pANTLR3_BASE_TREE node, string& str, int dep)
|
|||
|
||||
void QueryParser::printQuery(QueryTree& querytree)
|
||||
{
|
||||
printf("===========================================================================\n");
|
||||
|
||||
if (querytree.getQueryForm() == QueryTree::Select_Query)
|
||||
{
|
||||
printf("select");
|
||||
if (querytree.getProjectionModifier() == QueryTree::Modifier_Distinct)
|
||||
printf(" distinct");
|
||||
printf("\n");
|
||||
|
||||
printf("var is : \t");
|
||||
vector <string> &varvec = querytree.getProjection().varset;
|
||||
for (int i = 0; i < (int)varvec.size(); i++)
|
||||
printf("%s\t", varvec[i].c_str());
|
||||
if (querytree.checkProjectionAsterisk())
|
||||
printf("*");
|
||||
printf("\n");
|
||||
}
|
||||
else printf("ask\n");
|
||||
|
||||
printPatternGroup(querytree.getPatternGroup(), 0);
|
||||
|
||||
if ((int)querytree.getOrder().size() > 0)
|
||||
{
|
||||
printf("order by : \t");
|
||||
|
||||
vector<QueryTree::Order>&order = querytree.getOrder();
|
||||
for (int i = 0; i < (int)order.size(); i++)
|
||||
{
|
||||
if (!order[i].descending) printf("ASC(");
|
||||
else printf("DESC(");
|
||||
printf("%s) ", order[i].var.c_str());
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
if (querytree.getOffset() != 0)
|
||||
printf("offset : %d\n", querytree.getOffset());
|
||||
if (querytree.getLimit() != -1)
|
||||
printf("limit : %d\n", querytree.getLimit());
|
||||
printf("===========================================================================\n");
|
||||
}
|
||||
|
||||
void QueryParser::printPatternGroup(QueryTree::PatternGroup &patterngroup, int dep)
|
||||
{
|
||||
for (int j = 0; j < dep; j++) printf("\t"); printf("{\n");
|
||||
for (int j = 0; j < dep; j++) printf("\t"); printf("pattern:\n");
|
||||
for(int i = 0; i < (int)patterngroup.patterns.size(); i++)
|
||||
{
|
||||
for (int j = 0; j < dep; j++) printf("\t");
|
||||
printf("\t%s\t%s\t%s\n", patterngroup.patterns[i].subject.value.c_str(), patterngroup.patterns[i].predicate.value.c_str(), patterngroup.patterns[i].object.value.c_str());
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)patterngroup.unions.size(); i++)
|
||||
{
|
||||
for (int j = 0; j < dep; j++) printf("\t"); printf("union %d:\n", i);
|
||||
for (int j = 0; j < (int)patterngroup.unions[i].size(); j++)
|
||||
printPatternGroup(patterngroup.unions[i][j], dep + 1);
|
||||
}
|
||||
|
||||
if ((int)patterngroup.optionals.size() > 0)
|
||||
{
|
||||
for (int j = 0; j < dep; j++) printf("\t"); printf("optional:\n");
|
||||
for (int i = 0; i < (int)patterngroup.optionals.size(); i++)
|
||||
{
|
||||
printf("\tlast pattern id = %d\tlast union id = %d\n", patterngroup.optionals[i].lastpattern, patterngroup.optionals[i].lastunions);
|
||||
printPatternGroup(patterngroup.optionals[i].patterngroup, dep + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((int)patterngroup.filters.size() > 0)
|
||||
{
|
||||
for (int j = 0; j < dep; j++) printf("\t"); printf("filter:\n");
|
||||
for (int i = 0; i < (int)patterngroup.filters.size(); i++)
|
||||
{
|
||||
for (int j = 0; j <= dep; j++) printf("\t");
|
||||
printFilter(patterngroup.filter_exists_patterngroups[i], patterngroup.filters[i], dep + 1);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < dep; j++) printf("\t"); printf("}\n");
|
||||
}
|
||||
|
||||
void QueryParser::printFilter(std::vector<QueryTree::PatternGroup> &exist_patterngroups, QueryTree::FilterTree &filter, int dep)
|
||||
|
|
|
@ -283,13 +283,13 @@ BasicQuery::updateObjSig(int _obj_id, int _pre_id, int _sub_id, string _sub,int
|
|||
bool sub_is_str = (_sub_id == -1) && (_sub.at(0) != '?');
|
||||
if(sub_is_str)
|
||||
{
|
||||
cout << "str2entity" << endl;
|
||||
//////cout << "str2entity" << endl;
|
||||
Signature::encodeStr2Entity(_sub.c_str(), this->var_sig[_obj_id]);
|
||||
}
|
||||
|
||||
if(_pre_id != -1)
|
||||
{
|
||||
cout << "pre2entity" << endl;
|
||||
//////cout << "pre2entity" << endl;
|
||||
Signature::encodePredicate2Entity(_pre_id, this->var_sig[_obj_id], BasicQuery::EDGE_IN);
|
||||
}
|
||||
|
||||
|
@ -307,9 +307,9 @@ BasicQuery::updateObjSig(int _obj_id, int _pre_id, int _sub_id, string _sub,int
|
|||
void
|
||||
BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const vector<string>& _query_var)
|
||||
{
|
||||
cout << "IN buildBasicSignature" << endl;
|
||||
//////cout << "IN buildBasicSignature" << endl;
|
||||
this->initial();
|
||||
cout << "after init" << endl;
|
||||
//////cout << "after init" << endl;
|
||||
|
||||
this->buildTuple2Freq();
|
||||
|
||||
|
@ -330,12 +330,12 @@ BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const vector<string>& _query_v
|
|||
this->var_name[i] = _var;
|
||||
}
|
||||
|
||||
cout << "select variables: ";
|
||||
//////cout << "select variables: ";
|
||||
for(unsigned i = 0; i < this->var_str2id.size(); ++i)
|
||||
{
|
||||
cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
|
||||
//////cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
|
||||
}
|
||||
cout << endl;
|
||||
//////cout << endl;
|
||||
|
||||
if(this->encode_method == BasicQuery::SELECT_VAR)
|
||||
{
|
||||
|
@ -348,13 +348,13 @@ BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const vector<string>& _query_v
|
|||
// assign the this->var_num, all need to join
|
||||
this->graph_var_num = this->var_str2id.size();
|
||||
|
||||
cout<< "graph variables: ";
|
||||
////cout<< "graph variables: ";
|
||||
for(unsigned i = 0; i < this->var_str2id.size(); i ++)
|
||||
{
|
||||
cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
|
||||
////cout << "[" << this->var_name[i] << ", " << i << " " << this->var_str2id[this->var_name[i]] << "]\t";
|
||||
}
|
||||
cout << endl;
|
||||
cout << "before new IDList!" << endl; //just for debug
|
||||
////cout << endl;
|
||||
////cout << "before new IDList!" << endl; //just for debug
|
||||
|
||||
this->candidate_list = new IDList[this->graph_var_num];
|
||||
|
||||
|
@ -423,14 +423,14 @@ BasicQuery::encodeBasicQuery(KVstore* _p_kvstore, const vector<string>& _query_v
|
|||
{
|
||||
if(pre_id != -1)
|
||||
{
|
||||
cout << "pre2edge" << endl;
|
||||
////cout << "pre2edge" << endl;
|
||||
Signature::encodePredicate2Edge(pre_id, this->edge_sig[sub_id][obj_id]);
|
||||
// this->edge_pre_id[sub_id][obj_id] = pre_id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
cout << "OUT encodeBasicQuery" << endl;
|
||||
////cout << "OUT encodeBasicQuery" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -632,12 +632,12 @@ void GeneralEvaluation::TempResult::print()
|
|||
|
||||
this->var.print();
|
||||
|
||||
printf("temp result:\n");
|
||||
//printf("temp result:\n");
|
||||
for (int i = 0; i < (int)this->res.size(); i++)
|
||||
{
|
||||
for (int j = 0; j < varnum; j++)
|
||||
printf("%d ", this->res[i][j]);
|
||||
printf("\n");
|
||||
//printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,10 +802,10 @@ void GeneralEvaluation::TempResultSet::doFilter(QueryTree::FilterTree& filter, F
|
|||
|
||||
void GeneralEvaluation::TempResultSet::print()
|
||||
{
|
||||
printf("total temp result : %d\n", (int)this->results.size());
|
||||
//printf("total temp result : %d\n", (int)this->results.size());
|
||||
for (int i = 0; i < (int)this->results.size(); i++)
|
||||
{
|
||||
printf("temp result no.%d\n", i);
|
||||
//printf("temp result no.%d\n", i);
|
||||
this->results[i].print();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,11 +68,9 @@ Stream::Stream(std::vector<int>& _keys, std::vector<bool>& _desc, unsigned _rown
|
|||
if(Util::memoryLeft() < size)
|
||||
{
|
||||
this->inMem = false;
|
||||
fprintf(stderr, "Stream: memory is not enough!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Stream: memory is enough!\n");
|
||||
}
|
||||
#ifdef DEBUG_STREAM
|
||||
fprintf(stderr, "Stream:after memory check!\n");
|
||||
|
|
|
@ -12,7 +12,6 @@ int LRUCache::DEFAULT_CAPACITY = 1*1000*1000;
|
|||
|
||||
LRUCache::LRUCache(int _capacity)
|
||||
{
|
||||
cout << "LRUCache initial..." << endl;
|
||||
this->capacity = _capacity > 0 ? _capacity : LRUCache::DEFAULT_CAPACITY;
|
||||
// we should guarantee the cache is big enough.
|
||||
this->capacity = std::max(this->capacity, VNode::MAX_CHILD_NUM * 2000);
|
||||
|
@ -32,7 +31,6 @@ LRUCache::LRUCache(int _capacity)
|
|||
this->prev[LRUCache::START_INDEX] = LRUCache::NULL_INDEX;
|
||||
this->prev[LRUCache::END_INDEX] = LRUCache::START_INDEX;
|
||||
this->size = 0;
|
||||
cout << "LRUCache initial finish" << endl;
|
||||
}
|
||||
|
||||
LRUCache::~LRUCache()
|
||||
|
|
|
@ -438,7 +438,6 @@ bool VSTree::saveTree()
|
|||
|
||||
bool VSTree::loadTree()
|
||||
{
|
||||
cout << "loadTree..." << endl;
|
||||
(this->node_buffer) = new LRUCache(LRUCache::DEFAULT_CAPACITY);
|
||||
|
||||
bool flag = this->loadTreeInfo();
|
||||
|
@ -452,13 +451,11 @@ bool VSTree::loadTree()
|
|||
if (flag)
|
||||
{
|
||||
this->node_buffer->loadCache(VSTree::tree_node_file_path);
|
||||
cout << "finish loadCache" << endl;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
flag = loadEntityID2FileLineMap();
|
||||
cout << "finish loadEntityID2FileLineMap" << endl;
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
|
Loading…
Reference in New Issue