Changeset: 145eb51696db for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=145eb51696db
Modified Files:
        clients/mapiclient/mclient.c
        sql/benchmarks/tpcds/Tests/check1.stable.out
        sql/server/rel_optimizer.c
        sql/test/merge-partitions/Tests/mergepart28.stable.out
        sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128
Branch: default
Log Message:

Merge with Apr2019 branch.


diffs (truncated from 403 to 300 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1461,10 +1461,14 @@ SQLrenderer(MapiHdl hdl)
        rest = calloc(fields, sizeof(*rest));
        numeric = calloc(fields, sizeof(*numeric));
        if (len == NULL || hdr == NULL || rest == NULL || numeric == NULL) {
-               free(len);
-               free(hdr);
-               free(rest);
-               free(numeric);
+               if (len)
+                       free(len);
+               if (hdr)
+                       free(hdr);
+               if (rest)
+                       free(rest);
+               if (numeric)
+                       free(numeric);
                fprintf(stderr,"Malloc for SQLrenderer failed");
                exit(2);
        }
diff --git a/sql/benchmarks/tpcds/Tests/check1.stable.out 
b/sql/benchmarks/tpcds/Tests/check1.stable.out
--- a/sql/benchmarks/tpcds/Tests/check1.stable.out
+++ b/sql/benchmarks/tpcds/Tests/check1.stable.out
@@ -26,151 +26,151 @@ Ready.
 
 #start transaction;
 #select count(*) from dbgen_version;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 1 # length
 [ 1    ]
 #select count(*) from customer_address;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 5 # length
 [ 50000        ]
 #select count(*) from customer_demographics;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 7 # length
 [ 1920800      ]
 #select count(*) from date_dim;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 5 # length
 [ 73049        ]
 #select count(*) from warehouse;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 1 # length
 [ 5    ]
 #select count(*) from ship_mode;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
 [ 20   ]
 #select count(*) from time_dim;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 5 # length
 [ 86400        ]
 #select count(*) from reason;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
 [ 35   ]
 #select count(*) from income_band;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
 [ 20   ]
 #select count(*) from item;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 5 # length
 [ 18000        ]
 #select count(*) from store;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
 [ 12   ]
 #select count(*) from call_center;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 1 # length
 [ 6    ]
 #select count(*) from customer;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 6 # length
 [ 100000       ]
 #select count(*) from web_site;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
 [ 30   ]
 #select count(*) from store_returns;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 6 # length
 [ 287514       ]
 #select count(*) from household_demographics;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 4 # length
 [ 7200 ]
 #select count(*) from web_page;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
 [ 60   ]
 #select count(*) from promotion;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 3 # length
 [ 300  ]
 #select count(*) from catalog_page;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 5 # length
 [ 11718        ]
 #select count(*) from inventory;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 8 # length
 [ 11745000     ]
 #select count(*) from catalog_returns;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 6 # length
 [ 144067       ]
 #select count(*) from web_returns;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 5 # length
 [ 71763        ]
 #select count(*) from web_sales;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 6 # length
 [ 719384       ]
 #select count(*) from catalog_sales;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 7 # length
 [ 1441548      ]
 #select count(*) from store_sales;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 7 # length
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -3971,6 +3971,29 @@ rel_push_aggr_down(int *changes, mvc *sq
        return rel;
 }
 
+static int
+rel_is_join_on_pkey( sql_rel *rel ) 
+{
+       node *n;
+
+       if (!rel || !rel->exps)
+               return 0;
+       for (n = rel->exps->h; n; n = n->next){
+               sql_exp *je = n->data;
+
+               if (je->type == e_cmp && je->flag == cmp_equal &&
+                   find_prop(((sql_exp*)je->l)->p, PROP_HASHCOL)) { /* aligned 
PKEY JOIN */
+                       fcmp cmp = (fcmp)&kc_column_cmp;
+                       sql_exp *e = je->l;
+                       sql_column *c = exp_find_column(rel, e, -2);
+
+                       if (c && c->t->pkey && list_find(c->t->pkey->k.columns, 
c, cmp) != NULL) 
+                               return 1;
+               }
+       }
+       return 0;
+}
+
 /*
  * More general 
  *     groupby(
@@ -4023,7 +4046,9 @@ gen_push_groupby_down(int *changes, mvc 
                        return rel;
                }
 
-               if ((left && is_base(jl->op)) || (!left && is_base(jr->op)))
+               if ((left && is_base(jl->op)) || (!left && is_base(jr->op))||
+                   (left && is_select(jl->op)) || (!left && is_select(jr->op)) 
+                   || rel_is_join_on_pkey(j))
                        return rel;
 
                /* only add aggr (based on left/right), and repeat the group by 
column */
@@ -4622,29 +4647,6 @@ rel_push_semijoin_down(int *changes, mvc
 }
 
 static int
-rel_is_join_on_pkey( sql_rel *rel ) 
-{
-       node *n;
-
-       if (!rel || !rel->exps)
-               return 0;
-       for (n = rel->exps->h; n; n = n->next){
-               sql_exp *je = n->data;
-
-               if (je->type == e_cmp && je->flag == cmp_equal &&
-                   find_prop(((sql_exp*)je->l)->p, PROP_HASHCOL)) { /* aligned 
PKEY JOIN */
-                       fcmp cmp = (fcmp)&kc_column_cmp;
-                       sql_exp *e = je->l;
-                       sql_column *c = exp_find_column(rel, e, -2);
-
-                       if (c && c->t->p && list_find(c->t->pkey->k.columns, c, 
cmp) != NULL) 
-                               return 1;
-               }
-       }
-       return 0;
-}
-
-static int
 rel_part_nr( sql_rel *rel, sql_exp *e )
 {
        sql_column *c;
diff --git a/sql/test/merge-partitions/Tests/mergepart28.stable.out 
b/sql/test/merge-partitions/Tests/mergepart28.stable.out
--- a/sql/test/merge-partitions/Tests/mergepart28.stable.out
+++ b/sql/test/merge-partitions/Tests/mergepart28.stable.out
@@ -81,13 +81,13 @@ Ready.
 % 4 # length
 [ 1347 ]
 #SELECT COUNT(*) FROM subt1;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 4 # length
 [ 1322 ]
 #SELECT COUNT(*) FROM subt2;
-% sys.L3 # table_name
+% .L3 # table_name
 % L3 # name
 % bigint # type
 % 2 # length
diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -6185,7 +6185,7 @@ Ready.
 # 16:02:38 >  
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to