Changeset: 097a1facd950 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=097a1facd950
Modified Files:
        sql/server/rel_dump.c
        sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py
        sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out
Branch: Jun2020
Log Message:

Find analytic functions at rel_read and use all input types to find an aggregate


diffs (68 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -1027,12 +1027,16 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
                if (tname && !s)
                        return sql_error(sql, -1, SQLSTATE(42000) "Schema %s 
not found\n", tname);
                if (grp) {
-                       if (exps && exps->h)
-                               a = sql_bind_func(sql->sa, s, cname, 
exp_subtype(exps->h->data), NULL, F_AGGR);
-                       else
+                       if (exps && exps->h) {
+                               list *ops = sa_list(sql->sa);
+                               for( n = exps->h; n; n = n->next)
+                                       append(ops, exp_subtype(n->data));
+                               a = sql_bind_func_(sql->sa, s, cname, ops, 
F_AGGR);
+                       } else {
                                a = sql_bind_func(sql->sa, s, cname, 
sql_bind_localtype("void"), NULL, F_AGGR); /* count(*) */
+                       }
                        if (!a)
-                               return sql_error(sql, -1, SQLSTATE(42000) 
"Aggregate %s%s%s not found\n", tname ? tname : "", tname ? "." : "", cname);
+                               return sql_error(sql, -1, SQLSTATE(42000) 
"Aggregate '%s%s%s %d' not found\n", tname ? tname : "", tname ? "." : "", 
cname, list_length(exps));
                        exp = exp_aggr( sql->sa, exps, a, unique, no_nils, 
CARD_ATOM, 1);
                        if (zero_if_empty)
                                set_zero_if_empty(exp);
@@ -1041,6 +1045,8 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
                        for( n = exps->h; n; n = n->next)
                                append(ops, exp_subtype(n->data));
                        f = sql_bind_func_(sql->sa, s, cname, ops, F_FUNC);
+                       if (!f)
+                               f = sql_bind_func_(sql->sa, s, cname, ops, 
F_ANALYTIC);
 
                        /* fix scale of mul function, other type casts are 
explicit */
                        if (f && f->func->fix_scale == SCALE_MUL && 
list_length(exps) == 2) {
@@ -1071,7 +1077,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
                        if (f)
                                exp = exp_op( sql->sa, exps, f);
                        else
-                               return sql_error(sql, -1, SQLSTATE(42000) 
"Function: missing '%s.%s %d'\n", tname, cname, list_length(ops));
+                               return sql_error(sql, -1, SQLSTATE(42000) 
"Function '%s%s%s %d' not found\n", tname ? tname : "", tname ? "." : "", 
cname, list_length(ops));
                }
        }
 
diff --git a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py 
b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py
--- a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py
+++ b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py
@@ -53,6 +53,10 @@ with tempfile.TemporaryDirectory() as fa
             print(node2_cur.fetchall())
             node2_cur.execute("select * from remote_data where name like 'N%'")
             print(node2_cur.fetchall())
+            node2_cur.execute("select rank() over () from remote_data where 
name like 'N%'")
+            print(node2_cur.fetchall())
+            node2_cur.execute("select name like 'N%' from remote_data")
+            print(node2_cur.fetchall())
 
             # cleanup: shutdown the monetdb servers and remove tempdir
             out, err = node1_proc.communicate()
diff --git 
a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out 
b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out
--- a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out
+++ b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out
@@ -9,6 +9,8 @@ stdout of test 'remote-table-like.Bug-66
 [(1, 'Name 1')]
 [(1, 'Name 1')]
 [(1, 'Name 1')]
+[(1,)]
+[(True,)]
 
 # 10:29:37 >  
 # 10:29:37 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to