[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    MonetDB: sort-properties - Merge with default branch.
From:       Sjoerd Mullender <sjoerd () acm ! org>
Date:       2012-03-30 14:37:03
Message-ID: hg.af61abeba30f.1333118223.6315528441665844383 () monetdb2 ! cwi-incubator ! nl
[Download RAW message or body]

Changeset: af61abeba30f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af61abeba30f
Added Files:
	monetdb5/extras/jaql/jaqltree.h
Removed Files:
	monetdb5/extras/jaql/parser/force-jaql-yy-h-gen.c
Modified Files:
	NT/rules.msc
	buildtools/autogen/autogen/msc.py
	buildtools/conf/rules.mk
	clients/python/monetdb/mapi2.py
	gdk/gdk_calc.c
	gdk/gdk_ssort.mx
	monetdb5/extras/jaql/Makefile.ag
	monetdb5/extras/jaql/jaql.c
	monetdb5/extras/jaql/jaql.h
	monetdb5/extras/jaql/jaqlgencode.c
	monetdb5/extras/jaql/jaqlscenario.c
	monetdb5/extras/jaql/json.c
	monetdb5/extras/jaql/parser/Makefile.ag
	monetdb5/extras/jaql/parser/jaql.l
	monetdb5/extras/jaql/parser/jaql.y
	monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.sql
	monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out
	monetdb5/modules/mal/remote.c
	monetdb5/modules/mal/sample.c
	sql/backends/monet5/sql.mx
Branch: sort-properties
Log Message:

Merge with default branch.


diffs (truncated from 1079 to 300 lines):

diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -171,7 +171,8 @@ RUBY_DIR = lib\ruby\gems\1.9.1
 
 # install python, flex and bison on your systems 
 PYTHON = python
-YACC = bison -b y -y
+YACC = bison
+LEX = flex
 
 ARCHIVER = lib
 GENDLL =
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
@@ -349,25 +349,17 @@ def msc_dep(fd, tar, deplist, msc):
         of = b + '.' + de
         of = msc_translate_file(of, msc)
         fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
-        fd.write("\t$(DEL) y.tab.c\n")
-        fd.write('\t$(MV) y.tab.h "%s.tab.h"\n' % b)
+        fd.write("\t$(DEL) %s.tab.c\n" % b)
     if ext == "tab.c":
         fd.write(getsrc)
         x, de = split_filename(deplist[0])
         of = b + '.' + de
         of = msc_translate_file(of, msc)
         fd.write('\t$(YACC) $(YFLAGS) $(AM_YFLAGS) "%s"\n' % of)
-        fd.write('\t$(FILTER) $(FILTERPREF)"    ;" y.tab.c > "%s.tab.c"\n' % b)
-        fd.write("\t$(DEL) y.tab.h\n")
+        fd.write("\t$(DEL) %s.tab.h\n" % b)
     if ext == "yy.c":
         fd.write(getsrc)
         fd.write('\t$(LEX) $(LFLAGS) $(AM_LFLAGS) "%s.l"\n' % b)
-        # either lex.<name>.c or lex.yy.c or lex.$(PARSERNAME).c gets generated
-        fd.write('\tif exist lex.%s.c $(MV) lex.%s.c "%s.yy.c.tmp"\n' % (b,b,b))
-        fd.write('\tif exist lex.yy.c $(MV) lex.yy.c "%s.yy.c.tmp"\n' % b)
-        fd.write('\tif exist lex.$(PARSERNAME).c $(MV) lex.$(PARSERNAME).c "%s.yy.c.tmp"\n' % b)
-        fd.write('\techo #include "$(CONFIG_H)" > "%s.yy.c"\n' % b)
-        fd.write('\ttype "%s.yy.c.tmp" >> "%s.yy.c"\n' % (b, b))
     if ext in ("obj", "tab.obj", "yy.obj"):
         target, name = msc_find_target(tar, msc)
         if name[0] == '_':
diff --git a/buildtools/conf/rules.mk b/buildtools/conf/rules.mk
--- a/buildtools/conf/rules.mk
+++ b/buildtools/conf/rules.mk
@@ -22,17 +22,10 @@ MV=mv
 HIDE=1
 MX = $(top_builddir)/buildtools/Mx/Mx
 
-# in the next few rules, make sure that "$(CONFIG_H)" is included
-# first, also with bison-generated files.  This is crucial
-# to prevent inconsistent (re-)definitions of macros.
 %.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
-	$(MV) $*.tab.c $*.tab.c.tmp
-	echo '#include <'"$(CONFIG_H)"'>' > $*.tab.c
-	grep -v '^#include.*[<"]'"$(CONFIG_H)"'[">]' $*.tab.c.tmp >> $*.tab.c
-	$(RM) $*.tab.c.tmp
 	[ ! -f y.tab.h ] || $(RM) y.tab.h
 	$(RM) waiting
 
@@ -46,19 +39,13 @@ MX = $(top_builddir)/buildtools/Mx/Mx
 %.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 ; }
