opt_candidates.c and opt_candidates.h are missing. On 07/10/15 14:33, Martin Kersten wrote:
Changeset: c6e5763417d9 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6e5763417d9 Modified Files: clients/Tests/exports.stable.out monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.single monetdb5/mal/mal.h monetdb5/mal/mal_instruction.c monetdb5/mal/mal_instruction.h monetdb5/mal/mal_parser.c monetdb5/mal/mal_type.h monetdb5/optimizer/Makefile.ag monetdb5/optimizer/opt_pipes.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_remoteQueries.c monetdb5/optimizer/opt_support.h monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.mal sql/backends/monet5/UDF/Tests/udf-fuse.stable.out sql/backends/monet5/UDF/Tests/udf-reverse.stable.out sql/backends/monet5/sql.mal sql/backends/monet5/sql_gencode.c sql/benchmarks/ssbm/Tests/01-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/02-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/03-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/04-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/05-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/06-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/07-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/08-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/09-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/10-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/11-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/12-explain.stable.out.int128 sql/benchmarks/ssbm/Tests/13-explain.stable.out.int128 sql/benchmarks/tpch/Tests/01-explain.stable.out.int128 sql/benchmarks/tpch/Tests/02-explain.stable.out sql/benchmarks/tpch/Tests/03-explain.stable.out.int128 sql/benchmarks/tpch/Tests/04-explain.stable.out sql/benchmarks/tpch/Tests/05-explain.stable.out.int128 sql/benchmarks/tpch/Tests/06-explain.stable.out.int128 sql/benchmarks/tpch/Tests/07-explain.stable.out.int128 sql/benchmarks/tpch/Tests/08-explain.stable.out.int128 sql/benchmarks/tpch/Tests/09-explain.stable.out.int128 sql/benchmarks/tpch/Tests/10-explain.stable.out.int128 sql/benchmarks/tpch/Tests/11-explain.stable.out.int128 sql/benchmarks/tpch/Tests/12-explain.stable.out sql/benchmarks/tpch/Tests/12-explain.stable.out.int128 sql/benchmarks/tpch/Tests/13-explain.stable.out sql/benchmarks/tpch/Tests/13-explain.stable.out.32bit sql/benchmarks/tpch/Tests/14-explain.stable.out.int128 sql/benchmarks/tpch/Tests/15-explain.stable.out.int128 sql/benchmarks/tpch/Tests/16-explain.stable.out sql/benchmarks/tpch/Tests/16-explain.stable.out.32bit sql/benchmarks/tpch/Tests/17-explain.stable.out.int128 sql/benchmarks/tpch/Tests/18-explain.stable.out.int128 sql/benchmarks/tpch/Tests/19-explain.stable.out.int128 sql/benchmarks/tpch/Tests/20-explain.stable.out.int128 sql/benchmarks/tpch/Tests/21-explain.stable.out sql/benchmarks/tpch/Tests/21-explain.stable.out.32bit sql/benchmarks/tpch/Tests/22-explain.stable.out.int128 sql/test/BugTracker-2009/Tests/POWER_vs_prod.SF-2596114.stable.out sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out sql/test/BugTracker-2010/Tests/group-by_ordered_column.Bug-2564.stable.out sql/test/BugTracker-2010/Tests/group-by_ordered_column.Bug-2564.stable.out.32bit sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out.int128 sql/test/BugTracker-2011/Tests/func_iter_vs_bulk.Bug-2826.stable.out sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out.int128 sql/test/BugTracker-2014/Tests/manifold.Bug-3556.stable.out sql/test/BugTracker/Tests/explain.SF-1739353.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out sql/test/Tests/setoptimizer.stable.err sql/test/Tests/setoptimizer.stable.out sql/test/Tests/setoptimizer.stable.out.Windows sql/test/mergetables/Tests/mergequery.stable.out Branch: default Log Message:
Addition of the candidatelist property MAL variables can have a candidate list flag, which is set by a cheap optimizer at the start of the pipe. This property leads to different rendering of the variables.
diffs (truncated from 5982 to 300 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1559,6 +1559,7 @@ str MTIMEtzone_tostr(str *s, const tzone str MTIMEunix_epoch(timestamp *ret); void OPTaliasRemap(InstrPtr p, int *alias); int OPTaliasesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); +int OPTcandidatesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTcoercionImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTcommonTermsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTconstantsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); @@ -2186,6 +2187,7 @@ str ifthenelseRef; str ilikeRef; str ilikeselectRef; str ilikesubselectRef; +str ilikethetasubselectRef; str ilikeuselectRef; void initHeartbeat(void); void initLibraries(void); @@ -2257,6 +2259,7 @@ str levenshteinbasic_impl(int *result, s str likeRef; str likeselectRef; str likesubselectRef; +str likethetasubselectRef; str likeuselectRef; str listRef; str loadLibrary(str modulename, int flag); @@ -2587,6 +2590,7 @@ str subsliceRef; str subsortRef; str subsumRef; str subthetajoinRef; +str subuniqueRef; str sumRef; int tableProp; str takeOid(oid id, str *val); diff --git a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err --- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err +++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err @@ -30,16 +30,16 @@ stderr of test 'opt_sql_append` in direc # 22:58:57 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=rome" "--port=36275" # 22:58:57 >
-MAPI = (monetdb) /var/tmp/mtest-28239/.s.monetdb.30808 +MAPI = (monetdb) /var/tmp/mtest-21015/.s.monetdb.39072 QUERY = explain copy into ttt from '\tmp/xyz'; ERROR = !COPY INTO: filename must have absolute path: \tmp/xyz -MAPI = (monetdb) /var/tmp/mtest-28239/.s.monetdb.30808 +MAPI = (monetdb) /var/tmp/mtest-21015/.s.monetdb.39072 QUERY = explain copy into ttt from 'a:\tmp/xyz'; ERROR = !COPY INTO: filename must have absolute path: a:\tmp/xyz -MAPI = (monetdb) /var/tmp/mtest-28239/.s.monetdb.30808 +MAPI = (monetdb) /var/tmp/mtest-21015/.s.monetdb.39072 QUERY = explain copy into ttt from '\tmp/xyz'; ERROR = !COPY INTO: filename must have absolute path: \tmp/xyz -MAPI = (monetdb) /var/tmp/mtest-28239/.s.monetdb.30808 +MAPI = (monetdb) /var/tmp/mtest-21015/.s.monetdb.39072 QUERY = explain copy into ttt from 'Z:/tmp/xyz'; ERROR = !COPY INTO: filename must have absolute path: Z:/tmp/xyz
diff --git a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out --- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out +++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out @@ -55,8 +55,8 @@ Ready. % .L # table_name % def # name % clob # type -% 491 # length -[ "optimizer.inline();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.garbageCollector();" ] +% 514 # length +[ "optimizer.inline();optimizer.candidates();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.garbageCollector();" ] #explain copy into ttt from '/tmp/xyz'; % .explain # table_name % mal # name @@ -89,8 +89,8 @@ end user.s4_1; % .L # table_name % def # name % clob # type -% 514 # length -[ "optimizer.inline();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.sql_append();optimizer.garbageCollector();" ] +% 537 # length +[ "optimizer.inline();optimizer.candidates();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.sql_append();optimizer.garbageCollector();" ] #explain copy into ttt from '/tmp/xyz'; % .explain # table_name % mal # name diff --git a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.single b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.single --- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.single +++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.single @@ -55,8 +55,8 @@ Ready. % .L # table_name % def # name % clob # type -% 491 # length -[ "optimizer.inline();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.garbageCollector();" ] +% 514 # length +[ "optimizer.inline();optimizer.candidates();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.garbageCollector();" ] #explain copy into ttt from '/tmp/xyz'; % .explain # table_name % mal # name @@ -87,8 +87,8 @@ end user.s4_1; % .L # table_name % def # name % clob # type -% 514 # length -[ "optimizer.inline();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.sql_append();optimizer.garbageCollector();" ] +% 537 # length +[ "optimizer.inline();optimizer.candidates();optimizer.remap();optimizer.costModel();optimizer.coercions();optimizer.evaluate();optimizer.aliases();optimizer.pushselect();optimizer.mitosis();optimizer.mergetable();optimizer.deadcode();optimizer.aliases();optimizer.constants();optimizer.commonTerms();optimizer.joinPath();optimizer.reorder();optimizer.deadcode();optimizer.reduce();optimizer.matpack();optimizer.dataflow();optimizer.querylog();optimizer.multiplex();optimizer.generator();optimizer.sql_append();optimizer.garbageCollector();" ] #explain copy into ttt from '/tmp/xyz'; % .explain # table_name % mal # name diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -120,7 +120,8 @@ mal_export void mal_exit(void); #define VAR_CLEANUP 16 #define VAR_INIT 32 #define VAR_USED 64 -#define VAR_DISABLED 128 /* used for comments and scheduler */ +#define VAR_CLIST 128 /* Candidate list variable */ +#define VAR_DISABLED 256 /* used for comments and scheduler */
/* type check status is kept around to improve type checking efficiency */ #define TYPE_ERROR -1 diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -653,7 +653,7 @@ getVarName(MalBlkPtr mb, int i) nme = mb->var[i]->name;
if (nme == 0 || *nme =='_') { - snprintf(buf, PATHLENGTH, "%c_%d", REFMARKER, mb->var[i]->tmpindex); + snprintf(buf, PATHLENGTH, "%c_%d", refMarker(mb,i), mb->var[i]->tmpindex); nme = mb->var[i]->name = GDKstrdup(buf); } return nme; diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h --- a/monetdb5/mal/mal_instruction.h +++ b/monetdb5/mal/mal_instruction.h @@ -86,6 +86,10 @@ #define setVarConstant(M,I) ((M)->var[I]->flags |= VAR_CONSTANT) #define isVarConstant(M,I) ((M)->var[I]->flags & VAR_CONSTANT)
+#define clrVarCList(M,I) ((M)->var[I]->flags &= ~VAR_CLIST) +#define setVarCList(M,I) ((M)->var[I]->flags |= VAR_CLIST) +#define isVarCList(M,I) ((M)->var[I]->flags & VAR_CLIST) + #define getVarConstant(M,I) ((M)->var[I]->value) #define getVarValue(M,I) VALget(&(M)->var[I]->value)
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -116,7 +116,9 @@ initParser(void) static int idLength(Client cntxt) { - str s, t; + str s,t; + int len = 0; + skipSpace(cntxt); s = CURRENT(cntxt); t = s; @@ -128,9 +130,15 @@ idLength(Client cntxt) s[0] = REFMARKER; /* prepare escape of temporary names */ s++; - while (idCharacter2[(int) (*s)]) + while (len < IDLENGTH && idCharacter2[(int) (*s)]){ s++; - return (int) (s - t); + len++; + } + if( len == IDLENGTH) + // skip remainder + while (idCharacter2[(int) (*s)]) + s++; + return (int) (s-t);; }
/* Simple type identifiers can not be marked with a type variable. */ diff --git a/monetdb5/mal/mal_type.h b/monetdb5/mal/mal_type.h --- a/monetdb5/mal/mal_type.h +++ b/monetdb5/mal/mal_type.h @@ -15,6 +15,8 @@ #define malVARG " malVARG" #define TMPMARKER '_' #define REFMARKER 'X' +#define REFMARKERC 'C' +#define refMarker(M,I) (isVarCList(M,I)? 'C':'X')
#define newBatType(H,T) (1<<16 | (((TYPE_oid & 0377) <<8) | (T & 0377) )) #define isaBatType(X) ((1<<16) & (X) && (X)!= TYPE_any) diff --git a/monetdb5/optimizer/Makefile.ag b/monetdb5/optimizer/Makefile.ag --- a/monetdb5/optimizer/Makefile.ag +++ b/monetdb5/optimizer/Makefile.ag @@ -21,6 +21,7 @@ lib_optimizer = { opt_aliases.c opt_aliases.h \ opt_coercion.c opt_coercion.h \ opt_commonTerms.c opt_commonTerms.h \ + opt_candidates.c opt_candidates.h \ opt_constants.c opt_constants.h \ opt_costModel.c opt_costModel.h \ opt_dataflow.c opt_dataflow.h \ diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -46,6 +46,7 @@ static struct PIPELINES { */ {"minimal_pipe", "optimizer.inline();" + "optimizer.candidates();" "optimizer.remap();" "optimizer.deadcode();" "optimizer.multiplex();" @@ -63,6 +64,7 @@ static struct PIPELINES { */ {"default_pipe", "optimizer.inline();" + "optimizer.candidates();" "optimizer.remap();" "optimizer.costModel();" "optimizer.coercions();" @@ -99,6 +101,7 @@ static struct PIPELINES { {"no_mitosis_pipe", "optimizer.inline();" "optimizer.remap();" + "optimizer.candidates();" "optimizer.costModel();" "optimizer.coercions();" "optimizer.evaluate();" @@ -132,6 +135,7 @@ static struct PIPELINES { */ {"sequential_pipe", "optimizer.inline();" + "optimizer.candidates();" "optimizer.remap();" "optimizer.costModel();" "optimizer.coercions();" diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c --- a/monetdb5/optimizer/opt_prelude.c +++ b/monetdb5/optimizer/opt_prelude.c @@ -114,10 +114,10 @@ str kdifferenceRef; str languageRef; str leftfetchjoinRef; str leftfetchjoinPathRef; -str likeselectRef; -str ilikeselectRef; -str likeuselectRef; -str ilikeuselectRef; +str likesubselectRef; +str likethetasubselectRef; +str ilikesubselectRef; +str ilikethetasubselectRef; str likeRef; str ilikeRef; str not_likeRef; @@ -211,6 +211,7 @@ str subavgRef; str subsortRef; str takeRef; str not_uniqueRef; +str subuniqueRef; str unlockRef; str unpackRef; str unpinRef; @@ -357,10 +358,8 @@ void optimizerInit(void) languageRef= putName("language",8); leftfetchjoinRef = putName("leftfetchjoin",13); leftfetchjoinPathRef = putName("leftfetchjoinPath",17); - likeselectRef = putName("like_select",11); - ilikeselectRef = putName("ilike_select",12); - likeuselectRef = putName("like_uselect",12); - ilikeuselectRef = putName("ilike_uselect",13); + likesubselectRef = putName("likesubselect",13); + ilikesubselectRef = putName("ilikesubselect",14); listRef = putName("list",4); likeRef = putName("like",4); ilikeRef = putName("ilike",5); @@ -455,6 +454,7 @@ void optimizerInit(void) takeRef= putName("take",5); timestampRef = putName("timestamp", 9); not_uniqueRef= putName("not_unique",10); + subuniqueRef= putName("subunique",9); unlockRef= putName("unlock",6); unpackRef = putName("unpack",6); unpinRef = putName("unpin",5); @@ -462,7 +462,9 @@ void optimizerInit(void) subselectRef = putName("subselect",9); thetasubselectRef = putName("thetasubselect",14); likesubselectRef = putName("likesubselect",13); + likethetasubselectRef = putName("likethetasubselect",18); ilikesubselectRef = putName("ilikesubselect",14); + ilikethetasubselectRef = putName("ilikethetasubselect",19); vectorRef = putName("vector",6); zero_or_oneRef = putName("zero_or_one",11); userRef = putName("user",4); diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h --- a/monetdb5/optimizer/opt_prelude.h +++ b/monetdb5/optimizer/opt_prelude.h @@ -117,10 +117,6 @@ opt_export str ilikeselectRef; opt_export str likeuselectRef; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
-- Sjoerd Mullender