Changeset: 07708b9c1670 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=07708b9c1670
Modified Files:
        monetdb5/extras/jaql/jaql.c
        monetdb5/extras/jaql/jaqltree.h
        monetdb5/extras/jaql/parser/jaql.l
        monetdb5/extras/jaql/parser/jaql.y
        monetdb5/mal/mal_authorize.c
        sql/server/rel_optimizer.c
Branch: default
Log Message:

Merged from Jul2012


diffs (177 lines):

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
@@ -1296,6 +1296,15 @@ make_bool(char b)
        return res;
 }
 
+tree *
+make_null(void)
+{
+       tree *res = GDKzalloc(sizeof(tree));
+       res->type = j_null;
+       
+       return res;
+}
+
 /* creates a function call, with the optional arguments given */
 tree *
 make_func_call(char *name, tree *args)
@@ -1786,6 +1795,9 @@ printtree(stream *out, tree *t, int leve
                        case j_bool:
                                mnstr_printf(out, "%s ", t->nval == 0 ? "false" 
: "true");
                                break;
+                       case j_null:
+                               mnstr_printf(out, "null ");
+                               break;
                        case j_func:
                                if (op) {
                                        mnstr_printf(out, "j_func( %s, ", 
t->sval);
diff --git a/monetdb5/extras/jaql/jaqltree.h b/monetdb5/extras/jaql/jaqltree.h
--- a/monetdb5/extras/jaql/jaqltree.h
+++ b/monetdb5/extras/jaql/jaqltree.h
@@ -57,6 +57,7 @@ enum treetype {
        j_func,
        j_pred,
        j_operation,
+       j_null,
        j_bool,
        j_num,
        j_dbl,
@@ -151,6 +152,7 @@ tree *make_number(long long int n);
 tree *make_double(double d);
 tree *make_string(char *s);
 tree *make_bool(char b);
+tree *make_null(void);
 tree *make_func_call(char *name, tree *args);
 tree *make_func_arg(tree *arg);
 tree *append_func_arg(tree *oarg, tree *narg);
diff --git a/monetdb5/extras/jaql/parser/jaql.l 
b/monetdb5/extras/jaql/parser/jaql.l
--- a/monetdb5/extras/jaql/parser/jaql.l
+++ b/monetdb5/extras/jaql/parser/jaql.l
@@ -1,3 +1,22 @@
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.monetdb.org/Legal/MonetDBLicense
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2012 MonetDB B.V.
+ * All Rights Reserved.
+ */
+
 %{
 #include <stdio.h>
 #include "jaql.tab.h"
@@ -117,6 +136,7 @@ and        return AND;
 or         return OR;
 true       return TRUE;
 false      return FALSE;
+null       return NIL;
 "."        return '.';
 ":"        return ':';
 ","        return ',';
diff --git a/monetdb5/extras/jaql/parser/jaql.y 
b/monetdb5/extras/jaql/parser/jaql.y
--- a/monetdb5/extras/jaql/parser/jaql.y
+++ b/monetdb5/extras/jaql/parser/jaql.y
@@ -1,3 +1,22 @@
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.monetdb.org/Legal/MonetDBLicense
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2012 MonetDB B.V.
+ * All Rights Reserved.
+ */
+
 %{
 #define _CRT_SECURE_NO_WARNINGS 1
 
@@ -41,7 +60,7 @@ jaql_import void GDKfree(const char *);
 %token EACH FILTER TRANSFORM EXPAND GROUP INTO BY AS JOIN WHERE IN
 %token SORT TOP DESC ASC EXPLAIN PLAN PLANF DEBUG UNROLL PRESERVE
 
-%token ARROW ASSIGN EQUALS NEQUAL TRUE FALSE
+%token ARROW ASSIGN EQUALS NEQUAL TRUE FALSE NIL
 %token GREATER GEQUAL LESS LEQUAL NOT AND OR
 
 %token <j_ident>  IDENT
@@ -293,6 +312,7 @@ literal: NUMBER      {$$ = make_number($
           | STRING      {$$ = make_string($1);}
           | TRUE        {$$ = make_bool(1);}
           | FALSE       {$$ = make_bool(0);}
+          | NIL         {$$ = make_null();}
           ;
 
 arith_op: '+'        {$$ = make_op(j_plus);}
diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c
--- a/monetdb5/mal/mal_authorize.c
+++ b/monetdb5/mal/mal_authorize.c
@@ -266,7 +266,7 @@ AUTHaddUser(oid *uid, Client *c, str *us
        BUN p;
        oid *id;
        str tmp;
-       str hash;
+       str hash = NULL;
        BATiter useri;
 
        rethrow("addUser", tmp, AUTHrequireAdmin(c));
@@ -452,7 +452,7 @@ str
 AUTHsetPassword(Client *c, str *username, str *passwd) {
        BUN p;
        str tmp;
-       str hash;
+       str hash = NULL;
        oid id;
        BATiter useri;
 
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
@@ -4686,11 +4686,14 @@ rel_use_index(int *changes, mvc *sql, sq
        if (is_select(rel->op) || is_join(rel->op)) {
                list *exps = NULL;
                sql_idx *i = find_index(sql->sa, rel, rel, &exps);
+               int left = 1;
 
                if (!i && is_join(rel->op))
                        i = find_index(sql->sa, rel, rel->l, &exps);
-               if (!i && is_join(rel->op))
+               if (!i && is_join(rel->op)) {
+                       left = 0;
                        i = find_index(sql->sa, rel, rel->r, &exps);
+               }
                        
                if (i) {
                        prop *p;
@@ -4700,6 +4703,11 @@ rel_use_index(int *changes, mvc *sql, sq
                        for( n = exps->h; n; n = n->next) { 
                                sql_exp *e = n->data;
 
+                               /* swapped ? */
+                               if (is_join(rel->op) && 
+                                        ((left && !rel_find_exp(rel->l, e->l)) 
||
+                                        (!left && !rel_find_exp(rel->r, 
e->l)))) 
+                                       n->data = e = exp_compare(sql->sa, 
e->r, e->l, cmp_equal);
                                p = find_prop(e->p, PROP_HASHCOL);
                                if (!p)
                                        e->p = p = prop_create(sql->sa, 
PROP_HASHCOL, e->p);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to