-	if [ -f $(LEX_OUTPUT_ROOT).c ]; then $(MV) $(LEX_OUTPUT_ROOT).c $*.yy.c ; fi
-	$(MV) $*.yy.c $*.yy.c.tmp
-	echo '#include <'"$(CONFIG_H)"'>' > $*.yy.c
-	grep -v '^#include.*[<"]'"$(CONFIG_H)"'[">]' $*.yy.c.tmp >> $*.yy.c
-	$(RM) $*.yy.c.tmp
-	[ -f $(LEX_OUTPUT_ROOT).h ] && $(RM) $(LEX_OUTPUT_ROOT).h
+	[ -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 ; }
-	if [ -f $(LEX_OUTPUT_ROOT).h ]; then $(MV) $(LEX_OUTPUT_ROOT).h $*.yy.h ; fi
-	[ -f $(LEX_OUTPUT_ROOT).c ] && $(RM) $(LEX_OUTPUT_ROOT).c
+	[ -f $*.yy.c ] && $(RM) $*.yy.c
 	$(RM) waiting
 
 %.def: %.syms
diff --git a/clients/python/monetdb/mapi2.py b/clients/python/monetdb/mapi2.py
--- a/clients/python/monetdb/mapi2.py
+++ b/clients/python/monetdb/mapi2.py
@@ -41,6 +41,7 @@ logger = logging.getLogger("monetdb")
 MAX_PACKAGE_LENGTH = (1024*8)-2
 
 MSG_PROMPT = ""
+MSG_MORE = "\1\2\n"
 MSG_INFO = "#"
 MSG_ERROR = "!"
 MSG_Q = "&"
@@ -159,6 +160,9 @@ class Server:
         response = self.__getblock()
         if not len(response):
             return
+        if response == MSG_MORE:
+            # tell server it isn't going to get more
+            return self.cmd("")
         if response[0] in [MSG_Q, MSG_HEADER, MSG_TUPLE]:
             return response
         elif response[0] == MSG_ERROR:
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -382,6 +382,10 @@ VARcalcnegate(ValPtr ret, const ValRecor
 	return GDK_SUCCEED;
 }
 
+#ifdef ABSOLUTE
+/* Windows seems to define this somewhere */
+#undef ABSOLUTE
+#endif
 #define ABSOLUTE(x)	((x) < 0 ? -(x) : (x))
 
 BAT *
@@ -4518,7 +4522,7 @@ VARcalcmul(ValPtr ret, const ValRecord *
 				dst[k] = TYPE3##_nil;			\
 				nils++;					\
 			} else {					\
-				dst[k] = (TYPE3) lft[i] / rgt[j];	\
+				dst[k] = (TYPE3) (lft[i] / rgt[j]);	\
 			}						\
 		}							\
 		return nils;						\
@@ -12932,7 +12936,7 @@ VARconvert(ValPtr ret, const ValRecord *
 			if (v->val.btval == bte_nil) {
 				ret->val.fval = flt_nil;
 			} else if (ret->vtype == TYPE_bit) {
-				ret->val.fval = (flt) v->val.btval != 0;
+				ret->val.fval = (flt) (v->val.btval != 0);
 			} else {
 				ret->val.fval = (flt) v->val.btval;
 			}
diff --git a/gdk/gdk_ssort.mx b/gdk/gdk_ssort.mx
--- a/gdk/gdk_ssort.mx
+++ b/gdk/gdk_ssort.mx
@@ -64,8 +64,8 @@ typedef struct {
 	   most 2 lng's, we don't need to allocate anything. */
 	void *th;
 	void *tt;
-	char tempstorageh[16];	/* 16 bytes should be wide enough ... */
-	char tempstoraget[16];	/* ... for all our fixed-sized data */
+	lng tempstorageh[2];	/* 16 bytes should be wide enough ... */
+	lng tempstoraget[2];	/* ... for all our fixed-sized data */
 
 	/* This controls when we get *into* galloping mode.  It's
 	   initialized to MIN_GALLOP.  merge_lo and merge_hi tend to
diff --git a/monetdb5/extras/jaql/Makefile.ag b/monetdb5/extras/jaql/Makefile.ag
--- a/monetdb5/extras/jaql/Makefile.ag
+++ b/monetdb5/extras/jaql/Makefile.ag
@@ -31,17 +31,23 @@ lib__json = {
 	DIR = libdir/monetdb5
 	SOURCES = json.c json.h
 
-	LIBS = ../../tools/libmonetdb5
+	LIBS = ../../tools/libmonetdb5 \
+		   ../../../gdk/libbat \
+		   ../../../common/stream/libstream \
+		   $(MALLOC_LIBS)
 }
 
 lib__jaql = {
 	MODULE
 	DIR = libdir/monetdb5
 	SOURCES = jaql.c jaql.h jaqlgencode.c jaqlgencode.h \
-			  jaqlscenario.c jaqlscenario.h
+			  jaqlscenario.c jaqlscenario.h jaqltree.h
 
 	# the ./ is necessary for autogen not to generate garbage
-	LIBS = ./parser/libjaqlp ../../tools/libmonetdb5
+	LIBS = lib_json ./parser/libjaqlp ../../tools/libmonetdb5 \
+		   ../../../gdk/libbat \
+		   ../../../common/stream/libstream \
+		   $(MALLOC_LIBS)
 }
 
 headers_json_mal = {
diff --git a/monetdb5/extras/jaql/jaql.c b/monetdb5/extras/jaql/jaql.c
--- a/monetdb5/extras/jaql/jaql.c
+++ b/monetdb5/extras/jaql/jaql.c
@@ -23,20 +23,17 @@
 
 #include "monetdb_config.h"
 #include "jaql.h"
+#include "mal_client.h"
 #include "jaqlgencode.h"
 #include "json.h"
 #include "gdk.h"
 #include "mal.h"
-#include "mal_client.h"
 #include "mal_exception.h"
 #include "stream.h"
 
-#include "parser/jaql.tab.h"
-#include "parser/jaql.yy.h"
-
 extern int jaqlparse(jc *j);
-void freetree(tree *j);
-str getJAQLContext(Client c, jc **j);
+extern int jaqllex_init_extra(jc *user_defined, void **scanner);
+extern int jaqllex_destroy(void *yyscanner);
 
 /* assign the output of action (a 1 or more stage pipe) to ident, if
  * ident is NULL, the result should be outputted to the screen, if
@@ -124,7 +121,7 @@ append_jaql_pipe(tree *oaction, tree *na
 
 /* recursive helper to check variable usages for validity */
 static tree *
-_check_exp_var(const char *func, const char **vars, tree *t)
+_check_exp_var(const char *func, char **vars, tree *t)
 {
 	tree *res = NULL;
 
@@ -132,7 +129,7 @@ _check_exp_var(const char *func, const c
 		return res;
 
 	if (t->type == j_var) {
-		const char **var;
+		char **var;
 		for (var = vars; *var != NULL; var++) {
 			if (strcmp(*var, t->sval) == 0)
 				break;
@@ -158,9 +155,9 @@ _check_exp_var(const char *func, const c
 	return res;
 }
 static tree *
-_check_exp_var1(const char *func, const char *var, tree *t)
+_check_exp_var1(const char *func, char *var, tree *t)
 {
-	const char *vars[] = {var, NULL};
+	char *vars[] = {var, NULL};
 	return _check_exp_var(func, vars, t);
 }
 
@@ -274,7 +271,7 @@ make_jaql_expand(tree *var, tree *expr)
 
 	if (expr->type == j_var && expr->next != NULL) {
 		/* JAQL's confusing "inner pipes" feature -- most probably to
-		 * steer Hadoop's map-reduce job generationi -- is just useless
+		 * steer Hadoop's map-reduce job generation -- is just useless
 		 * for us and actually making our life harder, so just pull out
 		 * this inner pipe, and make it a proper top-level pipe instead */
 		res->next = expr->next;
@@ -316,6 +313,7 @@ make_jaql_group(tree *inputs, tree *tmpl
 
 	if (tmpl->type == j_error) {
 		freetree(inputs);
+		freetree(var);
 		return tmpl;
 	}
 
@@ -323,7 +321,7 @@ make_jaql_group(tree *inputs, tree *tmpl
 
 	if (inputs != NULL) {
 		size_t i;
-		const char **vars;
+		char **vars;
 
 		/* when multiple inputs are given, the groupkeyvar must be for
 		 * each input the same, its expression may differ */
@@ -335,6 +333,7 @@ make_jaql_group(tree *inputs, tree *tmpl
 						"inputs must be equal");
 				freetree(inputs);
 				freetree(tmpl);
+				freetree(var);
 				return res;
 			}
 			if (strcmp(w->tval2->sval, var->sval) != 0) {
@@ -345,6 +344,7 @@ make_jaql_group(tree *inputs, tree *tmpl
 				res->sval = GDKstrdup(buf);
 				freetree(inputs);
 				freetree(tmpl);
+				freetree(var);
 				return res;
 			}
 		}
@@ -359,6 +359,7 @@ make_jaql_group(tree *inputs, tree *tmpl
 							"inputs must be unique (for use in 'into' expression)");
 					freetree(inputs);
 					freetree(tmpl);
+					freetree(var);
 					return res;
 				}
 			}
@@ -374,15 +375,19 @@ make_jaql_group(tree *inputs, tree *tmpl
 		if ((w = _check_exp_var("group", vars, tmpl)) != NULL) {
 			freetree(inputs);
 			freetree(tmpl);
+			GDKfree(vars);
 			return w;
 		}
+		GDKfree(vars);
 	} else {
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic