Re: MonetDB: DVframework - fixed bug. Three subselect instructions r...
Hai Yagiz, Thanks for fixed bugs! :) Is this check-in supposed to fix some of the demo queries? I tried the query (on a freshly created repo.) SELECT channel, sample_time, sample_value FROM mseed.dataview WHERE station = 'ISK' AND sample_time > '2010-01-12T22:15:00.000' AND sample_time < '2010-01-12T22:18:00.000'; But it still gives the error: From the recursive call: MALException:sql.delta:Object not found Is this expected or did I forget something? Jennie On Jul 16, 2013, at 15:49, Yagiz Kargin wrote:
Changeset: 95bc831eb9fb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=95bc831eb9fb Modified Files: monetdb5/extras/dvf/dvf.c monetdb5/extras/dvf/opt_dvf.c Branch: DVframework Log Message:
fixed bug. Three subselect instructions resulting from selection predicate on sample_time are now separately taken care of.
diffs (152 lines):
diff --git a/monetdb5/extras/dvf/dvf.c b/monetdb5/extras/dvf/dvf.c --- a/monetdb5/extras/dvf/dvf.c +++ b/monetdb5/extras/dvf/dvf.c @@ -77,7 +77,7 @@ str plan_modifier(Client cntxt, MalBlkPt BATiter fli;
int run_dataflow_opt = 0; - int run_recycle_opt = 1; + int run_recycle_opt = 0;
VarRecord low, high;
@@ -343,8 +343,9 @@ str plan_modifier(Client cntxt, MalBlkPt /* adjust variable lifetimes */ malGarbageCollector(mb);
- /*chkProgram(cntxt->fdout, cntxt->nspace, mb); - printFunction(cntxt->fdout,mb, 0, LIST_MAL_ALL); */ + /*chkProgram(cntxt->fdout, cntxt->nspace, mb);*/ + /*printFunction(cntxt->fdout,mb, 0, LIST_MAL_EXPLAIN); */ + /*printFunction(cntxt->fdout,mb, 0, LIST_MAL_ALL); */
/* relocate the startpc, the instruction to proceed with the execution. Because it might be changed by the optimizers. */ for (i = 0; i < limit; i++) diff --git a/monetdb5/extras/dvf/opt_dvf.c b/monetdb5/extras/dvf/opt_dvf.c --- a/monetdb5/extras/dvf/opt_dvf.c +++ b/monetdb5/extras/dvf/opt_dvf.c @@ -119,6 +119,9 @@ OPTdvfImplementation(Client cntxt, MalBl int i, limit, which_column, actions = 0; int last_bind_return_var_id = -1; int last_data_tid_return_var_id = -1; + int last_insert_bind_return_var_id = -1; + int last_subselect_return_var_id = -1; + int last_update_bind_second_return_var_id = -1;
stk = stk; //to escape 'unused' parameter error. pci = pci; //to escape 'unused' parameter error. @@ -452,35 +455,107 @@ OPTdvfImplementation(Client cntxt, MalBl actions++; } else if((state == 2 || state == 3) && - ((getModuleId(p) == sqlRef && + getModuleId(p) == sqlRef && getFunctionId(p) == bindRef && p->argc == 7 && p->retc == 2 && strcmp(getVarConstant(mb, getArg(p, 3)).val.sval, getVarConstant(mb, getArg(old[i1], 2)).val.sval) == 0 && strstr(getVarConstant(mb, getArg(p, 4)).val.sval, data_table_identifier) != NULL && - getVarConstant(mb, getArg(p, 6)).val.ival == 2) || - (getModuleId(p) == sqlRef && + getVarConstant(mb, getArg(p, 6)).val.ival == 2) + { + last_update_bind_second_return_var_id = getArg(p, 1); + removeInstruction(mb, p); + i--; + actions++; + } + else if((state == 2 || state == 3) && + getModuleId(p) == sqlRef && getFunctionId(p) == bindRef && p->argc == 6 && p->retc == 1 && strcmp(getVarConstant(mb, getArg(p, 2)).val.sval, getVarConstant(mb, getArg(old[i1], 2)).val.sval) == 0 && strstr(getVarConstant(mb, getArg(p, 3)).val.sval, data_table_identifier) != NULL && - getVarConstant(mb, getArg(p, 5)).val.ival == 1))) + getVarConstant(mb, getArg(p, 5)).val.ival == 1) + { + last_insert_bind_return_var_id = getArg(p, 0); + removeInstruction(mb, p); + i--; + actions++; + } + else if((state == 2 || state == 3) && + getModuleId(p) == algebraRef && + getFunctionId(p) == subselectRef && + p->argc == 8 && + p->retc == 1 && + getArg(p, 1) == last_bind_return_var_id) + { + last_subselect_return_var_id = getArg(p, 0); + + r = newInstruction(mb, ASSIGNsymbol); + setModuleId(r, algebraRef); + setFunctionId(r, subselectRef); + r = pushReturn(mb, r, getArg(p, 0)); + r = pushArgument(mb, r, getArg(p, 1)); + r = pushArgument(mb, r, getArg(p, 3)); + r = pushArgument(mb, r, getArg(p, 4)); + r = pushArgument(mb, r, getArg(p, 5)); + r = pushArgument(mb, r, getArg(p, 6)); + r = pushArgument(mb, r, getArg(p, 7)); + + insertInstruction(mb, r, i+1); + removeInstruction(mb, p); + + actions += 2; + } + else if((state == 2 || state == 3) && + getModuleId(p) == algebraRef && + getFunctionId(p) == subselectRef && + (p->argc == 7 || p->argc == 8) && + p->retc == 1 && + (getArg(p, 1) == last_update_bind_second_return_var_id || getArg(p, 1) == last_insert_bind_return_var_id)) { removeInstruction(mb, p); i--; actions++; } else if((state == 3) && - (getModuleId(p) == sqlRef && + getModuleId(p) == sqlRef && getFunctionId(p) == projectdeltaRef && p->argc == 6 && p->retc == 1 && - last_bind_return_var_id == getArg(p, 2))) + last_bind_return_var_id == getArg(p, 2)) + { + r = newInstruction(mb, ASSIGNsymbol); + + if(getArg(p, 1) == last_data_tid_return_var_id) + { + r = pushReturn(mb, r, getArg(p, 0)); + r = pushArgument(mb, r, last_bind_return_var_id); + } + else + { + setModuleId(r, algebraRef); + setFunctionId(r, leftfetchjoinRef); + r = pushReturn(mb, r, getArg(p, 0)); + r = pushArgument(mb, r, getArg(p, 1)); + r = pushArgument(mb, r, last_bind_return_var_id); + } + + insertInstruction(mb, r, i+1); + removeInstruction(mb, p); + + actions += 2; + } + else if((state == 3) && + getModuleId(p) == sqlRef && + getFunctionId(p) == subdeltaRef && + p->argc == 6 && + p->retc == 1 && + last_subselect_return_var_id == getArg(p, 1)) { r = newInstruction(mb, ASSIGNsymbol); r = pushReturn(mb, r, getArg(p, 0)); - r = pushArgument(mb, r, last_bind_return_var_id); + r = pushArgument(mb, r, last_subselect_return_var_id);
insertInstruction(mb, r, i+1); removeInstruction(mb, p); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
Hi Jennie,
This is fixed now, thanks for pointing out. Otherwise, I had thought the sample_time bug is solved. But it was actually two-folded.
Best,
Yagiz.
----- Original Message -----
From: "Ying Zhang"
From the recursive call: MALException:sql.delta:Object not found
Is this expected or did I forget something? Jennie On Jul 16, 2013, at 15:49, Yagiz Kargin wrote:
Changeset: 95bc831eb9fb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=95bc831eb9fb Modified Files: monetdb5/extras/dvf/dvf.c monetdb5/extras/dvf/opt_dvf.c Branch: DVframework Log Message:
fixed bug. Three subselect instructions resulting from selection predicate on sample_time are now separately taken care of.
diffs (152 lines):
diff --git a/monetdb5/extras/dvf/dvf.c b/monetdb5/extras/dvf/dvf.c --- a/monetdb5/extras/dvf/dvf.c +++ b/monetdb5/extras/dvf/dvf.c @@ -77,7 +77,7 @@ str plan_modifier(Client cntxt, MalBlkPt BATiter fli;
int run_dataflow_opt = 0; - int run_recycle_opt = 1; + int run_recycle_opt = 0;
VarRecord low, high;
@@ -343,8 +343,9 @@ str plan_modifier(Client cntxt, MalBlkPt /* adjust variable lifetimes */ malGarbageCollector(mb);
- /*chkProgram(cntxt->fdout, cntxt->nspace, mb); - printFunction(cntxt->fdout,mb, 0, LIST_MAL_ALL); */ + /*chkProgram(cntxt->fdout, cntxt->nspace, mb);*/ + /*printFunction(cntxt->fdout,mb, 0, LIST_MAL_EXPLAIN); */ + /*printFunction(cntxt->fdout,mb, 0, LIST_MAL_ALL); */
/* relocate the startpc, the instruction to proceed with the execution. Because it might be changed by the optimizers. */ for (i = 0; i < limit; i++) diff --git a/monetdb5/extras/dvf/opt_dvf.c b/monetdb5/extras/dvf/opt_dvf.c --- a/monetdb5/extras/dvf/opt_dvf.c +++ b/monetdb5/extras/dvf/opt_dvf.c @@ -119,6 +119,9 @@ OPTdvfImplementation(Client cntxt, MalBl int i, limit, which_column, actions = 0; int last_bind_return_var_id = -1; int last_data_tid_return_var_id = -1; + int last_insert_bind_return_var_id = -1; + int last_subselect_return_var_id = -1; + int last_update_bind_second_return_var_id = -1;
stk = stk; //to escape 'unused' parameter error. pci = pci; //to escape 'unused' parameter error. @@ -452,35 +455,107 @@ OPTdvfImplementation(Client cntxt, MalBl actions++; } else if((state == 2 || state == 3) && - ((getModuleId(p) == sqlRef && + getModuleId(p) == sqlRef && getFunctionId(p) == bindRef && p->argc == 7 && p->retc == 2 && strcmp(getVarConstant(mb, getArg(p, 3)).val.sval, getVarConstant(mb, getArg(old[i1], 2)).val.sval) == 0 && strstr(getVarConstant(mb, getArg(p, 4)).val.sval, data_table_identifier) != NULL && - getVarConstant(mb, getArg(p, 6)).val.ival == 2) || - (getModuleId(p) == sqlRef && + getVarConstant(mb, getArg(p, 6)).val.ival == 2) + { + last_update_bind_second_return_var_id = getArg(p, 1); + removeInstruction(mb, p); + i--; + actions++; + } + else if((state == 2 || state == 3) && + getModuleId(p) == sqlRef && getFunctionId(p) == bindRef && p->argc == 6 && p->retc == 1 && strcmp(getVarConstant(mb, getArg(p, 2)).val.sval, getVarConstant(mb, getArg(old[i1], 2)).val.sval) == 0 && strstr(getVarConstant(mb, getArg(p, 3)).val.sval, data_table_identifier) != NULL && - getVarConstant(mb, getArg(p, 5)).val.ival == 1))) + getVarConstant(mb, getArg(p, 5)).val.ival == 1) + { + last_insert_bind_return_var_id = getArg(p, 0); + removeInstruction(mb, p); + i--; + actions++; + } + else if((state == 2 || state == 3) && + getModuleId(p) == algebraRef && + getFunctionId(p) == subselectRef && + p->argc == 8 && + p->retc == 1 && + getArg(p, 1) == last_bind_return_var_id) + { + last_subselect_return_var_id = getArg(p, 0); + + r = newInstruction(mb, ASSIGNsymbol); + setModuleId(r, algebraRef); + setFunctionId(r, subselectRef); + r = pushReturn(mb, r, getArg(p, 0)); + r = pushArgument(mb, r, getArg(p, 1)); + r = pushArgument(mb, r, getArg(p, 3)); + r = pushArgument(mb, r, getArg(p, 4)); + r = pushArgument(mb, r, getArg(p, 5)); + r = pushArgument(mb, r, getArg(p, 6)); + r = pushArgument(mb, r, getArg(p, 7)); + + insertInstruction(mb, r, i+1); + removeInstruction(mb, p); + + actions += 2; + } + else if((state == 2 || state == 3) && + getModuleId(p) == algebraRef && + getFunctionId(p) == subselectRef && + (p->argc == 7 || p->argc == 8) && + p->retc == 1 && + (getArg(p, 1) == last_update_bind_second_return_var_id || getArg(p, 1) == last_insert_bind_return_var_id)) { removeInstruction(mb, p); i--; actions++; } else if((state == 3) && - (getModuleId(p) == sqlRef && + getModuleId(p) == sqlRef && getFunctionId(p) == projectdeltaRef && p->argc == 6 && p->retc == 1 && - last_bind_return_var_id == getArg(p, 2))) + last_bind_return_var_id == getArg(p, 2)) + { + r = newInstruction(mb, ASSIGNsymbol); + + if(getArg(p, 1) == last_data_tid_return_var_id) + { + r = pushReturn(mb, r, getArg(p, 0)); + r = pushArgument(mb, r, last_bind_return_var_id); + } + else + { + setModuleId(r, algebraRef); + setFunctionId(r, leftfetchjoinRef); + r = pushReturn(mb, r, getArg(p, 0)); + r = pushArgument(mb, r, getArg(p, 1)); + r = pushArgument(mb, r, last_bind_return_var_id); + } + + insertInstruction(mb, r, i+1); + removeInstruction(mb, p); + + actions += 2; + } + else if((state == 3) && + getModuleId(p) == sqlRef && + getFunctionId(p) == subdeltaRef && + p->argc == 6 && + p->retc == 1 && + last_subselect_return_var_id == getArg(p, 1)) { r = newInstruction(mb, ASSIGNsymbol); r = pushReturn(mb, r, getArg(p, 0)); - r = pushArgument(mb, r, last_bind_return_var_id); + r = pushArgument(mb, r, last_subselect_return_var_id);
insertInstruction(mb, r, i+1); removeInstruction(mb, p); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list
participants (2)
-
Yagiz Kargin
-
Ying Zhang