Changeset: 1dd391b82899 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1dd391b82899
Modified Files:
        sql/backends/monet5/sql_statistics.c
        sql/storage/bat/bat_storage.c
Branch: Jan2022
Log Message:

Use min/max positions from iterator


diffs (41 lines):

diff --git a/sql/backends/monet5/sql_statistics.c 
b/sql/backends/monet5/sql_statistics.c
--- a/sql/backends/monet5/sql_statistics.c
+++ b/sql/backends/monet5/sql_statistics.c
@@ -329,8 +329,8 @@ sql_statistics(Client cntxt, MalBlkPtr m
                                                        }
 
                                                        BATiter bi = 
bat_iterator(fb);
-                                                       if (fb->tminpos != 
BUN_NONE) {
-                                                               if (tostr(&buf, 
&buflen, BUNtail(bi, fb->tminpos), false) < 0) {
+                                                       if (bi.minpos != 
BUN_NONE) {
+                                                               if (tostr(&buf, 
&buflen, BUNtail(bi, bi.minpos), false) < 0) {
                                                                        
bat_iterator_end(&bi);
                                                                        
BBPunfix(fb->batCacheid);
                                                                        msg = 
createException(SQL, "sql.statistics", SQLSTATE(HY013) MAL_MALLOC_FAIL);
@@ -346,8 +346,8 @@ sql_statistics(Client cntxt, MalBlkPtr m
                                                                goto bailout;
                                                        }
 
-                                                       if (fb->tmaxpos != 
BUN_NONE) {
-                                                               if (tostr(&buf, 
&buflen, BUNtail(bi, fb->tmaxpos), false) < 0) {
+                                                       if (bi.maxpos != 
BUN_NONE) {
+                                                               if (tostr(&buf, 
&buflen, BUNtail(bi, bi.maxpos), false) < 0) {
                                                                        
bat_iterator_end(&bi);
                                                                        
BBPunfix(fb->batCacheid);
                                                                        msg = 
createException(SQL, "sql.statistics", SQLSTATE(HY013) MAL_MALLOC_FAIL);
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2342,9 +2342,9 @@ min_max_col(sql_trans *tr, sql_column *c
        _DELETE(c->max);
        if ((d = ATOMIC_PTR_GET(&c->data)) && (b = temp_descriptor(d->cs.bid))) 
{
                BATiter bi = bat_iterator(b);
-               if (b->tminpos != BUN_NONE && b->tmaxpos != BUN_NONE) {
-                       void *nmin = BUNtail(bi, b->tminpos), *nmax = 
BUNtail(bi, b->tmaxpos);
-                       size_t minlen = ATOMlen(b->ttype, nmin), maxlen = 
ATOMlen(b->ttype, nmax);
+               if (bi.minpos != BUN_NONE && bi.maxpos != BUN_NONE) {
+                       void *nmin = BUNtail(bi, bi.minpos), *nmax = 
BUNtail(bi, bi.maxpos);
+                       size_t minlen = ATOMlen(bi.type, nmin), maxlen = 
ATOMlen(bi.type, nmax);
 
                        if (!(c->min = GDKmalloc(minlen)) || !(c->max = 
GDKmalloc(maxlen))) {
                                _DELETE(c->min);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to