MonetDB: mosaic - fixed compilation and code such that VARDICTde...

2014-09-03 Thread Stefan Manegold
Changeset: 8342fa22fa21 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8342fa22fa21
Modified Files:
monetdb5/modules/mal/mosaic_variance.c
Branch: mosaic
Log Message:

fixed compilation and code such that VARDICTdecompress() also handles first 
value correctly

This fixes
monetdb5/modules/mal/mosaic_variance.c(309) : warning C4244: '=' : conversion 
from 'wrd' to 'int', possible loss of data

Thanks to the MSVC compiler on Windows for pointing this out!


diffs (12 lines):

diff --git a/monetdb5/modules/mal/mosaic_variance.c 
b/monetdb5/modules/mal/mosaic_variance.c
--- a/monetdb5/modules/mal/mosaic_variance.c
+++ b/monetdb5/modules/mal/mosaic_variance.c
@@ -283,7 +283,7 @@ MOScompress_variance(Client cntxt, MOSta
 {  bte *idx = (bte*)(compressed + dictsize * sizeof(TPE));\
TPE *dict = (TPE*) compressed,val = dict[0];\
BUN lim = MOScnt(blk);\
-   ((int*)task-src)[0] = val;\
+   ((TPE*)task-src)[0] = val;\
for(i = 1; i  lim; i++,idx++){\
val += dict[ (bte)*idx];\
((TPE*)task-src)[i] = val;\
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Cleanup block header manipulations

2014-09-03 Thread Martin Kersten
Changeset: fc89ee61e658 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc89ee61e658
Modified Files:
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic.h
monetdb5/modules/mal/mosaic_delta.c
monetdb5/modules/mal/mosaic_dictionary.c
monetdb5/modules/mal/mosaic_hdr.c
monetdb5/modules/mal/mosaic_linear.c
monetdb5/modules/mal/mosaic_literal.c
monetdb5/modules/mal/mosaic_runlength.c
monetdb5/modules/mal/mosaic_variance.c
monetdb5/modules/mal/mosaic_zone.c
Branch: mosaic
Log Message:

Cleanup block header manipulations


diffs (truncated from 1459 to 300 lines):

diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -51,6 +51,12 @@ MOSinit(MOStask task, BAT *b){
task-dst = base + MosaicBlkSize;
 }
 
+void MOSblk(MosaicBlk blk)
+{
+   printf(Block %d tag %d cnt BUNFMT\n, (int)((lng)blk 
%1),MOSgetTag(blk),MOSgetCnt(blk));
+}
+
+#ifdef _DEBUG_MOSAIC_
 static void
 MOSdumpTask(Client cntxt,MOStask task)
 {
@@ -63,7 +69,9 @@ MOSdumpTask(Client cntxt,MOStask task)
for ( i=0; i  MOSAIC_METHODS; i++)
if( task-blks[i])
mnstr_printf(cntxt-fdout, %s\tLLFMT \tLLFMT   LLFMT\t 
, filtername[i], task-blks[i], task-elms[i], task-elms[i]/task-blks[i]);
+   mnstr_printf(cntxt-fdout,\n);
 }
+#endif
 
 // dump a compressed BAT
 static void
@@ -76,7 +84,7 @@ MOSdumpInternal(Client cntxt, BAT *b){
MOSinit(task,b);
MOSinitializeScan(cntxt,task,0,task-hdr-top);
while(task-start task-stop){
-   switch(MOStag(task-blk)){
+   switch(MOSgetTag(task-blk)){
case MOSAIC_NONE:
MOSdump_literal(cntxt,task);
MOSadvance_literal(cntxt,task);
@@ -270,12 +278,11 @@ MOScompressInternal(Client cntxt, int *r
MOSinitHeader(task);
 
// always start with an EOL block
-   *task-blk = MOSeol;
+   MOSsetTag(task-blk,MOSAIC_EOL);
 
cutoff = task-elm  1000? task-elm - 1000: task-elm;
while(task-elm  0){
// default is to extend the non-compressed block
-   //mnstr_printf(cntxt-fdout,#elements BUNFMT\n,task-elm);
cand = MOSAIC_NONE;
fac = 1.0;
factor = 1.0;
@@ -340,28 +347,28 @@ MOScompressInternal(Client cntxt, int *r
case MOSAIC_DELTA:
case MOSAIC_LINEAR:
// close the non-compressed part
-   if( (MOStag(task-blk) == MOSAIC_NONE || 
MOStag(task-blk) == MOSAIC_ZONE)  MOScnt(task-blk) ){
+   if( (MOSgetTag(task-blk) == MOSAIC_NONE || 
MOSgetTag(task-blk) == MOSAIC_ZONE)  MOSgetCnt(task-blk) ){
MOSupdateHeader(cntxt,task);
-   if( MOStag(task-blk) == MOSAIC_NONE)
+   if( MOSgetTag(task-blk) == MOSAIC_NONE)
MOSskip_literal(cntxt,task);
else
MOSskip_zone(cntxt,task);
// always start with an EOL block
task-dst = ((char*) task-blk)+ MosaicBlkSize;
-   *task-blk = MOSeol;
+   MOSsetTag(task-blk,MOSAIC_EOL);
}
break;
case MOSAIC_NONE:
case MOSAIC_ZONE:
-   if ( MOScnt(task-blk) == MOSlimit()){
+   if ( MOSgetCnt(task-blk) == MOSlimit()){
MOSupdateHeader(cntxt,task);
-   if( MOStag(task-blk) == MOSAIC_NONE)
+   if( MOSgetTag(task-blk) == MOSAIC_NONE)
MOSskip_literal(cntxt,task);
else
MOSskip_zone(cntxt,task);
// always start with an EOL block
task-dst = ((char*) task-blk)+ MosaicBlkSize;
-   *task-blk = MOSeol;
+   MOSsetTag(task-blk,MOSAIC_EOL);
}
}
// apply the compression to a chunk
@@ -370,55 +377,55 @@ MOScompressInternal(Client cntxt, int *r
MOScompress_dictionary(cntxt,task);
MOSupdateHeader(cntxt,task);
//prepare new block header
-   task-elm -= MOScnt(task-blk);
+   task-elm -= MOSgetCnt(task-blk);
MOSadvance_dictionary(cntxt,task);
-   *task-blk = MOSeol;
+   MOSsetTag(task-blk,MOSAIC_EOL);

MonetDB: mosaic - Accept output

2014-09-03 Thread Martin Kersten
Changeset: 0efcf2e779e5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0efcf2e779e5
Modified Files:
monetdb5/modules/mal/Tests/mosaic_delta.mal
monetdb5/modules/mal/Tests/mosaic_delta.stable.out
monetdb5/modules/mal/Tests/mosaic_linear.mal
monetdb5/modules/mal/Tests/mosaic_linear.stable.out
monetdb5/modules/mal/Tests/mosaic_runlength.mal
monetdb5/modules/mal/Tests/mosaic_runlength.stable.out
monetdb5/modules/mal/Tests/mosaic_zone.mal
monetdb5/modules/mal/Tests/mosaic_zone.stable.out
Branch: mosaic
Log Message:

Accept output


diffs (truncated from 513 to 300 lines):

diff --git a/monetdb5/modules/mal/Tests/mosaic_delta.mal 
b/monetdb5/modules/mal/Tests/mosaic_delta.mal
--- a/monetdb5/modules/mal/Tests/mosaic_delta.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_delta.mal
@@ -20,9 +20,11 @@ io.print(z);
 bs:= bat.new(:oid,:timestamp);
 bat.append(bs,2014-08-14 12:00:00:timestamp);
 bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
 bat.append(bs,2014-08-14 12:01:00:timestamp);
 bat.append(bs,2014-08-14 12:02:00:timestamp);
-bat.append(bs,2014-08-14 12:00:00:timestamp);
 bs:= bat.append(bs,bs);
 
 io.print(bs);
diff --git a/monetdb5/modules/mal/Tests/mosaic_delta.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_delta.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_delta.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_delta.stable.out
@@ -38,9 +38,11 @@ function user.main():void;
 bs := bat.new(:oid,:timestamp);
 bat.append(bs,2014-08-14 12:00:00.000:timestamp);
 bat.append(bs,2014-08-14 12:00:00.000:timestamp);
+bat.append(bs,2014-08-14 12:00:00.000:timestamp);
+bat.append(bs,2014-08-14 12:00:00.000:timestamp);
+bat.append(bs,2014-08-14 12:00:00.000:timestamp);
 bat.append(bs,2014-08-14 12:01:00.000:timestamp);
 bat.append(bs,2014-08-14 12:02:00.000:timestamp);
-bat.append(bs,2014-08-14 12:00:00.000:timestamp);
 bs := bat.append(bs,bs);
 io.print(bs);
 xs := mosaic.compress(bs,delta);
@@ -106,29 +108,36 @@ end main;
 #--#
 [ 0@0, 2014-08-14 12:00:00.000  ]
 [ 1@0, 2014-08-14 12:00:00.000  ]
-[ 2@0, 2014-08-14 12:01:00.000  ]
-[ 3@0, 2014-08-14 12:02:00.000  ]
+[ 2@0, 2014-08-14 12:00:00.000  ]
+[ 3@0, 2014-08-14 12:00:00.000  ]
 [ 4@0, 2014-08-14 12:00:00.000  ]
-[ 5@0, 2014-08-14 12:00:00.000  ]
-[ 6@0, 2014-08-14 12:00:00.000  ]
-[ 7@0, 2014-08-14 12:01:00.000  ]
-[ 8@0, 2014-08-14 12:02:00.000  ]
+[ 5@0, 2014-08-14 12:01:00.000  ]
+[ 6@0, 2014-08-14 12:02:00.000  ]
+[ 7@0, 2014-08-14 12:00:00.000  ]
+[ 8@0, 2014-08-14 12:00:00.000  ]
 [ 9@0, 2014-08-14 12:00:00.000  ]
-# clk 3sizes 80240 300%  0.33x none1   
10 10   
+[ 10@0,2014-08-14 12:00:00.000  ]
+[ 11@0,2014-08-14 12:00:00.000  ]
+[ 12@0,2014-08-14 12:01:00.000  ]
+[ 13@0,2014-08-14 12:02:00.000  ]
 #--#
 # ht  # name
 # void timestamp  # type
 #--#
 [ 0@0, 2014-08-14 12:00:00.000  ]
 [ 1@0, 2014-08-14 12:00:00.000  ]
-[ 2@0, 2014-08-14 12:01:00.000  ]
-[ 3@0, 2014-08-14 12:02:00.000  ]
+[ 2@0, 2014-08-14 12:00:00.000  ]
+[ 3@0, 2014-08-14 12:00:00.000  ]
 [ 4@0, 2014-08-14 12:00:00.000  ]
-[ 5@0, 2014-08-14 12:00:00.000  ]
-[ 6@0, 2014-08-14 12:00:00.000  ]
-[ 7@0, 2014-08-14 12:01:00.000  ]
-[ 8@0, 2014-08-14 12:02:00.000  ]
+[ 5@0, 2014-08-14 12:01:00.000  ]
+[ 6@0, 2014-08-14 12:02:00.000  ]
+[ 7@0, 2014-08-14 12:00:00.000  ]
+[ 8@0, 2014-08-14 12:00:00.000  ]
 [ 9@0, 2014-08-14 12:00:00.000  ]
+[ 10@0,2014-08-14 12:00:00.000  ]
+[ 11@0,2014-08-14 12:00:00.000  ]
+[ 12@0,2014-08-14 12:01:00.000  ]
+[ 13@0,2014-08-14 12:02:00.000  ]
 #--#
 # ht  # name
 # void date  # type
diff --git a/monetdb5/modules/mal/Tests/mosaic_linear.mal 
b/monetdb5/modules/mal/Tests/mosaic_linear.mal
--- a/monetdb5/modules/mal/Tests/mosaic_linear.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_linear.mal
@@ -20,3 +20,33 @@ x:= mosaic.compress(b,linear);
 #mosaic.dump(x);
 z:= mosaic.decompress(x);
 io.print(z);
+
+bs:= bat.new(:oid,:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:00:00:timestamp);
+bat.append(bs,2014-08-14 12:01:00:timestamp);
+bat.append(bs,2014-08-14 12:02:00:timestamp);
+bs:= bat.append(bs,bs);
+
+io.print(bs);
+xs:= mosaic.compress(bs,linear);
+#mosaic.dump(x);
+zs:= mosaic.decompress(xs);
+io.print(zs);
+
+d:= bat.new(:oid,:date);
+bat.append(d,2014-08-14:date);
+bat.append(d,2014-08-14:date);
+bat.append(d,2014-08-14:date);
+bat.append(d,2014-08-14:date);
+bat.append(d,2014-08-15:date);
+d:= 

MonetDB: mosaic - added missing break;'s in switch() statements

2014-09-03 Thread Stefan Manegold
Changeset: 2969b90e3e63 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2969b90e3e63
Modified Files:
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic_delta.c
Branch: mosaic
Log Message:

added missing break;'s in switch() statements


diffs (22 lines):

diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -1229,6 +1229,7 @@ MOSanalyseInternal(Client cntxt, BUN thr
MOScompressInternal(cntxt, ret, bid, properties);
if( ret != bid)
BBPdecref(ret,TRUE);
+   break;
case TYPE_str:
break;
default:
diff --git a/monetdb5/modules/mal/mosaic_delta.c 
b/monetdb5/modules/mal/mosaic_delta.c
--- a/monetdb5/modules/mal/mosaic_delta.c
+++ b/monetdb5/modules/mal/mosaic_delta.c
@@ -101,6 +101,7 @@ MOSestimate_delta(Client cntxt, MOStask 
if ( i  MOSlimit() ) i = MOSlimit();
factor = ((float) i * sizeof(oid))/  (MosaicBlkSize + 
sizeof(oid)+(bte)i-1);
}
+   break;
case TYPE_wrd: Estimate_delta(wrd); break;
case TYPE_lng: Estimate_delta(lng); break;
 #ifdef HAVE_HGE
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Fixed u couple of issues discovered by Coverity.

2014-09-03 Thread Sjoerd Mullender
Changeset: 08f2ad2d882b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=08f2ad2d882b
Modified Files:
common/options/monet_options.c
tools/merovingian/client/monetdb.c
tools/merovingian/daemon/controlrunner.c
Branch: Oct2014
Log Message:

Fixed u couple of issues discovered by Coverity.


diffs (65 lines):

diff --git a/common/options/monet_options.c b/common/options/monet_options.c
--- a/common/options/monet_options.c
+++ b/common/options/monet_options.c
@@ -125,9 +125,9 @@ mo_config_file(opt **Set, int setlen, ch
if (default_set == NULL) {
set = NULL;
setlen = mo_default_set(set, 0);
-   }
+   } else
+   setlen = default_setlen;
Set = default_set;
-   setlen = default_setlen;
}
set = *Set;
fd = fopen(file, r);
@@ -209,9 +209,9 @@ mo_system_config(opt **Set, int setlen)
opt *set = NULL;
 
setlen = mo_default_set(set, 0);
-   }
+   } else
+   setlen = default_setlen;
Set = default_set;
-   setlen = default_setlen;
}
cfg = mo_find_option(*Set, setlen, config);
if (!cfg)
@@ -305,9 +305,9 @@ mo_add_option(opt **Set, int setlen, opt
if (default_set == NULL) {
set = NULL;
setlen = mo_default_set(set, 0);
-   }
+   } else
+   setlen = default_setlen;
Set = default_set;
-   setlen = default_setlen;
}
set = (opt *) realloc(*Set, (setlen + 1) * sizeof(opt));
set[setlen].kind = kind;
diff --git a/tools/merovingian/client/monetdb.c 
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -1168,6 +1168,11 @@ command_set(int argc, char *argv[], mero
msab_freeStatus(orig);
orig = stats;
 
+   if (orig == NULL) {
+   /* error already printed by globMatchDBS */
+   exit(1);
+   }
+
/* handle rename separately due to single argument constraint */
if (strcmp(property, name) == 0) {
if (type == INHERIT) {
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -683,6 +683,7 @@ static void ctl_handle_client(
Mfprintf(_mero_ctlerr, %s: 
set: cannot perform 
client share 
request: discovery service 
is globally 
disabled\n, origin);
+   msab_freeStatus(stats);
continue;
}
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - fixed contains with x,y coordinates and filter wi...

2014-09-03 Thread Foteini Alvanaki
Changeset: fd696e488174 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fd696e488174
Modified Files:
geom/monetdb5/geom.c
Branch: geo
Log Message:

fixed contains with x,y coordinates and filter with imprints


diffs (60 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -3050,9 +3050,6 @@ str wkbFilteredPointsContains_geom_bat(b
BBPreleaseref(yBAT-batCacheid);
throw(MAL, batgeom.wkbContainsFiltered, 
RUNTIME_OBJECT_MISSING);
}
-fprintf(stderr, xBAT %d\n, (int)BATcount(xBAT));
-fprintf(stderr, yBAT %d\n, (int)BATcount(yBAT));
-fprintf(stderr, OIDsBAT %d\n, (int)BATcount(OIDsBAT));

//check if the BATs have dense heads and are aligned
if (!BAThdense(xBAT) || !BAThdense(yBAT) || !BAThdense(OIDsBAT)) {
@@ -3368,6 +3365,7 @@ str wkbFilterWithImprints_geom_bat(bat* 
BAT *xBAT=NULL, *yBAT=NULL, *xCandidateOIDsBAT=NULL, 
*candidateOIDsBAT=NULL;
mbr* geomMBR;
str err;
+   double xmin=0.0, xmax=0.0, ymin=0.0, ymax=0.0;
 
//get the descriptors of the BATs
if ((xBAT = BATdescriptor(*xBAT_id)) == NULL) {
@@ -3377,9 +3375,6 @@ str wkbFilterWithImprints_geom_bat(bat* 
BBPreleaseref(xBAT-batCacheid);
throw(MAL, batgeom.wkbFilterWithImprints, 
RUNTIME_OBJECT_MISSING);
}
-fprintf(stderr, xBAT %d\n, (int)BATcount(xBAT));
-fprintf(stderr, yBAT %d\n, (int)BATcount(yBAT));
-
 
//check if the BATs have dense heads and are aligned
if (!BAThdense(xBAT) || !BAThdense(yBAT)) {
@@ -3404,21 +3399,24 @@ fprintf(stderr, yBAT %d\n, (int)BATcou
}

//get candidateOIDs from xBAT (limits are considred to be inclusive)
-   xCandidateOIDsBAT = BATsubselect(xBAT, NULL, (geomMBR-xmin), 
(geomMBR-xmax), 1, 1, 0);
+   xmin = geomMBR-xmin;
+   xmax = geomMBR-xmax;
+   xCandidateOIDsBAT = BATsubselect(xBAT, NULL, xmin, xmax, 1, 1, 0);
if(xCandidateOIDsBAT == NULL) {
BBPreleaseref(xBAT-batCacheid);
BBPreleaseref(yBAT-batCacheid);
return 
createException(MAL,batgeom.wkbFilterWithImprints,Problem filtering xBAT);
}
-fprintf(stderr, xCandidateOIDsBAT %d, (%f, %f)\n, 
(int)BATcount(xCandidateOIDsBAT), geomMBR-xmin, geomMBR-xmax);
+   
//get candidateOIDs using yBAT and xCandidateOIDsBAT
-   candidateOIDsBAT = BATsubselect(yBAT, xCandidateOIDsBAT, 
(geomMBR-ymin), (geomMBR-ymax), 1, 1, 0);
+   ymin = geomMBR-ymin;
+   ymax = geomMBR-ymax;
+   candidateOIDsBAT = BATsubselect(yBAT, xCandidateOIDsBAT, ymin, ymax, 
1, 1, 0);
if(candidateOIDsBAT == NULL) {
BBPreleaseref(xBAT-batCacheid);
BBPreleaseref(yBAT-batCacheid);
return 
createException(MAL,batgeom.wkbFilterWithImprints,Problem filtering yBAT);
}
-fprintf(stderr, candidateOIDsBAT %d (%f, %f)\n, 
(int)BATcount(candidateOIDsBAT), geomMBR-ymin, geomMBR-ymax);
 
BBPreleaseref(xBAT-batCacheid);
BBPreleaseref(yBAT-batCacheid);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Use the actual storage needed

2014-09-03 Thread Martin Kersten
Changeset: ddbbf61ca978 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ddbbf61ca978
Modified Files:
monetdb5/modules/mal/mosaic.c
sql/backends/monet5/sql.c
Branch: mosaic
Log Message:

Use the actual storage needed


diffs (44 lines):

diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -538,7 +538,7 @@ MOSdecompressInternal(Client cntxt, int 
BBPreleaseref(bn-batCacheid);
throw(MAL, mosaic.decompress, MAL_MALLOC_FAIL);
}
-   MOSinit(task,b);;
+   MOSinit(task,b);
task-src = Tloc(bn, BUNfirst(bn));
task-timer = GDKusec();
while(task-blk){
@@ -579,6 +579,7 @@ MOSdecompressInternal(Client cntxt, int 
BATseqbase(bn,b-hseqbase);
 bn-hdense = 1;
 bn-hkey = 1;
+   bn-T-heap.free = (lng) (task-dst- Tloc(bn,BUNfirst(bn)));
bn-T-nonil = b-T-nonil;
bn-T-nil = b-T-nil;
bn-T-seq = b-T-seq;
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4625,17 +4625,13 @@ sql_storage(Client cntxt, MalBlkPtr mb, 

w = (int) (sum / cnt2);
}
atom = 
BUNappend(atom, w, FALSE);
-   
/*printf( size BUNFMT, tailsize(bn,BATcount(bn)) + (bn-T-vheap? 
bn-T-vheap-size:0)); */
-   sz = 
tailsize(bn, BATcount(bn));
-   sz += 
headsize(bn, BATcount(bn));
+   sz = 
bn-T-heap.free;
size = 
BUNappend(size, sz, FALSE);
 
-   sz = 
bn-T-vheap ? bn-T-vheap-size : 0;
-   sz += 
bn-H-vheap ? bn-H-vheap-size : 0;
+   sz = 
bn-T-vheap ? bn-T-vheap-free : 0;
heap = 
BUNappend(heap, sz, FALSE);
 
-   sz = 
bn-T-hash ? bn-T-hash-heap-size : 0;
-   sz += 
bn-H-hash ? bn-H-hash-heap-size : 0;
+   sz = 
bn-T-hash ? bn-T-hash-heap-free : 0;
indices 
= BUNappend(indices, sz, FALSE);
sz = 
IMPSimprintsize(bn);

imprints = BUNappend(imprints, sz, FALSE);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Move instruction to correct routine.

2014-09-03 Thread Martin Kersten
Changeset: 9fb60a1c483a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9fb60a1c483a
Modified Files:
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic_delta.c
Branch: mosaic
Log Message:

Move instruction to correct routine.


diffs (81 lines):

diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -465,6 +465,7 @@ MOScompressInternal(Client cntxt, int *r
bn-hdense = 1;
bn-hkey = 1;
bn-batDirty = 1;
+   bn-T-heap.free = (lng) (task-dst- Tloc(bn,BUNfirst(bn)));
bn-T-heap.compressed= 1;
bn-T-heap.count = cnt;
bn-T-nonil = b-T-nonil;
@@ -579,7 +580,6 @@ MOSdecompressInternal(Client cntxt, int 
BATseqbase(bn,b-hseqbase);
 bn-hdense = 1;
 bn-hkey = 1;
-   bn-T-heap.free = (lng) (task-dst- Tloc(bn,BUNfirst(bn)));
bn-T-nonil = b-T-nonil;
bn-T-nil = b-T-nil;
bn-T-seq = b-T-seq;
diff --git a/monetdb5/modules/mal/mosaic_delta.c 
b/monetdb5/modules/mal/mosaic_delta.c
--- a/monetdb5/modules/mal/mosaic_delta.c
+++ b/monetdb5/modules/mal/mosaic_delta.c
@@ -69,10 +69,11 @@ MOSskip_delta(Client cntxt, MOStask task
 }
 
 // append a series of values into the non-compressed block
-#define Estimate_delta(TYPE)\
+#define Estimate_delta(TYPE, EXPR)\
 {  TYPE *w = (TYPE*)task-src, val= *w, delta;\
for(w++,i =1; itask-elm; i++,w++){\
delta = *w -val;\
+   if ( EXPR)\
if ( delta  -127 || delta 127)\
break;\
val = *w;\
@@ -89,23 +90,13 @@ MOSestimate_delta(Client cntxt, MOStask 
(void) cntxt;
 
switch(ATOMstorage(task-type)){
-   case TYPE_sht: Estimate_delta(sht); break;
-   case TYPE_oid: 
-   {   oid *w = (oid*)task-src, val= *w, delta;
-   for(w++,i =1; itask-elm; i++,w++){
-   delta = *w -val;
-   if ( delta  256)
-   break;
-   val = *w;
-   }
-   if ( i  MOSlimit() ) i = MOSlimit();
-   factor = ((float) i * sizeof(oid))/  (MosaicBlkSize + 
sizeof(oid)+(bte)i-1);
-   }
-   break;
-   case TYPE_wrd: Estimate_delta(wrd); break;
-   case TYPE_lng: Estimate_delta(lng); break;
+   //case TYPE_bte: case TYPE_bit: no compression achievable
+   case TYPE_sht: Estimate_delta(sht,  (delta  -127 || delta 127)); 
break;
+   case TYPE_oid: Estimate_delta(sht,  (delta  256)); break;
+   case TYPE_wrd: Estimate_delta(wrd,  (delta  -127 || delta 127)); 
break;
+   case TYPE_lng: Estimate_delta(lng,  (delta  -127 || delta 127)); 
break;
 #ifdef HAVE_HGE
-   case TYPE_hge: Estimate_delta(hge); break;
+   case TYPE_hge: Estimate_delta(hge,  (delta  -127 || delta 127)); 
break;
 #endif
case TYPE_int:
{   int *w = (int*)task-src, val= *w, delta;
@@ -152,6 +143,7 @@ MOScompress_delta(Client cntxt, MOStask 
MOSsetTag(blk,MOSAIC_DELTA);
 
switch(ATOMstorage(task-type)){
+   //case TYPE_bte: case TYPE_bit: no compression achievable
case TYPE_sht: DELTAcompress(sht); break;
case TYPE_wrd: DELTAcompress(wrd); break;
case TYPE_int: DELTAcompress(int); break;
@@ -219,6 +211,7 @@ MOSdecompress_delta(Client cntxt, MOStas
(void) cntxt;
 
switch(ATOMstorage(task-type)){
+   //case TYPE_bte: case TYPE_bit: no compression achievable
case TYPE_sht: DELTAdecompress(sht); break;
case TYPE_oid: DELTAdecompress(oid); break;
case TYPE_wrd: DELTAdecompress(wrd); break;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - Separate files for bulk and point-secific functio...

2014-09-03 Thread Foteini Alvanaki
Changeset: 7baea15c592a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7baea15c592a
Added Files:
geom/monetdb5/geom.h
geom/monetdb5/geomBulk.c
geom/monetdb5/geomPoints.c
Modified Files:
geom/monetdb5/Makefile.ag
geom/monetdb5/geom.c
Branch: geo
Log Message:

Separate files for bulk and point-secific functions + header file


diffs (truncated from 3146 to 300 lines):

diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag
--- a/geom/monetdb5/Makefile.ag
+++ b/geom/monetdb5/Makefile.ag
@@ -26,7 +26,7 @@ INCLUDES = ../lib \
 lib__geom = {
MODULE
DIR = libdir/monetdb5
-   SOURCES = geom.c
+   SOURCES = geom.h geom.c geomBulk.c geomPoints.c
LIBS = ../lib/libgeom \
   ../../gdk/libbat \
   ../../common/stream/libstream \
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -18,38 +18,13 @@
  */
 
 /*
- * @a Wouter Scherphof, Niels Nes
+ * @a Wouter Scherphof, Niels Nes, Foteini Alvanaki
  * @* The simple geom module
  */
 
-
-#include monetdb_config.h
-#include libgeom.h
-
-
-#include mal.h
-#include mal_atom.h
-#include mal_exception.h
-#include mal_client.h
-#include stream.h
-
-
-#include stdio.h
-#include stdlib.h
-#include string.h
-#include math.h
-#include time.h
-
-#ifdef WIN32
-#ifndef LIBGEOM
-#define geom_export extern __declspec(dllimport)
-#else
-#define geom_export extern __declspec(dllexport)
-#endif
-#else
-#define geom_export extern
-#endif
-
+#include geom.h
+
+int TYPE_mbr;
 
 static inline int geometryHasZ(int info){return (info  0x02);}
 static inline int geometryHasM(int info){return (info  0x01);}
@@ -57,213 +32,6 @@ const double pi=3.14159265358979323846;
 
 /* the first argument in the functions is the return variable */
 
-int TYPE_mbr;
-
-/* general functions */
-geom_export void geoHasZ(int* res, int* info);
-geom_export void geoHasM(int* res, int* info);
-geom_export void geoGetType(char** res, int* info, int* flag);
-
-geom_export bat *geom_prelude(void);
-geom_export void geom_epilogue(void);
-
-/* the len argument is needed for correct storage and retrieval */
-geom_export int wkbTOSTR(char **geomWKT, int *len, wkb *geomWKB);
-geom_export int mbrTOSTR(char **dst, int *len, mbr *atom);
-geom_export size_t wkbaTOSTR(char **toStr, int* len, wkba *fromArray);
-
-geom_export size_t wkbFROMSTR(char* geomWKT, int *len, wkb** geomWKB, int 
srid);
-geom_export size_t mbrFROMSTR(char *src, int *len, mbr **atom);
-geom_export size_t wkbaFROMSTR(char *fromStr, int* len, wkba **toArray, int 
srid);
-
-geom_export wkb *wkbNULL(void);
-geom_export mbr *mbrNULL(void);
-geom_export wkba *wkbaNULL(void);
-
-geom_export BUN wkbHASH(wkb *w);
-geom_export BUN mbrHASH(mbr *atom);
-geom_export BUN wkbaHASH(wkba *w);
-
-geom_export int wkbCOMP(wkb *l, wkb *r);
-geom_export int mbrCOMP(mbr *l, mbr *r);
-geom_export int wkbaCOMP(wkba *l, wkba *r);
-
-/* read/write to/from log */
-geom_export wkb *wkbREAD(wkb *a, stream *s, size_t cnt);
-geom_export mbr *mbrREAD(mbr *a, stream *s, size_t cnt);
-geom_export wkba* wkbaREAD(wkba *a, stream *s, size_t cnt);
-
-geom_export int wkbWRITE(wkb *a, stream *s, size_t cnt);
-geom_export int mbrWRITE(mbr *c, stream *s, size_t cnt);
-geom_export int wkbaWRITE(wkba *c, stream *s, size_t cnt);
-
-geom_export var_t wkbPUT(Heap *h, var_t *bun, wkb *val);
-geom_export var_t wkbaPUT(Heap *h, var_t *bun, wkba *val);
-
-geom_export void wkbDEL(Heap *h, var_t *index);
-geom_export void wkbaDEL(Heap *h, var_t *index);
-
-geom_export int wkbLENGTH(wkb *p);
-geom_export int wkbaLENGTH(wkba *p);
-
-geom_export void wkbHEAP(Heap *heap, size_t capacity);
-geom_export void wkbaHEAP(Heap *heap, size_t capacity);
-
-//geom_export str mbrFromString(mbr **w, str *src);
-geom_export str wkbIsnil(bit *r, wkb **v);
-
-
-/* functions tha are used when a column is added to an existing table */
-geom_export str mbrFromMBR(mbr **w, mbr **src);
-geom_export str wkbFromWKB(wkb **w, wkb **src);
-//Is it needed?? geom_export str wkbFromWKB_bat(int* outBAT_id, int* inBAT_id);
-
-/* The WKB we use is the EWKB used also in PostGIS 
- * because we decided that it is easire to carry around
- * the SRID */
- 
-/* gets a GEOSGeometry and creates a WKB */
-geom_export wkb* geos2wkb(const GEOSGeometry* geosGeometry);
-/* gets a GEOSGeometry and returns the mbr of it 
- * works only for 2D geometries */
-geom_export mbr* mbrFromGeos(const GEOSGeom geosGeometry);
-
-
-geom_export str wkbFromText(wkb **geomWKB, str *geomWKT, int* srid, int *tpe);
-geom_export str wkbMLineStringToPolygon(wkb** geomWKB, str* geomWKT, int* 
srid, int* flag);
-
-
-/* Basic Methods on Geometric objects (OGC) */
-geom_export str wkbDimension(int*, wkb**);
-geom_export str wkbGeometryType(char**, wkb**, int*);
-geom_export str wkbGetSRID(int*, wkb**);
-//Envelope
-geom_export str wkbAsText(char**, wkb**, int*);
-geom_export str 

MonetDB: mosaic - Cleanup of some code. No major change

2014-09-03 Thread Martin Kersten
Changeset: 6318f19842c0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6318f19842c0
Modified Files:
monetdb5/modules/mal/mosaic_delta.c
monetdb5/modules/mal/mosaic_dictionary.c
monetdb5/modules/mal/mosaic_linear.c
monetdb5/modules/mal/mosaic_literal.c
monetdb5/modules/mal/mosaic_runlength.c
monetdb5/modules/mal/mosaic_variance.c
monetdb5/modules/mal/mosaic_zone.c
Branch: mosaic
Log Message:

Cleanup of some code. No major change


diffs (truncated from 1429 to 300 lines):

diff --git a/monetdb5/modules/mal/mosaic_delta.c 
b/monetdb5/modules/mal/mosaic_delta.c
--- a/monetdb5/modules/mal/mosaic_delta.c
+++ b/monetdb5/modules/mal/mosaic_delta.c
@@ -34,11 +34,13 @@ MOSadvance_delta(Client cntxt, MOStask t
 
task-start += MOSgetCnt(blk);
switch(task-type){
+   //case TYPE_bte: case TYPE_bit: no compression achievable
case TYPE_sht: task-blk = (MosaicBlk)( ((char*) blk) + MosaicBlkSize + 
wordaligned(sizeof(sht) + MOSgetCnt(blk)-1,sht)); break ;
case TYPE_int: task-blk = (MosaicBlk)( ((char*) blk) + MosaicBlkSize + 
wordaligned(sizeof(int) + MOSgetCnt(blk)-1,int)); break ;
case TYPE_oid: task-blk = (MosaicBlk)( ((char*) blk) + MosaicBlkSize + 
wordaligned(sizeof(oid) + MOSgetCnt(blk)-1,oid)); break ;
case TYPE_wrd: task-blk = (MosaicBlk)( ((char*) blk) + MosaicBlkSize + 
wordaligned(sizeof(wrd) + MOSgetCnt(blk)-1,wrd)); break ;
case TYPE_lng: task-blk = (MosaicBlk)( ((char*) blk) + MosaicBlkSize + 
wordaligned(sizeof(lng) + MOSgetCnt(blk)-1,lng)); break ;
+   //case TYPE_flt: case TYPE_dbl: to be looked into.
 #ifdef HAVE_HGE
case TYPE_hge: task-blk = (MosaicBlk)( ((char*) blk) + MosaicBlkSize + 
wordaligned(sizeof(hge) + MOSgetCnt(blk)-1,hge)); break ;
 #endif
@@ -108,6 +110,8 @@ MOSestimate_delta(Client cntxt, MOStask 
}
factor = ((float) i * sizeof(int))/  (MosaicBlkSize + 
sizeof(int)+(bte)i-1);
}
+   break;
+   //case TYPE_flt: case TYPE_dbl: to be looked into.
}
 #ifdef _DEBUG_MOSAIC_
mnstr_printf(cntxt-fdout,#estimate delta BUNFMT elm %.3f 
factor\n,i,factor);
@@ -115,7 +119,7 @@ MOSestimate_delta(Client cntxt, MOStask 
return factor;
 }
 
-#define DELTAcompress(TYPE)\
+#define DELTAcompress(TYPE,EXPR)\
 {  TYPE *w = (TYPE*)task-src, val= *w, delta;\
BUN limit = task-elm  MOSlimit()? MOSlimit():task-elm;\
task-dst = ((char*) task-blk) + MosaicBlkSize;\
@@ -123,7 +127,7 @@ MOSestimate_delta(Client cntxt, MOStask 
task-dst += sizeof(TYPE);\
for(w++,i =1; ilimit; i++,w++){\
delta = *w -val;\
-   if ( delta  -127 || delta 127)\
+   if ( EXPR )\
break;\
*(bte*)task-dst++ = (bte) delta;\
val = *w;\
@@ -144,35 +148,19 @@ MOScompress_delta(Client cntxt, MOStask 
 
switch(ATOMstorage(task-type)){
//case TYPE_bte: case TYPE_bit: no compression achievable
-   case TYPE_sht: DELTAcompress(sht); break;
-   case TYPE_wrd: DELTAcompress(wrd); break;
-   case TYPE_int: DELTAcompress(int); break;
+   case TYPE_sht: DELTAcompress(sht,(delta  -127 || delta 127)); break;
+   case TYPE_lng: DELTAcompress(lng,(delta  -127 || delta 127)); break;
+   case TYPE_oid: DELTAcompress(hge,(delta  256)); break;
+   case TYPE_wrd: DELTAcompress(wrd,(delta  -127 || delta 127)); break;
 #ifdef HAVE_HGE
-   case TYPE_hge: DELTAcompress(hge); break;
+   case TYPE_hge: DELTAcompress(hge,(delta  -127 || delta 127)); break;
 #endif
-   case TYPE_oid:
-   {   oid *w = (oid*)task-src, val= *w, delta;
+   case TYPE_int:
+   {   int *w = (int*)task-src, val= *w, delta;
BUN limit = task-elm  MOSlimit()? 
MOSlimit():task-elm;
task-dst = ((char*) task-blk) + MosaicBlkSize;
-   *(oid*)task-dst = val;
-   task-dst += sizeof(oid);
-   for(w++,i =1; ilimit; i++,w++){
-   delta = *w -val;
-   if ( delta  256)
-   break;
-   *(bte*)task-dst++ = (bte) delta;
-   val = *w;
-   }
-   task-src += i * sizeof(oid);
-   MOSincCnt(blk,i);
-   }
-   break;
-   case TYPE_lng:
-   {   lng *w = (lng*)task-src, val= *w, delta;
-   BUN limit = task-elm  MOSlimit()? 
MOSlimit():task-elm;
-   task-dst = ((char*) task-blk) + MosaicBlkSize;
-   *(lng*)task-dst = val;
-   task-dst += sizeof(lng);
+   *(int*)task-dst = val;
+   

MonetDB: geo - wkbFROMSTR() wkbaTOSTR()^Cfixed compilation (an...

2014-09-03 Thread Stefan Manegold
Changeset: 00915f58 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=00915f58
Modified Files:
geom/monetdb5/geom.c
Branch: geo
Log Message:

wkbFROMSTR()  wkbaTOSTR()^Cfixed compilation (and code): sizes are of type 
size_t, not of type int;

and strlen() returns tyep size_t, not type int.

Thanks to MSVC compiler on Windows for notifying!


Open question / ToDo:
why is len of type int,
while the rerurned length (correctly!) is of type size_t ?
(not only here, but also elsewhere in this file / the geom code)


diffs (55 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2948,7 +2948,7 @@ size_t wkbFROMSTR(char* geomWKT, int* le
char *polyhedralSurface = POLYHEDRALSURFACE;
char *multiPolygon = MULTIPOLYGON;
char *geoType;
-   int typeSize = 0;
+   size_t typeSize = 0;
char *geomWKT_original = NULL;
size_t parsedCharacters = 0;
 
@@ -2975,7 +2975,7 @@ size_t wkbFROMSTR(char* geomWKT, int* le
memcpy(geoType, geomWKT, typeSize);
geoType[typeSize] = '\0';
if(strcasecmp(geoType, polyhedralSurface) == 0) {
-   int sizeOfInfo = strlen(geomWKT)-strlen(polyhedralSurface);
+   size_t sizeOfInfo = strlen(geomWKT)-strlen(polyhedralSurface);
geomWKT_original = geomWKT;
geomWKT = 
(char*)GDKmalloc((sizeOfInfo+strlen(multiPolygon)+1)*sizeof(char));
strcpy(geomWKT, multiPolygon);
@@ -3279,10 +3279,17 @@ int mbrWRITE(mbr *c, stream *s, size_t c
 
 /* Creates the string representation of a wkb_array */
 /* return length of resulting string. */
+
+/* StM: Open question / ToDo:
+ * why is len of type int,
+ * while the rerurned length (correctly!) is of type size_t ?
+ * (not only here, but also elsewhere in this file / the geom code)
+ */
 size_t wkbaTOSTR(char **toStr, int* len, wkba *fromArray) {
int items = fromArray-itemsNum, i;
int itemsNumDigits = (int)ceil(log10(items));
size_t dataSize;//, skipBytes=0;
+   size_t szlen;
char** partialStrs;
char* nilStr = nil;
char* toStrPtr = NULL, 
*itemsNumStr=GDKmalloc((itemsNumDigits+1)*sizeof(char));
@@ -3340,7 +3347,14 @@ fprintf(stderr, wkbaTOSTR\n);
GDKfree(partialStrs);
GDKfree(itemsNumStr);
 
-   *len = strlen(*toStr)+1;
+   /* StM: Open question / ToDo:
+* why is len of type int,
+* while the rerurned length (correctly!) is of type size_t ?
+* (not only here, but also elsewhere in this file / the geom code)
+*/
+   szlen = strlen(*toStr)+1;
+   assert(szlen  (size_t) GDK_int_max);
+   *len = (int) szlen;
return (toStrPtr-*toStr);
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - turn debug output wkbaNULL into = wkbaNULL

2014-09-03 Thread Stefan Manegold
Changeset: 9b1eb25ebe8b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9b1eb25ebe8b
Modified Files:
geom/monetdb5/geom.c
Branch: geo
Log Message:

turn debug output wkbaNULL into = wkbaNULL

such that Mtest (Mdiff) treats it as minor difference;
purely for testing convenience to easily distinguish
real (unintended) differences / errors from fake / intended ones


diffs (79 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -3384,7 +3384,7 @@ fprintf(stderr, wkbaFROMSTR\n);
 /* returns a pointer to a null wkba */
 wkba* wkbaNULL(void) {
static wkba nullval;
-fprintf(stderr, wkbaNULL\n);
+fprintf(stderr, = wkbaNULL\n);
 
nullval.itemsNum = ~(int) 0;
return (nullval);
@@ -3393,7 +3393,7 @@ fprintf(stderr, wkbaNULL\n);
 BUN wkbaHASH(wkba *wArray) {
int j,i;
BUN h = 0;
-fprintf(stderr, wkbaNULL\n);
+fprintf(stderr, = wkbaNULL\n);
 
for (j = 0; j  wArray-itemsNum ; j++) {
wkb* w = wArray-data[j];
@@ -3407,7 +3407,7 @@ fprintf(stderr, wkbaNULL\n);
 
 int wkbaCOMP(wkba *l, wkba *r) {
int i, res =0;;
-fprintf(stderr, wkbaNULL\n);
+fprintf(stderr, = wkbaNULL\n);
 
//compare the number of items
if (l-itemsNum != r-itemsNum)
@@ -3429,7 +3429,7 @@ wkba* wkbaREAD(wkba *a, stream *s, size_
 
(void) cnt;
assert(cnt == 1);
-   fprintf(stderr, wkbaNULL\n);
+   fprintf(stderr, = wkbaNULL\n);
 
if (mnstr_readInt(s, items) != 1)
return NULL;
@@ -3452,7 +3452,7 @@ int wkbaWRITE(wkba *a, stream *s, size_t
 
(void) cnt;
assert(cnt == 1);
-   fprintf(stderr, wkbaNULL\n);
+   fprintf(stderr, = wkbaNULL\n);
 
if (!mnstr_writeInt(s, items))
return GDK_FAIL;
@@ -3467,7 +3467,7 @@ int wkbaWRITE(wkba *a, stream *s, size_t
 
 var_t wkbaPUT(Heap *h, var_t *bun, wkba *val) {
char *base;
-fprintf(stderr, wkbaNULL\n);
+fprintf(stderr, = wkbaNULL\n);
 
*bun = HEAP_malloc(h, wkba_size(val-itemsNum));
base = h-base;
@@ -3477,18 +3477,18 @@ fprintf(stderr, wkbaNULL\n);
 }
 
 void wkbaDEL(Heap *h, var_t *index) {
-   fprintf(stderr, wkbaNULL\n);
+   fprintf(stderr, = wkbaNULL\n);
 HEAP_free(h, *index);
 }
 
 int wkbaLENGTH(wkba *p) {
var_t len = wkba_size(p-itemsNum);
assert(len = GDK_int_max);
-   fprintf(stderr, wkbaNULL\n);
+   fprintf(stderr, = wkbaNULL\n);
 return (int) len;
 }
 
 void wkbaHEAP(Heap *heap, size_t capacity) {
-   fprintf(stderr, wkbaNULL\n);
+   fprintf(stderr, = wkbaNULL\n);
 HEAP_initialize(heap, capacity, 0, (int) sizeof(var_t));
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Fixed a weird function interface.

2014-09-03 Thread Sjoerd Mullender
Changeset: 4f651484a427 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4f651484a427
Modified Files:
common/utils/msabaoth.c
Branch: Oct2014
Log Message:

Fixed a weird function interface.


diffs (truncated from 402 to 300 lines):

diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -65,15 +65,15 @@ char *_sabaoth_internal_uuid = NULL;
  * Retrieves the dbfarm path plus an optional extra component added
  */
 static char *
-getFarmPath(char **ret, size_t size, const char *extra)
+getFarmPath(char *pathbuf, size_t size, const char *extra)
 {
if (_sabaoth_internal_dbfarm == NULL)
return(strdup(sabaoth not initialized));
 
if (extra == NULL) {
-   snprintf(*ret, size, %s, _sabaoth_internal_dbfarm);
+   snprintf(pathbuf, size, %s, _sabaoth_internal_dbfarm);
} else {
-   snprintf(*ret, size, %s%c%s,
+   snprintf(pathbuf, size, %s%c%s,
_sabaoth_internal_dbfarm, DIR_SEP, extra);
}
 
@@ -85,7 +85,7 @@ getFarmPath(char **ret, size_t size, con
  * component added
  */
 static char *
-getDBPath(char **ret, size_t size, const char *extra)
+getDBPath(char *pathbuf, size_t size, const char *extra)
 {
if (_sabaoth_internal_dbfarm == NULL)
return(strdup(sabaoth not initialized));
@@ -93,10 +93,10 @@ getDBPath(char **ret, size_t size, const
return(strdup(sabaoth was not initialized as active 
database));
 
if (extra == NULL) {
-   snprintf(*ret, size, %s%c%s,
+   snprintf(pathbuf, size, %s%c%s,
_sabaoth_internal_dbfarm, DIR_SEP, 
_sabaoth_internal_dbname);
} else {
-   snprintf(*ret, size, %s%c%s%c%s,
+   snprintf(pathbuf, size, %s%c%s%c%s,
_sabaoth_internal_dbfarm, DIR_SEP,
_sabaoth_internal_dbname, DIR_SEP, extra);
}
@@ -206,13 +206,12 @@ msab_marchScenario(const char *lang)
char buf[256];  /* should be enough for now */
size_t len;
char pathbuf[PATHLENGTH];
-   char *path = pathbuf;
char *tmp;
 
-   if ((tmp = getDBPath(path, PATHLENGTH, SCENARIOFILE)) != NULL)
+   if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), SCENARIOFILE)) != NULL)
return(tmp);
 
-   if ((f = fopen(path, a+)) != NULL) {
+   if ((f = fopen(pathbuf, a+)) != NULL) {
if ((len = fread(buf, 1, 255, f))  0) {
char *p;
 
@@ -235,7 +234,7 @@ msab_marchScenario(const char *lang)
return(NULL);
}
snprintf(buf, sizeof(buf), failed to open file: %s (%s),
-   strerror(errno), path);
+   strerror(errno), pathbuf);
return(strdup(buf));
 }
 
@@ -251,13 +250,12 @@ msab_retreatScenario(const char *lang)
char buf[256];  /* should be enough to hold the entire file */
size_t len;
char pathbuf[PATHLENGTH];
-   char *path = pathbuf;
char *tmp;
 
-   if ((tmp = getDBPath(path, PATHLENGTH, SCENARIOFILE)) != NULL)
+   if ((tmp = getDBPath(pathbuf, sizeof(pathbuf), SCENARIOFILE)) != NULL)
return(tmp);
 
-   if ((f = fopen(path, a+)) != NULL) {
+   if ((f = fopen(pathbuf, a+)) != NULL) {
if ((len = fread(buf, 1, 255, f))  0) {
char *p;
char written = 0;
@@ -281,7 +279,7 @@ msab_retreatScenario(const char *lang)
if (fwrite(buf, 1, len, f)  len) {
(void)fclose(f);
snprintf(buf, sizeof(buf), failed to 
write: %s (%s),
-   strerror(errno), path);
+   strerror(errno), 
pathbuf);
return(strdup(buf));
}
fflush(f);
@@ -289,24 +287,24 @@ msab_retreatScenario(const char *lang)
return(NULL);
} else {
(void)fclose(f);
-   unlink(path);
+   unlink(pathbuf);
return(NULL);
}
} else {
if (ferror(f)) {
/* some error */
snprintf(buf, sizeof(buf), failed to write: %s 
(%s),
-strerror(errno), path);
+strerror(errno), pathbuf);
(void)fclose(f);
return strdup(buf);
} else
- 

MonetDB: Oct2014 - Fixed various issues found by Coverity.

2014-09-03 Thread Sjoerd Mullender
Changeset: 831685e763a4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=831685e763a4
Modified Files:
tools/merovingian/client/monetdb.c
tools/merovingian/daemon/argvcmds.c
tools/merovingian/daemon/connections.c
tools/merovingian/daemon/discoveryrunner.c
tools/merovingian/daemon/forkmserver.c
tools/merovingian/daemon/merovingian.c
tools/merovingian/daemon/multiplex-funnel.c
tools/merovingian/daemon/peering.c
tools/merovingian/daemon/proxy.c
tools/merovingian/utils/utils.c
Branch: Oct2014
Log Message:

Fixed various issues found by Coverity.


diffs (truncated from 597 to 300 lines):

diff --git a/tools/merovingian/client/monetdb.c 
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -198,7 +198,7 @@ MEROgetStatus(sabdb **ret, char *databas
sabdb *w = NULL;
size_t swlen = 50;
size_t swpos = 0;
-   sabdb **sw = malloc(sizeof(sabdb *) * swlen);
+   sabdb **sw;
char *p;
char *buf;
char *e;
@@ -211,11 +211,13 @@ MEROgetStatus(sabdb **ret, char *databas
if (e != NULL)
return(e);
 
+   sw = malloc(sizeof(sabdb *) * swlen);
orig = NULL;
if ((p = strtok(buf, \n)) != NULL) {
if (strcmp(p, OK) != 0) {
p = strdup(p);
free(buf);
+   free(sw);
return(p);
}
for (swpos = 0; (p = strtok(NULL, \n)) != NULL; swpos++) {
@@ -345,6 +347,7 @@ printStatus(sabdb *stats, int mode, int 
printf(   );
}
printf(  %-*s\n, uriwidth, uri);
+   free(uri);
} else if (mode == 2) {
/* long mode */
char *state;
@@ -1299,6 +1302,7 @@ command_get(int argc, char *argv[])
/* avoid work when there are no results */
if (orig == NULL) {
free(props);
+   free(defprops);
return;
}
 
@@ -1434,6 +1438,7 @@ command_get(int argc, char *argv[])
free(value);
msab_freeStatus(orig);
free(props);
+   free(defprops);
 }
 
 static void
diff --git a/tools/merovingian/daemon/argvcmds.c 
b/tools/merovingian/daemon/argvcmds.c
--- a/tools/merovingian/daemon/argvcmds.c
+++ b/tools/merovingian/daemon/argvcmds.c
@@ -197,10 +197,11 @@ command_get(confkeyval *ckv, int argc, c
FILE *pf;
char *pfile = getConfVal(ckv, pidfile);
 
-   if (pfile != NULL  (pf = fopen(pfile, r)) != NULL 
-   fgets(buf, sizeof(buf), pf) != NULL)
-   {
-   meropid = atoi(buf);
+   if (pfile != NULL  (pf = fopen(pfile, r)) != NULL) {
+   if (fgets(buf, sizeof(buf), pf) != NULL) {
+   meropid = atoi(buf);
+   }
+   fclose(pf);
}
} else {
if (ret = 0) {
@@ -410,6 +411,7 @@ command_set(confkeyval *ckv, int argc, c
if (dohash == 1) {
p = mcrypt_BackendSum(p, strlen(p));
snprintf(h, sizeof(h), {%s}%s, MONETDB5_PASSWDHASH, 
p);
+   free(p);
p = h;
}
}
@@ -433,20 +435,18 @@ command_set(confkeyval *ckv, int argc, c
return(1);
}
 
-   if ((pfile = fopen(property, r)) != NULL 
-   fgets(buf, sizeof(buf), pfile) != NULL)
-   {
-   meropid = atoi(buf);
-   if (meropid != 0) {
-   if (kill(meropid, SIGHUP) == -1) {
-   fprintf(stderr, sending SIGHUP to monetdbd[%d] 
failed: %s\n,
-   (int)meropid, strerror(errno));
-   return(1);
-   }
+   if ((pfile = fopen(property, r)) != NULL) {
+   if (fgets(buf, sizeof(buf), pfile) != NULL 
+   (meropid = atoi(buf)) != 0 
+   kill(meropid, SIGHUP) == -1)
+   {
+   fprintf(stderr, sending SIGHUP to monetdbd[%d] failed: 
%s\n,
+   (int)meropid, strerror(errno));
+   fclose(pfile);
+   return(1);
}
+   fclose(pfile);
}
-   if (pfile != NULL)
-   fclose(pfile);
 
return(0);
 }
@@ -492,6 +492,7 @@ command_stop(confkeyval *ckv, int argc, 
if (fgets(buf, sizeof(buf), pfile) == NULL) {
fprintf(stderr, unable to read from %s: 

MonetDB: Oct2014 - Dead code: name cannot be NULL after checking...

2014-09-03 Thread Sjoerd Mullender
Changeset: aa2f8ffb92b6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aa2f8ffb92b6
Modified Files:
sql/server/sql_mvc.c
Branch: Oct2014
Log Message:

Dead code: name cannot be NULL after checking that it is not NULL.


diffs (12 lines):

diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -223,7 +223,7 @@ build up the hash (not copyied in the tr
qc_clean(m-qc);
m-session-schema = find_sql_schema(m-session-tr, 
m-session-schema_name);
if (mvc_debug)
-   fprintf(stderr, #mvc_commit %s done\n, (name) ? name 
: );
+   fprintf(stderr, #mvc_commit %s done\n, name);
return 0;
}
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - small optimizations (reduce amount of nil/sor...

2014-09-03 Thread Niels Nes
Changeset: 34e4b974ad06 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=34e4b974ad06
Modified Files:
gdk/gdk_join.c
Branch: Oct2014
Log Message:

small optimizations (reduce amount of nil/sort checks for once we know it has 
nils or isn't sorted)


diffs (28 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2770,17 +2770,22 @@ project_##TYPE(BAT *bn, BAT *l, BAT *r, 
if (nilcheck  v == TYPE##_nil  bn-T-nonil) { \
bn-T-nonil = 0;   \
bn-T-nil = 1; \
+   nilcheck = 0;   \
}   \
if (sortcheck  lo   \
(bn-trevsorted | bn-tsorted | bn-tkey)) { \
if (v  prev) { \
bn-trevsorted = 0; \
-   if (!bn-tsorted)   \
+   if (!bn-tsorted) { \
bn-tkey = 0; /* can't be sure 
*/ \
+   sortcheck = 0;  \
+   }   \
} else if (v  prev) {  \
bn-tsorted = 0;\
-   if (!bn-trevsorted)\
+   if (!bn-trevsorted) {  \
bn-tkey = 0; /* can't be sure 
*/ \
+   sortcheck = 0;  \
+   }   \
} else {\
bn-tkey = 0; /* definitely */  \
}   \
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - only push down group by's down outer-joins (n...

2014-09-03 Thread Niels Nes
Changeset: 40d2e5b14efe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=40d2e5b14efe
Modified Files:
sql/benchmarks/tpch/Tests/02-explain.stable.out
sql/benchmarks/tpch/Tests/02-plan.stable.out
sql/benchmarks/tpch/Tests/17-explain.stable.out
sql/benchmarks/tpch/Tests/17-plan.stable.out
sql/benchmarks/tpch/Tests/20-explain.stable.out
sql/benchmarks/tpch/Tests/20-plan.stable.out
sql/server/rel_optimizer.c
Branch: Oct2014
Log Message:

only push down group by's down outer-joins (not usualy size reducing joins)


diffs (truncated from 843 to 300 lines):

diff --git a/sql/benchmarks/tpch/Tests/02-explain.stable.out 
b/sql/benchmarks/tpch/Tests/02-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/02-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/02-explain.stable.out
@@ -67,167 +67,168 @@ Ready.
 % 823 # length
 function user.s2_1{autoCommit=true}(A0:int,A1:str,A2:str,A3:str):void;
 X_6 := sql.mvc();
-X_10 := sql.bind(X_6,sys,part,p_type,0);
-X_19 := sql.bind(X_6,sys,part,p_size,0);
-X_7:bat[:oid,:oid]  := sql.tid(X_6,sys,part);
-X_334 := algebra.subselect(X_19,X_7,A0,A0,true,true,false);
-(X_21,r1_25) := sql.bind(X_6,sys,part,p_size,2);
-X_335 := algebra.subselect(r1_25,A0,A0,true,true,false);
-X_23 := sql.bind(X_6,sys,part,p_size,1);
-X_336 := algebra.subselect(X_23,X_7,A0,A0,true,true,false);
-X_24 := sql.subdelta(X_334,X_7,X_21,X_335,X_336);
-X_337 := algebra.likesubselect(X_10,X_24,A1,,false);
-(X_13,r1_13) := sql.bind(X_6,sys,part,p_type,2);
-X_338 := algebra.likesubselect(r1_13,A1,,false);
-X_16 := sql.bind(X_6,sys,part,p_type,1);
-X_339 := algebra.likesubselect(X_16,X_24,A1,,false);
-X_26 := sql.subdelta(X_337,X_24,X_13,X_338,X_339);
-X_27 := sql.bind(X_6,sys,part,p_partkey,0);
-(X_29,r1_36) := sql.bind(X_6,sys,part,p_partkey,2);
-X_31 := sql.bind(X_6,sys,part,p_partkey,1);
-X_32 := sql.projectdelta(X_26,X_27,X_29,r1_36,X_31);
-X_33:bat[:oid,:oid]  := sql.tid(X_6,sys,nation);
-X_36 := sql.bind_idxbat(X_6,sys,nation,nation_n_regionkey_fkey,0);
-(X_39,r1_48) := 
sql.bind_idxbat(X_6,sys,nation,nation_n_regionkey_fkey,2);
-X_42 := sql.bind_idxbat(X_6,sys,nation,nation_n_regionkey_fkey,1);
-X_44 := sql.projectdelta(X_33,X_36,X_39,r1_48,X_42);
-X_47 := sql.bind(X_6,sys,region,r_name,0);
-X_45:bat[:oid,:oid]  := sql.tid(X_6,sys,region);
-X_340 := algebra.subselect(X_47,X_45,A3,A3,true,true,false);
-(X_49,r1_59) := sql.bind(X_6,sys,region,r_name,2);
-X_341 := algebra.subselect(r1_59,A3,A3,true,true,false);
-X_51 := sql.bind(X_6,sys,region,r_name,1);
-X_342 := algebra.subselect(X_51,X_45,A3,A3,true,true,false);
-X_52 := sql.subdelta(X_340,X_45,X_49,X_341,X_342);
-X_55 := X_52;
-(X_56,r1_69) := algebra.join(X_44,X_55);
-X_58 := algebra.leftfetchjoin(X_56,X_33);
-X_59:bat[:oid,:oid]  := sql.tid(X_6,sys,supplier);
-X_61 := 
sql.bind_idxbat(X_6,sys,supplier,supplier_s_nationkey_fkey,0);
-(X_63,r1_76) := 
sql.bind_idxbat(X_6,sys,supplier,supplier_s_nationkey_fkey,2);
-X_66 := 
sql.bind_idxbat(X_6,sys,supplier,supplier_s_nationkey_fkey,1);
-X_67 := sql.projectdelta(X_59,X_61,X_63,r1_76,X_66);
-(X_68,r1_82) := algebra.join(X_58,X_67);
-X_70 := algebra.leftfetchjoin(r1_82,X_59);
-X_71:bat[:oid,:oid]  := sql.tid(X_6,sys,partsupp);
-X_73 := sql.bind_idxbat(X_6,sys,partsupp,partsupp_ps_suppkey_fkey,0);
-(X_76,r1_90) := 
sql.bind_idxbat(X_6,sys,partsupp,partsupp_ps_suppkey_fkey,2);
-X_79 := sql.bind_idxbat(X_6,sys,partsupp,partsupp_ps_suppkey_fkey,1);
-X_81 := sql.projectdelta(X_71,X_73,X_76,r1_90,X_79);
-(X_82,r1_97) := algebra.join(X_70,X_81);
-X_84 := sql.bind(X_6,sys,partsupp,ps_partkey,0);
-(X_86,r1_101) := sql.bind(X_6,sys,partsupp,ps_partkey,2);
-X_88 := sql.bind(X_6,sys,partsupp,ps_partkey,1);
-X_89 := sql.projectdelta(X_71,X_84,X_86,r1_101,X_88);
-X_90 := algebra.leftfetchjoin(r1_97,X_89);
-(X_91,r1_107,r2_107) := group.subgroupdone(X_90);
-X_94 := algebra.leftfetchjoin(r1_107,X_90);
-X_109 := sql.bind(X_6,sys,partsupp,ps_supplycost,0);
-(X_112,r1_130) := sql.bind(X_6,sys,partsupp,ps_supplycost,2);
-X_115 := sql.bind(X_6,sys,partsupp,ps_supplycost,1);
-X_117 := sql.projectdelta(X_71,X_109,X_112,r1_130,X_115);
-X_119 := algebra.leftfetchjoin(r1_97,X_117);
-X_120:bat[:oid,:lng]  := aggr.submin(X_119,X_91,r1_107,true);
-(X_95,r1_111) := algebra.join(X_32,X_94);
-X_97 := X_26;
-X_98 := algebra.leftfetchjoin(X_95,X_97);
-X_100 := 
sql.bind_idxbat(X_6,sys,partsupp,partsupp_ps_partkey_fkey,0);
-(X_102,r1_119) := 
sql.bind_idxbat(X_6,sys,partsupp,partsupp_ps_partkey_fkey,2);
-X_105 := 
sql.bind_idxbat(X_6,sys,partsupp,partsupp_ps_partkey_fkey,1);
-X_106 := sql.projectdelta(X_71,X_100,X_102,r1_119,X_105);
-(X_107,r1_125) := algebra.join(X_98,X_106);
-X_118 := 

MonetDB: Oct2014 - merged

2014-09-03 Thread Niels Nes
Changeset: 38bae7f3938b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38bae7f3938b
Modified Files:
sql/backends/monet5/bam/bam_loader.c
Branch: Oct2014
Log Message:

merged


diffs (12 lines):

diff --git a/sql/backends/monet5/bam/bam_loader.c 
b/sql/backends/monet5/bam/bam_loader.c
--- a/sql/backends/monet5/bam/bam_loader.c
+++ b/sql/backends/monet5/bam/bam_loader.c
@@ -543,7 +543,7 @@ bam_loader_files(Client cntxt, MalBlkPtr
 
FILE *f = NULL;
 
-   char cur;
+   int cur;
int line_size;
str line = NULL;
size_t line_buf_size = 0;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - merged

2014-09-03 Thread Niels Nes
Changeset: df60a79c660a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=df60a79c660a
Modified Files:
sql/server/sql_mvc.c
Branch: Oct2014
Log Message:

merged


diffs (12 lines):

diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -223,7 +223,7 @@ build up the hash (not copyied in the tr
qc_clean(m-qc);
m-session-schema = find_sql_schema(m-session-tr, 
m-session-schema_name);
if (mvc_debug)
-   fprintf(stderr, #mvc_commit %s done\n, (name) ? name 
: );
+   fprintf(stderr, #mvc_commit %s done\n, name);
return 0;
}
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - Fixed all(?) size_t that were wrongly written as ...

2014-09-03 Thread Foteini Alvanaki
Changeset: a0c0f1b2fbd8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a0c0f1b2fbd8
Modified Files:
geom/monetdb5/geom.c
geom/monetdb5/geom.h
Branch: geo
Log Message:

Fixed all(?) size_t that were wrongly written as int by old code.
Hopefully nothing will break again.


diffs (172 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -772,7 +772,8 @@ str wkbFromWKB(wkb **w, wkb **src) {
 /*int* tpe is needed to verify that the type of the FromText function used is 
the
  * same with the type of the geometry created from the wkt representation */
 str wkbFromText(wkb **geomWKB, str *geomWKT, int* srid, int *tpe) {
-   int len=0, te = *tpe;
+   size_t len=0; 
+   int te = *tpe;
char *errbuf;
str ex;
 
@@ -803,7 +804,7 @@ str wkbFromText(wkb **geomWKB, str *geom
 
 /*create textual representation of the wkb */
 str wkbAsText(char **txt, wkb **geomWKB, int* withSRID) {
-   int len =0;
+   size_t len =0;
char* wkt;
 
if(wkbTOSTR(wkt, len, *geomWKB)) {
@@ -959,7 +960,7 @@ str wkbMLineStringToPolygon(wkb** geomWK
//print areas
for(i=0; iitemsNum; i++) {
char* toStr = NULL;
-   int len = 0;
+   size_t len = 0;
wkbTOSTR(toStr, len, linestringsWKB[i]);
fprintf(stderr, %f %s\n, linestringsArea[i], toStr);
GDKfree(toStr);
@@ -2848,7 +2849,7 @@ str wkbCoordinateFromWKB(dbl* coordinate
 /*str
 mbrFromString(mbr **w, str *src)
 {
-   int len = *w ? (int) sizeof(mbr) : 0;
+   size_t len = *w ? sizeof(mbr) : 0;
char *errbuf;
str ex;
 
@@ -2905,9 +2906,9 @@ ordinatesMBR(mbr **res, flt *minX, flt *
 
 /* Creates the string representation (WKT) of a WKB */
 /* return length of resulting string. */
-int wkbTOSTR(char **geomWKT, int* len, wkb *geomWKB) {
+size_t wkbTOSTR(char **geomWKT, size_t* len, wkb *geomWKB) {
char *wkt = NULL;
-   int dstStrLen = 5;  /* nil */
+   size_t dstStrLen = 5;   /* nil */
 
/* from WKB to GEOSGeometry */
GEOSGeom geosGeometry = wkb2geos(geomWKB);
@@ -2921,7 +2922,7 @@ int wkbTOSTR(char **geomWKT, int* len, w
wkt = GEOSWKTWriter_write(WKT_wr, geosGeometry);
l = strlen(wkt);
assert(l  GDK_int_max);
-   dstStrLen = (int) l + 2;/* add quotes */
+   dstStrLen = l + 2;  /* add quotes */
GEOSWKTWriter_destroy(WKT_wr);
GEOSGeom_destroy(geosGeometry);
}
@@ -2937,12 +2938,13 @@ int wkbTOSTR(char **geomWKT, int* len, w
strcpy(*geomWKT, nil);
}
 
-   return (int) dstStrLen;
+   assert(dstStrLen = GDK_int_max);
+   return dstStrLen;
 }
 
 /* Creates WKB representation (including srid) from WKT representation */
 /* return number of parsed characters. */
-size_t wkbFROMSTR(char* geomWKT, int* len, wkb **geomWKB, int srid) {
+size_t wkbFROMSTR(char* geomWKT, size_t* len, wkb **geomWKB, int srid) {
GEOSGeom geosGeometry = NULL;   /* The geometry object that is parsed 
from the src string. */
GEOSWKTReader *WKT_reader;
char *polyhedralSurface = POLYHEDRALSURFACE;
@@ -3126,7 +3128,7 @@ void wkbHEAP(Heap *heap, size_t capacity
 
 /* TOSTR: print atom in a string. */
 /* return length of resulting string. */
-int mbrTOSTR(char **dst, int *len, mbr *atom) {
+size_t mbrTOSTR(char **dst, size_t *len, mbr *atom) {
static char tempWkt[MBR_WKTLEN];
size_t dstStrLen = 3;
 
@@ -3137,22 +3139,22 @@ int mbrTOSTR(char **dst, int *len, mbr *
assert(dstStrLen  GDK_int_max);
}
 
-   if (*len  (int) dstStrLen + 1) {
+   if (*len  dstStrLen + 1) {
if (*dst)
GDKfree(*dst);
-   *dst = GDKmalloc(*len = (int) dstStrLen + 1);
+   *dst = GDKmalloc(*len = dstStrLen + 1);
}
 
if (dstStrLen  3)
snprintf(*dst, *len, \%s\, tempWkt);
else
strcpy(*dst, nil);
-   return (int) dstStrLen;
+   return dstStrLen;
 }
 
 /* FROMSTR: parse string to mbr. */
 /* return number of parsed characters. */
-size_t mbrFROMSTR(char *src, int *len, mbr **atom) {
+size_t mbrFROMSTR(char *src, size_t *len, mbr **atom) {
int nil = 0;
size_t nchars = 0;  /* The number of characters parsed; the return 
value. */
GEOSGeom geosMbr = NULL; /* The geometry object that is parsed from the 
src string. */
@@ -3285,11 +3287,10 @@ int mbrWRITE(mbr *c, stream *s, size_t c
  * while the rerurned length (correctly!) is of type size_t ?
  * (not only here, but also elsewhere in this file / the geom code)
  */
-size_t wkbaTOSTR(char **toStr, int* len, wkba *fromArray) {
+size_t wkbaTOSTR(char **toStr, size_t *len, wkba *fromArray) {
int items 

MonetDB: SciQL-2-NetCDF - Merged with SciQL-2 branch.

2014-09-03 Thread Stefan Manegold
Changeset: 909c0db4670b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=909c0db4670b
Added Files:
sql/test/BugTracker-2014/Tests/All
sql/test/BugTracker-2014/Tests/nested_common_table_exp.Bug-3417.sql

sql/test/BugTracker-2014/Tests/nested_common_table_exp.Bug-3417.stable.err

sql/test/BugTracker-2014/Tests/nested_common_table_exp.Bug-3417.stable.out
sql/test/BugTracker-2014/Tests/query-crash.Bug-3418.sql
sql/test/BugTracker-2014/Tests/query-crash.Bug-3418.stable.err
sql/test/BugTracker-2014/Tests/query-crash.Bug-3418.stable.out
Modified Files:
.hgtags
Makefile.ag
NT/Makefile
NT/rules.msc
NT/winconfig.py
README
bootstrap
buildtools/Makefile.ag
buildtools/Mx/Code.c
buildtools/Mx/Def.c
buildtools/Mx/Display.c
buildtools/Mx/Form.c
buildtools/Mx/Io.c
buildtools/Mx/Makefile.ag
buildtools/Mx/Mx.c
buildtools/Mx/Mx.h
buildtools/Mx/MxFcnDef.h
buildtools/Mx/Print.c
buildtools/Mx/Sys.c
buildtools/Mx/Tok.c
buildtools/Mx/disclaimer.c
buildtools/Mx/disclaimer.h
buildtools/Mx/mx-mode.el
buildtools/Mx/mx_getopt.h
buildtools/autogen/autogen.py
buildtools/autogen/autogen/am.py
buildtools/autogen/autogen/codegen.py
buildtools/autogen/autogen/msc.py
buildtools/autogen/autogen/var.py
buildtools/autogen/setup.py
buildtools/conf/Makefile.ag
buildtools/conf/fixlicense.py
buildtools/conf/rules.mk
buildtools/conf/website.html
buildtools/doc/windowsbuild.rst
clients/Makefile.ag
clients/NT/Makefile.ag
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures_nocfitsio.stable.out
clients/Tests/MAL-signatures_sphinxclient.stable.out
clients/Tests/SQL-dump.stable.out
clients/Tests/SQL-dump.stable.out.32bit
clients/Tests/SQL-dump_nogeom.stable.out
clients/examples/C/Makefile.ag
clients/examples/C/sample0.c
clients/examples/C/sample1.c
clients/examples/C/sample2.c
clients/examples/C/sample3.c
clients/examples/C/sample4.c
clients/examples/C/smack00.c
clients/examples/C/smack01.c
clients/examples/Makefile.ag
clients/examples/php/Makefile.ag
clients/examples/python/basics.py
clients/examples/python/mclient-python2.py
clients/examples/python/mclient-python3.py
clients/examples/python/perf.py
clients/examples/python/sqlsample.py
clients/mapiclient/Makefile.ag
clients/mapiclient/ReadlineTools.c
clients/mapiclient/ReadlineTools.h
clients/mapiclient/dotmonetdb.c
clients/mapiclient/dotmonetdb.h
clients/mapiclient/dump.c
clients/mapiclient/mclient.c
clients/mapiclient/mnc.c
clients/mapiclient/mprompt.h
clients/mapiclient/msqldump.c
clients/mapiclient/msqldump.h
clients/mapiclient/prompt.c
clients/mapiclient/stethoscope.c
clients/mapiclient/tomograph.c
clients/mapilib/Makefile.ag
clients/mapilib/mapi.c
clients/mapilib/mapi.h
clients/mapilib/mapi.rc
clients/odbc/Makefile.ag
clients/odbc/doc/ExcelMonetDB.html
clients/odbc/doc/unixODBC.html
clients/odbc/driver/Makefile.ag
clients/odbc/driver/ODBCConvert.c
clients/odbc/driver/ODBCDbc.c
clients/odbc/driver/ODBCDbc.h
clients/odbc/driver/ODBCDesc.c
clients/odbc/driver/ODBCDesc.h
clients/odbc/driver/ODBCEnv.c
clients/odbc/driver/ODBCEnv.h
clients/odbc/driver/ODBCError.c
clients/odbc/driver/ODBCError.h
clients/odbc/driver/ODBCGlobal.h
clients/odbc/driver/ODBCStmt.c
clients/odbc/driver/ODBCStmt.h
clients/odbc/driver/ODBCUtil.c
clients/odbc/driver/ODBCUtil.h
clients/odbc/driver/SQLAllocConnect.c
clients/odbc/driver/SQLAllocEnv.c
clients/odbc/driver/SQLAllocHandle.c
clients/odbc/driver/SQLAllocStmt.c
clients/odbc/driver/SQLBindCol.c
clients/odbc/driver/SQLBindParameter.c
clients/odbc/driver/SQLBrowseConnect.c
clients/odbc/driver/SQLBulkOperations.c
clients/odbc/driver/SQLCancel.c
clients/odbc/driver/SQLCloseCursor.c
clients/odbc/driver/SQLColAttribute.c
clients/odbc/driver/SQLColAttributes.c
clients/odbc/driver/SQLColumnPrivileges.c
clients/odbc/driver/SQLColumns.c
clients/odbc/driver/SQLConnect.c
clients/odbc/driver/SQLCopyDesc.c
clients/odbc/driver/SQLDataSources.c
clients/odbc/driver/SQLDescribeCol.c
clients/odbc/driver/SQLDescribeParam.c
clients/odbc/driver/SQLDisconnect.c
clients/odbc/driver/SQLDriverConnect.c
  

MonetDB: Oct2014 - Postpone incrementing pointer until after NUL...

2014-09-03 Thread Sjoerd Mullender
Changeset: 430c75b1de90 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=430c75b1de90
Modified Files:
sql/backends/monet5/bam/bam_export.c
Branch: Oct2014
Log Message:

Postpone incrementing pointer until after NULL check.


diffs (17 lines):

diff --git a/sql/backends/monet5/bam/bam_export.c 
b/sql/backends/monet5/bam/bam_export.c
--- a/sql/backends/monet5/bam/bam_export.c
+++ b/sql/backends/monet5/bam/bam_export.c
@@ -185,11 +185,12 @@ fill_bam_alig(str qname, sht flag, str r
FILL_BAM_ALIG_ERR CIGAR and sequence 
length inconsistency: %d (SEQ) vs %d (CIGAR),
alignment_nr, c-l_qseq, 
(int32_t)bam_cigar2qlen(c, bam1_cigar(b)));
}
-   p = (uint8_t*)alloc_data(b, doff + c-l_qseq + 
(c-l_qseq+1)/2) + doff;
+   p = (uint8_t*)alloc_data(b, doff + c-l_qseq + 
(c-l_qseq+1)/2);
if(p == NULL) {
throw(MAL, fill_bam_alig,
FILL_BAM_ALIG_ERR MAL_MALLOC_FAIL, 
alignment_nr);
}
+   p += doff;
memset(p, 0, (c-l_qseq+1)/2);
for (i = 0; i  c-l_qseq; ++i)
p[i/2] |= bam_nt16_table[(int)seq[i]]  
4*(1-i%2);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Coverity-inspired fixes.

2014-09-03 Thread Sjoerd Mullender
Changeset: 5af8c49ef07d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5af8c49ef07d
Modified Files:
sql/backends/monet5/bam/bam_loader.c
sql/backends/monet5/bam/bam_wrapper.c
Branch: Oct2014
Log Message:

Coverity-inspired fixes.


diffs (274 lines):

diff --git a/sql/backends/monet5/bam/bam_loader.c 
b/sql/backends/monet5/bam/bam_loader.c
--- a/sql/backends/monet5/bam/bam_loader.c
+++ b/sql/backends/monet5/bam/bam_loader.c
@@ -81,8 +81,14 @@ create_reader_thread_data(bam_wrapper * 
 
sht i;
 
+   assert(nr_threads  0);
+
if (d == NULL || reader_lock == NULL || cur_file == NULL
|| failure == NULL) {
+   GDKfree(d);
+   GDKfree(reader_lock);
+   GDKfree(cur_file);
+   GDKfree(failure);
return NULL;
}
 
diff --git a/sql/backends/monet5/bam/bam_wrapper.c 
b/sql/backends/monet5/bam/bam_wrapper.c
--- a/sql/backends/monet5/bam/bam_wrapper.c
+++ b/sql/backends/monet5/bam/bam_wrapper.c
@@ -1783,63 +1783,118 @@ write_aux_bam1_t(bam_wrapper * bw, bam1_
 /* Macros for appending data from an alignment struct to binary
  * files. Note that str msg should be defined in the caller. */
 
-#define ERR_APPEND_ALIGNMENT(msg, fnc, field) \
-   msg = createException(MAL, fnc, \
- Could not append alignment 
from file '%s' to binary files: Could not write field '%s' to binary file, \
-  bw-file_location, field)
+#define ERR_APPEND_ALIGNMENT(msg, fnc, field)  \
+   do {
\
+   msg = createException(MAL, fnc, 
\
+ Could not append 
alignment from file '%s' to binary files: Could not write field '%s' to binary 
file, \
+ bw-file_location, 
field);\
+   goto cleanup;   
\
+   } while (0)
 
-#define APPEND_ALIGNMENT(msg, fnc, a, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, 
f11, f12) { \
-   if(!APPEND_LNG(f1, (a).virtual_offset)) ERR_APPEND_ALIGNMENT(msg, fnc, 
virtual_offset); \
-   if(f2 != NULL) { \
-   if(!APPEND_STR(f2, (a).qname)) ERR_APPEND_ALIGNMENT(msg, fnc, 
qname); \
-   } \
-   if(!APPEND_SHT(f3, (a).flag)) ERR_APPEND_ALIGNMENT(msg, fnc, flag); \
-   if(!APPEND_STR(f4, (a).rname)) ERR_APPEND_ALIGNMENT(msg, fnc, rname); 
\
-   if(!APPEND_INT(f5, (a).pos)) ERR_APPEND_ALIGNMENT(msg, fnc, pos); \
-   if(!APPEND_SHT(f6, (a).mapq)) ERR_APPEND_ALIGNMENT(msg, fnc, mapq); \
-   if(!APPEND_STR(f7, (a).cigar)) ERR_APPEND_ALIGNMENT(msg, fnc, cigar); 
\
-   if(!APPEND_STR(f8, (a).rnext)) ERR_APPEND_ALIGNMENT(msg, fnc, rnext); 
\
-   if(!APPEND_INT(f9, (a).pnext)) ERR_APPEND_ALIGNMENT(msg, fnc, pnext); 
\
-   if(!APPEND_INT(f10, (a).tlen)) ERR_APPEND_ALIGNMENT(msg, fnc, tlen); \
-   if(!APPEND_STR(f11, (a).seq)) ERR_APPEND_ALIGNMENT(msg, fnc, seq); \
-   if(!APPEND_STR(f12, (a).qual)) ERR_APPEND_ALIGNMENT(msg, fnc, qual); \
-}
+#define APPEND_ALIGNMENT(msg, fnc, a, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, 
f11, f12) \
+   do {
\
+   if(!APPEND_LNG(f1, (a).virtual_offset)) 
\
+   ERR_APPEND_ALIGNMENT(msg, fnc, virtual_offset);   
\
+   if(f2 != NULL) {
\
+   if(!APPEND_STR(f2, (a).qname))  
\
+   ERR_APPEND_ALIGNMENT(msg, fnc, qname);
\
+   }   
\
+   if(!APPEND_SHT(f3, (a).flag))   
\
+   ERR_APPEND_ALIGNMENT(msg, fnc, flag); 
\
+   if(!APPEND_STR(f4, (a).rname))  
\
+   ERR_APPEND_ALIGNMENT(msg, fnc, rname);
\
+   if(!APPEND_INT(f5, (a).pos))
\
+   ERR_APPEND_ALIGNMENT(msg, fnc, pos);  
\
+   

MonetDB: Oct2014 - Approved output.

2014-09-03 Thread Sjoerd Mullender
Changeset: 9085d8de739c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9085d8de739c
Modified Files:
clients/Tests/exports.stable.out
Branch: Oct2014
Log Message:

Approved output.


diffs (21 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2245,7 +2245,7 @@ Scenario findScenario(str nme);
 Symbol findSymbol(Module nspace, str mod, str fcn);
 Symbol findSymbolInModule(Module v, str fcn);
 int findTmpVariable(MalBlkPtr mb, int type);
-int findVariable(MalBlkPtr mb, str name);
+int findVariable(MalBlkPtr mb, const char *name);
 int findVariableLength(MalBlkPtr mb, str name, int len);
 void finishNamespace(void);
 str finishRef;
@@ -2374,7 +2374,7 @@ int isProcedure(MalBlkPtr mb, InstrPtr p
 int isSideEffectFree(MalBlkPtr mb);
 int isSlice(InstrPtr q);
 int isSubSelect(InstrPtr q);
-int isTmpName(str n);
+int isTmpName(const char *n);
 int isTopn(InstrPtr q);
 int isTypeName(str n);
 int isUnsafeFunction(InstrPtr q);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Coverity-inspired fixes.

2014-09-03 Thread Sjoerd Mullender
Changeset: 5540ca0e866b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5540ca0e866b
Modified Files:
sql/backends/monet5/bam/bam_export.c
sql/backends/monet5/bam/bam_loader.c
sql/backends/monet5/bam/bam_wrapper.c
Branch: Oct2014
Log Message:

Coverity-inspired fixes.


diffs (73 lines):

diff --git a/sql/backends/monet5/bam/bam_export.c 
b/sql/backends/monet5/bam/bam_export.c
--- a/sql/backends/monet5/bam/bam_export.c
+++ b/sql/backends/monet5/bam/bam_export.c
@@ -426,7 +426,8 @@ sam_export(Client cntxt, MalBlkPtr mb, M
goto cleanup;
}
 
-   write_header(output, fields);
+   if ((msg = write_header(output, fields)) != MAL_SUCCEED)
+   goto cleanup;
 
 
for (i=0; ituple_count; ++i) {
diff --git a/sql/backends/monet5/bam/bam_loader.c 
b/sql/backends/monet5/bam/bam_loader.c
--- a/sql/backends/monet5/bam/bam_loader.c
+++ b/sql/backends/monet5/bam/bam_loader.c
@@ -689,12 +689,13 @@ bam_drop_file(Client cntxt, MalBlkPtr mb
 
str msg;
 
-   if ((msg =
-drop_file(cntxt, bam.drop_file, file_id,
-  dbschema)) != MAL_SUCCEED) {
-   throw(MAL, bam_drop_file,
+   msg = drop_file(cntxt, bam.drop_file, file_id, dbschema);
+   if (msg != MAL_SUCCEED) {
+   str msg2 = createException(MAL, bam_drop_file,
  Error when dropping file with file id ' LLFMT
  ': %s\n, file_id, msg);
+   GDKfree(msg);
+   return msg2;
}
 
(void) stk;
diff --git a/sql/backends/monet5/bam/bam_wrapper.c 
b/sql/backends/monet5/bam/bam_wrapper.c
--- a/sql/backends/monet5/bam/bam_wrapper.c
+++ b/sql/backends/monet5/bam/bam_wrapper.c
@@ -720,6 +720,7 @@ process_header(bam_wrapper * bw)
str s;
lng l;
 
+   hl.options = NULL;
if (bw-type == BAM) {
header_str = bw-bam.header-text;
} else {
@@ -2101,7 +2102,8 @@ process_alignments(bam_wrapper * bw, bit
 * this knowledge to write the alignments for
 * that qname to suitable files.
 */
-   complete_qname_group(aligs, alig_index, bw);
+   if ((msg = complete_qname_group(aligs, alig_index, bw)) 
!= MAL_SUCCEED)
+   goto cleanup;
 
/* All alignments for the previous qname are
 * written to files, we can now start
@@ -2173,7 +2175,7 @@ process_alignments(bam_wrapper * bw, bit
if ((aligs =
 GDKrealloc(aligs,
new_nr_aligs *
-   sizeof(alignment))) ==
+   sizeof(alignment *))) ==
NULL) {
msg = createException(MAL,
  
process_alignments,
@@ -2209,7 +2211,7 @@ process_alignments(bam_wrapper * bw, bit
if (bw-dbschema == 1) {
/* alignments will still contain at least one
 * alignment, so empty it */
-   complete_qname_group(aligs, alig_index, bw);
+   msg = complete_qname_group(aligs, alig_index, bw);
}
 
  cleanup:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Comment out unused code.

2014-09-03 Thread Sjoerd Mullender
Changeset: 2e1396cdfb83 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e1396cdfb83
Modified Files:
sql/backends/monet5/bam/bam_export.c
Branch: Oct2014
Log Message:

Comment out unused code.


diffs (60 lines):

diff --git a/sql/backends/monet5/bam/bam_export.c 
b/sql/backends/monet5/bam/bam_export.c
--- a/sql/backends/monet5/bam/bam_export.c
+++ b/sql/backends/monet5/bam/bam_export.c
@@ -33,6 +33,7 @@
 #include bam_db_interface.h
 #include bam_export.h
 
+#define NOT_IMPLEMENTED/* export is not yet implemented */
 
 typedef struct bam_field {
str name;
@@ -43,6 +44,8 @@ typedef struct bam_field {
 } bam_field;
 
 
+#ifndef NOT_IMPLEMENTED
+
 /**
  * Copied directly from bam.h/bam_import.c for use by fill_bam_alig
  * Can not change the calls to realloc to GDKrealloc, since
@@ -222,7 +225,7 @@ fill_bam_alig(str qname, sht flag, str r
 
return MAL_SUCCEED;
 }
-
+#endif
 
 
 
@@ -462,6 +465,14 @@ cleanup:
 str
 bam_export(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
+#ifdef NOT_IMPLEMENTED
+   (void) cntxt;
+   (void) mb;
+   (void) stk;
+   (void) pci;
+
+   throw(MAL, bam_export, Exporting to BAM files is not implemented 
yet. This is our first priority for the next release of the BAM library.);
+#else
/* arg 1: path to desired output file */
str output_path = *(str *) getArgReference(stk, pci, pci-retc);
 
@@ -480,8 +491,6 @@ bam_export(Client cntxt, MalBlkPtr mb, M
str sql;
str msg = MAL_SUCCEED;
 
-   throw(MAL, bam_export, Exporting to BAM files is not implemented 
yet. This is our first priority for the next release of the BAM library.);
-
if ((output = bam_open(output_path, wb)) == NULL) {
msg = createException(MAL, bam_export, Could not open output 
file '%s' for writing, output_path);
goto cleanup;
@@ -564,5 +573,6 @@ cleanup:
unlink(output_header_path);
}
return msg;
+#endif
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Use after free.

2014-09-03 Thread Sjoerd Mullender
Changeset: bb3efdc23c6a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bb3efdc23c6a
Modified Files:
sql/backends/monet5/bam/bam_wrapper.c
Branch: Oct2014
Log Message:

Use after free.


diffs (18 lines):

diff --git a/sql/backends/monet5/bam/bam_wrapper.c 
b/sql/backends/monet5/bam/bam_wrapper.c
--- a/sql/backends/monet5/bam/bam_wrapper.c
+++ b/sql/backends/monet5/bam/bam_wrapper.c
@@ -1023,11 +1023,12 @@ process_header(bam_wrapper * bw)
   
pg_fields_found[4]);
 
/* if this point is reached, option 
wasn't recognized */
-   clear_bam_header_line(hl);
-   throw(MAL, process_header,
+   msg = createException(MAL, 
process_header,
  ERR_PROCESS_HEADER
  Unknown option '%s' found in 
header tag PG,
  bw-file_location, 
hl.options[o].tag);
+   clear_bam_header_line(hl);
+   return msg;
}
if (!pg_fields_found[0]) {
clear_bam_header_line(hl);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Oct2014 branch.

2014-09-03 Thread Sjoerd Mullender
Changeset: 404fa0bd1997 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=404fa0bd1997
Modified Files:
clients/Tests/exports.stable.out
common/options/monet_options.c
common/utils/msabaoth.c
gdk/gdk_join.c
monetdb5/extras/rapi/rapi.c
monetdb5/modules/atoms/json.c
sql/backends/monet5/bam/bam_export.c
sql/backends/monet5/bam/bam_loader.c
sql/backends/monet5/bam/bam_wrapper.c
sql/benchmarks/tpch/Tests/02-explain.stable.out
sql/benchmarks/tpch/Tests/02-plan.stable.out
sql/benchmarks/tpch/Tests/17-explain.stable.out
sql/benchmarks/tpch/Tests/17-plan.stable.out
sql/benchmarks/tpch/Tests/20-explain.stable.out
sql/benchmarks/tpch/Tests/20-plan.stable.out
sql/server/rel_optimizer.c
sql/server/sql_mvc.c
tools/merovingian/client/monetdb.c
tools/merovingian/daemon/argvcmds.c
tools/merovingian/daemon/connections.c
tools/merovingian/daemon/controlrunner.c
tools/merovingian/daemon/discoveryrunner.c
tools/merovingian/daemon/forkmserver.c
tools/merovingian/daemon/merovingian.c
tools/merovingian/daemon/multiplex-funnel.c
tools/merovingian/daemon/peering.c
tools/merovingian/daemon/proxy.c
tools/merovingian/utils/utils.c
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (truncated from 2575 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2266,7 +2266,7 @@ Scenario findScenario(str nme);
 Symbol findSymbol(Module nspace, str mod, str fcn);
 Symbol findSymbolInModule(Module v, str fcn);
 int findTmpVariable(MalBlkPtr mb, int type);
-int findVariable(MalBlkPtr mb, str name);
+int findVariable(MalBlkPtr mb, const char *name);
 int findVariableLength(MalBlkPtr mb, str name, int len);
 void finishNamespace(void);
 str finishRef;
@@ -2395,7 +2395,7 @@ int isProcedure(MalBlkPtr mb, InstrPtr p
 int isSideEffectFree(MalBlkPtr mb);
 int isSlice(InstrPtr q);
 int isSubSelect(InstrPtr q);
-int isTmpName(str n);
+int isTmpName(const char *n);
 int isTopn(InstrPtr q);
 int isTypeName(str n);
 int isUnsafeFunction(InstrPtr q);
diff --git a/common/options/monet_options.c b/common/options/monet_options.c
--- a/common/options/monet_options.c
+++ b/common/options/monet_options.c
@@ -125,9 +125,9 @@ mo_config_file(opt **Set, int setlen, ch
if (default_set == NULL) {
set = NULL;
setlen = mo_default_set(set, 0);
-   }
+   } else
+   setlen = default_setlen;
Set = default_set;
-   setlen = default_setlen;
}
set = *Set;
fd = fopen(file, r);
@@ -209,9 +209,9 @@ mo_system_config(opt **Set, int setlen)
opt *set = NULL;
 
setlen = mo_default_set(set, 0);
-   }
+   } else
+   setlen = default_setlen;
Set = default_set;
-   setlen = default_setlen;
}
cfg = mo_find_option(*Set, setlen, config);
if (!cfg)
@@ -305,9 +305,9 @@ mo_add_option(opt **Set, int setlen, opt
if (default_set == NULL) {
set = NULL;
setlen = mo_default_set(set, 0);
-   }
+   } else
+   setlen = default_setlen;
Set = default_set;
-   setlen = default_setlen;
}
set = (opt *) realloc(*Set, (setlen + 1) * sizeof(opt));
set[setlen].kind = kind;
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -65,15 +65,15 @@ char *_sabaoth_internal_uuid = NULL;
  * Retrieves the dbfarm path plus an optional extra component added
  */
 static char *
-getFarmPath(char **ret, size_t size, const char *extra)
+getFarmPath(char *pathbuf, size_t size, const char *extra)
 {
if (_sabaoth_internal_dbfarm == NULL)
return(strdup(sabaoth not initialized));
 
if (extra == NULL) {
-   snprintf(*ret, size, %s, _sabaoth_internal_dbfarm);
+   snprintf(pathbuf, size, %s, _sabaoth_internal_dbfarm);
} else {
-   snprintf(*ret, size, %s%c%s,
+   snprintf(pathbuf, size, %s%c%s,
_sabaoth_internal_dbfarm, DIR_SEP, extra);
}
 
@@ -85,7 +85,7 @@ getFarmPath(char **ret, size_t size, con
  * component added
  */
 static char *
-getDBPath(char **ret, size_t size, const char *extra)
+getDBPath(char *pathbuf, size_t size, const char *extra)
 {
if (_sabaoth_internal_dbfarm == NULL)
return(strdup(sabaoth not initialized));
@@ -93,10 +93,10 @@ getDBPath(char **ret, size_t size, 

MonetDB: Oct2014 - Resource leak.

2014-09-03 Thread Sjoerd Mullender
Changeset: d6c98d782a78 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d6c98d782a78
Modified Files:
monetdb5/extras/rapi/rapi.c
Branch: Oct2014
Log Message:

Resource leak.


diffs (12 lines):

diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -402,7 +402,7 @@ str RAPIeval(Client cntxt, MalBlkPtr mb,
int ret_cols = 0; /* int because pci-retc is int, too*/
str *args;
int evalErr;
-   char *msg = createException(MAL, rapi.eval, NYI);
+   char *msg = MAL_SUCCEED;
BAT *b;
BUN cnt;
node * argnode;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: rdf - Fix a bug causing FK violation.

2014-09-03 Thread Minh-Duc Pham
Changeset: 91767bd46ad3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=91767bd46ad3
Modified Files:
monetdb5/extras/rdf/rdfschema.c
Branch: rdf
Log Message:

Fix a bug causing FK violation.

The reason is that FKs referring to lots-of-null subjects will be violated 
after these subject are moved to PSO.

Thus, we do not remove lots-of-null subjects from tables which are referred by 
non-dirty FKs.


diffs (76 lines):

diff --git a/monetdb5/extras/rdf/rdfschema.c b/monetdb5/extras/rdf/rdfschema.c
--- a/monetdb5/extras/rdf/rdfschema.c
+++ b/monetdb5/extras/rdf/rdfschema.c
@@ -8862,6 +8862,27 @@ str printFinalStructure(CStableStat* cst
 }
 #endif
 
+
+static
+str getRefTables(CSPropTypes *csPropTypes, int numTables, char* isRefTables){
+   int i, j; 
+   for (i = 0; i  numTables; i++){
+
+   for(j = 0; j  csPropTypes[i].numProp; j++){
+   #if REMOVE_INFREQ_PROP
+   if (csPropTypes[i].lstPropTypes[j].defColIdx == -1) 
continue;  //Infrequent prop
+   #endif
+   if (csPropTypes[i].lstPropTypes[j].isFKProp == 1  
csPropTypes[i].lstPropTypes[j].isDirtyFKProp == 0){
+   
isRefTables[csPropTypes[i].lstPropTypes[j].refTblId] = 1;
+   }
+
+   }
+   }
+   
+   return MAL_SUCCEED; 
+}
+
+
 static
 void initCSTableIdxMapping(CSset* freqCSset, int* csTblIdxMapping, int* 
csFreqCSMapping, int* mfreqIdxTblIdxMapping, int* mTblIdxFreqIdxMapping, int 
*numTables, CSlabel *labels){
 
@@ -9821,7 +9842,7 @@ RDFextractCSwithTypes(int *ret, bat *sba

free(pscores); 
}
-   
+
printf(The final simTfidfThreshold is %f\n,simTfidfThreshold);
// Create label per freqCS
 
@@ -11240,6 +11261,7 @@ RDFreorganize(int *ret, CStableStat *cst
#if REMOVE_LOTSOFNULL_SUBJECT
int freqIdx;
int numSubjRemoved = 0;
+   char*isRefTables = NULL;
#endif
char*isLotsNullSubj = NULL; 
 
@@ -11467,8 +11489,18 @@ RDFreorganize(int *ret, CStableStat *cst
#if REMOVE_LOTSOFNULL_SUBJECT
//TODO: Find the better way than using isLotsNullSubj array to keep
//the status of subject
+   //
+   //If the to-be-removed subject is referred to by an FK, it will make the
+   //FK violated. Hence, either the FK should be set isDirty or the 
subject of
+   //non-dirty FK is not removed. We follow the latter approach: Do not 
remove
+   //the subject if it is referred to by a NON-dirty FK. (Dirty FK will be 
re-checked, thus, 
+   //the triples refers to removed subjects will go to PSO).
+   //
+   isRefTables = (char *)malloc(sizeof(char) * cstablestat-numTables);
isLotsNullSubj = (char *) malloc(sizeof(char) * BATcount(sbat) + 1);
initCharArray(isLotsNullSubj, BATcount(sbat) + 1,0);
+   initCharArray(isRefTables, cstablestat-numTables, 0); 
+   getRefTables(*csPropTypes, cstablestat-numTables, isRefTables);
#else
(void) isLotsNullSubj;
#endif
@@ -11483,7 +11515,7 @@ RDFreorganize(int *ret, CStableStat *cst
//TODO: If the subject is the target 
// of an FK prop, do not remove that subject. This is hard to 
check.
//
-   if (tblIdx != -1){
+   if (tblIdx != -1  isRefTables[tblIdx] != 1){
freqIdx = csFreqCSMapping[subjCSMap[*sbt]];
if (freqCSset-items[freqIdx].numProp  
cstablestat-lstcstable[tblIdx].numCol * LOTSOFNULL_SUBJECT_THRESHOLD){
//printf(Subject  BUNFMT  is removed from 
table %d with %d cols \n,*sbt,tblIdx, cstablestat-lstcstable[tblIdx].numCol);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mosaic - Fix join calls

2014-09-03 Thread Martin Kersten
Changeset: fc5c96451897 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc5c96451897
Modified Files:
monetdb5/modules/mal/Tests/mosaic_runlength_joins.mal
monetdb5/modules/mal/Tests/mosaic_runlength_joins.stable.out
monetdb5/modules/mal/mosaic.c
Branch: mosaic
Log Message:

Fix join calls


diffs (72 lines):

diff --git a/monetdb5/modules/mal/Tests/mosaic_runlength_joins.mal 
b/monetdb5/modules/mal/Tests/mosaic_runlength_joins.mal
--- a/monetdb5/modules/mal/Tests/mosaic_runlength_joins.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_runlength_joins.mal
@@ -8,7 +8,7 @@ bat.append(b,9);
 b:= bat.append(b,b);
 
 io.print(b);
-x:= mosaic.compress(b,runtime);
+x:= mosaic.compress(b,runlength);
 
 c:= bat.new(:oid,:oid);
 bat.append(c,0@0);
diff --git a/monetdb5/modules/mal/Tests/mosaic_runlength_joins.stable.out 
b/monetdb5/modules/mal/Tests/mosaic_runlength_joins.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_runlength_joins.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_runlength_joins.stable.out
@@ -27,7 +27,7 @@ function user.main():void;
 bat.append(b,9);
 b := bat.append(b,b);
 io.print(b);
-x := mosaic.compress(b,runtime);
+x := mosaic.compress(b,runlength);
 c := bat.new(:oid,:oid);
 bat.append(c,0@0);
 bat.append(c,2@0);
diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -207,10 +207,6 @@ MOScompressInternal(Client cntxt, int *r
} else
dictsize = 2;
}
-   if (flg == 0){
-   BBPkeepref(*ret = *bid);
-   return msg; // don't compress at all
-   }
 
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, mosaic.compress, INTERNAL_BAT_ACCESS);
@@ -234,6 +230,10 @@ MOScompressInternal(Client cntxt, int *r
BBPkeepref(*ret = b-batCacheid);
return msg;
}
+   if (flg == 0){
+   BBPkeepref(*ret = b-batCacheid);
+   return msg; // don't compress at all
+   }
 
if (b-T-heap.compressed) {
BBPkeepref(*ret = b-batCacheid);
@@ -1057,7 +1057,7 @@ str MOSleftfetchjoin(Client cntxt, MalBl
 str
 MOSjoin(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
-   int *ret,*lid,*rid;
+   int *ret, *ret2,*lid,*rid;
int part, nrofparts;
int startblk,stopblk;
BAT  *bl = NULL, *br = NULL, *bln = NULL, *brn= NULL;
@@ -1069,11 +1069,12 @@ MOSjoin(Client cntxt, MalBlkPtr mb, MalS
(void) cntxt;
(void) mb;
ret = (int*) getArgReference(stk,pci,0);
+   ret2 = (int*) getArgReference(stk,pci,1);
lid = (int*) getArgReference(stk,pci,2);
rid = (int*) getArgReference(stk,pci,3);
 
if( !isCompressed(*lid)  !isCompressed(*rid))
-   return ALGjoin(ret,lid,rid);
+   return ALGjoin2(ret,ret2,lid,rid);
 
bl = BATdescriptor(*(int*) getArgReference(stk,pci,2));
if( bl == NULL)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - Headless does not need :void tails

2014-09-03 Thread Martin Kersten
Changeset: 4128e4d4ea6e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4128e4d4ea6e
Modified Files:
monetdb5/modules/mal/batcalc.mal
monetdb5/modules/mal/batcalc.mal.sh
Branch: Oct2014
Log Message:

Headless does not need :void tails
It is a physical property


diffs (225 lines):

diff --git a/monetdb5/modules/mal/batcalc.mal b/monetdb5/modules/mal/batcalc.mal
--- a/monetdb5/modules/mal/batcalc.mal
+++ b/monetdb5/modules/mal/batcalc.mal
@@ -19813,16 +19813,16 @@ pattern avg(b:bat[:oid,:dbl],s:bat[:oid,
 address CMDcalcavg
 comment average and number of non-nil values of B with candidates list;
 
-pattern bit(b:bat[:oid,:void]) :bat[:oid,:bit]
+pattern bit(b:bat[:oid,:oid]) :bat[:oid,:bit]
 address CMDconvertsignal_bit
 comment cast from void to bit, signal error on overflow;
-pattern bit(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:bit]
+pattern bit(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:bit]
 address CMDconvertsignal_bit
 comment cast from void to bit with candidates list, signal error on overflow;
-pattern bit_noerror(b:bat[:oid,:void]) :bat[:oid,:bit]
+pattern bit_noerror(b:bat[:oid,:oid]) :bat[:oid,:bit]
 address CMDconvert_bit
 comment cast from void to bit;
-pattern bit_noerror(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:bit]
+pattern bit_noerror(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:bit]
 address CMDconvert_bit
 comment cast from void to bit with candidates list;
 
@@ -19956,16 +19956,16 @@ pattern bit_noerror(b:bat[:oid,:str],s:b
 address CMDconvert_bit
 comment cast from str to bit with candidates list;
 
-pattern bte(b:bat[:oid,:void]) :bat[:oid,:bte]
+pattern bte(b:bat[:oid,:oid]) :bat[:oid,:bte]
 address CMDconvertsignal_bte
 comment cast from void to bte, signal error on overflow;
-pattern bte(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:bte]
+pattern bte(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:bte]
 address CMDconvertsignal_bte
 comment cast from void to bte with candidates list, signal error on overflow;
-pattern bte_noerror(b:bat[:oid,:void]) :bat[:oid,:bte]
+pattern bte_noerror(b:bat[:oid,:oid]) :bat[:oid,:bte]
 address CMDconvert_bte
 comment cast from void to bte;
-pattern bte_noerror(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:bte]
+pattern bte_noerror(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:bte]
 address CMDconvert_bte
 comment cast from void to bte with candidates list;
 
@@ -20099,16 +20099,16 @@ pattern bte_noerror(b:bat[:oid,:str],s:b
 address CMDconvert_bte
 comment cast from str to bte with candidates list;
 
-pattern sht(b:bat[:oid,:void]) :bat[:oid,:sht]
+pattern sht(b:bat[:oid,:oid]) :bat[:oid,:sht]
 address CMDconvertsignal_sht
 comment cast from void to sht, signal error on overflow;
-pattern sht(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:sht]
+pattern sht(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:sht]
 address CMDconvertsignal_sht
 comment cast from void to sht with candidates list, signal error on overflow;
-pattern sht_noerror(b:bat[:oid,:void]) :bat[:oid,:sht]
+pattern sht_noerror(b:bat[:oid,:oid]) :bat[:oid,:sht]
 address CMDconvert_sht
 comment cast from void to sht;
-pattern sht_noerror(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:sht]
+pattern sht_noerror(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:sht]
 address CMDconvert_sht
 comment cast from void to sht with candidates list;
 
@@ -20242,16 +20242,16 @@ pattern sht_noerror(b:bat[:oid,:str],s:b
 address CMDconvert_sht
 comment cast from str to sht with candidates list;
 
-pattern int(b:bat[:oid,:void]) :bat[:oid,:int]
+pattern int(b:bat[:oid,:oid]) :bat[:oid,:int]
 address CMDconvertsignal_int
 comment cast from void to int, signal error on overflow;
-pattern int(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:int]
+pattern int(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:int]
 address CMDconvertsignal_int
 comment cast from void to int with candidates list, signal error on overflow;
-pattern int_noerror(b:bat[:oid,:void]) :bat[:oid,:int]
+pattern int_noerror(b:bat[:oid,:oid]) :bat[:oid,:int]
 address CMDconvert_int
 comment cast from void to int;
-pattern int_noerror(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:int]
+pattern int_noerror(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:int]
 address CMDconvert_int
 comment cast from void to int with candidates list;
 
@@ -20385,16 +20385,16 @@ pattern int_noerror(b:bat[:oid,:str],s:b
 address CMDconvert_int
 comment cast from str to int with candidates list;
 
-pattern wrd(b:bat[:oid,:void]) :bat[:oid,:wrd]
+pattern wrd(b:bat[:oid,:oid]) :bat[:oid,:wrd]
 address CMDconvertsignal_wrd
 comment cast from void to wrd, signal error on overflow;
-pattern wrd(b:bat[:oid,:void],s:bat[:oid,:oid]) :bat[:oid,:wrd]
+pattern wrd(b:bat[:oid,:oid],s:bat[:oid,:oid]) :bat[:oid,:wrd]
 address CMDconvertsignal_wrd
 comment cast from void to wrd with candidates list, signal error on overflow;
-pattern wrd_noerror(b:bat[:oid,:void]) :bat[:oid,:wrd]
+pattern wrd_noerror(b:bat[:oid,:oid]) 

MonetDB: Oct2014 - Headless does not require :void tails

2014-09-03 Thread Martin Kersten
Changeset: 2dfb5ae2e84d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2dfb5ae2e84d
Modified Files:
sql/backends/monet5/sql.mal
Branch: Oct2014
Log Message:

Headless does not require :void tails


diffs (90 lines):

diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -700,10 +700,10 @@ comment cast to bte and check for overf
 command calc.bte( v:void, digits:int, scale:int ) :bte 
 address nil_2dec_bte
 comment cast to dec(bte) and check for overflow;
-command batcalc.bte( v:bat[:oid,:void], digits:int ) :bat[:oid,:bte] 
+command batcalc.bte( v:bat[:oid,:oid], digits:int ) :bat[:oid,:bte] 
 address batnil_2num_bte
 comment cast to bte and check for overflow;
-command batcalc.bte( v:bat[:oid,:void], digits:int, scale:int ) 
:bat[:oid,:bte] 
+command batcalc.bte( v:bat[:oid,:oid], digits:int, scale:int ) :bat[:oid,:bte] 
 address batnil_2dec_bte
 comment cast to dec(bte) and check for overflow;
 
@@ -726,10 +726,10 @@ comment cast to sht and check for overf
 command calc.sht( v:void, digits:int, scale:int ) :sht 
 address nil_2dec_sht
 comment cast to dec(sht) and check for overflow;
-command batcalc.sht( v:bat[:oid,:void], digits:int ) :bat[:oid,:sht] 
+command batcalc.sht( v:bat[:oid,:oid], digits:int ) :bat[:oid,:sht] 
 address batnil_2num_sht
 comment cast to sht and check for overflow;
-command batcalc.sht( v:bat[:oid,:void], digits:int, scale:int ) 
:bat[:oid,:sht] 
+command batcalc.sht( v:bat[:oid,:oid], digits:int, scale:int ) :bat[:oid,:sht] 
 address batnil_2dec_sht
 comment cast to dec(sht) and check for overflow;
 
@@ -752,10 +752,10 @@ comment cast to int and check for overf
 command calc.int( v:void, digits:int, scale:int ) :int 
 address nil_2dec_int
 comment cast to dec(int) and check for overflow;
-command batcalc.int( v:bat[:oid,:void], digits:int ) :bat[:oid,:int] 
+command batcalc.int( v:bat[:oid,:oid], digits:int ) :bat[:oid,:int] 
 address batnil_2num_int
 comment cast to int and check for overflow;
-command batcalc.int( v:bat[:oid,:void], digits:int, scale:int ) 
:bat[:oid,:int] 
+command batcalc.int( v:bat[:oid,:oid], digits:int, scale:int ) :bat[:oid,:int] 
 address batnil_2dec_int
 comment cast to dec(int) and check for overflow;
 
@@ -778,10 +778,10 @@ comment cast to lng and check for overf
 command calc.lng( v:void, digits:int, scale:int ) :lng 
 address nil_2dec_lng
 comment cast to dec(lng) and check for overflow;
-command batcalc.lng( v:bat[:oid,:void], digits:int ) :bat[:oid,:lng] 
+command batcalc.lng( v:bat[:oid,:oid], digits:int ) :bat[:oid,:lng] 
 address batnil_2num_lng
 comment cast to lng and check for overflow;
-command batcalc.lng( v:bat[:oid,:void], digits:int, scale:int ) 
:bat[:oid,:lng] 
+command batcalc.lng( v:bat[:oid,:oid], digits:int, scale:int ) :bat[:oid,:lng] 
 address batnil_2dec_lng
 comment cast to dec(lng) and check for overflow;
 
@@ -805,10 +805,10 @@ command calc.timestamp( v:void, digits:i
 address nil_2time_timestamp
 comment cast to timestamp and check for overflow;
 
-command batcalc.timestamp( v:bat[:oid,:void] ) :bat[:oid,:timestamp] 
+command batcalc.timestamp( v:bat[:oid,:oid] ) :bat[:oid,:timestamp] 
 address batnil_2_timestamp
 comment Cast to timestamp;
-command batcalc.timestamp( v:bat[:oid,:void], digits:int ) 
:bat[:oid,:timestamp] 
+command batcalc.timestamp( v:bat[:oid,:oid], digits:int ) 
:bat[:oid,:timestamp] 
 address batnil_2time_timestamp
 comment cast to timestamp and check for overflow;
 
@@ -839,10 +839,10 @@ command calc.daytime( v:void, digits:int
 address nil_2time_daytime
 comment cast to daytime and check for overflow;
 
-command batcalc.daytime( v:bat[:oid,:void] ) :bat[:oid,:daytime] 
+command batcalc.daytime( v:bat[:oid,:oid] ) :bat[:oid,:daytime] 
 address batnil_2_daytime
 comment Cast to daytime;
-command batcalc.daytime( v:bat[:oid,:void], digits:int ) :bat[:oid,:daytime] 
+command batcalc.daytime( v:bat[:oid,:oid], digits:int ) :bat[:oid,:daytime] 
 address batnil_2time_daytime
 comment cast to daytime and check for overflow;
 
@@ -877,7 +877,7 @@ comment Get the clients current timesta
 command calc.date( v:void ) :date 
 address nil_2_date
 comment cast to date;
-command batcalc.date( v:bat[:oid,:void] ) :bat[:oid,:date] 
+command batcalc.date( v:bat[:oid,:oid] ) :bat[:oid,:date] 
 address batnil_2_date
 comment cast to date;
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2014 - compute type once outside loop

2014-09-03 Thread Niels Nes
Changeset: b33a229823f9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b33a229823f9
Modified Files:
gdk/gdk_join.c
Branch: Oct2014
Log Message:

compute type once outside loop


diffs (31 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -1437,6 +1437,13 @@ hashjoin(BAT *r1, BAT *r2, BAT *l, BAT *
r1-trevsorted = 0;
}
} else {
+   int t = r-htype;
+   if (t != ATOMstorage(t) 
+   ATOMnilptr(ATOMstorage(t)) == ATOMnilptr(t) 
+   BATatoms[ATOMstorage(t)].atomCmp == BATatoms[t].atomCmp 
+   BATatoms[ATOMstorage(t)].atomHash == BATatoms[t].atomHash)
+   t = ATOMstorage(t);
+
for (lo = lstart - BUNfirst(l) + l-hseqbase; lstart  lend; 
lo++) {
if (l-ttype == TYPE_void) {
if (l-tseqbase != oid_nil)
@@ -1460,13 +1467,6 @@ hashjoin(BAT *r1, BAT *r2, BAT *l, BAT *
break;
}
} else {
-   int t = r-htype;
-   if (t != ATOMstorage(t) 
-   ATOMnilptr(ATOMstorage(t)) == ATOMnilptr(t) 

-   BATatoms[ATOMstorage(t)].atomCmp == 
BATatoms[t].atomCmp 
-   BATatoms[ATOMstorage(t)].atomHash == 
BATatoms[t].atomHash)
-   t = ATOMstorage(t);
-
switch (t) {
case TYPE_int:
if (!nil_matches  *(const int*)v == 
int_nil) {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list