Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv1746/src/backends/monet5
Modified Files:
sql.mx
Log Message:
propagated changes of Tuesday Oct 20 2009 - Wednesday Oct 21 2009
from the Nov2009 branch to the development trunk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/10/20 - mlkersten: src/backends/monet5/sql.mx,1.358.2.2
Prepared the code for faster execution. Scales[0] seems to be a 1 for
consistency reasons with the rest. Remaining cast operations
should also be dealt with. Moreover, upcast in some cases can re-use
space, e.g. lng-dec2-dbl. [tobedone]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.360
retrieving revision 1.361
diff -u -d -r1.360 -r1.361
--- sql.mx 17 Oct 2009 06:54:02 -0000 1.360
+++ sql.mx 21 Oct 2009 09:41:49 -0000 1.361
@@ -2716,7 +2716,7 @@
}
lng scales[20] = {
- LL_CONSTANT(0),
+ LL_CONSTANT(1),
LL_CONSTANT(10),
LL_CONSTANT(100),
LL_CONSTANT(1000),
@@ -3232,8 +3232,9 @@
BBPunfix(b->batCacheid);
return msg;
}
-...@c
-
+...@-
+The simple cast up operations in some cases
+could re-use the storage space as well.
@= numcastup
@:simpleupcast(@1,@2)@
@@ -3302,26 +3303,37 @@
str b...@2_dec2_@1( int *res, int *s1, int *bid )
{
- BAT *b, *dst;
+ BAT *b, *bn;
BATiter bi;
- BUN p,q;
+ @2 *p,*q;
char *msg = NULL;
+ int scale = *s1;
+ @1 *o;
if( (b = BATdescriptor(*bid)) == NULL ){
throw(SQL, "batca...@2_dec2_@1", "Cannot access descriptor");
}
bi = bat_iterator(b);
- dst = BATnew(b->htype, ty...@1, BATcount(b));
- BATseqbase(dst, b->hseqbase);
- BATloop(b,p,q) {
- @2 *v = (@2*)BUNtail(bi,p);
- @1 r;
- msg = @2_de...@1( &r, s1, v );
- if (msg)
- break;
- BUNins(dst, BUNhead(bi,p), &r, FALSE);
+ bn = BATnew(b->htype, ty...@1, BATcount(b));
+ BATseqbase(bn, b->hseqbase);
+ o = (@1*) Tloc(bn,BUNfirst(bn));
+ p = (@2*) Tloc(b, BUNfirst(b));
+ q = (@2*) Tloc(b, BUNlast(b));
+ if ( b->T->nonil){
+ for (; p<q; p++)
+ *o = (@1) ((*p + (*p<0)?-5:5) / scales[scale]);
+ } else{
+ if (*p == @2_nil)
+ *o = @1_nil;
+ else
+ *o = (@1) ((*p + (*p<0)?-5:5) / scales[scale]);
}
- BBPkeepref( *res = dst->batCacheid);
+ BATsetcount(bn, BATcount(b));
+ bn->tsorted = 0;
+ BATkey(BATmirror(bn),FALSE);
+ if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
+
+ BBPkeepref( *res = bn->batCacheid);
BBPunfix(b->batCacheid);
return msg;
}
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins