MonetDB: default - Check arguments of MEL commands.
Changeset: cd8a99c0d73a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cd8a99c0d73a Modified Files: testing/melcheck.py Branch: default Log Message: Check arguments of MEL commands. diffs (107 lines): diff --git a/testing/melcheck.py b/testing/melcheck.py --- a/testing/melcheck.py +++ b/testing/melcheck.py @@ -12,21 +12,69 @@ except ImportError: from MonetDBtesting import exportutils # MEL pattern -argreg = r'\s*,\s*(?:bat)?(?:var)?arg(?:any)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)' +argreg = r'\s*,\s*(?Pbat)?(?Pvar)?arg(?Pany)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)' patreg = r'^\s*(?Ppattern|command)\s*\(\s*"(?P[^"]*)"\s*,\s*"(?P[^"]*)"\s*,\s*(?P\w+)\s*,[^,]*,\s*"[^\"]*(?:\\.[^\"]*)*"\s*,\s*args\s*\(\s*(?P\d+)\s*,\s*(?P\d+)(?P(?:'+argreg+')*)\s*\)\s*\)' argre = re.compile(argreg) patre = re.compile(patreg, re.MULTILINE) -fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:\s*,\s*(?:const\s+)?(?:\w+\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*\w+)*))\s*\)\s*{' +fcnargreg = r'\s*,\s*(?:const\s+)?(?:(?P\w+)\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*(?P\w+)' +fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:'+ fcnargreg + r')*))\s*\)\s*{' fcnre = re.compile(fcnreg) +fcnargre = re.compile(fcnargreg) gpats = {} gcmds = {} mel = [] +mappings = { +'streams': 'Stream', +'bstream': 'Bstream', +} + +def checkcommand(imp, mod, fcn, decl, retc, argc, args): +if argc < retc: +print('bad argc < retc for command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +decl = ',' + decl # makes processing easier +pos = 0 +cpos = 0 +if retc == 0: +retc = 1 +argc += 1 +args = ',arg("",void)' + args +for i in range(argc): +res = argre.match(args, pos) +if res is None: +print('not enough arguments in command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +if res.group('var'): +print('cannot have variable number of arguments in command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +if res.group('bat'): +cmaltype = 'bat' +elif res.group('any'): +cmaltype = 'void' +else: +cmaltype = res.group('argval') +cmaltype = mappings.get(cmaltype, cmaltype) +cres = fcnargre.match(decl, cpos) +if cres is None: +print('not enough arguments in implementation {} for command {}.{}'.format(imp, mod, fcn)) +return +ctype = cres.group('type') +if not ctype: +ctype = 'void' # declared as "ptr val", so type is void * +if i < retc and 'const' in cres.group(0): +print('const return pointer in implementation {} for command {}.{} (arg {})'.format(imp, mod, fcn, i)) +if ctype != cmaltype: +if cmaltype != 'str' or ctype != 'char' or cres.group(0).count('*') != 2: +print('type mismatch for arg {} in implementation {} for command {}.{}'.format(i, imp, mod, fcn)) +pos = res.end(0) +cpos = cres.end(0) + def process1(f): data = exportutils.preprocess(f) pats = {} @@ -51,17 +99,19 @@ def process1(f): if imp in cmds or imp in gcmds: print('command implementation {} for pattern {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) else: -mel.append(('pattern', imp, res.group('mod'), res.group('fcn'))) +mel.append(('pattern', imp, res.group('mod'), res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args'))) else: if imp not in cmds and imp not in gcmds: if imp in pats or imp in gpats: print('pattern implementation {} for command {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) else: -mel.append(('command ', imp, res.group('mod'), res.group('fcn'))) +mel.append(('command', imp, res.group('mod'), res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args'))) +else: +checkcommand(imp, res.group('mod'), res.group('fcn'), cmds.get(imp, gcmds.get(imp)), int(res.group('retc')), int(res.group('argc')), res.group('args')) res = patre.search(data, pos=res.end(0)) def process2(): -for (cmdpat, imp, mod, fcn) in mel: +for (cmdpat, imp, mod, fcn, retc, argc, args) in mel: if cmdpat == 'pattern': if imp not in gpats: if imp in gcmds: @@ -74,6 +124,8 @@ def process2(): print('pattern implementation {} f
MonetDB: Oct2020 - Check arguments of MEL commands.
Changeset: 0d3c319ac98a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0d3c319ac98a Modified Files: testing/melcheck.py Branch: Oct2020 Log Message: Check arguments of MEL commands. diffs (107 lines): diff --git a/testing/melcheck.py b/testing/melcheck.py --- a/testing/melcheck.py +++ b/testing/melcheck.py @@ -12,21 +12,69 @@ except ImportError: from MonetDBtesting import exportutils # MEL pattern -argreg = r'\s*,\s*(?:bat)?(?:var)?arg(?:any)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)' +argreg = r'\s*,\s*(?Pbat)?(?Pvar)?arg(?Pany)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)' patreg = r'^\s*(?Ppattern|command)\s*\(\s*"(?P[^"]*)"\s*,\s*"(?P[^"]*)"\s*,\s*(?P\w+)\s*,[^,]*,\s*"[^\"]*(?:\\.[^\"]*)*"\s*,\s*args\s*\(\s*(?P\d+)\s*,\s*(?P\d+)(?P(?:'+argreg+')*)\s*\)\s*\)' argre = re.compile(argreg) patre = re.compile(patreg, re.MULTILINE) -fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:\s*,\s*(?:const\s+)?(?:\w+\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*\w+)*))\s*\)\s*{' +fcnargreg = r'\s*,\s*(?:const\s+)?(?:(?P\w+)\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*(?P\w+)' +fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:'+ fcnargreg + r')*))\s*\)\s*{' fcnre = re.compile(fcnreg) +fcnargre = re.compile(fcnargreg) gpats = {} gcmds = {} mel = [] +mappings = { +'streams': 'Stream', +'bstream': 'Bstream', +} + +def checkcommand(imp, mod, fcn, decl, retc, argc, args): +if argc < retc: +print('bad argc < retc for command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +decl = ',' + decl # makes processing easier +pos = 0 +cpos = 0 +if retc == 0: +retc = 1 +argc += 1 +args = ',arg("",void)' + args +for i in range(argc): +res = argre.match(args, pos) +if res is None: +print('not enough arguments in command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +if res.group('var'): +print('cannot have variable number of arguments in command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +if res.group('bat'): +cmaltype = 'bat' +elif res.group('any'): +cmaltype = 'void' +else: +cmaltype = res.group('argval') +cmaltype = mappings.get(cmaltype, cmaltype) +cres = fcnargre.match(decl, cpos) +if cres is None: +print('not enough arguments in implementation {} for command {}.{}'.format(imp, mod, fcn)) +return +ctype = cres.group('type') +if not ctype: +ctype = 'void' # declared as "ptr val", so type is void * +if i < retc and 'const' in cres.group(0): +print('const return pointer in implementation {} for command {}.{} (arg {})'.format(imp, mod, fcn, i)) +if ctype != cmaltype: +if cmaltype != 'str' or ctype != 'char' or cres.group(0).count('*') != 2: +print('type mismatch for arg {} in implementation {} for command {}.{}'.format(i, imp, mod, fcn)) +pos = res.end(0) +cpos = cres.end(0) + def process1(f): data = exportutils.preprocess(f) pats = {} @@ -51,17 +99,19 @@ def process1(f): if imp in cmds or imp in gcmds: print('command implementation {} for pattern {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) else: -mel.append(('pattern', imp, res.group('mod'), res.group('fcn'))) +mel.append(('pattern', imp, res.group('mod'), res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args'))) else: if imp not in cmds and imp not in gcmds: if imp in pats or imp in gpats: print('pattern implementation {} for command {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) else: -mel.append(('command ', imp, res.group('mod'), res.group('fcn'))) +mel.append(('command', imp, res.group('mod'), res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args'))) +else: +checkcommand(imp, res.group('mod'), res.group('fcn'), cmds.get(imp, gcmds.get(imp)), int(res.group('retc')), int(res.group('argc')), res.group('args')) res = patre.search(data, pos=res.end(0)) def process2(): -for (cmdpat, imp, mod, fcn) in mel: +for (cmdpat, imp, mod, fcn, retc, argc, args) in mel: if cmdpat == 'pattern': if imp not in gpats: if imp in gcmds: @@ -74,6 +124,8 @@ def process2(): print('pattern implementation {} f
MonetDB: Oct2020 - Initial version of a melcheck.py program to c...
Changeset: bdafff4d9886 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bdafff4d9886 Added Files: testing/melcheck.py Modified Files: testing/exportutils.py testing/listexports.py.in testing/malcheck.py Branch: Oct2020 Log Message: Initial version of a melcheck.py program to check mel_func array contents. diffs (truncated from 395 to 300 lines): diff --git a/testing/exportutils.py b/testing/exportutils.py --- a/testing/exportutils.py +++ b/testing/exportutils.py @@ -5,119 +5,157 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. import re - -# a function-like #define that we expand to also find exports hidden -# in preprocessor macros -defre = re.compile(r'^[ \t]*#[ \t]*define[ \t]+'# #define - r'(?P[a-zA-Z_][a-zA-Z0-9_]*)' # name being defined - r'\((?P[a-zA-Z0-9_, \t]*)\)[ \t]*' # arguments - r'(?P.*)$', # macro replacement - re.MULTILINE) -# line starting with a "#" -cldef = re.compile(r'^[ \t]*#', re.MULTILINE) +import os -# white space -spcre = re.compile(r'\s+') +# macro definition +macrore = re.compile(r'\s*#\s*define\s+'# #define + r'(?P\w+)' # name being defined + r'(?:\((?P[^)]*)\))?\s*' # optional arguments + r'(?P.*)') # replacement +# include file +inclre = re.compile(r'\s*#\s*include\s+"(?P[^"]*)"') +# comments (/* ... */ where ... is as short as possible) +cmtre = re.compile(r'/\*[^*]*(\*(?=[^/])[^*]*)*\*/|//.*') +# horizontal white space +spcre = re.compile(r'[ \t]+') +# identifier +identre = re.compile(r'\b(?P[a-zA-Z_]\w*)\b') +# undef +undefre = re.compile(r'\s*#\s*undef\s+(?P\w+)') +ifre = re.compile(r'\s*#\s*if') # #if or #ifdef +elifre = re.compile(r'\s*#\s*elif') +elsere = re.compile(r'\s*#\s*else') +endifre = re.compile(r'\s*#\s*endif') -# some regexps helping to normalize a declaration -strre = re.compile(r'([^ *])\*') -comre = re.compile(r',\s*') - -# comments (/* ... */ where ... is as short as possible) -cmtre = re.compile(r'/\*.*?\*/|//[^\n]*', re.DOTALL) - -deepnesting = False +nested = r'' # r'(?:\([^()]*(?:\([^()]*(?:\([^()]*(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)[^()]*)*\)[^()]*)*\)[^()]*)*\)[^()]*)*' -# do something a bit like the C preprocessor -# -# we expand function-like macros and remove all ## sequences from the -# replacement (even when there are no adjacent parameters that were -# replaced), but this is good enough for our purpose of finding -# exports that are hidden away in several levels of macro definitions -# -# we assume that there are no continuation lines in the input -def preprocess(data, printdef=False): -# remove C comments -res = cmtre.search(data) +def process(line, funmac, macros, infunmac=False): +nline = '' +pos = 0 +res = identre.search(line) while res is not None: -data = data[:res.start(0)] + ' ' + data[res.end(0):] -res = cmtre.search(data, res.start(0)) -# remove \ combo's +name = res.group('ident') +if name in macros: +macros2 = macros.copy() +del macros2[name] +repl = process(macros[name], funmac, macros2) +if line[res.start(0)-1:res.start(0)] == '#' and \ + line[res.start(0)-2:res.start(0)] != '##': +nline += line[pos:res.start(0)-1] +nline += '"' + repl.replace('\\', r'\\').replace('"', r'\"') + '"' +else: +nline += line[pos:res.start(0)] + repl +pos = res.end(0) +elif name in funmac: +args, repl = funmac[name] +pat = r'\s*\(' +sep = r'' +for arg in args: +pat += sep + r'([^,()]*(?:\([^()]*'+nested+r'\)[^,()]*)*)' +sep = r',' +pat += r'\s*\)' +r = re.compile(pat) +res2 = r.match(line, pos=res.end(0)) +if res2 is not None: +macros2 = {} +i = 1 +for arg in args: +macros2[arg] = res2.group(i).strip() +i += 1 +repl = process(repl, {}, macros2, True) +funmac2 = funmac.copy() +del funmac2[name] +repl = process(repl, funmac2, macros) +repl = repl.replace('##', '') +nline += line[pos:res.start(0)] + repl +pos = res2.end(0) +else: +nline += line[pos:res.end(0)] +pos = res.end(0) +else: +nline += line[pos:res.end(0)] +pos = res.end(0) +res = identre.search(line, pos=pos) +nline += line[pos:] +return nline + +def readfile(f, funmac=None, macros=None, files=None, printdef=False): +data = open(f).read() +dirname, f = os.p
MonetDB: Oct2020 - Deal with restrict, plus some fixes.
Changeset: 46659a7de18f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=46659a7de18f Modified Files: testing/melcheck.py Branch: Oct2020 Log Message: Deal with restrict, plus some fixes. diffs (28 lines): diff --git a/testing/melcheck.py b/testing/melcheck.py --- a/testing/melcheck.py +++ b/testing/melcheck.py @@ -18,7 +18,7 @@ patreg = r'^\s*(?Ppattern|comman argre = re.compile(argreg) patre = re.compile(patreg, re.MULTILINE) -fcnargreg = r'\s*,\s*(?:const\s+)?(?:(?P\w+)\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*(?P\w+)' +fcnargreg = r'\s*,\s*(?:const\s+)?(?:(?P\w+)\s*\*(?:\s*(?:const\s*)?\*)*(?:\s*restrict\s)?|ptr\s)\s*(?P\w+)' fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:'+ fcnargreg + r')*))\s*\)\s*{' fcnre = re.compile(fcnreg) @@ -115,13 +115,13 @@ def process2(): if cmdpat == 'pattern': if imp not in gpats: if imp in gcmds: -print('command implementation {} for pattern {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) +print('command implementation {} for pattern {}.{}'.format(imp, mod, fcn)) else: print('pattern implementation {} for {}.{} is missing'.format(imp, mod, fcn)) else: if imp not in gcmds: if imp in gpats: -print('pattern implementation {} for command {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) +print('pattern implementation {} for command {}.{}'.format(imp, mod, fcn)) else: print('command implementation {} for {}.{} is missing'.format(imp, mod, fcn)) else: ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Fixing problems found with melcheck.py.
Changeset: 005ce1ec7b37 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=005ce1ec7b37 Modified Files: monetdb5/modules/atoms/xml.c monetdb5/modules/mal/mdb.c sql/backends/monet5/sql.c Branch: Oct2020 Log Message: Fixing problems found with melcheck.py. diffs (36 lines): diff --git a/monetdb5/modules/atoms/xml.c b/monetdb5/modules/atoms/xml.c --- a/monetdb5/modules/atoms/xml.c +++ b/monetdb5/modules/atoms/xml.c @@ -376,7 +376,7 @@ XMLparse(xml *x, str *doccont, str *val, } str -XMLpi(str *ret, str *target, str *value) +XMLpi(xml *ret, str *target, str *value) { size_t len; str buf; diff --git a/monetdb5/modules/mal/mdb.c b/monetdb5/modules/mal/mdb.c --- a/monetdb5/modules/mal/mdb.c +++ b/monetdb5/modules/mal/mdb.c @@ -735,7 +735,7 @@ static str MDBdump(Client cntxt, MalBlkP } static str -MDBdummy(int *ret) +MDBdummy(void *ret) { (void) ret; throw(MAL, "mdb.dummy", OPERATION_FAILED); diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -6485,7 +6485,7 @@ static mel_func sql_init_funcs[] = { command("sql", "round", hge_round_wrap, false, "round off the decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, arg("",hge),arg("v",hge),arg("d",int),arg("s",int),arg("r",bte))), command("batsql", "round", hge_bat_round_wrap, false, "round off the decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, batarg("",hge),batarg("v",hge),arg("d",int),arg("s",int),arg("r",bte))), command("calc", "second_interval", hge_dec2second_interval, false, "cast hge decimal to a second_interval", args(1,5, arg("",lng),arg("sc",int),arg("v",hge),arg("ek",int),arg("sk",int))), - command("batcalc", "second_interval", hge_batdec2second_interval, false, "cast hge decimal to a second_interval", args(1,5, batarg("",lng),arg("sc",int),batarg("v",hge),arg("ek",int),arg("sk",int))), + pattern("batcalc", "second_interval", hge_batdec2second_interval, false, "cast hge decimal to a second_interval", args(1,5, batarg("",lng),arg("sc",int),batarg("v",hge),arg("ek",int),arg("sk",int))), pattern("batcalc", "second_interval", hge_batdec2second_interval, false, "cast hge decimal to a second_interval", args(1,6, batarg("",lng),arg("sc",int),batarg("v",hge),batarg("s",oid),arg("ek",int),arg("sk",int))), command("calc", "hge", nil_2dec_hge, false, "cast to dec(hge) and check for overflow", args(1,4, arg("",hge),arg("v",void),arg("digits",int),arg("scale",int))), command("batcalc", "hge", batnil_2dec_hge, false, "cast to dec(hge) and check for overflow", args(1,4, batarg("",hge),batarg("v",void),arg("digits",int),arg("scale",int))), ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - merged with default
Changeset: 3c163505cee4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3c163505cee4 Branch: nospare Log Message: merged with default diffs (107 lines): diff --git a/testing/melcheck.py b/testing/melcheck.py --- a/testing/melcheck.py +++ b/testing/melcheck.py @@ -12,21 +12,69 @@ except ImportError: from MonetDBtesting import exportutils # MEL pattern -argreg = r'\s*,\s*(?:bat)?(?:var)?arg(?:any)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)' +argreg = r'\s*,\s*(?Pbat)?(?Pvar)?arg(?Pany)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)' patreg = r'^\s*(?Ppattern|command)\s*\(\s*"(?P[^"]*)"\s*,\s*"(?P[^"]*)"\s*,\s*(?P\w+)\s*,[^,]*,\s*"[^\"]*(?:\\.[^\"]*)*"\s*,\s*args\s*\(\s*(?P\d+)\s*,\s*(?P\d+)(?P(?:'+argreg+')*)\s*\)\s*\)' argre = re.compile(argreg) patre = re.compile(patreg, re.MULTILINE) -fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:\s*,\s*(?:const\s+)?(?:\w+\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*\w+)*))\s*\)\s*{' +fcnargreg = r'\s*,\s*(?:const\s+)?(?:(?P\w+)\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*(?P\w+)' +fcnreg = r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:'+ fcnargreg + r')*))\s*\)\s*{' fcnre = re.compile(fcnreg) +fcnargre = re.compile(fcnargreg) gpats = {} gcmds = {} mel = [] +mappings = { +'streams': 'Stream', +'bstream': 'Bstream', +} + +def checkcommand(imp, mod, fcn, decl, retc, argc, args): +if argc < retc: +print('bad argc < retc for command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +decl = ',' + decl # makes processing easier +pos = 0 +cpos = 0 +if retc == 0: +retc = 1 +argc += 1 +args = ',arg("",void)' + args +for i in range(argc): +res = argre.match(args, pos) +if res is None: +print('not enough arguments in command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +if res.group('var'): +print('cannot have variable number of arguments in command {}.{} with implementation {}'.format(mod, fcn, imp)) +return +if res.group('bat'): +cmaltype = 'bat' +elif res.group('any'): +cmaltype = 'void' +else: +cmaltype = res.group('argval') +cmaltype = mappings.get(cmaltype, cmaltype) +cres = fcnargre.match(decl, cpos) +if cres is None: +print('not enough arguments in implementation {} for command {}.{}'.format(imp, mod, fcn)) +return +ctype = cres.group('type') +if not ctype: +ctype = 'void' # declared as "ptr val", so type is void * +if i < retc and 'const' in cres.group(0): +print('const return pointer in implementation {} for command {}.{} (arg {})'.format(imp, mod, fcn, i)) +if ctype != cmaltype: +if cmaltype != 'str' or ctype != 'char' or cres.group(0).count('*') != 2: +print('type mismatch for arg {} in implementation {} for command {}.{}'.format(i, imp, mod, fcn)) +pos = res.end(0) +cpos = cres.end(0) + def process1(f): data = exportutils.preprocess(f) pats = {} @@ -51,17 +99,19 @@ def process1(f): if imp in cmds or imp in gcmds: print('command implementation {} for pattern {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) else: -mel.append(('pattern', imp, res.group('mod'), res.group('fcn'))) +mel.append(('pattern', imp, res.group('mod'), res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args'))) else: if imp not in cmds and imp not in gcmds: if imp in pats or imp in gpats: print('pattern implementation {} for command {}.{}'.format(imp, res.group('mod'), res.group('fcn'))) else: -mel.append(('command ', imp, res.group('mod'), res.group('fcn'))) +mel.append(('command', imp, res.group('mod'), res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args'))) +else: +checkcommand(imp, res.group('mod'), res.group('fcn'), cmds.get(imp, gcmds.get(imp)), int(res.group('retc')), int(res.group('argc')), res.group('args')) res = patre.search(data, pos=res.end(0)) def process2(): -for (cmdpat, imp, mod, fcn) in mel: +for (cmdpat, imp, mod, fcn, retc, argc, args) in mel: if cmdpat == 'pattern': if imp not in gpats: if imp in gcmds: @@ -74,6 +124,8 @@ def process2(): print('pattern implementation {} for command {}.{}'.format(imp, res.group('mod'), res.grou
MonetDB: default - Merge with Oct2020 branch.
Changeset: 75ff603ffaba for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75ff603ffaba Modified Files: sql/backends/monet5/sql.c sql/server/rel_dump.c sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_select.c sql/server/rel_unnest.c sql/server/rel_updates.c sql/test/SQLancer/Tests/sqlancer02.sql sql/test/SQLancer/Tests/sqlancer02.test sql/test/bugs/Tests/All sql/test/miscellaneous/Tests/simple_selects.sql sql/test/miscellaneous/Tests/simple_selects.stable.err testing/listexports.py.in Branch: default Log Message: Merge with Oct2020 branch. diffs (truncated from 400 to 300 lines): diff --git a/monetdb5/modules/atoms/xml.c b/monetdb5/modules/atoms/xml.c --- a/monetdb5/modules/atoms/xml.c +++ b/monetdb5/modules/atoms/xml.c @@ -376,7 +376,7 @@ XMLparse(xml *x, str *doccont, str *val, } str -XMLpi(str *ret, str *target, str *value) +XMLpi(xml *ret, str *target, str *value) { size_t len; str buf; diff --git a/monetdb5/modules/mal/mdb.c b/monetdb5/modules/mal/mdb.c --- a/monetdb5/modules/mal/mdb.c +++ b/monetdb5/modules/mal/mdb.c @@ -735,7 +735,7 @@ static str MDBdump(Client cntxt, MalBlkP } static str -MDBdummy(int *ret) +MDBdummy(void *ret) { (void) ret; throw(MAL, "mdb.dummy", OPERATION_FAILED); diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -5719,22 +5719,22 @@ rel_joinquery_(sql_query *query, sql_rel } lateral = check_is_lateral(tab2); - t1 = table_ref(query, NULL, tab1, 0, NULL); + t1 = table_ref(query, NULL, tab1, 0, refs); if (rel && !t1 && sql->session->status != -ERR_AMBIGUOUS) { /* reset error */ sql->session->status = 0; sql->errstr[0] = 0; - t1 = table_ref(query, NULL, tab1, 0, NULL); + t1 = table_ref(query, NULL, tab1, 0, refs); } if (t1) { - t2 = table_ref(query, NULL, tab2, 0, NULL); + t2 = table_ref(query, NULL, tab2, 0, refs); if (lateral && !t2 && sql->session->status != -ERR_AMBIGUOUS) { /* reset error */ sql->session->status = 0; sql->errstr[0] = 0; query_push_outer(query, t1, sql_from); - t2 = table_ref(query, NULL, tab2, 0, NULL); + t2 = table_ref(query, NULL, tab2, 0, refs); t1 = query_pop_outer(query); } } @@ -5743,9 +5743,6 @@ rel_joinquery_(sql_query *query, sql_rel if (!t1 || !t2) return NULL; - if (!lateral && rel_name(t1) && rel_name(t2) && strcmp(rel_name(t1), rel_name(t2)) == 0) - return sql_error(sql, 02, SQLSTATE(42000) "SELECT: '%s' on both sides of the JOIN expression", rel_name(t1)); - inner = rel = rel_crossproduct(sql->sa, t1, t2, op_join); inner->op = op; if (lateral) @@ -5833,17 +5830,6 @@ rel_joinquery_(sql_query *query, sql_rel } if (!rel) return NULL; - if (!lateral) { /* if this relation is under a FROM clause, check for duplicate names */ - const char *rname1 = rel_name(t1), *rname2 = rel_name(t2); - if (refs) { - if (list_find(refs, (char *)rname1, (fcmp) &strcmp)) - return sql_error(sql, 02, SQLSTATE(42000) "SELECT: relation name \"%s\" specified more than once", rname1); - if (list_find(refs, (char *)rname2, (fcmp) &strcmp)) - return sql_error(sql, 02, SQLSTATE(42000) "SELECT: relation name \"%s\" specified more than once", rname2); - list_append(refs, (char *)rname1); - list_append(refs, (char *)rname2); - } - } if (inner && is_outerjoin(inner->op)) set_processed(inner); set_processed(rel); @@ -5871,28 +5857,12 @@ rel_crossquery(sql_query *query, sql_rel mvc *sql = query->sql; dnode *n = q->data.lval->h; symbol *tab1 = n->data.sym, *tab2 = n->next->data.sym; - sql_rel *t1 = table_ref(query, rel, tab1, 0, NULL), *t2 = NULL; - const char *rname1, *rname2; + sql_rel *t1 = table_ref(query, rel, tab1, 0, refs), *t2 = NULL; if (t1) - t2 = table_ref(query, rel, tab2, 0, NULL); + t2 = table_ref(query, rel, tab2, 0, refs); if (!t1 || !t2) return NULL; - - rname1 = rel_name(t1); - rname2 = rel_name(t2); - if (rname1 && rname2 && strcmp(rname1, rname2) == 0) - return sql_error(sql, 02, SQLSTATE(42000) "SELECT: '%s' on both sides of t
MonetDB: nospare - Get os_cleanup working correctly.
Changeset: a04beab3594a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a04beab3594a Modified Files: sql/storage/objectset.c sql/test/BugTracker-2017/Tests/All Branch: nospare Log Message: Get os_cleanup working correctly. diffs (truncated from 486 to 300 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -20,14 +20,18 @@ struct object_node;// TODO: rename to object_version_chain -#define id_based_rollbacked 1 -#define name_based_rollbacked (1<<1) +#define id_based_rollbacked(1) +#define name_based_rollbacked (1<<1) +#define under_destruction (1<<2) +#define under_construction (1<<3) typedef struct objectversion { bool deleted; ulng ts; bte rollbacked; + bte life_cycle; sql_base *obj; + struct objectset* os; struct objectversion*name_based_older; struct objectversion*name_based_newer; // TODO: must become atomic pointer struct object_node *name_based_chain; @@ -41,7 +45,6 @@ typedef struct object_node { struct object_node* prev; struct object_node* next; objectversion* data; - struct objectset* os; } object_node; typedef struct objectset { @@ -229,7 +232,6 @@ os_append_node_name(objectset *os, objec } else { os->name_based_h = n; } - n->os = os; n->prev = os->name_based_t; // aka the double linked list. os->name_based_t = n; if (n->data) { @@ -268,7 +270,6 @@ os_append_node_id(objectset *os, object_ } else { os->id_based_h = n; } - n->os = os; n->prev = os->id_based_t; // aka the double linked list. os->id_based_t = n; if (n->data) { @@ -301,42 +302,12 @@ os_append_id(objectset *os, objectversio static object_node* find_name(objectset *os, const char *name); static void -objectversion_destroy(sqlstore *store, objectversion *ov, ulng commit_ts, ulng oldest) +objectversion_destroy(sqlstore *store, objectset* os, objectversion *ov) { - // TODO: clean this up once the add and del functions are working - // TODO: handle name_based_cnt s and id_based_cnt s - objectversion *name_based_older = ov->name_based_older; - objectversion *name_based_newer = ov->name_based_newer; - - if (name_based_older && commit_ts) { - objectversion_destroy(store, name_based_older, commit_ts, oldest); - name_based_older = NULL; - } else if (name_based_older) { - name_based_older->name_based_newer = name_based_newer; - } - ov->name_based_older = NULL; + if (os->destroy) + os->destroy(store, ov->obj); - if (name_based_newer && commit_ts) - name_based_newer->name_based_older = NULL; - else if (name_based_newer && name_based_older) - name_based_newer->name_based_older = name_based_older; - - objectset* os = ov->name_based_chain->os; - if (!name_based_newer) { - object_node *on = NULL; - if (os->unique) - on = find_name(os, ov->obj->name); - else - on = find_id(os, ov->obj->id); - assert(on->data == ov); - if (on) - os_remove_name_based_chain(os, store, on); - if (name_based_older) - os_append_name(os, name_based_older); - } - if (ov && os && os->destroy) - os->destroy(store, ov->obj); - /* free ov */ + _DELETE(ov); } static void os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store); @@ -363,7 +334,7 @@ os_rollback_os_id_based_cascading(object } else { // this is a terminal node. i.e. this objectversion does not have id based committed history - os_remove_id_based_chain(ov->id_based_chain->os, store, ov->id_based_chain); + os_remove_id_based_chain(ov->os, store, ov->id_based_chain); } } @@ -388,7 +359,7 @@ os_rollback_os_name_based_cascading(obje } else { // this is a terminal node. i.e. this objectversion does not have name based committed history - os_remove_name_based_chain(ov->name_based_chain->os, store, ov->name_based_chain); + os_remove_name_based_chain(ov->os, store, ov->name_based_chain); } } @@ -427,46 +398,99 @@ os_rollback(objectversion *ov, sqlstore return LOG_OK; } +static void +put_under_destruction(sqlstore* store, objectversion *ov, ulng oldest) +{ + //TODO ATOMIC CAS + if (ov->life_cycle == 0) { + ov->life_cycle = under_destruction; + + if (!ov->name_based_newer) { + os_remove_name_based_chain(ov->os, st
MonetDB: nospare - Remove disabled code.
Changeset: 936353be4fce for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=936353be4fce Modified Files: sql/storage/objectset.c Branch: nospare Log Message: Remove disabled code. diffs (33 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -685,29 +685,6 @@ get_valid_object_id(sql_trans *tr, objec return ov; } -#if 0 -static void -os_update_hash(objectset *os, object_node *n, /*new*/ objectversion *ov) -{ - MT_lock_set(&os->ht_lock); - if (os->name_map) { - hash_delete(os->name_map, n); - int nkey = os->name_map->key(ov); - hash_add(os->name_map, nkey, ov); - } - - if (os->id_map) { - hash_delete(os->id_map, n); - int nkey = os->id_map->key(ov); - hash_add(os->id_map, nkey, ov); - } - - n->data = ov; - - MT_lock_unset(&os->ht_lock); -} -#endif - static int os_add_name_based(objectset *os, struct sql_trans *tr, const char *name, objectversion *ov) { object_node *name_based_node = NULL; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - also for triggers, first create a new table (...
Changeset: 2001897e1b1b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2001897e1b1b Modified Files: sql/backends/monet5/rel_bin.c sql/storage/store.c Branch: nospare Log Message: also for triggers, first create a new table (version). (some more cleanup) diffs (67 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -1324,11 +1324,10 @@ exp_bin(backend *be, sql_exp *e, stmt *l static stmt * stmt_col( backend *be, sql_column *c, stmt *del, int part) { - //sql_trans *tr = be->mvc->session->tr; stmt *sc = stmt_bat(be, c, RDONLY, part); if (isTable(c->t) && c->t->access != TABLE_READONLY && - (!isNew(c) /*|| (c->t->s && !inTransaction(tr, c->t))*/ || !isNew(c->t) /* alter */) && + (!isNew(c) || !isNew(c->t) /* alter */) && (c->t->persistence == SQL_PERSIST || c->t->s) /*&& !c->t->commit_action*/) { stmt *i = stmt_bat(be, c, RD_INS, 0); stmt *u = stmt_bat(be, c, RD_UPD_ID, part); @@ -1344,11 +1343,10 @@ stmt_col( backend *be, sql_column *c, st static stmt * stmt_idx( backend *be, sql_idx *i, stmt *del, int part) { - //sql_trans *tr = be->mvc->session->tr; stmt *sc = stmt_idxbat(be, i, RDONLY, part); if (isTable(i->t) && i->t->access != TABLE_READONLY && - (!isNew(i) /*|| (i->t->s && !inTransaction(tr, i->t))*/ || !isNew(i->t)/* alter */) && + (!isNew(i) || !isNew(i->t) /* alter */) && (i->t->persistence == SQL_PERSIST || i->t->s) /*&& !i->t->commit_action*/) { stmt *ic = stmt_idxbat(be, i, RD_INS, 0); stmt *u = stmt_idxbat(be, i, RD_UPD_ID, part); @@ -4052,7 +4050,6 @@ static stmt * update_check_ukey(backend *be, stmt **updates, sql_key *k, stmt *tids, stmt *idx_updates, int updcol) { mvc *sql = be->mvc; - //sql_trans *tr = sql->session->tr; char *msg = NULL; stmt *res = NULL; @@ -4073,7 +4070,7 @@ update_check_ukey(backend *be, stmt **up This is done using a relation join and a count (which should be zero) */ - if (!isNew(k) /*|| !inTransaction(tr, k)*/) { + if (!isNew(k)) { stmt *nu_tids = stmt_tdiff(be, dels, tids, NULL); /* not updated ids */ list *lje = sa_list(sql->sa); list *rje = sa_list(sql->sa); @@ -4186,7 +4183,7 @@ update_check_ukey(backend *be, stmt **up stmt *s = NULL, *h = NULL, *o; /* s should be empty */ - if (!isNew(k) /*|| !inTransaction(tr, k)*/) { + if (!isNew(k)) { stmt *nu_tids = stmt_tdiff(be, dels, tids, NULL); /* not updated ids */ assert (updates); diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -5519,6 +5519,8 @@ sql_trans_create_trigger(sql_trans *tr, const char *nilptr = ATOMnilptr(TYPE_str); assert(name); + + t = new_table(tr, t); base_init(tr->sa, &nt->base, next_oid(tr->store), TR_NEW, name); nt->columns = list_new(tr->sa, (fdestroy) NULL); nt->t = t; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - merged
Changeset: 5d78ec199c33 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5d78ec199c33 Branch: nospare Log Message: merged diffs (truncated from 516 to 300 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -20,14 +20,18 @@ struct object_node;// TODO: rename to object_version_chain -#define id_based_rollbacked 1 -#define name_based_rollbacked (1<<1) +#define id_based_rollbacked(1) +#define name_based_rollbacked (1<<1) +#define under_destruction (1<<2) +#define under_construction (1<<3) typedef struct objectversion { bool deleted; ulng ts; bte rollbacked; + bte life_cycle; sql_base *obj; + struct objectset* os; struct objectversion*name_based_older; struct objectversion*name_based_newer; // TODO: must become atomic pointer struct object_node *name_based_chain; @@ -41,7 +45,6 @@ typedef struct object_node { struct object_node* prev; struct object_node* next; objectversion* data; - struct objectset* os; } object_node; typedef struct objectset { @@ -229,7 +232,6 @@ os_append_node_name(objectset *os, objec } else { os->name_based_h = n; } - n->os = os; n->prev = os->name_based_t; // aka the double linked list. os->name_based_t = n; if (n->data) { @@ -268,7 +270,6 @@ os_append_node_id(objectset *os, object_ } else { os->id_based_h = n; } - n->os = os; n->prev = os->id_based_t; // aka the double linked list. os->id_based_t = n; if (n->data) { @@ -301,42 +302,12 @@ os_append_id(objectset *os, objectversio static object_node* find_name(objectset *os, const char *name); static void -objectversion_destroy(sqlstore *store, objectversion *ov, ulng commit_ts, ulng oldest) +objectversion_destroy(sqlstore *store, objectset* os, objectversion *ov) { - // TODO: clean this up once the add and del functions are working - // TODO: handle name_based_cnt s and id_based_cnt s - objectversion *name_based_older = ov->name_based_older; - objectversion *name_based_newer = ov->name_based_newer; - - if (name_based_older && commit_ts) { - objectversion_destroy(store, name_based_older, commit_ts, oldest); - name_based_older = NULL; - } else if (name_based_older) { - name_based_older->name_based_newer = name_based_newer; - } - ov->name_based_older = NULL; + if (os->destroy) + os->destroy(store, ov->obj); - if (name_based_newer && commit_ts) - name_based_newer->name_based_older = NULL; - else if (name_based_newer && name_based_older) - name_based_newer->name_based_older = name_based_older; - - objectset* os = ov->name_based_chain->os; - if (!name_based_newer) { - object_node *on = NULL; - if (os->unique) - on = find_name(os, ov->obj->name); - else - on = find_id(os, ov->obj->id); - assert(on->data == ov); - if (on) - os_remove_name_based_chain(os, store, on); - if (name_based_older) - os_append_name(os, name_based_older); - } - if (ov && os && os->destroy) - os->destroy(store, ov->obj); - /* free ov */ + _DELETE(ov); } static void os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store); @@ -363,7 +334,7 @@ os_rollback_os_id_based_cascading(object } else { // this is a terminal node. i.e. this objectversion does not have id based committed history - os_remove_id_based_chain(ov->id_based_chain->os, store, ov->id_based_chain); + os_remove_id_based_chain(ov->os, store, ov->id_based_chain); } } @@ -388,7 +359,7 @@ os_rollback_os_name_based_cascading(obje } else { // this is a terminal node. i.e. this objectversion does not have name based committed history - os_remove_name_based_chain(ov->name_based_chain->os, store, ov->name_based_chain); + os_remove_name_based_chain(ov->os, store, ov->name_based_chain); } } @@ -427,46 +398,99 @@ os_rollback(objectversion *ov, sqlstore return LOG_OK; } +static void +put_under_destruction(sqlstore* store, objectversion *ov, ulng oldest) +{ + //TODO ATOMIC CAS + if (ov->life_cycle == 0) { + ov->life_cycle = under_destruction; + + if (!ov->name_based_newer) { + os_remove_name_based_chain(ov->os, store, ov->name_based_chain); + } + else { + ov->name_based_newer->na
MonetDB: nospare - Rename some struct fields.
Changeset: c7b97bee8c2a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c7b97bee8c2a Modified Files: sql/include/sql_catalog.h sql/storage/objectset.c Branch: nospare Log Message: Rename some struct fields. diffs (truncated from 711 to 300 lines): diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -223,11 +223,11 @@ typedef void *sql_store; struct sql_trans; struct sql_change; struct objectset; -struct object_node; +struct versionhead; struct os_iter { struct objectset *os; struct sql_trans *tr; - struct object_node *n; + struct versionhead *n; struct sql_hash_e *e; const char *name; }; diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -18,7 +18,7 @@ * keep hash/map of names -> objectversion */ -struct object_node;// TODO: rename to object_version_chain +struct versionhead ;// TODO: rename to object_version_chain #define id_based_rollbacked(1) #define name_based_rollbacked (1<<1) @@ -30,32 +30,32 @@ typedef struct objectversion { ulng ts; bte rollbacked; bte life_cycle; - sql_base *obj; + sql_base *b; // base of underlying sql object struct objectset* os; struct objectversion*name_based_older; struct objectversion*name_based_newer; // TODO: must become atomic pointer - struct object_node *name_based_chain; + struct versionhead *name_based_head; struct objectversion*id_based_older; struct objectversion*id_based_newer; - struct object_node *id_based_chain; + struct versionhead *id_based_head; } objectversion; -typedef struct object_node { -struct object_node* prev; -struct object_node* next; -objectversion* data; -} object_node; +typedef struct versionhead { +struct versionhead * prev; +struct versionhead * next; +objectversion* ov; +} versionhead ; typedef struct objectset { int refcnt; sql_allocator *sa; destroy_fptr destroy; MT_Lock ht_lock;/* latch protecting ht */ - object_node *name_based_h; - object_node *name_based_t; - object_node *id_based_h; - object_node *id_based_t; + versionhead *name_based_h; + versionhead *name_based_t; + versionhead *id_based_h; + versionhead *id_based_t; int name_based_cnt; int id_based_cnt; struct sql_hash *name_map; @@ -65,12 +65,12 @@ typedef struct objectset { } objectset; static int -os_id_key(object_node *n) +os_id_key(versionhead *n) { - return BATatoms[TYPE_int].atomHash(&n->data->obj->id); + return BATatoms[TYPE_int].atomHash(&n->ov->b->id); } -static object_node * +static versionhead * find_id(objectset *os, sqlid id) { if (os) { @@ -83,7 +83,7 @@ find_id(objectset *os, sqlid id) return NULL; } - for (object_node *n = os->id_based_h; n; n = n->next ) { + for (versionhead *n = os->id_based_h; n; n = n->next ) { int key = os_id_key(n); if (hash_add(os->id_map, key, n) == NULL) { @@ -97,9 +97,9 @@ find_id(objectset *os, sqlid id) sql_hash_e *he = os->id_map->buckets[key&(os->id_map->size-1)]; for (; he; he = he->chain) { - object_node *n = he->value; + versionhead *n = he->value; - if (n && n->data->obj->id == id) { + if (n && n->ov->b->id == id) { MT_lock_unset(&os->ht_lock); return n; } @@ -109,11 +109,11 @@ find_id(objectset *os, sqlid id) } MT_lock_unset(&os->ht_lock); // TODO: can we actually reach this point? - for (object_node *n = os->id_based_h; n; n = n->next) { - objectversion *ov = n->data; + for (versionhead *n = os->id_based_h; n; n = n->next) { + objectversion *ov = n->ov; /* check if ids match */ - if (id == ov->obj->id) { + if (id == ov->b->id) { return n; } } @@ -140,18 +140,18 @@ hash_delete(sql_hash *h, void *data) } static void -node_destroy(objectset *os, sqlstore *store, object_node *n) +node_destroy(objectset *os, sqlstore *store, versionhead *n) { if (!os->sa) _DELETE(n); - (void)store; /*
MonetDB: nospare - Restore 2017 All file.
Changeset: 335dc267be90 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=335dc267be90 Modified Files: sql/test/BugTracker-2017/Tests/All Branch: nospare Log Message: Restore 2017 All file. diffs (130 lines): diff --git a/sql/test/BugTracker-2017/Tests/All b/sql/test/BugTracker-2017/Tests/All --- a/sql/test/BugTracker-2017/Tests/All +++ b/sql/test/BugTracker-2017/Tests/All @@ -1,4 +1,125 @@ - +# keep drop_system_schema.Bug-6437 as first test as it appears that the behavior is different (wrong) when it is the first test or not +drop_system_schema.Bug-6437 +check_system_schema.Bug-6437 +unknown_col_in_order_by.Bug-3535 +extract_quarter_week_from_date.Bug-3831 +KNOWNFAIL?insert_self_ref_FK.Bug-6131 +shutdown.Bug-6182 +avggroupbysq.Bug-6178 +semijoinunion.Bug-6150 +HAVE_LIBZ?heapextend.Bug-6134 +incorrect_error.Bug-6141 +empty-interval.Bug-6184 +crash_in_null_cast.Bug-6186 +drop_not_null_on_pkey.Bug-6189 +too-large-decimals.Bug-6192 +splitpart.Bug-6194 +HAVE_HGE?cast-with-many-decimals.Bug-6195 +union_func_crash.Bug-6196 +complicated_logic.Bug-105 +crash_on_count_div_count.Bug-6201 +oidx-on-strings.Bug-6202 +group-by-on-constant.Bug-6082 +rel2bin_project-assert.Bug-6080 +str2decimal.Bug-6206 +integer_addition_overflow.Bug-6205 +dce_bug-6177 +default-insert-update.Bug-6249 +crash_on_NULL_ptr.Bug-6130 +sqlsmith01 +HAVE_GEOM&HAVE_NETCDF?sqlsmith02 +HAVE_GEOM?sqlsmith03 +sqlsmith04 +nested_with.Bug-6187 +prepare.Bug-6133 +null-quantile.Bug-6218 +sqlsmith.Bug-6216 +sqlsmith.Bug-6217 +real-power.Bug-6228 +sqlsmith.Bug-6219 +create_view_order_by.Bug-3465 +cast_boolean_to_string.Bug-6110 +modulo.Bug-6225 +one-plus-nil.Bug-6243 +with-alias-bug.6246 +crash_after_oidx_on_sys_statistics.Bug-6251 +crash_correlated_subqueries_in_select.Bug-6254 +fullouterjoinfilter.Bug-6256 +wrong_aggregation_count.Bug-6257 +select.Bug-6259 +function_and_mergetable.Bug-6288 +crash_in_in_handling.Bug-6260 +crash_correlated_subqueries_not_in_select.Bug-6290 +crash_function_returning_sample.Bug-6291 +nestedoperators.Bug-6292 +not_plus.Bug-6294 distinct_minus_count_distinct.Bug-6296 +all_minus_count_star.Bug-6297 lateral.Bug-6310 limit_clause.Bug-6312 +type-resolution-error.Bugs-6313 +lateral02.Bug-6314 +exist-bigint-missing.Bug-6315 +coalesc-limit.Bug-6316 +limit.Bug-6322 +simplify_math.Bug-6324 +push_subslice.Bug-6322 +create_table_as-missing_not_null.Bug-6329 +crash-dce.Bug-6330 +delete_from_merge_table.Bug-3743 +statistics_nils_not_eq_zero.Bug-6331 +crash-select_after_MAL_error.Bug-6332 +handle-values-subqueries.Bug-6336 +groupby_assertion.Bug-6338 +spurious_error.Bug-6344 +caching_stats_bug.6374 +name-interference.Bug-6348 +parsererror.Bug-6381 +HAVE_LIBPY3?aggr_udf_with_more_than_2params.Bug-6385 +exists.Bug-6392 +case.Bug-6386 +sqllitelogistest_case.Bug-6335 +udf_crash_subquery_scalar_paramters.Bug-6399 +side-effect.Bug-6397 +copy_into_crash.Bug-6404 +null_matches_in_outer.Bug-6398 +corr_coersion.Bug-6287 +sqlitelogictest-having-with-not-in.Bug-6409 +sqlitelogictest-having-with-in.Bug-6410 +sqlitelogictest-aggregation-distinct.Bug-6411 +sqlitelogictest-aggregation-not-in.Bug-6416 +sqlsmith-semijoin-constant.bug-6417 +sqlsmith.Bug-6418 +sqlsmith.Bug-6423 +sqlsmith.Bug-6424 +sqlsmith.Bug-6425 +double-groupby-column.Bug-6207 +sqlitelogictest-aggregation-having-avg.Bug-6428 +sqlitelogictest-aggregation-distinct-coalesce.Bug-6431 +sqlsmith.Bug-6432 +sqlitelogictest-select-in.Bug-6433 +sqlitelogictest-select-not-in.Bug-6435 +drop_schema_restrict.Bug-6438 +date-arithmetic.Bug-6415 +sqlitelogictest-cast-decimal.Bug-6445 +HAVE_LIBPY3?table_returning_with.Bug-6444 +insert_into_multiple_subqueries.Bug-6448 +sqlsmith.Bug-6449 +HAVE_LIBPY3?python_loader_clobbers_default_with_null.Bug-6464 +skip_problem_best_effort.Bug-6442 +date_to_str.Bug-6467 +cleanup_statistics.Bug-6439 +update_on_procedure.Bug-6479 +sqlsmith.Bug-6477 +crash-in-topn.Bug-6478 +function-resolution.Bug-6436 +generate-resolution.Bug-6471 +sqlitelogictest-select-in-column.Bug-6490 +select-in-returns-null.Bug-6491 +sqlitelogictest-min-distinct-empty-table.Bug-6493 +sqlitelogictest-algebra-operators.Bug-6494 +sqlitelogictest-hidden-alias.Bug-6495 +sqlitelogictest-comparisons-between-floating-points-and-NULL.Bug-6496 +sqlitelogictest-not-between.Bug-6497 +createorreplace-system-func.Bug-6499 +crash-on-limit-rename.Bug-6502 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Fix for rtrim bug. At rel2bin_semijoin, equal...
Changeset: bae3c5ac6652 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bae3c5ac6652 Modified Files: sql/backends/monet5/rel_bin.c sql/test/bugs/Tests/rtrim_bug.stable.out Branch: Oct2020 Log Message: Fix for rtrim bug. At rel2bin_semijoin, equality expressions with function calls require materialization of the left relation diffs (46 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2516,6 +2516,8 @@ rel2bin_antijoin(backend *be, sql_rel *r return stmt_list(be, l); } +#define complex_join_expression(e) (exp_has_func(e) && (e)->flag != cmp_filter) || (e)->flag == cmp_or || ((e)->f && (e)->anti) + static stmt * rel2bin_semijoin(backend *be, sql_rel *rel, list *refs) { @@ -2560,10 +2562,8 @@ rel2bin_semijoin(backend *be, sql_rel *r int idx = 0, equality_only = 1; jexps = get_equi_joins_first(sql, jexps, &equality_only); - if (!equality_only || list_length(jexps) > 1) { + if (!equality_only || list_length(jexps) > 1 || complex_join_expression((sql_exp*)jexps->h->data)) left = subrel_project(be, left, refs, rel->l); - equality_only = 0; - } right = subrel_project(be, right, refs, rel->r); for( en = jexps->h; en; en = en->next ) { @@ -2572,8 +2572,7 @@ rel2bin_semijoin(backend *be, sql_rel *r stmt *s = NULL; /* only handle simple joins here */ - if ((exp_has_func(e) && e->flag != cmp_filter) || - e->flag == cmp_or || (e->f && e->anti)) { + if (complex_join_expression(e)) { if (!join && !list_length(lje)) { stmt *l = bin_first_column(be, left); stmt *r = bin_first_column(be, right); diff --git a/sql/test/bugs/Tests/rtrim_bug.stable.out b/sql/test/bugs/Tests/rtrim_bug.stable.out --- a/sql/test/bugs/Tests/rtrim_bug.stable.out +++ b/sql/test/bugs/Tests/rtrim_bug.stable.out @@ -47,7 +47,7 @@ stdout of test 'rtrim_bug` in directory % sys.,sys. # table_name % data_length, data_value # name % int, varchar # type -% 1, 1 # length +% 1, 0 # length #DROP VIEW v1; #DROP VIEW v2; #DROP TABLE t1; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Approve.
Changeset: 222fe5c89560 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=222fe5c89560 Modified Files: clients/Tests/MAL-signatures.stable.out.int128 Branch: Oct2020 Log Message: Approve. diffs (13 lines): diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -8150,8 +8150,8 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "rsh_noerror", "pattern batcalc.rsh_noerror(X_1:sht, X_2:bat[:sht], X_3:bat[:oid]):bat[:sht] ","CMDbatRSH;", "" ] [ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:bte], X_3:bat[:oid], X_4:int, X_5:int):bat[:lng] ", "bte_batdec2second_interval;", "" ] [ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:bte], X_3:int, X_4:int):bat[:lng] ", "bte_batdec2second_interval;", "" ] -[ "batcalc", "second_interval", "command batcalc.second_interval(X_1:int, X_2:bat[:hge], X_3:int, X_4:int):bat[:lng] ", "hge_batdec2second_interval;", "" ] [ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:hge], X_3:bat[:oid], X_4:int, X_5:int):bat[:lng] ", "hge_batdec2second_interval;", "" ] +[ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:hge], X_3:int, X_4:int):bat[:lng] ", "hge_batdec2second_interval;", "" ] [ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:int], X_3:bat[:oid], X_4:int, X_5:int):bat[:lng] ", "int_batdec2second_interval;", "" ] [ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:int], X_3:int, X_4:int):bat[:lng] ", "int_batdec2second_interval;", "" ] [ "batcalc", "second_interval", "pattern batcalc.second_interval(X_1:int, X_2:bat[:lng], X_3:bat[:oid], X_4:int, X_5:int):bat[:lng] ", "lng_batdec2second_interval;", "" ] ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Fixes so that new code can be run for old (ex...
Changeset: 4970ce7b1c1d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4970ce7b1c1d Modified Files: testing/exportutils.py testing/listexports.py.in testing/melcheck.py Branch: Oct2020 Log Message: Fixes so that new code can be run for old (exports) test. diffs (110 lines): diff --git a/testing/exportutils.py b/testing/exportutils.py --- a/testing/exportutils.py +++ b/testing/exportutils.py @@ -17,7 +17,7 @@ inclre = re.compile(r'\s*#\s*include\s+" # comments (/* ... */ where ... is as short as possible) cmtre = re.compile(r'/\*[^*]*(\*(?=[^/])[^*]*)*\*/|//.*') # horizontal white space -spcre = re.compile(r'[ \t]+') +horspcre = re.compile(r'[ \t]+') # identifier identre = re.compile(r'\b(?P[a-zA-Z_]\w*)\b') # undef @@ -79,12 +79,12 @@ def process(line, funmac, macros, infunm nline += line[pos:] return nline -def readfile(f, funmac=None, macros=None, files=None, printdef=False): +def readfile(f, funmac=None, macros=None, files=None, printdef=False, include=False): data = open(f).read() dirname, f = os.path.split(f) data = cmtre.sub(' ', data) data = data.replace('\\\n', '') -data = spcre.sub(' ', data) +data = horspcre.sub(' ', data) data = data.splitlines() if funmac is None: funmac = {} @@ -110,7 +110,7 @@ def readfile(f, funmac=None, macros=None if elifre.match(line) or elsere.match(line): if printdef: ndata.append(line) -if skip: +if include and skip: skip[-1] = True continue if skip and skip[-1]: @@ -130,13 +130,14 @@ def readfile(f, funmac=None, macros=None args = () # empty argument list funmac[name] = (args, repl) continue -macros[name] = repl +if include: +macros[name] = repl continue res = inclre.match(line) if res is not None: fn = res.group('file') -if '/' not in fn and os.path.exists(os.path.join(dirname, fn)) and fn not in files: -incdata = readfile(os.path.join(dirname, fn), funmac, macros, files, printdef) +if include and '/' not in fn and os.path.exists(os.path.join(dirname, fn)) and fn not in files: +incdata = readfile(os.path.join(dirname, fn), funmac, macros, files, printdef, include) ndata.extend(incdata) continue ndata.append(line) @@ -154,8 +155,13 @@ def readfile(f, funmac=None, macros=None files.remove(f) return ndata -def preprocess(f, printdef=False): -return '\n'.join(readfile(f, printdef=printdef)) +def preprocess(f, printdef=False, include=True): +return '\n'.join(readfile(f, printdef=printdef, include=include)) + +# some regexps helping to normalize a declaration +spcre = re.compile(r'\s+') +strre = re.compile(r'([^ *])\*') +comre = re.compile(r',\s*') def normalize(decl): decl = spcre.sub(' ', decl) \ @@ -175,4 +181,4 @@ def normalize(decl): if __name__ == '__main__': import sys for f in sys.argv[1:]: -print(preprocess(f, printdef=True)) +print(preprocess(f, printdef=False)) diff --git a/testing/listexports.py.in b/testing/listexports.py.in --- a/testing/listexports.py.in +++ b/testing/listexports.py.in @@ -38,7 +38,7 @@ nmere = re.compile(r'\b(?P[a-zA-Z_ def extract(f): decls = [] -data = exportutils.preprocess(f) +data = exportutils.preprocess(f, include=False) res = expre.search(data) while res is not None: @@ -81,8 +81,7 @@ def findfiles(dirlist, skipfiles = [], s decls.extend(extract(os.path.join(root, f))) done[f] = True decls.sort() -names, decls = list(zip(*decls)) -return decls +return [decl for name, decl in decls] def main(): for lib in libs: diff --git a/testing/melcheck.py b/testing/melcheck.py --- a/testing/melcheck.py +++ b/testing/melcheck.py @@ -76,7 +76,7 @@ def checkcommand(imp, mod, fcn, decl, re cpos = cres.end(0) def process1(f): -data = exportutils.preprocess(f) +data = exportutils.preprocess(f, include=True) pats = {} cmds = {} res = fcnre.search(data) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - approved output
Changeset: 8aa5a6885aa6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8aa5a6885aa6 Modified Files: sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.test Branch: nospare Log Message: approved output diffs (21 lines): diff --git a/sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.test b/sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.test --- a/sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.test +++ b/sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.test @@ -15,7 +15,7 @@ select name, func, "mod", language, "typ mycounter1 create function mycounter1()@returns integer@begin@ declare s int;@ while (true)@ do@ set s =1;@ end while;@ return s;@end@; -user +sql 2 1 False @@ -37,7 +37,7 @@ select name, func, "mod", language, "typ mycounter2 create function mycounter2()@returns integer@begin@ declare s int;@ while (select true)@ do@ set s =1;@ end while;@ return s;@end@; -user +sql 2 1 False ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - approved output
Changeset: 07ede2490e4e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=07ede2490e4e Modified Files: sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test Branch: nospare Log Message: approved output diffs (19 lines): diff --git a/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test b/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test --- a/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test +++ b/sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test @@ -26,12 +26,12 @@ user.main 1 querylog.define 1 -bat.pack -5 -user.my_generate_series +sql.my_generate_series 2 aggr.count 2 +bat.pack +5 bat.single 2 algebra.crossproduct ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with Oct2020 branch.
Changeset: bbf76460ea5d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bbf76460ea5d Modified Files: clients/Tests/MAL-signatures.stable.out.int128 sql/backends/monet5/rel_bin.c testing/listexports.py.in Branch: default Log Message: Merge with Oct2020 branch. diffs (156 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2519,6 +2519,8 @@ rel2bin_antijoin(backend *be, sql_rel *r return stmt_list(be, l); } +#define complex_join_expression(e) (exp_has_func(e) && (e)->flag != cmp_filter) || (e)->flag == cmp_or || ((e)->f && (e)->anti) + static stmt * rel2bin_semijoin(backend *be, sql_rel *rel, list *refs) { @@ -2563,10 +2565,8 @@ rel2bin_semijoin(backend *be, sql_rel *r int idx = 0, equality_only = 1; jexps = get_equi_joins_first(sql, jexps, &equality_only); - if (!equality_only || list_length(jexps) > 1) { + if (!equality_only || list_length(jexps) > 1 || complex_join_expression((sql_exp*)jexps->h->data)) left = subrel_project(be, left, refs, rel->l); - equality_only = 0; - } right = subrel_project(be, right, refs, rel->r); for( en = jexps->h; en; en = en->next ) { @@ -2575,8 +2575,7 @@ rel2bin_semijoin(backend *be, sql_rel *r stmt *s = NULL; /* only handle simple joins here */ - if ((exp_has_func(e) && e->flag != cmp_filter) || - e->flag == cmp_or || (e->f && e->anti)) { + if (complex_join_expression(e)) { if (!join && !list_length(lje)) { stmt *l = bin_first_column(be, left); stmt *r = bin_first_column(be, right); diff --git a/sql/test/bugs/Tests/rtrim_bug.stable.out b/sql/test/bugs/Tests/rtrim_bug.stable.out --- a/sql/test/bugs/Tests/rtrim_bug.stable.out +++ b/sql/test/bugs/Tests/rtrim_bug.stable.out @@ -47,7 +47,7 @@ stdout of test 'rtrim_bug` in directory % sys.,sys. # table_name % data_length, data_value # name % int, varchar # type -% 1, 1 # length +% 1, 0 # length #DROP VIEW v1; #DROP VIEW v2; #DROP TABLE t1; diff --git a/testing/exportutils.py b/testing/exportutils.py --- a/testing/exportutils.py +++ b/testing/exportutils.py @@ -17,7 +17,7 @@ inclre = re.compile(r'\s*#\s*include\s+" # comments (/* ... */ where ... is as short as possible) cmtre = re.compile(r'/\*[^*]*(\*(?=[^/])[^*]*)*\*/|//.*') # horizontal white space -spcre = re.compile(r'[ \t]+') +horspcre = re.compile(r'[ \t]+') # identifier identre = re.compile(r'\b(?P[a-zA-Z_]\w*)\b') # undef @@ -79,12 +79,12 @@ def process(line, funmac, macros, infunm nline += line[pos:] return nline -def readfile(f, funmac=None, macros=None, files=None, printdef=False): +def readfile(f, funmac=None, macros=None, files=None, printdef=False, include=False): data = open(f).read() dirname, f = os.path.split(f) data = cmtre.sub(' ', data) data = data.replace('\\\n', '') -data = spcre.sub(' ', data) +data = horspcre.sub(' ', data) data = data.splitlines() if funmac is None: funmac = {} @@ -110,7 +110,7 @@ def readfile(f, funmac=None, macros=None if elifre.match(line) or elsere.match(line): if printdef: ndata.append(line) -if skip: +if include and skip: skip[-1] = True continue if skip and skip[-1]: @@ -130,13 +130,14 @@ def readfile(f, funmac=None, macros=None args = () # empty argument list funmac[name] = (args, repl) continue -macros[name] = repl +if include: +macros[name] = repl continue res = inclre.match(line) if res is not None: fn = res.group('file') -if '/' not in fn and os.path.exists(os.path.join(dirname, fn)) and fn not in files: -incdata = readfile(os.path.join(dirname, fn), funmac, macros, files, printdef) +if include and '/' not in fn and os.path.exists(os.path.join(dirname, fn)) and fn not in files: +incdata = readfile(os.path.join(dirname, fn), funmac, macros, files, printdef, include) ndata.extend(incdata) continue ndata.append(line) @@ -154,8 +155,13 @@ def readfile(f, funmac=None, macros=None files.remove(f) return ndata -def preprocess(f, printdef=False): -return '\n'.join(readfile(f, printdef=printdef)) +d
MonetDB: nospare - Merge rollbacked and life_cycle into single '...
Changeset: 3413fd39af2b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3413fd39af2b Modified Files: sql/storage/objectset.c Branch: nospare Log Message: Merge rollbacked and life_cycle into single 'state' flag holder. diffs (233 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -20,16 +20,16 @@ struct versionhead ;// TODO: rename to object_version_chain +#define active (0) #define id_based_rollbacked(1) #define name_based_rollbacked (1<<1) -#define under_destruction (1<<2) -#define under_construction (1<<3) +#define under_destruction (id_based_rollbacked | name_based_rollbacked) +#define under_resurrection (1<<3) typedef struct objectversion { bool deleted; ulng ts; - bte rollbacked; - bte life_cycle; + bte state; sql_base *b; // base of underlying sql object struct objectset* os; struct objectversion*name_based_older; @@ -315,7 +315,10 @@ static void os_rollback_name_based_termi static void os_rollback_os_id_based_cascading(objectversion *ov, sqlstore *store) { - assert(ov->rollbacked & id_based_rollbacked); + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + assert(state & id_based_rollbacked); if (ov->id_based_older) { if (ov->id_based_older->ts < TRANSACTION_ID_BASE) { @@ -326,9 +329,15 @@ os_rollback_os_id_based_cascading(object } else { os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store); + // TODO ATOMIC GET + state = ov->id_based_older->state; + + state |= id_based_rollbacked; + //TODO ATOMIC SET + ov->id_based_older->state = state; + // END ATOMIC SET // id based cascaded rollback along the parents - ov->id_based_older->rollbacked |= id_based_rollbacked; os_rollback_os_id_based_cascading(ov->id_based_older, store); } } @@ -340,7 +349,10 @@ os_rollback_os_id_based_cascading(object static void os_rollback_os_name_based_cascading(objectversion *ov, sqlstore *store) { - assert(ov->rollbacked & name_based_rollbacked); + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + assert(state & name_based_rollbacked); if (ov->name_based_older) { if (ov->name_based_older->ts < TRANSACTION_ID_BASE) { @@ -351,9 +363,15 @@ os_rollback_os_name_based_cascading(obje } else { os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store); + // TODO ATOMIC GET + state = ov->name_based_older->state; + + state |= name_based_rollbacked; + //TODO ATOMIC SET + ov->name_based_older->state = state; + // END ATOMIC SET // name based cascaded rollback along the parents - ov->name_based_older->rollbacked |= name_based_rollbacked; os_rollback_os_name_based_cascading(ov->name_based_older, store); } } @@ -365,24 +383,39 @@ os_rollback_os_name_based_cascading(obje static void os_rollback_name_based_terminal_decendant(objectversion *ov, sqlstore *store) { - if (ov->rollbacked & name_based_rollbacked) { + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + + if (state & name_based_rollbacked) { return; } - ov->rollbacked |= name_based_rollbacked; + state |= name_based_rollbacked; + + //TODO ATOMIC SET + ov->state = state; + // END ATOMIC SET os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store); os_rollback_os_name_based_cascading(ov, store); - } static void os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store) { - if (ov->rollbacked & id_based_rollbacked) { + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + + if (state & id_based_rollbacked) { return; } - ov->rollbacked |= id_based_rollbacked; + state |= id_based_rollbacked; + + //TODO ATOMIC SET + ov->state = state; + // END ATOMIC SET os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store); os_rollback_os_id_based_cascading(ov, store); @@ -402,8 +435,8 @@ static void put_under_destruction(sqlstore* store, objectversion *ov, ulng oldest) { //TODO ATOMIC C
MonetDB: Oct2020 - Undo my previous sqlancer fixes. Fixed regres...
Changeset: 08124a306ac1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=08124a306ac1 Modified Files: sql/backends/monet5/rel_bin.c sql/server/rel_optimizer.c sql/test/bugs/Tests/rtrim_bug.sql sql/test/bugs/Tests/rtrim_bug.stable.out sql/test/miscellaneous/Tests/simple_plans.stable.out Branch: Oct2020 Log Message: Undo my previous sqlancer fixes. Fixed regression for semijoin by disabling can_push_func on projections for now diffs (187 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2516,8 +2516,6 @@ rel2bin_antijoin(backend *be, sql_rel *r return stmt_list(be, l); } -#define complex_join_expression(e) (exp_has_func(e) && (e)->flag != cmp_filter) || (e)->flag == cmp_or || ((e)->f && (e)->anti) - static stmt * rel2bin_semijoin(backend *be, sql_rel *rel, list *refs) { @@ -2562,7 +2560,7 @@ rel2bin_semijoin(backend *be, sql_rel *r int idx = 0, equality_only = 1; jexps = get_equi_joins_first(sql, jexps, &equality_only); - if (!equality_only || list_length(jexps) > 1 || complex_join_expression((sql_exp*)jexps->h->data)) + if (!equality_only || list_length(jexps) > 1 || exp_has_func((sql_exp*)jexps->h->data)) left = subrel_project(be, left, refs, rel->l); right = subrel_project(be, right, refs, rel->r); @@ -2572,7 +2570,7 @@ rel2bin_semijoin(backend *be, sql_rel *r stmt *s = NULL; /* only handle simple joins here */ - if (complex_join_expression(e)) { + if ((exp_has_func(e) && e->flag != cmp_filter) || e->flag == cmp_or || (e->f && e->anti)) { if (!join && !list_length(lje)) { stmt *l = bin_first_column(be, left); stmt *r = bin_first_column(be, right); diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1350,16 +1350,16 @@ can_push_func(sql_exp *e, sql_rel *rel, { switch(e->type) { case e_cmp: { + int mustl = 0, mustr = 0, mustf = 0; sql_exp *l = e->l, *r = e->r, *f = e->f; - int res = 1, lmust = 0; - - if (e->flag == cmp_or || e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter) + + if (is_project(rel->op) || e->flag == cmp_or || e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter) return 0; - res = can_push_func(l, rel, &lmust) && can_push_func(r, rel, &lmust) && (!f || can_push_func(f, rel, &lmust)); - if (res && !lmust) - return 1; - (*must) |= lmust; - return res; + return ((l->type == e_column || can_push_func(l, rel, &mustl)) && (*must = mustl)) || + (!f && (r->type == e_column || can_push_func(r, rel, &mustr)) && (*must = mustr)) || + (f && + (r->type == e_column || can_push_func(r, rel, &mustr)) && + (f->type == e_column || can_push_func(f, rel, &mustf)) && (*must = (mustr || mustf))); } case e_convert: return can_push_func(e->l, rel, must); @@ -1378,8 +1378,7 @@ can_push_func(sql_exp *e, sql_rel *rel, return res; } case e_column: -/* aliases cannot be bound on the same level, ie same projection */ - if ((exp_name(e) && !has_label(e)) || (rel && !rel_find_exp(rel, e))) + if (rel && !rel_find_exp(rel, e)) return 0; (*must) = 1; /* fall through */ diff --git a/sql/test/bugs/Tests/rtrim_bug.sql b/sql/test/bugs/Tests/rtrim_bug.sql --- a/sql/test/bugs/Tests/rtrim_bug.sql +++ b/sql/test/bugs/Tests/rtrim_bug.sql @@ -12,6 +12,24 @@ SELECT length("m") as data_length, "m" a CREATE VIEW v2 as select "m" from t1 where rtrim(m) in (select rtrim(m) from sys.t1); SELECT * FROM v2; + +PLAN SELECT length("m") as data_length, "m" as data_value FROM "sys"."v2" WHERE "m" IS NOT NULL AND length("m") > 1; + +set optimizer = 'sequential_pipe'; +create procedure profiler.starttrace() external name profiler."starttrace"; +create procedure profiler.stoptrace() external name profiler.stoptrace; + +call profiler."starttrace"(); +SELECT length("m") as data_length, "m" as data_value FROM "sys"."v2" WHERE "m" IS NOT NULL AND length("m") > 1; +call profiler.stoptrace(); + +select count(*) from sys.tracelog() where stmt like '% algebra.c
MonetDB: default - Merged with Oct2020 and converted tests
Changeset: 43ad3ab454ad for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=43ad3ab454ad Added Files: sql/test/bugs/Tests/rtrim_bug.test Modified Files: sql/backends/monet5/rel_bin.c sql/server/rel_optimizer.c sql/test/miscellaneous/Tests/simple_plans.stable.out sql/test/miscellaneous/Tests/simple_selects.test Branch: default Log Message: Merged with Oct2020 and converted tests diffs (294 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2519,8 +2519,6 @@ rel2bin_antijoin(backend *be, sql_rel *r return stmt_list(be, l); } -#define complex_join_expression(e) (exp_has_func(e) && (e)->flag != cmp_filter) || (e)->flag == cmp_or || ((e)->f && (e)->anti) - static stmt * rel2bin_semijoin(backend *be, sql_rel *rel, list *refs) { @@ -2565,7 +2563,7 @@ rel2bin_semijoin(backend *be, sql_rel *r int idx = 0, equality_only = 1; jexps = get_equi_joins_first(sql, jexps, &equality_only); - if (!equality_only || list_length(jexps) > 1 || complex_join_expression((sql_exp*)jexps->h->data)) + if (!equality_only || list_length(jexps) > 1 || exp_has_func((sql_exp*)jexps->h->data)) left = subrel_project(be, left, refs, rel->l); right = subrel_project(be, right, refs, rel->r); @@ -2575,7 +2573,7 @@ rel2bin_semijoin(backend *be, sql_rel *r stmt *s = NULL; /* only handle simple joins here */ - if (complex_join_expression(e)) { + if ((exp_has_func(e) && e->flag != cmp_filter) || e->flag == cmp_or || (e->f && e->anti)) { if (!join && !list_length(lje)) { stmt *l = bin_first_column(be, left); stmt *r = bin_first_column(be, right); diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1350,16 +1350,16 @@ can_push_func(sql_exp *e, sql_rel *rel, { switch(e->type) { case e_cmp: { + int mustl = 0, mustr = 0, mustf = 0; sql_exp *l = e->l, *r = e->r, *f = e->f; - int res = 1, lmust = 0; - - if (e->flag == cmp_or || e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter) + + if (is_project(rel->op) || e->flag == cmp_or || e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter) return 0; - res = can_push_func(l, rel, &lmust) && can_push_func(r, rel, &lmust) && (!f || can_push_func(f, rel, &lmust)); - if (res && !lmust) - return 1; - (*must) |= lmust; - return res; + return ((l->type == e_column || can_push_func(l, rel, &mustl)) && (*must = mustl)) || + (!f && (r->type == e_column || can_push_func(r, rel, &mustr)) && (*must = mustr)) || + (f && + (r->type == e_column || can_push_func(r, rel, &mustr)) && + (f->type == e_column || can_push_func(f, rel, &mustf)) && (*must = (mustr || mustf))); } case e_convert: return can_push_func(e->l, rel, must); @@ -1378,8 +1378,7 @@ can_push_func(sql_exp *e, sql_rel *rel, return res; } case e_column: -/* aliases cannot be bound on the same level, ie same projection */ - if ((exp_name(e) && !has_label(e)) || (rel && !rel_find_exp(rel, e))) + if (rel && !rel_find_exp(rel, e)) return 0; (*must) = 1; /* fall through */ diff --git a/sql/test/bugs/Tests/rtrim_bug.sql b/sql/test/bugs/Tests/rtrim_bug.sql --- a/sql/test/bugs/Tests/rtrim_bug.sql +++ b/sql/test/bugs/Tests/rtrim_bug.sql @@ -12,6 +12,24 @@ SELECT length("m") as data_length, "m" a CREATE VIEW v2 as select "m" from t1 where rtrim(m) in (select rtrim(m) from sys.t1); SELECT * FROM v2; + +PLAN SELECT length("m") as data_length, "m" as data_value FROM "sys"."v2" WHERE "m" IS NOT NULL AND length("m") > 1; + +set optimizer = 'sequential_pipe'; +create procedure profiler.starttrace() external name profiler."starttrace"; +create procedure profiler.stoptrace() external name profiler.stoptrace; + +call profiler."starttrace"(); +SELECT length("m") as data_length, "m" as data_value FROM "sys"."v2" WHERE "m" IS NOT NULL AND length("m") > 1; +call profiler.stoptrace(); + +select count(*) from sys.tracelog() where stmt like '% algebra.crossproduct%'; -- don't do crossjoin +select count(
MonetDB: nospare - make sure we handle more modules when rewriti...
Changeset: f23931a92851 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f23931a92851 Modified Files: monetdb5/optimizer/opt_inline.c monetdb5/optimizer/opt_remap.c Branch: nospare Log Message: make sure we handle more modules when rewriting multiplex functions diffs (52 lines): diff --git a/monetdb5/optimizer/opt_inline.c b/monetdb5/optimizer/opt_inline.c --- a/monetdb5/optimizer/opt_inline.c +++ b/monetdb5/optimizer/opt_inline.c @@ -29,9 +29,10 @@ static bool OPTinlineMultiplex(Client cn Symbol s; str mod,fcn; - mod = VALget(&getVar(mb, getArg(p, 1))->value); - fcn = VALget(&getVar(mb, getArg(p, 2))->value); - if( (s= findSymbol(cntxt->usermodule, mod,fcn)) ==0 ) + mod = VALget(&getVar(mb, getArg(p, p->retc+0))->value); + fcn = VALget(&getVar(mb, getArg(p, p->retc+1))->value); + //if( (s= findSymbol(cntxt->usermodule, mod,fcn)) ==0 ) + if( (s= findSymbolInModule(getModule(putName(mod)), putName(fcn))) ==0 ) return false; if (s->def == mb) /* avoid infinite recursion */ return false; diff --git a/monetdb5/optimizer/opt_remap.c b/monetdb5/optimizer/opt_remap.c --- a/monetdb5/optimizer/opt_remap.c +++ b/monetdb5/optimizer/opt_remap.c @@ -115,13 +115,13 @@ OPTmultiplexInline(Client cntxt, MalBlkP int i,j,k,m, actions=0; int refbat=0, retc = p->retc; bit *upgrade; - Symbol s; str msg; - s= findSymbol(cntxt->usermodule, - VALget(&getVar(mb, getArg(p, retc+0))->value), - VALget(&getVar(mb, getArg(p, retc+1))->value)); + str mod = VALget(&getVar(mb, getArg(p, retc+0))->value); + str fcn = VALget(&getVar(mb, getArg(p, retc+1))->value); + //Symbol s = findSymbol(cntxt->usermodule, mod,fcn); + Symbol s = findSymbolInModule(getModule(putName(mod)), putName(fcn)); if( s== NULL || !isSideEffectFree(s->def) || getInstrPtr(s->def,0)->retc != p->retc ) { @@ -396,9 +396,10 @@ OPTremapImplementation(Client cntxt, Mal * such as the calculator functions. It is particularly * geared at handling the PSM code. */ - str mod = VALget(&getVar(mb, getArg(p, 1))->value); - str fcn = VALget(&getVar(mb, getArg(p, 2))->value); - Symbol s = findSymbol(cntxt->usermodule, mod,fcn); + str mod = VALget(&getVar(mb, getArg(p, p->retc+0))->value); + str fcn = VALget(&getVar(mb, getArg(p, p->retc+1))->value); + //Symbol s = findSymbol(cntxt->usermodule, mod,fcn); + Symbol s = findSymbolInModule(getModule(putName(mod)),putName(fcn)); if (s && s->def->inlineProp ){ pushInstruction(mb, p); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - make sure we don't log indices without storage
Changeset: 3ccb783f1632 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3ccb783f1632 Modified Files: sql/storage/bat/bat_storage.c Branch: nospare Log Message: make sure we don't log indices without storage diffs (13 lines): diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -1863,7 +1863,8 @@ log_create_del(sql_trans *tr, sql_change for(node *n = t->idxs.set->h; n && ok == LOG_OK; n = n->next) { sql_idx *i = n->data; - ok = log_create_idx_(tr, i); + if (i->data) + ok = log_create_idx_(tr, i); } } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - merged
Changeset: 066e5323f660 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=066e5323f660 Branch: nospare Log Message: merged diffs (233 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -20,16 +20,16 @@ struct versionhead ;// TODO: rename to object_version_chain +#define active (0) #define id_based_rollbacked(1) #define name_based_rollbacked (1<<1) -#define under_destruction (1<<2) -#define under_construction (1<<3) +#define under_destruction (id_based_rollbacked | name_based_rollbacked) +#define under_resurrection (1<<3) typedef struct objectversion { bool deleted; ulng ts; - bte rollbacked; - bte life_cycle; + bte state; sql_base *b; // base of underlying sql object struct objectset* os; struct objectversion*name_based_older; @@ -315,7 +315,10 @@ static void os_rollback_name_based_termi static void os_rollback_os_id_based_cascading(objectversion *ov, sqlstore *store) { - assert(ov->rollbacked & id_based_rollbacked); + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + assert(state & id_based_rollbacked); if (ov->id_based_older) { if (ov->id_based_older->ts < TRANSACTION_ID_BASE) { @@ -326,9 +329,15 @@ os_rollback_os_id_based_cascading(object } else { os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store); + // TODO ATOMIC GET + state = ov->id_based_older->state; + + state |= id_based_rollbacked; + //TODO ATOMIC SET + ov->id_based_older->state = state; + // END ATOMIC SET // id based cascaded rollback along the parents - ov->id_based_older->rollbacked |= id_based_rollbacked; os_rollback_os_id_based_cascading(ov->id_based_older, store); } } @@ -340,7 +349,10 @@ os_rollback_os_id_based_cascading(object static void os_rollback_os_name_based_cascading(objectversion *ov, sqlstore *store) { - assert(ov->rollbacked & name_based_rollbacked); + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + assert(state & name_based_rollbacked); if (ov->name_based_older) { if (ov->name_based_older->ts < TRANSACTION_ID_BASE) { @@ -351,9 +363,15 @@ os_rollback_os_name_based_cascading(obje } else { os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store); + // TODO ATOMIC GET + state = ov->name_based_older->state; + + state |= name_based_rollbacked; + //TODO ATOMIC SET + ov->name_based_older->state = state; + // END ATOMIC SET // name based cascaded rollback along the parents - ov->name_based_older->rollbacked |= name_based_rollbacked; os_rollback_os_name_based_cascading(ov->name_based_older, store); } } @@ -365,24 +383,39 @@ os_rollback_os_name_based_cascading(obje static void os_rollback_name_based_terminal_decendant(objectversion *ov, sqlstore *store) { - if (ov->rollbacked & name_based_rollbacked) { + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + + if (state & name_based_rollbacked) { return; } - ov->rollbacked |= name_based_rollbacked; + state |= name_based_rollbacked; + + //TODO ATOMIC SET + ov->state = state; + // END ATOMIC SET os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store); os_rollback_os_name_based_cascading(ov, store); - } static void os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store) { - if (ov->rollbacked & id_based_rollbacked) { + // TODO ATOMIC GET + bte state = ov->state; + // END ATOMIC GET + + if (state & id_based_rollbacked) { return; } - ov->rollbacked |= id_based_rollbacked; + state |= id_based_rollbacked; + + //TODO ATOMIC SET + ov->state = state; + // END ATOMIC SET os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store); os_rollback_os_id_based_cascading(ov, store); @@ -402,8 +435,8 @@ static void put_under_destruction(sqlstore* store, objectversion *ov, ulng oldest) { //TODO ATOMIC CAS - if (ov->life_cycle == 0) { - ov->life_cycle = under_destruction; + if (ov->
MonetDB: nospare - merged
Changeset: f585fa27f65e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f585fa27f65e Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/server/rel_dump.c sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_select.c sql/server/rel_unnest.c sql/server/rel_updates.c Branch: nospare Log Message: merged diffs (truncated from 776 to 300 lines): diff --git a/monetdb5/modules/atoms/xml.c b/monetdb5/modules/atoms/xml.c --- a/monetdb5/modules/atoms/xml.c +++ b/monetdb5/modules/atoms/xml.c @@ -376,7 +376,7 @@ XMLparse(xml *x, str *doccont, str *val, } str -XMLpi(str *ret, str *target, str *value) +XMLpi(xml *ret, str *target, str *value) { size_t len; str buf; diff --git a/monetdb5/modules/mal/mdb.c b/monetdb5/modules/mal/mdb.c --- a/monetdb5/modules/mal/mdb.c +++ b/monetdb5/modules/mal/mdb.c @@ -735,7 +735,7 @@ static str MDBdump(Client cntxt, MalBlkP } static str -MDBdummy(int *ret) +MDBdummy(void *ret) { (void) ret; throw(MAL, "mdb.dummy", OPERATION_FAILED); diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -2563,10 +2563,8 @@ rel2bin_semijoin(backend *be, sql_rel *r int idx = 0, equality_only = 1; jexps = get_equi_joins_first(sql, jexps, &equality_only); - if (!equality_only || list_length(jexps) > 1) { + if (!equality_only || list_length(jexps) > 1 || exp_has_func((sql_exp*)jexps->h->data)) left = subrel_project(be, left, refs, rel->l); - equality_only = 0; - } right = subrel_project(be, right, refs, rel->r); for( en = jexps->h; en; en = en->next ) { @@ -2575,8 +2573,7 @@ rel2bin_semijoin(backend *be, sql_rel *r stmt *s = NULL; /* only handle simple joins here */ - if ((exp_has_func(e) && e->flag != cmp_filter) || - e->flag == cmp_or || (e->f && e->anti)) { + if ((exp_has_func(e) && e->flag != cmp_filter) || e->flag == cmp_or || (e->f && e->anti)) { if (!join && !list_length(lje)) { stmt *l = bin_first_column(be, left); stmt *r = bin_first_column(be, right); diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -1358,16 +1358,16 @@ can_push_func(sql_exp *e, sql_rel *rel, { switch(e->type) { case e_cmp: { + int mustl = 0, mustr = 0, mustf = 0; sql_exp *l = e->l, *r = e->r, *f = e->f; - int res = 1, lmust = 0; - - if (e->flag == cmp_or || e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter) + + if (is_project(rel->op) || e->flag == cmp_or || e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter) return 0; - res = can_push_func(l, rel, &lmust) && can_push_func(r, rel, &lmust) && (!f || can_push_func(f, rel, &lmust)); - if (res && !lmust) - return 1; - (*must) |= lmust; - return res; + return ((l->type == e_column || can_push_func(l, rel, &mustl)) && (*must = mustl)) || + (!f && (r->type == e_column || can_push_func(r, rel, &mustr)) && (*must = mustr)) || + (f && + (r->type == e_column || can_push_func(r, rel, &mustr)) && + (f->type == e_column || can_push_func(f, rel, &mustf)) && (*must = (mustr || mustf))); } case e_convert: return can_push_func(e->l, rel, must); @@ -1386,8 +1386,7 @@ can_push_func(sql_exp *e, sql_rel *rel, return res; } case e_column: -/* aliases cannot be bound on the same level, ie same projection */ - if ((exp_name(e) && !has_label(e)) || (rel && !rel_find_exp(rel, e))) + if (rel && !rel_find_exp(rel, e)) return 0; (*must) = 1; /* fall through */ diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -5719,22 +5719,22 @@ rel_joinquery_(sql_query *query, sql_rel } lateral = check_is_lateral(tab2); - t1 = table_ref(query, NULL, tab1, 0, NULL); + t1 = table_ref(query, NULL, tab1, 0, refs); if (rel && !t1 && sql->sess
MonetDB: default - Remove quotes.
Changeset: e2218d24ec5a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2218d24ec5a Modified Files: sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh Branch: default Log Message: Remove quotes. diffs (11 lines): diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh --- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh +++ b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh @@ -5,6 +5,6 @@ user=monetdb password=monetdb EOF -java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f \"$TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql\" +java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f $TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql rm -f .monetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - check for key dependencies again
Changeset: cb5eda62 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb5eda62 Modified Files: sql/backends/monet5/sql_cat.c Branch: nospare Log Message: check for key dependencies again diffs (45 lines): diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -548,29 +548,28 @@ drop_table(mvc *sql, char *sname, char * throw(SQL,"sql.drop_table", SQLSTATE(42000) "DROP TABLE: cannot drop system table '%s'", tname); if (!mvc_schema_privs(sql, s) && !(isTempSchema(s) && t->persistence == SQL_LOCAL_TEMP)) throw(SQL,"sql.drop_table", SQLSTATE(42000) "DROP TABLE: access denied for %s to schema '%s'", get_string_global_var(sql, "current_user"), s->base.name); - /* to be checked via dependencies */ -#if 0 + if (!drop_action && t->keys.set) { for (node *n = t->keys.set->h; n; n = n->next) { sql_key *k = n->data; if (k->type == ukey || k->type == pkey) { - sql_ukey *uk = (sql_ukey *) k; - - if (uk->keys && list_length(uk->keys)) { - node *l = uk->keys->h; + struct os_iter oi; + os_iterator(&oi, k->t->s->keys, sql->session->tr, NULL); + for (sql_base *b = oi_next(&oi); b; b=oi_next(&oi)) { + sql_key *fk = (sql_key*)b; + sql_fkey *rk = (sql_fkey*)b; - for (; l; l = l->next) { - k = l->data; - /* make sure it is not a self referencing key */ - if (k->t != t) - throw(SQL,"sql.drop_table", SQLSTATE(4) "DROP TABLE: FOREIGN KEY %s.%s depends on %s", k->t->base.name, k->base.name, tname); - } + if (fk->type != fkey || rk->rkey != k->base.id) + continue; + + /* make sure it is not a self referencing key */ + if (fk->t != t) + throw(SQL,"sql.drop_table", SQLSTATE(4) "DROP TABLE: FOREIGN KEY %s.%s depends on %s", k->t->base.name, k->base.name, tname); } } } } -#endif if (!drop_action && mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL)) throw (SQL,"sql.drop_table",SQLSTATE(42000) "DROP TABLE: unable to drop table %s (there are database objects which depend on it)\n", t->base.name); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - merged with default
Changeset: 6e3074fdb92a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e3074fdb92a Branch: nospare Log Message: merged with default diffs (11 lines): diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh --- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh +++ b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh @@ -5,6 +5,6 @@ user=monetdb password=monetdb EOF -java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f \"$TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql\" +java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f $TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql rm -f .monetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - Remove some comments.
Changeset: feaec2ce06de for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=feaec2ce06de Modified Files: sql/storage/objectset.c Branch: nospare Log Message: Remove some comments. diffs (143 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -317,15 +317,13 @@ static void os_rollback_os_id_based_cascading(objectversion *ov, sqlstore *store) { // TODO ATOMIC GET bte state = ov->state; - // END ATOMIC GET assert(state & id_based_rollbacked); if (ov->id_based_older) { if (ov->id_based_older->ts < TRANSACTION_ID_BASE) { // older is last committed state. Restore versionhead pointer to that. - // TODO START ATOMIC() + // TODO START ATOMIC SET ov->id_based_head->ov = ov->id_based_older; - // END ATOMIC() } else { os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store); @@ -335,7 +333,6 @@ os_rollback_os_id_based_cascading(object state |= id_based_rollbacked; //TODO ATOMIC SET ov->id_based_older->state = state; - // END ATOMIC SET // id based cascaded rollback along the parents os_rollback_os_id_based_cascading(ov->id_based_older, store); @@ -351,15 +348,13 @@ static void os_rollback_os_name_based_cascading(objectversion *ov, sqlstore *store) { // TODO ATOMIC GET bte state = ov->state; - // END ATOMIC GET assert(state & name_based_rollbacked); if (ov->name_based_older) { if (ov->name_based_older->ts < TRANSACTION_ID_BASE) { // older is last committed state. Restore versionhead pointer to that. - // TODO START ATOMIC() + // TODO START ATOMIC SET ov->name_based_head->ov = ov->name_based_older; - // END ATOMIC() } else { os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store); @@ -369,7 +364,6 @@ os_rollback_os_name_based_cascading(obje state |= name_based_rollbacked; //TODO ATOMIC SET ov->name_based_older->state = state; - // END ATOMIC SET // name based cascaded rollback along the parents os_rollback_os_name_based_cascading(ov->name_based_older, store); @@ -385,7 +379,6 @@ static void os_rollback_name_based_terminal_decendant(objectversion *ov, sqlstore *store) { // TODO ATOMIC GET bte state = ov->state; - // END ATOMIC GET if (state & name_based_rollbacked) { return; @@ -395,7 +388,6 @@ os_rollback_name_based_terminal_decendan //TODO ATOMIC SET ov->state = state; - // END ATOMIC SET os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store); os_rollback_os_name_based_cascading(ov, store); @@ -405,7 +397,6 @@ static void os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store) { // TODO ATOMIC GET bte state = ov->state; - // END ATOMIC GET if (state & id_based_rollbacked) { return; @@ -415,7 +406,6 @@ os_rollback_id_based_terminal_decendant( //TODO ATOMIC SET ov->state = state; - // END ATOMIC SET os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store); os_rollback_os_id_based_cascading(ov, store); @@ -454,7 +444,6 @@ put_under_destruction(sqlstore* store, o // TODO ATOMIC GET ov->ts = store->timestamp+1; - // END ATOMIC GET if (ov->id_based_older) { put_under_destruction(store, ov->id_based_older, oldest); @@ -486,7 +475,6 @@ os_cleanup(sqlstore* store, objectversio */ // TODO ATOMIC GET ov->ts = store->timestamp+2; - // END ATOMIC GET } // not yet old enough to be safely removed. Try later. @@ -506,7 +494,6 @@ os_cleanup(sqlstore* store, objectversio // TODO ATOMIC GET objectversion* newer = ov->name_based_newer; - // END ATOMIC GET if (ov->ts < oldest && newer && (newer->ts < oldest && !newer->state)) { assert(newer == ov->id_based_newer); @@ -757,7 +744,7 @@ os_add_name_based(objectset *os, struct else { return -1; /*conflict with cleaner*/ } -
MonetDB: nospare - Merge 'deleted' flag into 'state' flag holder.
Changeset: 990d6dc5c9c1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=990d6dc5c9c1 Modified Files: sql/storage/objectset.c Branch: nospare Log Message: Merge 'deleted' flag into 'state' flag holder. diffs (231 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -25,15 +25,15 @@ struct versionhead ;// TODO: rename to o #define name_based_rollbacked (1<<1) #define under_destruction (id_based_rollbacked | name_based_rollbacked) #define under_resurrection (1<<3) +#define deleted(1<<4) typedef struct objectversion { - bool deleted; ulng ts; bte state; sql_base *b; // base of underlying sql object struct objectset* os; struct objectversion*name_based_older; - struct objectversion*name_based_newer; // TODO: must become atomic pointer + struct objectversion*name_based_newer; struct versionhead *name_based_head; struct objectversion*id_based_older; @@ -481,7 +481,8 @@ os_cleanup(sqlstore* store, objectversio return LOG_OK; } - if (ov->deleted) { + // TODO ATOMIC GET + if (ov->state == deleted) { if (ov->ts < oldest) { // the oldest relevant state is deleted so lets try to mark it as destroyed put_under_destruction(store, ov, oldest); @@ -696,7 +697,7 @@ static objectversion* get_valid_object_name(sql_trans *tr, objectversion *ov) { while(ov) { - if (ov->ts == tr->tid || (tr->parent && tr_version_of_parent(tr, ov->ts)) || (!ov->state && ov->ts < tr->ts)) + if (ov->ts == tr->tid || (tr->parent && tr_version_of_parent(tr, ov->ts)) || ov->ts < tr->ts) return ov; else ov = ov->name_based_older; @@ -708,7 +709,7 @@ static objectversion* get_valid_object_id(sql_trans *tr, objectversion *ov) { while(ov) { - if (ov->ts == tr->tid || (tr->parent && tr_version_of_parent(tr, ov->ts)) || (!ov->state && ov->ts < tr->ts)) + if (ov->ts == tr->tid || (tr->parent && tr_version_of_parent(tr, ov->ts)) || ov->ts < tr->ts) return ov; else ov = ov->id_based_older; @@ -734,17 +735,22 @@ os_add_name_based(objectset *os, struct assert(ov != oo); // Time loops are not allowed - if (oo->deleted) { - // Since our parent oo is comitted deleted objectversion, we might have a conflict with - // another transaction that tries to clean up oo. + //TODO ATOMIC GET + bte state = oo->state; + if (state != active) { + // This can only happen if the parent oo was a comitted deleted at some point. + assert(state == deleted || state == under_destruction); + /* Since our parent oo is comitted deleted objectversion, we might have a conflict with + * another transaction that tries to clean up oo. + */ //TODO ATOMIC CAS - if (oo->state == 0) { + if (oo->state == deleted) { oo->state = under_resurrection; } else { return -1; /*conflict with cleaner*/ } - //END ATOMIC CAS + // END ATOMIC CAS } MT_lock_set(&os->ht_lock); @@ -756,7 +762,7 @@ os_add_name_based(objectset *os, struct if (oo) { oo->name_based_newer = ov; // TODO ATOMIC SET - oo->state = 0; + oo->state = state; // if the parent was originally deleted, we restore it to that state. } MT_lock_unset(&os->ht_lock); return 0; @@ -784,28 +790,34 @@ os_add_id_based(objectset *os, struct sq assert(ov != oo); // Time loops are not allowed - if (oo->deleted) { - // Since our parent oo is comitted deleted objectversion, we might have a conflict with - // another transaction that tries to clean up oo. + //TODO ATOMIC GET + bte state = oo->state; + if (state != active) { + // This can only happen if the parent oo was a comitted deleted at some point. + assert(state == deleted || state == under_destruction); + /* Since our parent oo is comitted deleted objectversio
MonetDB: Oct2020 - Fixing SQLancer crash and other bugs.
Changeset: ab0a0b3be4f4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ab0a0b3be4f4 Modified Files: sql/include/sql_relation.h sql/server/rel_rel.c sql/server/rel_select.c sql/server/rel_unnest.c sql/server/rel_updates.c sql/test/SQLancer/Tests/sqlancer02.stable.out Branch: Oct2020 Log Message: Fixing SQLancer crash and other bugs. As a projection, if an expression cannot be found on a set relation don't look further. Make sure a set relation is always processed. Don't look for expressions on ordering columns. diffs (209 lines): diff --git a/sql/include/sql_relation.h b/sql/include/sql_relation.h --- a/sql/include/sql_relation.h +++ b/sql/include/sql_relation.h @@ -197,7 +197,6 @@ typedef enum operator_type { #define is_simple_project(op) (op == op_project) #define is_project(op) (op == op_project || op == op_groupby || is_set(op)) #define is_groupby(op) (op == op_groupby) -#define is_sort(rel) (((rel)->op == op_project && (rel)->r) || (rel)->op == op_topn) #define is_topn(op)(op == op_topn) #define is_modify(op) (op == op_insert || op == op_update || op == op_delete || op == op_truncate) #define is_sample(op) (op == op_sample) diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c --- a/sql/server/rel_rel.c +++ b/sql/server/rel_rel.c @@ -378,6 +378,9 @@ rel_bind_column2( mvc *sql, sql_rel *rel if ((is_simple_project(rel->op) || is_groupby(rel->op)) && rel->l) { if (!is_processed(rel)) return rel_bind_column2(sql, rel->l, tname, cname, f); + } else if (is_set(rel->op)) { + assert(is_processed(rel)); + return NULL; } else if (is_join(rel->op)) { sql_exp *e = rel_bind_column2(sql, rel->l, tname, cname, f); @@ -389,9 +392,7 @@ rel_bind_column2( mvc *sql, sql_rel *rel set_has_nil(e); } return e; - } else if (is_set(rel->op) || - is_sort(rel) || - is_semi(rel->op) || + } else if (is_semi(rel->op) || is_select(rel->op) || is_topn(rel->op) || is_sample(rel->op)) { @@ -1564,17 +1565,27 @@ rel_find_column( sql_allocator *sa, sql_ if (e && !ambiguous && !multi) return exp_alias(sa, exp_relname(e), exp_name(e), exp_relname(e), cname, exp_subtype(e), e->card, has_nil(e), is_intern(e)); } - if (is_project(rel->op) && rel->l && !is_processed(rel)) { - return rel_find_column(sa, rel->l, tname, cname); + if ((is_simple_project(rel->op) || is_groupby(rel->op)) && rel->l) { + if (!is_processed(rel)) + return rel_find_column(sa, rel->l, tname, cname); + } else if (is_set(rel->op)) { + assert(is_processed(rel)); + return NULL; } else if (is_join(rel->op)) { sql_exp *e = rel_find_column(sa, rel->l, tname, cname); - if (!e) + + if (e && (is_right(rel->op) || is_full(rel->op))) + set_has_nil(e); + if (!e) { e = rel_find_column(sa, rel->r, tname, cname); + if (e && (is_left(rel->op) || is_full(rel->op))) + set_has_nil(e); + } return e; - } else if (is_set(rel->op) || - is_sort(rel) || - is_semi(rel->op) || - is_select(rel->op)) { + } else if (is_semi(rel->op) || + is_select(rel->op) || + is_topn(rel->op) || + is_sample(rel->op)) { if (rel->l) return rel_find_column(sa, rel->l, tname, cname); } diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -5718,8 +5718,11 @@ rel_setquery(sql_query *query, symbol *q res = rel_setquery_(query, t1, t2, corresponding, op_except ); else if ( q->token == SQL_INTERSECT) res = rel_setquery_(query, t1, t2, corresponding, op_inter ); - if (res && distinct) - res = rel_distinct(res); + if (res) { + set_processed(res); + if (distinct) + res = rel_distinct(res); + } return res; } diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c --- a/sql/server/rel_unnest.c +++ b/sql/server/rel_unnest.c @@ -2007,6 +2007,7 @@ rewrite_or_exp(visitor *v, sql_rel *rel) list *rs = rel_projections(v->sql, rel, NULL, 1, 1); if (!(rel = rel_setop_check_types(v->sql, l, r, ls, rs, op_union)))
MonetDB: nospare - fixed partition by value list/range partitions
Changeset: 3bb206122ef5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3bb206122ef5 Modified Files: sql/storage/store.c Branch: nospare Log Message: fixed partition by value list/range partitions diffs (45 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -4261,6 +4261,7 @@ sql_trans_add_table(sql_trans *tr, sql_t /* merge table depends on part table */ sql_trans_create_dependency(tr, pt->base.id, mt->base.id, TABLE_DEPENDENCY); assert(isMergeTable(mt) || isReplicaTable(mt)); + mt = new_table(tr, mt); p->t = mt; p->member = pt; /* TODO parts should have a unique name - id ? */ @@ -4291,6 +4292,7 @@ sql_trans_add_range_partition(sql_trans vmin = vmax = (ValRecord) {.vtype = TYPE_void,}; + mt = new_table(tr, mt); if (min) { ok = VALinit(&vmin, localtype, min); if (ok && localtype != TYPE_str) @@ -4381,7 +4383,7 @@ sql_trans_add_range_partition(sql_trans } if (!update) - cs_add(&mt->members, p, TR_NEW); + os_add(mt->s->parts, tr, p->base.name, dup_base(&p->base)); finish: VALclear(&vmin); VALclear(&vmax); @@ -4402,6 +4404,7 @@ sql_trans_add_value_partition(sql_trans int localtype = tpe.type->localtype, i = 0; sqlid *v; + mt = new_table(tr, mt); if (!update) { p = SA_ZNEW(tr->sa, sql_part); base_init(tr->sa, &p->base, pt->base.id, TR_NEW, pt->base.name); @@ -4474,7 +4477,7 @@ sql_trans_add_value_partition(sql_trans /* add merge table dependency */ sql_trans_create_dependency(tr, pt->base.id, mt->base.id, TABLE_DEPENDENCY); store->table_api.table_insert(tr, sysobj, &mt->base.id, p->base.name, &p->base.id); - cs_add(&mt->members, p, TR_NEW); + os_add(mt->s->parts, tr, p->base.name, dup_base(&p->base)); } return 0; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - SQLancer query with wrong results. Looking in...
Changeset: 533522f0ebfe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=533522f0ebfe Modified Files: sql/test/SQLancer/Tests/sqlancer02.sql Branch: Oct2020 Log Message: SQLancer query with wrong results. Looking into it diffs (27 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer02.sql b/sql/test/SQLancer/Tests/sqlancer02.sql --- a/sql/test/SQLancer/Tests/sqlancer02.sql +++ b/sql/test/SQLancer/Tests/sqlancer02.sql @@ -360,3 +360,23 @@ from v54 as l1v54, v1 as l1v1 where l1v5 select 1 from v20 as l0v20, v27 as l0v27, v1 as l0v1 where (l0v20.vc0) in (-3, l0v20.vc0, l0v27.vc1); ROLLBACK; + +START TRANSACTION; +CREATE TABLE "t1" ("c0" BOOLEAN NOT NULL,CONSTRAINT "t1_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t1_c0_unique" UNIQUE ("c0")); +INSERT INTO "t1" VALUES (false), (true); + +create view v5(vc0) as (values (1), (4)); + +create view v8(vc1) as ((select l0t1.c0 from t1 as l0t1) union distinct (select false)); + +SELECT v5.vc0 FROM v5, v8 JOIN (VALUES (0.3, 10.0),(0.5, 8.0)) AS sub0 ON +true WHERE least(CASE v5.vc0 WHEN v5.vc0 THEN v8.vc1 END, true); + -- 1 + -- 1 + -- 4 + -- 4 + +SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT CAST(least(CASE v5.vc0 WHEN v5.vc0 THEN v8.vc1 END, true) AS INT) as count +FROM v5, v8 JOIN (VALUES (0.3, 10.0),(0.5, 8.0)) AS sub0 ON true) as res; + -- 4 +ROLLBACK; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - make sure we use the correct version also for...
Changeset: 581be5e45b8a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=581be5e45b8a Modified Files: sql/storage/bat/bat_storage.c sql/storage/bat/bat_storage.h sql/storage/bat/bat_table.c sql/storage/store.c Branch: nospare Log Message: make sure we use the correct version also for the system (internal) tables diffs (104 lines): diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -126,7 +126,7 @@ get_dbat(sql_dbat *d, ulng tid, int is_t return d; } -static sql_delta * +sql_delta * timestamp_delta( sql_trans *tr, sql_delta *d, int type, int is_temp) { if (is_temp) @@ -343,7 +343,7 @@ bind_idx(sql_trans *tr, sql_idx * i, int return bind_uidx(tr, i, access); int type = oid_index(i->type)?TYPE_oid:TYPE_lng; sql_delta *d = timestamp_delta(tr, i->data, type, isTempTable(i->t)); - return delta_bind_bat( d, access, isTempTable(i->t) || isNew(i->t)); + return delta_bind_bat( d, access, isNew(i->t)); } static int diff --git a/sql/storage/bat/bat_storage.h b/sql/storage/bat/bat_storage.h --- a/sql/storage/bat/bat_storage.h +++ b/sql/storage/bat/bat_storage.h @@ -41,6 +41,7 @@ typedef struct sql_dbat { /* initialize bat storage call back functions interface */ extern void bat_storage_init( store_functions *sf ); +extern sql_delta * timestamp_delta( sql_trans *tr, sql_delta *d, int type, int is_temp); #endif /*BATSTORAGE_H */ diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c --- a/sql/storage/bat/bat_table.c +++ b/sql/storage/bat/bat_table.c @@ -54,7 +54,7 @@ delta_cands(sql_trans *tr, sql_table *t) } static BAT * -delta_full_bat_( sql_trans *tr, sql_column *c, sql_delta *bat, int temp) +delta_full_bat_( sql_trans *tr, sql_column *c, sql_delta *bat, int is_new) { /* return full normalized column bat * b := b.copy() @@ -68,7 +68,7 @@ delta_full_bat_( sql_trans *tr, sql_colu if (!i) return NULL; r = i; - if (temp) + if (is_new) return r; b = temp_descriptor(bat->bid); if (!b) { @@ -122,19 +122,19 @@ delta_full_bat_( sql_trans *tr, sql_colu } static BAT * -delta_full_bat( sql_trans *tr, sql_column *c, sql_delta *bat, int temp) +delta_full_bat( sql_trans *tr, sql_column *c, sql_delta *bat, int is_new) { sqlstore *store = tr->store; if (!store->initialized && bat->cached) return bat->cached; - return delta_full_bat_( tr, c, bat, temp); + return delta_full_bat_( tr, c, bat, is_new); } static BAT * full_column(sql_trans *tr, sql_column *c) { assert(c->data); - return delta_full_bat(tr, c, c->data, isTempTable(c->t)); + return delta_full_bat(tr, c, timestamp_delta(tr, c->data, c->type.type->localtype, isTempTable(c->t)), isNew(c->t)); } static void diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -4487,14 +4487,21 @@ sql_trans_rename_table(sql_trans *tr, sq { sqlstore *store = tr->store; sql_table *systable = find_sql_table(tr, find_sql_schema(tr, isTempSchema(s) ? "tmp":"sys"), "_tables"); - sql_base *b = os_find_id(s->tables, tr, id); - sql_table *t = (sql_table*)b; + sql_table *t = find_sql_table_id(tr, s, id); oid rid; assert(!strNil(new_name)); - os_del(s->tables, tr, t->base.name, &t->base); + if (isGlobal(t)) + os_del(s->tables, tr, t->base.name, &t->base); + else { + node *n = cs_find_id(&tr->localtmps, t->base.id); + if (n) + cs_del(&tr->localtmps, tr->store, n, t->base.flags); + } t = table_dup(tr, t, t->s, new_name); + if (!isGlobal(t)) + cs_add(&tr->localtmps, t, TR_NEW); rid = store->table_api.column_find_row(tr, find_sql_column(systable, "id"), &t->base.id, NULL); assert(!is_oid_nil(rid)); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: nospare - merged with default
Changeset: ee1369de5b83 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ee1369de5b83 Branch: nospare Log Message: merged with default diffs (truncated from 1296255 to 300 lines): diff --git a/clients/Tests/MAL-signatures.sql b/clients/Tests/MAL-signatures.sql deleted file mode 100644 --- a/clients/Tests/MAL-signatures.sql +++ /dev/null @@ -1,1 +0,0 @@ -select * from sys.malfunctions() order by module, "function", address, signature, comment; diff --git a/clients/Tests/MAL-signatures.stable.err b/clients/Tests/MAL-signatures.stable.err deleted file mode 100644 --- a/clients/Tests/MAL-signatures.stable.err +++ /dev/null @@ -1,36 +0,0 @@ -stderr of test 'MAL-signatures` in directory 'clients` itself: - - -# 21:33:47 > -# 21:33:47 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35607" "--set" "mapi_usock=/var/tmp/mtest-19610/.s.monetdb.35607" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/home/sjoerd/Monet-stable/var/MonetDB/mTests_clients" "--set" "mal_listing=2" -# 21:33:47 > - -# builtin opt gdk_dbpath = /home/sjoerd/Monet-stable/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 35607 -# cmdline opt mapi_usock = /var/tmp/mtest-19610/.s.monetdb.35607 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbpath = /home/sjoerd/Monet-stable/var/MonetDB/mTests_clients -# cmdline opt mal_listing = 2 - -# 21:33:48 > -# 21:33:48 > "mclient" "-lmal" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-19610" "--port=35607" -# 21:33:48 > - - - -# 21:33:51 > -# 21:33:51 > "Done." -# 21:33:51 > - diff --git a/clients/Tests/exports.stable.err b/clients/Tests/exports.stable.err deleted file mode 100644 --- a/clients/Tests/exports.stable.err +++ /dev/null @@ -1,9 +0,0 @@ -stderr of test 'exports` in directory 'clients` itself: - - -# 15:10:42 > -# 15:10:42 > "/usr/bin/python" "exports.py" "exports" -# 15:10:42 > - - - diff --git a/clients/Tests/exports.stable.err-noapprove b/clients/Tests/exports.stable.err-noapprove deleted file mode 100644 diff --git a/clients/Tests/malcheck.stable.err b/clients/Tests/malcheck.stable.err deleted file mode 100644 --- a/clients/Tests/malcheck.stable.err +++ /dev/null @@ -1,12 +0,0 @@ -stderr of test 'malcheck` in directory 'clients` itself: - - -# 15:15:51 > -# 15:15:51 > "./malcheck.sh" "malcheck" -# 15:15:51 > - - -# 15:16:26 > -# 15:16:26 > "Done." -# 15:16:26 > - diff --git a/clients/Tests/malcheck.stable.err-noapprove b/clients/Tests/malcheck.stable.err-noapprove deleted file mode 100644 diff --git a/clients/Tests/malcheck.stable.out b/clients/Tests/malcheck.stable.out deleted file mode 100644 --- a/clients/Tests/malcheck.stable.out +++ /dev/null @@ -1,12 +0,0 @@ -stdout of test 'malcheck` in directory 'clients` itself: - - -# 15:15:51 > -# 15:15:51 > "./malcheck.sh" "malcheck" -# 15:15:51 > - - -# 15:16:26 > -# 15:16:26 > "Done." -# 15:16:26 > - diff --git a/clients/Tests/malcheck.stable.out-noapprove b/clients/Tests/malcheck.stable.out-noapprove deleted file mode 100644 diff --git a/clients/ruby/Tests/gemtest.stable.err b/clients/ruby/Tests/gemtest.stable.err deleted file mode 100644 --- a/clients/ruby/Tests/gemtest.stable.err +++ /dev/null @@ -1,37 +0,0 @@ -stderr of test 'gemtest` in directory 'clients/ruby` itself: - - -# 11:01:32 > -# 11:01:32 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=31445" "--set" "mapi_usock=/var/tmp/mtest-29264/.s.monetdb.31445" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/Users/rkoopmanschap/projects/MonetDB-installation/var/MonetDB/mTests_." "--set" "mal_listing=0" "--set" "embedded_r=yes" -# 11:01:32 > - -# builtin opt gdk_dbpath = /Users/rkoopmanschap/projects/MonetDB-installation/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 31445 -# cmdline opt mapi_usock = /var/tmp/mtest-29264/.s.monetdb.31445 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbpath = /Users/rkoopmanschap/projects/MonetDB-installation/var/MonetDB/mTests_. -# cmdline opt mal_listing = 0 -# cmdline opt embedded_r = y
MonetDB: Oct2020 - On union relations, the expression's properti...
Changeset: 8002219d9426 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8002219d9426 Modified Files: sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_rel.h sql/server/rel_unnest.c sql/test/SQLancer/Tests/sqlancer02.stable.out sql/test/merge-partitions/Tests/mergepart31.stable.out Branch: Oct2020 Log Message: On union relations, the expression's properties cannot be propagated. Also make sure to call rel_setop_set_exps on set relations when setting exressions diffs (truncated from 375 to 300 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -2077,6 +2077,7 @@ rel_push_topn_and_sample_down(visitor *v ur = func(v->sql->sa, ur, sum_limit_offset(v->sql, rel)); u = rel_setop(v->sql->sa, ul, ur, op_union); + /* TODO the list of expressions of u don't match ul and ur */ u->exps = exps_alias(v->sql, r->exps); u->nrcols = list_length(u->exps); set_processed(u); @@ -4159,7 +4160,7 @@ rel_push_aggr_down(visitor *v, sql_rel * sql_table *mt = (bt)?bt->r:NULL; if (c && mt && list_find(c->t->pkey->k.columns, c, cmp) != NULL) { v->changes++; - return rel_inplace_setop(rel, ul, ur, op_union, + return rel_inplace_setop(v->sql, rel, ul, ur, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); } } @@ -5117,7 +5118,7 @@ rel_push_join_down_union(visitor *v, sql nl = rel_project(v->sql->sa, nl, rel_projections(v->sql, nl, NULL, 1, 1)); nr = rel_project(v->sql->sa, nr, rel_projections(v->sql, nr, NULL, 1, 1)); v->changes++; - return rel_inplace_setop(rel, nl, nr, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); + return rel_inplace_setop(v->sql, rel, nl, nr, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); } else if (is_union(l->op) && !need_distinct(l) && is_union(r->op) && !need_distinct(r)) { sql_rel *nl, *nr; @@ -5160,7 +5161,7 @@ rel_push_join_down_union(visitor *v, sql nl = rel_project(v->sql->sa, nl, rel_projections(v->sql, nl, NULL, 1, 1)); nr = rel_project(v->sql->sa, nr, rel_projections(v->sql, nr, NULL, 1, 1)); v->changes++; - return rel_inplace_setop(rel, nl, nr, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); + return rel_inplace_setop(v->sql, rel, nl, nr, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); } else if (!is_union(l->op) && is_union(r->op) && !need_distinct(r) && !is_semi(rel->op)) { @@ -5189,7 +5190,7 @@ rel_push_join_down_union(visitor *v, sql nl = rel_project(v->sql->sa, nl, rel_projections(v->sql, nl, NULL, 1, 1)); nr = rel_project(v->sql->sa, nr, rel_projections(v->sql, nr, NULL, 1, 1)); v->changes++; - return rel_inplace_setop(rel, nl, nr, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); + return rel_inplace_setop(v->sql, rel, nl, nr, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); /* {semi}join ( A1, union (A2, B)) [A1.partkey = A2.partkey] -> * {semi}join ( A1, A2 ) * and @@ -5519,7 +5520,7 @@ rel_push_select_down_union(visitor *v, s ul->exps = exps_copy(v->sql, s->exps); ur->exps = exps_copy(v->sql, s->exps); - rel = rel_inplace_setop(rel, ul, ur, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); + rel = rel_inplace_setop(v->sql, rel, ul, ur, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); v->changes++; return rel; } @@ -5648,7 +5649,7 @@ rel_push_project_down_union(visitor *v, ul->exps = exps_copy(v->sql, p->exps); ur->exps = exps_copy(v->sql, p->exps); - rel = rel_inplace_setop(rel, ul, ur, op_union, + rel = rel_inplace_setop(v->sql, rel, ul, ur, op_union, rel_projections(v->sql, rel, NULL, 1, 1)); if (need_distinct) set_distinct(rel); diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c --- a/sql/server/rel_rel.c +++ b/sql/se