Changeset: 3292c7ef4415 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3292c7ef4415
Modified Files:
        sql/backends/monet5/sql_statistics.c
Branch: Jan2022
Log Message:

At the moment, don't retrieve min/max values from views


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
@@ -309,6 +309,14 @@ sql_statistics(Client cntxt, MalBlkPtr m
                                                                msg = 
createException(SQL, "sql.statistics", SQLSTATE(HY005) "Cannot access column 
descriptor");
                                                                goto bailout;
                                                        }
+                                                       if (isVIEW(re)) { /* If 
it is a view get the parent BAT */
+                                                               BAT *nb = 
BBP_cache(VIEWtparent(re));
+                                                               
BBPunfix(re->batCacheid);
+                                                               if (!(re = 
BATdescriptor(nb->batCacheid))) {
+                                                                       msg = 
createException(SQL, "sql.statistics", SQLSTATE(HY005) "Cannot access column 
descriptor");
+                                                                       goto 
bailout;
+                                                               }
+                                                       }
                                                        issorted = 
BATtordered(qd) && BATtordered(re);
                                                        isrevsorted = 
BATtrevordered(qd) && BATtrevordered(re);
                                                        hnils = !re->tnonil || 
re->tnil;
@@ -343,9 +351,19 @@ sql_statistics(Client cntxt, MalBlkPtr m
                                                if (pos->tminpos != BUN_NONE || 
pos->tmaxpos != BUN_NONE) {
                                                        if (dict) {
                                                                fb = re;
-                                                       } else if (!(fb = 
store->storage_api.bind_col(tr, c, RDONLY))) {
-                                                               msg = 
createException(SQL, "sql.statistics", SQLSTATE(HY005) "Cannot access column 
descriptor");
-                                                               goto bailout;
+                                                       } else {
+                                                               if (!(fb = 
store->storage_api.bind_col(tr, c, RDONLY))) {
+                                                                       msg = 
createException(SQL, "sql.statistics", SQLSTATE(HY005) "Cannot access column 
descriptor");
+                                                                       goto 
bailout;
+                                                               }
+                                                               if (isVIEW(fb)) 
{ /* If it is a view get the parent BAT */
+                                                                       BAT *nb 
= BBP_cache(VIEWtparent(fb));
+                                                                       
BBPunfix(fb->batCacheid);
+                                                                       if 
(!(fb = BATdescriptor(nb->batCacheid))) {
+                                                                               
msg = createException(SQL, "sql.statistics", SQLSTATE(HY005) "Cannot access 
column descriptor");
+                                                                               
goto bailout;
+                                                                       }
+                                                               }
                                                        }
 
                                                        ssize_t 
(*tostr)(str*,size_t*,const void*,bool) = BATatoms[fb->ttype].atomToStr;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to