Changeset: 71a80133d806 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=71a80133d806 Modified Files: sql/server/rel_select.c sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out sql/test/BugTracker-2020/Tests/window-order-by-extract.Bug-6828.stable.out sql/test/analytics/Tests/analytics02.stable.out Branch: linear-hashing Log Message:
Fix for bug 6828, ie make sure window function call parameters have labels diffs (truncated from 1381 to 300 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -4471,6 +4471,8 @@ calculate_window_bound(sql_query *query, } } } + if (res && !exp_name(res)) + exp_label(sql->sa, res, ++sql->label); return res; } @@ -4662,6 +4664,8 @@ rel_rankop(sql_query *query, sql_rel **r GDKfree(uaname); return NULL; } + if (!exp_name(in)) + exp_label(sql->sa, in, ++sql->label); if (is_ntile && nfargs == 1) { /* ntile first argument null handling case */ sql_subtype *empty = sql_bind_localtype("void"); if (subtype_cmp(exp_subtype(in), empty) == 0) { @@ -4717,6 +4721,8 @@ rel_rankop(sql_query *query, sql_rel **r GDKfree(uaname); return NULL; } + if (!exp_name(in)) + exp_label(sql->sa, in, ++sql->label); append(fargs, in); if (strcmp(s->base.name, "sys") == 0 && strcmp(aname, "count") == 0) { @@ -4745,6 +4751,8 @@ rel_rankop(sql_query *query, sql_rel **r if (!exp_subtype(e)) return sql_error(sql, 02, SQLSTATE(42000) "SELECT: parameters not allowed at PARTITION BY clause from window functions"); + if (!exp_name(e)) + exp_label(sql->sa, e, ++sql->label); e = exp_copy(sql, e); args = sa_list(sql->sa); @@ -4762,6 +4770,8 @@ rel_rankop(sql_query *query, sql_rel **r } else { pe = exp_atom_bool(sql->sa, 0); } + if (pe && !exp_name(pe)) + exp_label(sql->sa, pe, ++sql->label); /* diff for orderby */ if (obe) { sql_subtype *bt = sql_bind_localtype("bit"); @@ -4772,6 +4782,8 @@ rel_rankop(sql_query *query, sql_rel **r if (!exp_subtype(e)) return sql_error(sql, 02, SQLSTATE(42000) "SELECT: parameters not allowed at ORDER BY clause from window functions"); + if (!exp_name(e)) + exp_label(sql->sa, e, ++sql->label); e = exp_copy(sql, e); args = sa_list(sql->sa); @@ -4789,6 +4801,8 @@ rel_rankop(sql_query *query, sql_rel **r } else { oe = exp_atom_bool(sql->sa, 0); } + if (oe && !exp_name(oe)) + exp_label(sql->sa, oe, ++sql->label); if (frame_clause || supports_frames) ie = exp_copy(sql, obe ? (sql_exp*) obe->t->data : in); @@ -4858,6 +4872,11 @@ rel_rankop(sql_query *query, sql_rel **r if (!obe) frame_type = FRAME_ALL; + if (fstart && !exp_name(fstart)) + exp_label(sql->sa, fstart, ++sql->label); + if (fend && !exp_name(fend)) + exp_label(sql->sa, fend, ++sql->label); + if (generate_window_bound_call(sql, &start, &eend, s, gbe ? pe : NULL, ie, fstart, fend, frame_type, EXCLUDE_NONE, SQL_PRECEDING, SQL_FOLLOWING) == NULL) return NULL; @@ -4865,6 +4884,10 @@ rel_rankop(sql_query *query, sql_rel **r if (!pe || !oe) return NULL; + if (start && !exp_name(start)) + exp_label(sql->sa, start, ++sql->label); + if (eend && !exp_name(eend)) + exp_label(sql->sa, eend, ++sql->label); if (!supports_frames) { append(fargs, pe); @@ -4906,6 +4929,8 @@ rel_rankop(sql_query *query, sql_rel **r append(args, eend); } call = exp_rank_op(sql->sa, args, gbe, obe, wf); + if (call && !exp_name(call)) + exp_label(sql->sa, call, ++sql->label); *rel = p; return call; } diff --git a/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out b/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out --- a/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out +++ b/sql/test/BugTracker-2018/Tests/count_from_commented_function_signatures.Bug-6542.stable.out @@ -83,7 +83,7 @@ stdout of test 'count_from_commented_fun % .plan # table_name % rel # name % clob # type -% 150 # length +% 157 # length project ( | group by ( | | project ( @@ -118,14 +118,14 @@ project ( | | | | | | | ) [ "f"."id", "p"."number" ] [ "f"."id" ASC, "p"."number" NULLS LAST ] | | | | | | ) [ "f"."id", "p"."number" ] | | | | | ) [ "f"."id", "p"."number" ] [ "f"."id" ASC, "p"."number" ASC ] -| | | | ) [ "f"."id", sys.row_number("f"."id", boolean "false", sys.diff(sys.diff("f"."id" ASC), "p"."number" ASC)) as "line" ] +| | | | ) [ "f"."id", sys.row_number("f"."id", boolean "false" as "%17"."%17", sys.diff(sys.diff("f"."id" ASC), "p"."number" ASC) as "%20"."%20") as "line" ] | | | ) [ "f"."id" as "fid", "line" ] | | ) [ "fid" as "commented_function_signatures_6542"."fid" ] [ "line" ASC ] -| ) [ ] [ sys.count() NOT NULL as "%12"."%12" ] -) [ "%12"."%12" NOT NULL ] +| ) [ ] [ sys.count() NOT NULL as "%23"."%23" ] +) [ "%23"."%23" NOT NULL ] #select count (*) from sys.commented_function_signatures_6542; -% .%12 # table_name -% %12 # name +% .%23 # table_name +% %23 # name % bigint # type % 1 # length [ 0 ] diff --git a/sql/test/BugTracker-2020/Tests/window-order-by-extract.Bug-6828.stable.out b/sql/test/BugTracker-2020/Tests/window-order-by-extract.Bug-6828.stable.out --- a/sql/test/BugTracker-2020/Tests/window-order-by-extract.Bug-6828.stable.out +++ b/sql/test/BugTracker-2020/Tests/window-order-by-extract.Bug-6828.stable.out @@ -77,7 +77,7 @@ stdout of test 'window-order-by-extract. # ('sls', 'Wilson',72,str_to_date('21-09-2019', '%d-%m-%Y')), [ 10 ] #SELECT dep, name, salary, SUM(salary) OVER (ORDER BY EXTRACT(MONTH FROM hire_date)) salary_sum FROM employees; -% sys.employees, sys.employees, sys.employees, sys.L5 # table_name +% sys.employees, sys.employees, sys.employees, sys. # table_name % dep, name, salary, salary_sum # name % varchar, varchar, double, double # type % 4, 8, 24, 24 # length @@ -92,7 +92,7 @@ stdout of test 'window-order-by-extract. [ "sls", "Evans", 87, 730 ] [ "sls", "Wilson", 72, 730 ] #SELECT dep, name, salary, SUM(salary) OVER (ORDER BY hire_date) salary_sum FROM employees; -% sys.employees, sys.employees, sys.employees, sys.L4 # table_name +% sys.employees, sys.employees, sys.employees, sys. # table_name % dep, name, salary, salary_sum # name % varchar, varchar, double, double # type % 4, 8, 24, 24 # length @@ -107,7 +107,7 @@ stdout of test 'window-order-by-extract. [ "sls", "Evans", 87, 658 ] [ "sls", "Wilson", 72, 730 ] #SELECT dep, name, salary, SUM(salary) OVER (PARTITION BY dep ORDER BY EXTRACT(MONTH FROM hire_date)) salary_sum FROM employees; -% sys.employees, sys.employees, sys.employees, sys.L5 # table_name +% sys.employees, sys.employees, sys.employees, sys. # table_name % dep, name, salary, salary_sum # name % varchar, varchar, double, double # type % 4, 8, 24, 24 # length diff --git a/sql/test/analytics/Tests/analytics02.stable.out b/sql/test/analytics/Tests/analytics02.stable.out --- a/sql/test/analytics/Tests/analytics02.stable.out +++ b/sql/test/analytics/Tests/analytics02.stable.out @@ -35,12 +35,12 @@ stdout of test 'analytics02` in director % .prepare, .prepare, .prepare, .prepare, .prepare, .prepare # table_name % type, digits, scale, schema, table, column # name % varchar, int, int, str, str, str # type -% 6, 3, 1, 0, 2, 2 # length -[ "bigint", 64, 0, "", "%2", "%2" ] +% 6, 3, 1, 0, 3, 3 # length +[ "bigint", 64, 0, "", "%10", "%10" ] [ "bigint", 64, 0, NULL, NULL, NULL ] #exec 11(2); -% sys. # table_name -% %2 # name +% sys.%10 # table_name +% %10 # name % bigint # type % 1 # length [ 1 ] @@ -59,11 +59,11 @@ stdout of test 'analytics02` in director % type, digits, scale, schema, table, column # name % varchar, int, int, str, str, str # type % 7, 2, 1, 0, 2, 2 # length -[ "varchar", 0, 0, "", "%1", "%1" ] +[ "varchar", 0, 0, "", "%7", "%7" ] [ "bigint", 64, 0, NULL, NULL, NULL ] #exec 13(2); -% sys. # table_name -% %1 # name +% sys.%7 # table_name +% %7 # name % varchar # type % 6 # length [ "stress" ] @@ -76,8 +76,8 @@ stdout of test 'analytics02` in director [ "stress" ] [ "please" ] #select cast(sum(aa) over (rows between 5 preceding and 0 following) as bigint) from analytics; -% sys. # table_name -% %1 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 2 # length [ 15 ] @@ -91,8 +91,8 @@ stdout of test 'analytics02` in director [ 26 ] [ 21 ] #select cast(sum(aa) over (rows between 5 preceding and 2 following) as bigint) from analytics; -% sys. # table_name -% %1 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 2 # length [ 20 ] @@ -106,8 +106,8 @@ stdout of test 'analytics02` in director [ 26 ] [ 21 ] #select cast(sum(aa) over (partition by bb order by bb rows between 5 preceding and 0 following) as bigint) from analytics; -% sys.%3 # table_name -% %3 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 2 # length [ 3 ] @@ -121,8 +121,8 @@ stdout of test 'analytics02` in director [ 26 ] [ NULL ] #select cast(sum(aa) over (partition by bb order by bb rows between 5 preceding and 2 following) as bigint) from analytics; -% sys.%3 # table_name -% %3 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 2 # length [ 9 ] @@ -136,8 +136,8 @@ stdout of test 'analytics02` in director [ 26 ] [ NULL ] #select cast(prod(aa) over (rows between 5 preceding and 0 following) as bigint) from analytics; -% sys. # table_name -% %1 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 4 # length [ 15 ] @@ -151,8 +151,8 @@ stdout of test 'analytics02` in director [ 2880 ] [ 576 ] #select cast(prod(aa) over (rows between 5 preceding and 2 following) as bigint) from analytics; -% sys. # table_name -% %1 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 5 # length [ 90 ] @@ -166,8 +166,8 @@ stdout of test 'analytics02` in director [ 2880 ] [ 576 ] #select cast(prod(aa) over (partition by bb order by bb rows between 5 preceding and 0 following) as bigint) from analytics; -% sys.%3 # table_name -% %3 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 3 # length [ 3 ] @@ -181,8 +181,8 @@ stdout of test 'analytics02` in director [ 450 ] [ NULL ] #select cast(prod(aa) over (partition by bb order by bb rows between 5 preceding and 2 following) as bigint) from analytics; -% sys.%3 # table_name -% %3 # name +% sys.%7 # table_name +% %7 # name % bigint # type % 3 # length [ 24 ] @@ -196,8 +196,8 @@ stdout of test 'analytics02` in director [ 450 ] [ NULL ] #select avg(aa) over (rows between 5 preceding and 0 following) from analytics; -% sys. # table_name -% %1 # name +% sys.%7 # table_name +% %7 # name % double # type % 24 # length [ 15 ] @@ -211,8 +211,8 @@ stdout of test 'analytics02` in director [ 5.2 ] [ 5.25 ] #select avg(aa) over (rows between 5 preceding and 2 following) from analytics; -% sys. # table_name -% %1 # name _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list