Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21250/src/backends/monet5
Modified Files:
sql.mx
Log Message:
propagated changes of Sunday Jan 24 2010 - Tuesday Jan 26 2010
from the Feb2010 branch to the development trunk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010/01/24 - nielsnes: src/backends/monet5/sql.mx,1.389.2.1
fixed bug in bulk decimal conversions (fixes problems with moa tests)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.389
retrieving revision 1.390
diff -u -d -r1.389 -r1.390
--- sql.mx 11 Jan 2010 10:42:41 -0000 1.389
+++ sql.mx 26 Jan 2010 13:25:21 -0000 1.390
@@ -3636,7 +3636,7 @@
o = (@1*) Tloc(bn,BUNfirst(bn));
p = (@2*) Tloc(b, BUNfirst(b));
q = (@2*) Tloc(b, BUNlast(b));
- bn->T->nonil= b->T->nonil;
+ bn->T->nonil = 1;
if ( b->T->nonil){
for (; p<q; p++, o++)
*o = (@1)*p;
@@ -3702,10 +3702,10 @@
bn = BATnew(TYPE_void, ty...@1, BATcount(b));
BATseqbase(bn, b->hseqbase);
bn->H->nonil = 1;
+ bn->T->nonil = 1;
o = (@1*) Tloc(bn,BUNfirst(bn));
p = (@2*) Tloc(b, BUNfirst(b));
q = (@2*) Tloc(b, BUNlast(b));
- bn->T->nonil= b->T->nonil;
if ( b->T->nonil){
for (; p<q; p++, o++){
val = *p;
@@ -3836,17 +3836,23 @@
o = (@1*) Tloc(bn,BUNfirst(bn));
p = (@2*) Tloc(b, BUNfirst(b));
q = (@2*) Tloc(b, BUNlast(b));
- bn->T->nonil= b->T->nonil;
+ bn->T->nonil = 1;
if ( b->T->nonil){
- for (; p<q; p++, o++)
- *o = (@1) ((*p + (*p<0)?-5:5) / scales[scale]);
+ if (scale)
+ for (; p<q; p++, o++)
+ *o = (@1) ((*p + (*p<0)?-5:5) / scales[scale]);
+ else
+ for (; p<q; p++, o++)
+ *o = (@1) (*p);
} else {
for (; p<q; p++, o++) {
if (*p == @2_nil) {
*o = @1_nil;
bn->T->nonil= FALSE;
- } else {
+ } else if (scale) {
*o = (@1) ((*p + (*p<0)?-5:5) / scales[scale]);
+ } else {
+ *o = (@1) (*p);
}
}
}
@@ -4011,79 +4017,6 @@
@:fnumcastdown(wrd,dbl)@
@:fnumcastdown(lng,dbl)@
-...@-
-Code derived from the BATcast module because the old sql code was way to slow.
-Focused for the time being on DECIMAL conversion.
-...@= GeneralFixed
-sql5_export str cmdconve...@1_dec2_@2(int *ret, int *bid);
-str cmdconve...@1_@2(int *ret, int *bid)
-{
- BAT *b,*bn;
- @2 *o;
-
- if( (b= BATdescriptor(*bid)) == NULL ){
- throw(MAL, "batca...@2", RUNTIME_OBJECT_MISSING);
- }
-
- bn = BATnew(TYPE_void, ty...@2, BATcount(b));
- BATseqbase(bn, b->hseqbase);
- if (bn == NULL) {
- throw(MAL, "batca...@2", MAL_MALLOC_FAIL);
- }
- bn->hsorted = b->hsorted;
- bn->tsorted = b->tsorted;
- bn->H->nonil = 1;
- bn->T->nonil = b->T->nonil;
-
- o = (@2*)Tloc(bn,BUNfirst(bn));
-
- if (b->ttype == TYPE_void) {
- oid t = b->tseqbase;
- BUN i, cnt = BATcount(b);
-
- for(i=0; i<cnt; i++)
- *o++ = (@2)t++;
- } else {
- @1 *p = (@1*)Tloc(b, BUNfirst(b));
- @1 *q = (@1*)Tloc(b, BUNlast(b));
-
- if (b->T->nonil)
- for(; p<q; o++, p++)
- *o = (@2) *p;
- else
- if (@3) {
- for(; p<q; o++, p++)
- if (*p == @1_nil) {
- *o = @2_nil;
- bn->T->nonil = 0;
- } else
- *o = (@2) ((*p + (*p < 0 ? -5:5))/ scal...@3]);
- } else
- for(; p<q; o++, p++)
- if (*p == @1_nil) {
- *o = @2_nil;
- bn->T->nonil = 0;
- } else
- *o = (@2) ((*p + (*p < 0 ? -5:5))/ scal...@3]);
-
- }
- /* wrapup */
- BATsetcount(bn, BATcount(b));
- if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
- BATkey(BATmirror(bn), FALSE);
- bn->tsorted = 0;
-
- if (b->htype != bn->htype) {
- BAT *r = VIEWcreate(b,bn);
-
- BBPreleaseref(bn->batCacheid);
- bn = r;
- }
- BBPkeepref(*ret = bn->batCacheid);
- BBPreleaseref(b->batCacheid);
- return MAL_SUCCEED;
-}
-
@= fnumcastup
@:simpleupcast(@1,@2)@
@@ -4167,11 +4100,11 @@
o = (@1*) Tloc(bn,BUNfirst(bn));
p = (@2*) Tloc(b, BUNfirst(b));
q = (@2*) Tloc(b, BUNlast(b));
- bn->T->nonil= b->T->nonil;
+ bn->T->nonil = 1;
if ( b->T->nonil){
for (; p<q; p++, o++)
*o = (((@1)*p)/scales[scale]);
- } else{
+ } else {
for (; p<q; p++, o++) {
if (*p == @2_nil) {
*o = @1_nil;
@@ -4353,10 +4286,13 @@
o = (@1*) Tloc(bn,BUNfirst(bn));
p = (@2*) Tloc(b, BUNfirst(b));
q = (@2*) Tloc(b, BUNlast(b));
- bn->T->nonil= b->T->nonil;
+ bn->T->nonil = 1;
if ( b->T->nonil){
for (; p<q; p++, o++) {
- val = (@2) ((*p+ (*p<0)?-5:5)/scales[scale]);
+ if (scale)
+ val = (@2) ((*p+ (*p<0)?-5:5)/scales[scale]);
+ else
+ val = (@2) (*p);
/* see if the number fits in the data type */
if (val > g...@1_min && val <= g...@1_max)
*o = (@1)val;
@@ -4372,7 +4308,10 @@
*o = @1_nil;
bn->T->nonil= FALSE;
} else {
- val = (@2) (( *p + ( *p<0)?-5:5)/scales[scale]);
+ if (scale)
+ val = (@2) (( *p + (
*p<0)?-5:5)/scales[scale]);
+ else
+ val = (@2) (*p);
/* see if the number fits in the data type */
if (val > g...@1_min && val <= g...@1_max)
*o = (@1)val;
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins