Changeset: a94cf6d20ea1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a94cf6d20ea1
Modified Files:
        sql/server/rel_distribute.c
Branch: default
Log Message:

Fixes the REMOTE property value (remote uri instead of local name)


diffs (40 lines):

diff --git a/sql/server/rel_distribute.c b/sql/server/rel_distribute.c
--- a/sql/server/rel_distribute.c
+++ b/sql/server/rel_distribute.c
@@ -12,6 +12,7 @@
 #include "rel_optimizer_private.h"
 #include "rel_basetable.h"
 #include "rel_exp.h"
+#include "rel_remote.h"
 #include "sql_privileges.h"
 
 static int
@@ -219,12 +220,17 @@ rel_rewrite_remote_(visitor *v, sql_rel 
        case op_basetable: {
                sql_table *t = rel->l;
 
-               /* set_remote() */
+               /* when a basetable wraps a sql_table (->l) which is remote we 
want to store its remote
+                * uri to the REMOTE property. As the property is pulled up the 
tree it can be used in
+                * the case of binary rel operators (see later switch cases) in 
order to
+                * 1. resolve properly (same uri) replica tables in the other 
subtree (that's why we
+                *    call the rewrite_replica)
+                * 2. pull REMOTE over the binary op if the other subtree has a 
matching uri remote table
+                */
                if (t && isRemote(t) && (p = find_prop(rel->p, PROP_REMOTE)) == 
NULL) {
-                       char *local_name = sa_strconcat(v->sql->sa, 
sa_strconcat(v->sql->sa, t->s->base.name, "."), t->base.name);
                        p = rel->p = prop_create(v->sql->sa, PROP_REMOTE, 
rel->p);
                        p->id = t->base.id;
-                       p->value.pval = local_name;
+                       p->value.pval = (void *)mapiuri_uri(t->query, 
v->sql->sa);
                }
        } break;
        case op_table:
@@ -290,6 +296,7 @@ rel_rewrite_remote_(visitor *v, sql_rel 
                if (rel->flag&MERGE_LEFT) /* search for any remote tables but 
don't propagate over to this relation */
                        return rel;
 
+               /* if both subtrees have the REMOTE property with the same uri 
then pull it up */
                if (l && (pl = find_prop(l->p, PROP_REMOTE)) != NULL &&
                        r && (pr = find_prop(r->p, PROP_REMOTE)) != NULL &&
                        strcmp(pl->value.pval, pr->value.pval) == 0) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to