Changeset: 1f817dc828df for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1f817dc828df
Modified Files:
        sql/backends/monet5/rel_bin.c
Branch: Jul2021
Log Message:

Give preference for the first one encountered (helps removing unecessary 
bat.mirror calls)


diffs (35 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
@@ -308,18 +308,19 @@ statment_score(stmt *c)
 static stmt *
 bin_find_smallest_column(backend *be, stmt *sub)
 {
-       stmt *res = NULL;
-       int best_score = 0;
-
-       for (node *n = sub->op4.lval->h ; n ; n = n->next) {
-               stmt *c = n->data;
-               int next_score = statment_score(c);
-
-               if (next_score >= best_score) {
-                       res = c;
-                       best_score = next_score;
-               }
-       }
+       stmt *res = sub->op4.lval->h->data;
+       int best_score = statment_score(sub->op4.lval->h->data);
+
+       if (sub->op4.lval->h->next)
+               for (node *n = sub->op4.lval->h->next ; n ; n = n->next) {
+                       stmt *c = n->data;
+                       int next_score = statment_score(c);
+
+                       if (next_score > best_score) {
+                               res = c;
+                               best_score = next_score;
+                       }
+               }
        if (res->nrcols == 0)
                return const_column(be, res);
        return res;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to