Changeset: fb7cafba74ea for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb7cafba74ea
Added Files:
        sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.sql
        
sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.err
        
sql/test/BugTracker-2019/Tests/avg-changes-value-scale.Bug-6783.stable.out
Modified Files:
        .hgignore
        NT/rules.msc
        buildtools/autogen/autogen/am.py
        buildtools/autogen/autogen/codegen.py
        buildtools/autogen/autogen/filesplit.py
        buildtools/autogen/autogen/msc.py
        buildtools/conf/rules.mk
        configure.ag
        monetdb5/modules/atoms/strptime.c
        sql/backends/monet5/sql_statement.c
        sql/common/sql_types.c
        sql/server/rel_dump.c
        sql/test/BugTracker-2019/Tests/All
        sql/test/Tests/truncate-statements-extra.sql
        sql/test/Tests/truncate-statements-extra.stable.out
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
        sql/test/sys-schema/Tests/systemfunctions.stable.out
        sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

Merge with Nov2019


diffs (truncated from 741 to 300 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -49,7 +49,6 @@ sql/backends/monet5/UDF/capi/cheader.tex
 .#*
 
 # files generated by compilers
-lex.yy.c
 *.tab.c
 *.tab.h
 .libs
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -186,8 +186,7 @@ libpy3_CFLAGS = -DHAVE_LIBPY3 "-I$(PYTHO
 # PYTHON may be either a version 2 or a version 3
 # here we let %Path% determine which version we get
 PYTHON = python
-YACC = bison
-LEX = flex
+BISON = bison
 
 ARCHIVER = lib /nologo
 GENDLL =
diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py
--- a/buildtools/autogen/autogen/am.py
+++ b/buildtools/autogen/autogen/am.py
@@ -19,7 +19,7 @@ from filesplit import split_filename, rs
 # buildtools/conf.  The generated sources should therefore be included
 # in the tar ball and not be removed with `make distclean' when
 # running "in" said tar ball.
-buildtools_ext = ['brg', 'l', 'pm.i', 'syms', 't', 'y']
+buildtools_ext = ['syms', 'y']
 
 am_assign = "+="
 
@@ -150,6 +150,8 @@ def am_find_srcs(target, deps, am, cond)
                 am['CLEAN'].append(pf)
     b, ext = split_filename(pf)
     if ext in automake_ext:
+        if ext in ['tab.c', 'tab.h']:
+            dist = True
         return dist, pf
     return dist, ""
 
@@ -563,7 +565,7 @@ def am_binary(fd, var, binmap, am):
         if ext in scripts_ext:
             if target not in SCRIPTS:
                 SCRIPTS.append(target)
-        elif ext in ('o', 'glue.o', 'tab.o', 'yy.o'):
+        elif ext in ('o', 'tab.o'):
             dist, src = am_find_srcs(target, binmap['DEPS'], am, cond)
             if src in binmap['SOURCES']:
                 dist = True
diff --git a/buildtools/autogen/autogen/codegen.py 
b/buildtools/autogen/autogen/codegen.py
--- a/buildtools/autogen/autogen/codegen.py
+++ b/buildtools/autogen/autogen/codegen.py
@@ -21,25 +21,15 @@ from filesplit import split_filename
 # direct rules
 code_gen = {'y':        [ '.tab.c', '.tab.h' ],
             'tab.c':    [ '.tab.o' ],
-            'l':        [ '.yy.c', '.yy.h' ],
-            'yy.c':     [ '.yy.o' ],
             'mt':       [ '.symbols.h', '.c' ],
-            'brg':      [ '.c' ],
             't':        [ '.c' ],
             'c':        [ '.o' ],
-            'cpp':      [ '.o' ],
-#            'java':     [ '.class' ],
-            #'tex':      [ '.html', '.dvi', '.pdf' ],
-            #'dvi':      [ '.ps' ],
-            #'fig':      [ '.eps' ],
-            #'feps':     [ '.eps' ],
             'in':       [ '' ],
             '1.in':     [ '.1' ],  # TODO: add more manpage sections as needed
             'cfg.in':   [ '.cfg' ],
             'java.in':  [ '.java' ],
             'mal.in':   [ '.mal' ],
             'py.in':    [ '.py' ],
-            'pl.in':    [ '.pl' ],
             'bat.in':   [ '.bat' ],
             'mt.sed':   [ '.mt' ],
             'c.sed':    [ '.c' ],
@@ -69,15 +59,8 @@ t_inc = re.compile(t_inc, re.MULTILINE)
 
 scan_map = {
     'c': [ c_inc, None, '' ],
-    'cpp': [ c_inc, None, '' ],
     'h': [ c_inc, None, '' ],
     'y': [ c_inc, None, '' ],
-    'l': [ c_inc, None, '' ],
-    'mt': [ c_inc, None, '' ],
-    'brg': [ c_inc, None, '' ],
-    't': [ t_inc, None, '' ],
-    'xsl': [ xsl_inc, None, '' ],
-    'tex': [ tex_inc, None, '' ],
 }
 
 def readfile(f):
diff --git a/buildtools/autogen/autogen/filesplit.py 
b/buildtools/autogen/autogen/filesplit.py
--- a/buildtools/autogen/autogen/filesplit.py
+++ b/buildtools/autogen/autogen/filesplit.py
@@ -13,7 +13,7 @@ def rsplit_filename(f):
         return f[:s], f[s+1:]
     return base, ext
 
-automake_ext = ['', 'c', 'cpp', 'def', 'h', 'lo', 'o', 'pm.c', 'tab.c', 
'tab.h', 'yy.c', 'pm.i']
+automake_ext = set(['', 'c', 'def', 'h', 'lo', 'o', 'tab.c', 'tab.h'])
 automake_extra_extensions = set([rsplit_filename(x)[1] for x in automake_ext 
if '.' in x])
 extra_extensions = ['in', 'bat', 'sed']
 
diff --git a/buildtools/autogen/autogen/msc.py 
b/buildtools/autogen/autogen/msc.py
--- a/buildtools/autogen/autogen/msc.py
+++ b/buildtools/autogen/autogen/msc.py
@@ -326,22 +326,21 @@ def msc_dep(fd, tar, deplist, msc):
         fd.write(getsrc)
         x, de = split_filename(deplist[0])
         of = b + '.' + de
-        fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
+        fd.write('\t$(BISON) -o %s.tmpc.c --defines=%s.tab.h $(YFLAGS) 
$(AM_YFLAGS) %s\n' % (b, b, of))
+        fd.write('\trm -f %s.tmpc.c\n' % b)
     elif ext == "tab.c":
         fd.write(getsrc)
         x, de = split_filename(deplist[0])
         of = b + '.' + de
-        fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
-    elif ext == "yy.c":
-        fd.write(getsrc)
-        fd.write('\t$(LEX) $(LFLAGS) $(AM_LFLAGS) "%s.l"\n' % b)
-    elif ext in ("obj", "tab.obj", "yy.obj"):
+        fd.write('\t$(BISON) -o %s.tab.c --defines=%s.tmph.h $(YFLAGS) 
$(AM_YFLAGS) %s\n' % (b, b, of))
+        fd.write('\trm -f %s.tmph.h\n' % b)
+    elif ext in ("obj", "tab.obj"):
         target, name = msc_find_target(tar, msc)
         if name[0] == '_':
             name = name[1:]
         if target == "LIB":
             d, dext = split_filename(deplist[0])
-            if dext in ("c", "cpp", "yy.c", "tab.c"):
+            if dext in ("c", "tab.c"):
                 fd.write('\t$(CC) /EHsc $(CFLAGS) $(%s_CFLAGS) $(GENDLL) 
-D_CRT_SECURE_NO_WARNINGS -DLIB%s "-Fo%s" -c "%s"\n' %
                          (split_filename(msc_basename(src))[0], name, t, src))
     elif ext == 'res':
@@ -569,8 +568,6 @@ def msc_binary(fd, var, binmap, msc):
             srcs = srcs + " " + t + ".obj"
         elif ext == "tab.o":
             srcs = srcs + " " + t + ".tab.obj"
-        elif ext == "yy.o":
-            srcs = srcs + " " + t + ".yy.obj"
         elif ext == 'def':
             srcs = srcs + ' ' + target
         elif ext == 'res':
@@ -665,8 +662,6 @@ def msc_bins(fd, var, binsmap, msc):
                     srcs = srcs + " " + t + ".obj"
                 elif ext == "tab.o":
                     srcs = srcs + " " + t + ".tab.obj"
-                elif ext == "yy.o":
-                    srcs = srcs + " " + t + ".yy.obj"
                 elif ext == 'res':
                     srcs = srcs + " " + t + ".res"
                 elif ext in hdrs_ext:
@@ -809,10 +804,6 @@ def msc_library(fd, var, libmap, msc):
                 srcs = srcs + " " + t + ".obj"
             elif ext == "tab.o":
                 srcs = srcs + " " + t + ".tab.obj"
-            elif ext == "yy.o":
-                srcs = srcs + " " + t + ".yy.obj"
-            elif ext == "pm.o":
-                srcs = srcs + " " + t + ".pm.obj"
             elif ext == 'res':
                 srcs = srcs + " " + t + ".res"
             elif ext in hdrs_ext:
diff --git a/buildtools/conf/rules.mk b/buildtools/conf/rules.mk
--- a/buildtools/conf/rules.mk
+++ b/buildtools/conf/rules.mk
@@ -10,30 +10,12 @@ CP=cp
 MV=mv
 
 %.tab.c: %.y
-       touch waiting.$$$$ && until ln waiting.$$$$ waiting 2>/dev/null; do 
sleep 1; done && rm waiting.$$$$
-       $(YACC) $(YFLAGS) $(AM_YFLAGS) $< || { $(RM) waiting ; exit 1 ; }
-       if [ -f y.tab.c ]; then $(MV) y.tab.c $*.tab.c ; fi
-       [ ! -f y.tab.h ] || $(RM) y.tab.h
-       $(RM) waiting
+       $(BISON) -o $*.tab.c --defines=$*.tmph.h $(YFLAGS) $(AM_YFLAGS) $<
+       rm -f $*.tmph.h
 
 %.tab.h: %.y
-       touch waiting.$$$$ && until ln waiting.$$$$ waiting 2>/dev/null; do 
sleep 1; done && rm waiting.$$$$
-       $(YACC) $(YFLAGS) $(AM_YFLAGS) $< || { $(RM) waiting ; exit 1 ; }
-       if [ -f y.tab.h ]; then $(MV) y.tab.h $*.tab.h ; fi
-       [ ! -f y.tab.c ] || $(RM) y.tab.c
-       $(RM) waiting
-
-%.yy.c: %.l
-       touch waiting.$$$$ && until ln waiting.$$$$ waiting 2>/dev/null; do 
sleep 1; done && rm waiting.$$$$
-       $(LEX) $(LFLAGS) $(AM_LFLAGS) $< || { $(RM) waiting ; exit 1 ; }
-       [ -f $*.yy.h ] && $(RM) $*.yy.h
-       $(RM) waiting
-
-%.yy.h: %.l
-       touch waiting.$$$$ && until ln waiting.$$$$ waiting 2>/dev/null; do 
sleep 1; done && rm waiting.$$$$
-       $(LEX) $(LFLAGS) $(AM_LFLAGS) $< || { $(RM) waiting ; exit 1 ; }
-       [ -f $*.yy.c ] && $(RM) $*.yy.c
-       $(RM) waiting
+       $(BISON) -o $*.tmpc.c --defines=$*.tab.h $(YFLAGS) $(AM_YFLAGS) $<
+       rm -f $*.tmpc.c
 
 %.def: %.syms
        case `(uname -s) 2> /dev/null || echo unknown` in CYGWIN*) cat $<;; *) 
sed '/DllMain/d;s/=.*//' $<;; esac > $@
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1113,25 +1113,7 @@ XPYTHON_LIBDIR=`$translatepath "$QPYTHON
 QXPYTHON_LIBDIR=`AS_ECHO(["$XPYTHON_LIBDIR"]) | sed 's/\\\\/\\\\\\\\/g'`
 AC_SUBST([QXPYTHON_LIBDIR])
 
-AC_PROG_YACC
-AS_CASE([$YACC],
-       [bison*],
-       [
-               # Ubuntu still comes with an ancient bison that uses defines
-               # without checking if they are defined.  This triggers a warning
-               # from gcc with -Wundef.  If we have a bison < 2.4.3, then
-               # disable the warning.
-               BISON_VER=`$YACC --version | head -n1 | sed -e 's/^.* //'`
-               AS_VERSION_COMPARE([$BISON_VER],
-                       [2.4.3],
-                       [X_CFLAGS=`AS_ECHO(["${X_CFLAGS}"]) | sed -e 
's/-Wundef//g'`])
-       ],
-       [
-               # in embedded mode, we ship the bison-generated files
-               AS_VAR_IF([enable_embedded], [no],
-                       [AC_MSG_ERROR([MonetDB/SQL requires bison])],
-                       [AC_MSG_WARN([ignoring missing bison in embedded 
configuration])])
-       ])
+AC_CHECK_PROG([BISON], [bison], [bison], [:])
 
 INSTALL_BACKUP=""
 AC_MSG_CHECKING([$INSTALL --backup option])
diff --git a/monetdb5/modules/atoms/strptime.c 
b/monetdb5/modules/atoms/strptime.c
--- a/monetdb5/modules/atoms/strptime.c
+++ b/monetdb5/modules/atoms/strptime.c
@@ -296,6 +296,22 @@ literal:
                                if (!(strptime_conv_num(&bp, &tm->tm_sec, 0, 
61)))
                                        return NULL;
                                break;
+                       case 's': /* number of seconds since epoch */
+                       LEGAL_ALT(ALT_O);
+                               {
+                                       time_t secs = 0;
+                                       if (*bp < '0' || *bp > '9') /* at least 
one digit */
+                                               return NULL;
+
+                                       do {
+                                               secs *= 10;
+                                               secs += *bp++ - '0';
+                                       } while (*bp >= '0' && *bp <= '9');
+
+                                       /* convert the number of seconds to tm 
structure */
+                                       if (localtime_s(tm, &secs))
+                                               return NULL;
+                               } break;
                        case 'U':       /* The week of year, beginning on 
sunday. */
                        case 'W':       /* The week of year, beginning on 
monday. */
                        LEGAL_ALT(ALT_O);
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -2795,9 +2795,13 @@ stmt_convert(backend *be, stmt *v, sql_s
                q = pushInt(mb, q, f->digits);
                q = pushInt(mb, q, f->scale);
                q = pushInt(mb, q, type_has_tz(f));
-       } else if (f->type->eclass == EC_DEC)
+       } else if (f->type->eclass == EC_DEC) {
                /* scale of the current decimal */
                q = pushInt(mb, q, f->scale);
+       } else if (f->type->eclass == EC_SEC && t->type->eclass == EC_FLT) {
+               /* scale of the current decimal */
+               q = pushInt(mb, q, 3);
+       }
        q = pushArgument(mb, q, v->nr);
        if (sel && v->nrcols && f->type->eclass != EC_DEC && 
!EC_TEMP_FRAC(t->type->eclass) && !EC_INTERVAL(t->type->eclass))
                q = pushArgument(mb, q, sel->nr);
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -111,7 +111,7 @@ static int convert_matrix[EC_MAX][EC_MAX
 /* EC_POS */   { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
 /* EC_NUM */   { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
 /* EC_MONTH*/   { 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0 },
-/* EC_SEC*/     { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0 },
+/* EC_SEC*/     { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0 },
 /* EC_DEC */   { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 },
 /* EC_FLT */   { 0, 0, 0, 1, 1, 0, 1, 1, 0, 3, 1, 1, 0, 0, 0, 0, 0 },
 /* EC_TIME */  { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 },
@@ -1665,7 +1665,7 @@ sqltypeinit( sql_allocator *sa)
        sql_create_aggr(sa, "avg", "aggr", "avg", FLT, DBL);
 
        sql_create_aggr(sa, "avg", "aggr", "avg", MONINT, DBL);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to