Changeset: 7b069f173715 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7b069f173715
Modified Files:
        gdk/gdk_aggr.c
        gdk/gdk_bat.c
        sql/backends/monet5/sql_fround_impl.h
        sql/backends/monet5/sql_round_impl.h
        sql/storage/bat/bat_utils.c
Branch: Mar2018
Log Message:

No need to call BAThseqbase after COLnew.


diffs (125 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2772,7 +2772,7 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e,
                        /* singleton groups, so calculating quantile is
                         * easy */
                        bn = COLcopy(b, tp, 0, TRANSIENT);
-                       BAThseqbase(bn, g->tseqbase);
+                       BAThseqbase(bn, g->tseqbase); /* deals with NULL */
                        if (freeb)
                                BBPunfix(b->batCacheid);
                        if (freeg)
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -713,7 +713,7 @@ COLcopy(BAT *b, int tt, int writable, in
                                bunstocopy = cnt;
                }
 
-               bn = COLnew(0, tt, MAX(1, bunstocopy == BUN_NONE ? 0 : 
bunstocopy), role);
+               bn = COLnew(b->hseqbase, tt, MAX(1, bunstocopy == BUN_NONE ? 0 
: bunstocopy), role);
                if (bn == NULL)
                        return NULL;
 
@@ -796,7 +796,6 @@ COLcopy(BAT *b, int tt, int writable, in
                BATsetcount(bn, cnt);
        }
        /* set properties (note that types may have changed in the copy) */
-       BAThseqbase(bn, b->hseqbase);
        if (ATOMtype(tt) == ATOMtype(b->ttype)) {
                if (BATtvoid(b)) {
                        /* b is either dense or has a void(nil) tail */
diff --git a/sql/backends/monet5/sql_fround_impl.h 
b/sql/backends/monet5/sql_fround_impl.h
--- a/sql/backends/monet5/sql_fround_impl.h
+++ b/sql/backends/monet5/sql_fround_impl.h
@@ -68,7 +68,7 @@ bat_dec_round_wrap(bat *_res, const bat 
        cnt = BATcount(v);
 
        /* allocate result BAT */
-       res = COLnew(0, TPE(TYPE), cnt, TRANSIENT);
+       res = COLnew(v->hseqbase, TPE(TYPE), cnt, TRANSIENT);
        if (res == NULL) {
                BBPunfix(v->batCacheid);
                throw(MAL, "round", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -95,8 +95,6 @@ bat_dec_round_wrap(bat *_res, const bat 
 
        /* set result BAT properties */
        BATsetcount(res, cnt);
-       /* result head is aligned with argument head */
-       BAThseqbase(res, v->hseqbase);
        /* hard to predict correct tail properties in general */
        res->tnonil = nonil;
        res->tnil = !nonil;
@@ -180,7 +178,7 @@ bat_round_wrap(bat *_res, const bat *_v,
        cnt = BATcount(v);
 
        /* allocate result BAT */
-       res = COLnew(0, TPE(TYPE), cnt, TRANSIENT);
+       res = COLnew(v->hseqbase, TPE(TYPE), cnt, TRANSIENT);
        if (res == NULL) {
                BBPunfix(v->batCacheid);
                throw(MAL, "round", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -207,8 +205,6 @@ bat_round_wrap(bat *_res, const bat *_v,
 
        /* set result BAT properties */
        BATsetcount(res, cnt);
-       /* result head is aligned with argument head */
-       BAThseqbase(res, v->hseqbase);
        /* hard to predict correct tail properties in general */
        res->tnonil = nonil;
        res->tnil = !nonil;
diff --git a/sql/backends/monet5/sql_round_impl.h 
b/sql/backends/monet5/sql_round_impl.h
--- a/sql/backends/monet5/sql_round_impl.h
+++ b/sql/backends/monet5/sql_round_impl.h
@@ -81,7 +81,7 @@ bat_dec_round_wrap(bat *_res, const bat 
        cnt = BATcount(v);
 
        /* allocate result BAT */
-       res = COLnew(0, TPE(TYPE), cnt, TRANSIENT);
+       res = COLnew(v->hseqbase, TPE(TYPE), cnt, TRANSIENT);
        if (res == NULL) {
                BBPunfix(v->batCacheid);
                throw(MAL, "round", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -108,8 +108,6 @@ bat_dec_round_wrap(bat *_res, const bat 
 
        /* set result BAT properties */
        BATsetcount(res, cnt);
-       /* result head is aligned with argument head */
-       BAThseqbase(res, v->hseqbase);
        /* hard to predict correct tail properties in general */
        res->tnonil = nonil;
        res->tnil = !nonil;
@@ -210,7 +208,7 @@ bat_round_wrap(bat *_res, const bat *_v,
        cnt = BATcount(v);
 
        /* allocate result BAT */
-       res = COLnew(0, TPE(TYPE), cnt, TRANSIENT);
+       res = COLnew(v->hseqbase, TPE(TYPE), cnt, TRANSIENT);
        if (res == NULL) {
                BBPunfix(v->batCacheid);
                throw(MAL, "round", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -237,8 +235,6 @@ bat_round_wrap(bat *_res, const bat *_v,
 
        /* set result BAT properties */
        BATsetcount(res, cnt);
-       /* result head is aligned with argument head */
-       BAThseqbase(res, v->hseqbase);
        /* hard to predict correct tail properties in general */
        res->tnonil = nonil;
        res->tnil = !nonil;
diff --git a/sql/storage/bat/bat_utils.c b/sql/storage/bat/bat_utils.c
--- a/sql/storage/bat/bat_utils.c
+++ b/sql/storage/bat/bat_utils.c
@@ -20,10 +20,7 @@ bat_destroy(BAT *b)
 BAT *
 bat_new(int tt, BUN size, int role)
 {
-       BAT *bn = COLnew(0, tt, size, role);
-       if (bn)
-               BAThseqbase(bn, 0);
-       return bn;
+       return COLnew(0, tt, size, role);
 }
 
 BAT *
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to