Changeset: 80e570d1d8c6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/80e570d1d8c6
Modified Files:
        sql/server/rel_optimize_proj.c
Branch: Sep2022
Log Message:

fix for bug 7342, the rel_simplify_groupby_columns optimizer had some issues 
with dangling
aliases within functions (ie can clearly be zapped as those aren't used within 
functions).


diffs (24 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -1618,6 +1618,8 @@ rel_simplify_groupby_columns(visitor *v,
                                                                                
        }
                                                                                
}
                                                                                
col = c; /* 'c' is a column reference from the left relation */
+                                                                               
if (col->type == e_column)
+                                                                               
        exp_setalias(col, col->l, col->r); /* zap alias */
                                                                                
done = true;
                                                                        } else {
                                                                                
exp = c; /* maybe a nested function call, let's continue searching */
@@ -3460,8 +3462,10 @@ rel_distinct_project2groupby_(visitor *v
 
                        set_nodistinct(e);
                        ne = exp_ref(v->sql, e);
-                       if (e->card > CARD_ATOM && !list_find_exp(gbe, ne)) /* 
no need to group by on constants, or the same column multiple times */
+                       if (e->card > CARD_ATOM && !list_find_exp(gbe, ne)) { 
/* no need to group by on constants, or the same column multiple times */
                                append(gbe, ne);
+                               ne = exp_ref(v->sql, ne);
+                       }
                        append(exps, ne);
                }
                rel->op = op_groupby;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to