Update of /cvsroot/monetdb/sql/src/backends/monet4
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28679/backends/monet4
Modified Files:
Tag: SQL_2-20
sql_server.mx
Log Message:
m4 use dynamic hash sizes for group by over columns with type oid
fixes for select .. from x where ... and true.
both fixes were needed for
[ 1796269 ] SQL: hangs/crashes on 'exists' subqueries after a join
Index: sql_server.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet4/sql_server.mx,v
retrieving revision 1.173.2.5
retrieving revision 1.173.2.6
diff -u -d -r1.173.2.5 -r1.173.2.6
--- sql_server.mx 16 Nov 2007 20:40:25 -0000 1.173.2.5
+++ sql_server.mx 19 Nov 2007 18:10:28 -0000 1.173.2.6
@@ -259,6 +259,8 @@
.COMMAND not_unique( BAT[oid,oid] b) : bit = not_unique; "check if the
tail sorted bat b doesn't have unique tail values"
+ .COMMAND storage( int t ) : int = atom_storage; "return the atoms (t)
storage type"
+
.END sql_server;
@-
@@ -1402,6 +1404,12 @@
return GDK_SUCCEED;
}
+int atom_storage(int *t, int *i )
+{
+ *t = ATOMstorage(*i);
+ return GDK_SUCCEED;
+}
+
@-
An SQL session needs a minimal set of modules, shown below.
The MIL procs should also be moved to the kernel, despite the
@@ -1473,9 +1481,9 @@
return x.join(b1);
}
-proc log2(int i) : int {
+proc log2(lng i) : int {
var n := 0;
- while(i > 1) {
+ while(i > lng(1)) {
i >>= 1;
n :+= 1;
}
@@ -1499,16 +1507,22 @@
proc SQLgroup(BAT[oid,any] a) : grp {
# handle the grouping for unique checks with the special _CTgroup
- if (and(or((a.ttype()=int),(a.ttype()=lng)),(a.count()>(256*1024)))) {
- var N := (max(a) - min(a));
- if (or((N.type()=lng),isnil(N)))
- N := a.count();
- if (or((N > a.count()),(N<0)))
- N := a.count();
- if (or((N = 0),(log2(N)=0))) {
+ if
(and(or((storage(a.ttype())=int),(storage(a.ttype())=lng)),(a.count()>(256*1024))))
{
+ var N := lng(0);
+ if (and(storage(a.ttype())=lng,a.ttype()!=lng))
+ N := (lng(max(a)) - lng(min(a)));
+ if (and(storage(a.ttype())=int,a.ttype()!=int))
+ N := lng(int(max(a)) - int(min(a)));
+ if (N=lng(0))
+ N := lng(max(a) - min(a));
+ if (isnil(N))
+ N := lng(a.count());
+ if (or((N > lng(a.count())),(N<lng(0))))
+ N := lng(a.count());
+ if (or((N = lng(0)),(log2(lng(N))=0))) {
return 1;
}
- return _CTgroup(a, log2(N), 1);
+ return _CTgroup(a, log2(lng(N)), 1);
}
return CTgroup(a);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins