MonetDB: sfcgal - A bunch of leaks related with sfcgal structure...

2016-08-11 Thread Romulo Goncalves
Changeset: 05bc5907e01b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=05bc5907e01b
Modified Files:
geom/monetdb5/sfcgal.c
Branch: sfcgal
Log Message:

A bunch of leaks related with sfcgal structures, that's why today was raining.


diffs (159 lines):

diff --git a/geom/monetdb5/sfcgal.c b/geom/monetdb5/sfcgal.c
--- a/geom/monetdb5/sfcgal.c
+++ b/geom/monetdb5/sfcgal.c
@@ -324,6 +324,8 @@ sfcgal_to_geom(GEOSGeom *res, const sfcg
 return ret;
 }
 *res = GEOSGeom_createCollection(type-1, geoms, ngeoms);
+if (geoms)
+GDKfree(geoms);
 break;
 case SFCGAL_TYPE_POLYHEDRALSURFACE:
 ngeoms = sfcgal_polyhedral_surface_num_polygons(geom);
@@ -346,6 +348,8 @@ sfcgal_to_geom(GEOSGeom *res, const sfcg
 return ret;
 }
 *res = GEOSGeom_createCollection(type-1, geoms, ngeoms);
+if (geoms)
+GDKfree(geoms);
 break;
 /* Solid is map as a closed PolyhedralSurface (for now) */
 case SFCGAL_TYPE_SOLID:
@@ -378,6 +382,8 @@ sfcgal_to_geom(GEOSGeom *res, const sfcg
 return ret;
 }
 *res = GEOSGeom_createCollection(type-1, geoms, ngeoms);
+if (geoms)
+GDKfree(geoms);
 //TODO: if (ngeoms) FLAGS_SET_SOLID( rgeom->flags, 1);
 break;
 case SFCGAL_TYPE_TRIANGULATEDSURFACE:
@@ -401,6 +407,8 @@ sfcgal_to_geom(GEOSGeom *res, const sfcg
 return ret;
 }
 *res = GEOSGeom_createCollection(type-1, geoms, ngeoms);
+if (geoms)
+GDKfree(geoms);
 break;
 //Unsupported types.
 case SFCGAL_TYPE_MULTISOLID:
@@ -460,6 +468,7 @@ sfcgal_from_geom(str *ret, const GEOSGeo
 sfcgal_linestring_add_point(line,
 sfcgal_point_create_from_xy(point_x, point_y));
 }
+GEOSGeom_destroy(pointG);
 }
 
 return line;
@@ -720,17 +729,23 @@ geom_sfcgal_extrude(wkb **res, wkb **geo
 msg = createException(MAL, "geom_sfcgal_extrude", "geom_to_sfcgal 
failed:%s", ret);
 GDKfree(ret);
return msg;
-   }
+   } else {
+GEOSGeom_destroy(inGeos);
+}
if (!(outGeom = sfcgal_geometry_extrude (inGeom, *ex, *ey, *ez))) {
*res = NULL;
return createException(MAL, "geom_sfcgal_extrude", 
"sfcgal_geometry_extrude failed");
-   }
+   } else {
+sfcgal_geometry_delete(inGeom);
+}
 
 if ( ( ret = sfcgal_to_geom(, outGeom, 0, srid, 0)) != 
MAL_SUCCEED) {
*res = NULL;
msg = createException(MAL, "geom_sfcgal_extrude", 
"sfcgal_to_geom failed:%s", ret);
 GDKfree(ret);
 return msg;
+} else {
+sfcgal_geometry_delete(outGeom);
 }
 
*res = geos2wkb(outGeos);
@@ -766,17 +781,23 @@ geom_sfcgal_straightSkeleton(wkb **res, 
msg = createException(MAL, "geom_sfcgal_straightSkeleton", 
"geom_to_sfcgal failed:%s", ret);
 GDKfree(ret);
 return msg;
-   }
+   } else {
+GEOSGeom_destroy(inGeos);
+}
if (!(outGeom = sfcgal_geometry_straight_skeleton(inGeom))) {
*res = NULL;
return createException(MAL, "geom_sfcgal_straightSkeleton", 
"sfcgal_geometry_straight_skeleton failed");
-   }
+   } else {
+sfcgal_geometry_delete(inGeom);
+}
 
 if ( (ret = sfcgal_to_geom(, outGeom, 0, srid, 0)) != MAL_SUCCEED) 
{
*res = NULL;
msg = createException(MAL, "geom_sfcgal_straightSkeleton", 
"sfcgal_to_geom failed:%s", ret);
 GDKfree(ret);
 return msg;
+} else {
+sfcgal_geometry_delete(outGeom);
 }
 
*res = geos2wkb(outGeos);
@@ -812,17 +833,23 @@ geom_sfcgal_tesselate(wkb **res, wkb **g
msg = createException(MAL, "geom_sfcgal_tesselate", 
"geom_to_sfcgal failed:%s", ret);
 GDKfree(ret);
 return msg;
-   }
+   } else {
+GEOSGeom_destroy(inGeos);
+}
if (!(outGeom = sfcgal_geometry_tesselate(inGeom))) {
*res = NULL;
return createException(MAL, "geom_sfcgal_tesselate", 
"sfcgal_geometry_tesselate failed");
-   }
+   } else {
+sfcgal_geometry_delete(inGeom);
+}
 
 if (  (ret = sfcgal_to_geom(, outGeom, 0, srid, 0)) != 
MAL_SUCCEED) {
*res = NULL;
msg = createException(MAL, "geom_sfcgal_tesselate", 
"sfcgal_to_geom failed:%s", ret);
 GDKfree(ret);
 return msg;
+} else {
+sfcgal_geometry_delete(outGeom);
 }
 
*res = geos2wkb(outGeos);
@@ -858,7 +885,9 @@ geom_sfcgal_triangulate2DZ(wkb **res, wk
msg = createException(MAL, 

MonetDB: sfcgal - Do not use GEOS_getWKBOutputDims because it do...

2016-08-11 Thread Romulo Goncalves
Changeset: 165a9254c5be for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=165a9254c5be
Modified Files:
geom/monetdb5/geom_x3d.c
Branch: sfcgal
Log Message:

Do not use GEOS_getWKBOutputDims because it does not always return correct 
Dimension number, what we want is GEOSGeom_getCoordinateDimension


diffs (33 lines):

diff --git a/geom/monetdb5/geom_x3d.c b/geom/monetdb5/geom_x3d.c
--- a/geom/monetdb5/geom_x3d.c
+++ b/geom/monetdb5/geom_x3d.c
@@ -360,7 +360,8 @@ x3d_3_multi_buf(GEOSGeom col, char *outp
 char *ptr, *x3dtype;
 int i;
 int ngeoms;
-int dimension= GEOS_getWKBOutputDims(col);
+//int dimension= GEOS_getWKBOutputDims(col);
+int dimension= GEOSGeom_getCoordinateDimension(col);
 int type = GEOSGeomTypeId(col)+1;
 
 GEOSGeom subgeom;
@@ -712,7 +713,8 @@ geom_toX3D3(const GEOSGeometry *geom, ch
 
 ptr = output;
 
-if ( GEOS_getWKBOutputDims(geom) == 2)
+//if ( GEOS_getWKBOutputDims(geom) == 2)
+if ( GEOSGeom_getCoordinateDimension(geom) == 2)
 {
 for (i=0; i

MonetDB: sfcgal - Do not use GEOS_getWKBOutputDims because it do...

2016-08-11 Thread Romulo Goncalves
Changeset: f3339f0df82a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3339f0df82a
Modified Files:
geom/monetdb5/sfcgal.c
Branch: sfcgal
Log Message:

Do not use GEOS_getWKBOutputDims because it does not always return correct 
Dimension number, what we want is GEOSGeom_getCoordinateDimension


diffs (13 lines):

diff --git a/geom/monetdb5/sfcgal.c b/geom/monetdb5/sfcgal.c
--- a/geom/monetdb5/sfcgal.c
+++ b/geom/monetdb5/sfcgal.c
@@ -432,7 +432,8 @@ sfcgal_from_geom(str *ret, const GEOSGeo
 int i;
 *ret = MAL_SUCCEED;
 
-is_3d = GEOS_getWKBOutputDims(geom) == 3;
+//is_3d = GEOS_getWKBOutputDims(geom) == 3;
+is_3d = GEOSGeom_getCoordinateDimension(geom) == 3;
 
 switch (type)
 {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sfcgal - Do not use GEOS_getWKBOutputDims because it do...

2016-08-11 Thread Romulo Goncalves
Changeset: 9a23fad61bbe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a23fad61bbe
Modified Files:
geom/monetdb5/geom.c
Branch: sfcgal
Log Message:

Do not use GEOS_getWKBOutputDims because it does not always return correct 
Dimension number, what we want is GEOSGeom_getCoordinateDimension


diffs (24 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -8063,8 +8063,6 @@ wkbAsX3D(str *res, wkb **geomWKB, int *m
GEOSGeom geom = NULL;
 int srid;
bit empty;
-int dimension = 0;
-int type = -1;
 
 //check if the geometry is empty
if ((ret = wkbIsEmpty(, geomWKB)) != MAL_SUCCEED) {
@@ -8088,10 +8086,7 @@ wkbAsX3D(str *res, wkb **geomWKB, int *m
 }
 }
 
-dimension= GEOS_getWKBOutputDims(geom);
-type = GEOSGeomTypeId(geom)+1;
-
-if (dimension == 2 && type == wkbMultiPolygon_mdb) {
+if (GEOSGeom_getCoordinateDimension(geom) == 2 && (GEOSGeomTypeId(geom)+1) 
== wkbMultiPolygon_mdb) {
 throw(MAL, "geom.wkbAsX3D", "For a MultiPolygon the dimension should 
be 3.");
 }
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sfcgal - Revert because Since WKB does not accept Polye...

2016-08-11 Thread Romulo Goncalves
Changeset: 77e616302b94 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=77e616302b94
Modified Files:
geom/monetdb5/sfcgal.c
Branch: sfcgal
Log Message:

Revert because Since WKB does not accept PolyehdralSurface type we need to 
trick it to use a Collection.


diffs (14 lines):

diff --git a/geom/monetdb5/sfcgal.c b/geom/monetdb5/sfcgal.c
--- a/geom/monetdb5/sfcgal.c
+++ b/geom/monetdb5/sfcgal.c
@@ -73,8 +73,8 @@ sfcgal_type_to_geom_type(int *res, sfcga
 case SFCGAL_TYPE_GEOMETRYCOLLECTION:
 case SFCGAL_TYPE_POLYHEDRALSURFACE:
 case SFCGAL_TYPE_SOLID:
-*res = wkbPolyehdralSurface_mdb;
-//*res = wkbGeometryCollection_mdb;
+//*res = wkbPolyehdralSurface_mdb;
+*res = wkbGeometryCollection_mdb;
 break;
 
 case SFCGAL_TYPE_TRIANGULATEDSURFACE:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sfcgal - Since WKB does not accept PolyehdralSurface ty...

2016-08-11 Thread Romulo Goncalves
Changeset: 1a2ec665763f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a2ec665763f
Modified Files:
geom/monetdb5/geom_x3d.c
Branch: sfcgal
Log Message:

Since WKB does not accept PolyehdralSurface type we need to trick it to use a 
Collection. If it is dimension 2 let build proper output. The check should be 
done a layer up.


diffs (29 lines):

diff --git a/geom/monetdb5/geom_x3d.c b/geom/monetdb5/geom_x3d.c
--- a/geom/monetdb5/geom_x3d.c
+++ b/geom/monetdb5/geom_x3d.c
@@ -66,8 +66,8 @@ geom_to_x3d_3(GEOSGeom geom, int precisi
 return x3d_3_tin(geom, precision, opts, defid);
 
 case wkbGeometryCollection_mdb:
-//return x3d_3_psurface(geom, precision, opts, defid);
-return x3d_3_collection(geom, precision, opts, defid);
+return x3d_3_psurface(geom, precision, opts, defid);
+//return x3d_3_collection(geom, precision, opts, defid);
 
 default:
 assert(0);
@@ -395,12 +395,12 @@ x3d_3_multi_buf(GEOSGeom col, char *outp
 default:
 assert(0);
 }
-if (dimension == 3){
+//if (dimension == 3){
 if ( X3D_USE_GEOCOORDS(opts) ) 
 ptr += sprintf(ptr, "https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sfcgal - Fix compilation

2016-08-11 Thread Romulo Goncalves
Changeset: 19122d0a0866 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=19122d0a0866
Modified Files:
geom/monetdb5/geom_clean.c
Branch: sfcgal
Log Message:

Fix compilation


diffs (12 lines):

diff --git a/geom/monetdb5/geom_clean.c b/geom/monetdb5/geom_clean.c
--- a/geom/monetdb5/geom_clean.c
+++ b/geom/monetdb5/geom_clean.c
@@ -728,7 +728,7 @@ geom_make_valid(GEOSGeometry **res, cons
if ( (GEOSGeomTypeId(geosGeometry)+1) == wkbGeometryCollection_mdb && 
(GEOSGeomTypeId(*res) +1 ) != wkbGeometryCollection_mdb) {
GEOSGeom *ogeoms = (GEOSGeom *) GDKmalloc(sizeof(GEOSGeom*));
 int geometryType = -1, type = -1;
-   assert(geosGeometry != res);
+   assert(geosGeometry != *res);
 ogeoms[0] = *res;
 
 geometryType = GEOSGeomTypeId(*res);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sfcgal - Since WKB does not accept PolyehdralSurface ty...

2016-08-11 Thread Romulo Goncalves
Changeset: 834b1a646a6d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=834b1a646a6d
Modified Files:
geom/monetdb5/sfcgal.c
Branch: sfcgal
Log Message:

Since WKB does not accept PolyehdralSurface type we need to trick it to use a 
Collection.


diffs (14 lines):

diff --git a/geom/monetdb5/sfcgal.c b/geom/monetdb5/sfcgal.c
--- a/geom/monetdb5/sfcgal.c
+++ b/geom/monetdb5/sfcgal.c
@@ -73,8 +73,8 @@ sfcgal_type_to_geom_type(int *res, sfcga
 case SFCGAL_TYPE_GEOMETRYCOLLECTION:
 case SFCGAL_TYPE_POLYHEDRALSURFACE:
 case SFCGAL_TYPE_SOLID:
-//*res = wkbPolyehdralSurface_mdb;
-*res = wkbGeometryCollection_mdb;
+*res = wkbPolyehdralSurface_mdb;
+//*res = wkbGeometryCollection_mdb;
 break;
 
 case SFCGAL_TYPE_TRIANGULATEDSURFACE:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: sfcgal - Fix more leaks detected by valgrind. When a WK...

2016-08-11 Thread Romulo Goncalves
Changeset: 422b840e887c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=422b840e887c
Modified Files:
geom/monetdb5/geom.c
Branch: sfcgal
Log Message:

Fix more leaks detected by valgrind. When a WKB is appended to a BAT you need 
to free it.


diffs (113 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2356,7 +2356,10 @@ wkbPolygonize_(wkb** outWKB, wkb** geom1
 
 str
 wkbPolygonize(wkb** outWKB, wkb** geom1) {
-wkb *geom2 = 
geos2wkb(GEOSGeom_createEmptyCollection(wkbGeometryCollection_mdb - 1));
+GEOSGeometry* emptyCol = 
GEOSGeom_createEmptyCollection(wkbGeometryCollection_mdb - 1);
+wkb *geom2 = geos2wkb(emptyCol);
+GEOSGeom_destroy(emptyCol);
+
 return wkbPolygonize_(outWKB, geom1, );
 }
 
@@ -2398,8 +2401,11 @@ wkbsubPolygonize(bat *outBAT_id, bat* bB
 if ( ngrp && (empty_geoms = (wkb**) GDKmalloc(sizeof(wkb*)*ngrp)) == NULL) 
{
 throw(MAL, "geom.wkbPolygonize", MAL_MALLOC_FAIL);
 }
-for (i = 0; i < ngrp; i++)
-empty_geoms[i] = 
geos2wkb(GEOSGeom_createEmptyCollection(wkbGeometryCollection_mdb - 1));
+for (i = 0; i < ngrp; i++) {
+GEOSGeometry* emptyCol = 
GEOSGeom_createEmptyCollection(wkbGeometryCollection_mdb - 1);
+empty_geoms[i] = geos2wkb(emptyCol);
+GEOSGeom_destroy(emptyCol);
+}
 
 msg = BATgroupWKBWKBtoWKB(outBAT_id, b, g, e, skip_nils, min, max, ngrp, 
start, end, empty_geoms, wkbPolygonize_, "wkbsubPolygonize");
BBPkeepref(*outBAT_id);
@@ -5592,6 +5598,7 @@ BATgroupWKBWKBtoWKB(bat *outBAT_id, BAT 
 outBAT = NULL;
throw(MAL, name, "BUNappend failed");
 }
+GDKfree(grpWKBs[i]);
 }
 
 if (nils < BUN_NONE) {
@@ -5718,10 +5725,14 @@ wkbCollectAppend(wkb **out, wkb **geom1W
 geomGeometries[num_geoms] = geom2Geometry;
 
 if ( (outGeometry = GEOSGeom_createCollection(type, geomGeometries, 
num_geoms+1)) == NULL ) {
-err = createException(MAL, "geom.Collect", 
"GEOSGeom_createCollection failed!!!");
+GDKfree(geomGeometries);
+GEOSGeom_destroy(geom1Geometry);
+GEOSGeom_destroy(geom2Geometry);
+throw(MAL, "geom.Collect", "GEOSGeom_createCollection failed!!!");
 } else {
GEOSSetSRID(outGeometry, srid);
 *out = geos2wkb(outGeometry);
+GEOSGeom_destroy(outGeometry);
 }
 }
 
@@ -5729,7 +5740,7 @@ wkbCollectAppend(wkb **out, wkb **geom1W
 GDKfree(geomGeometries);
 
 GEOSGeom_destroy(geom1Geometry);
-GEOSGeom_destroy(geom2Geometry);
+//GEOSGeom_destroy(geom2Geometry);
 
 return err;
 }
@@ -5774,12 +5785,17 @@ wkbsubCollect(bat *outBAT_id, bat* bBAT_
 BBPunfix(e->batCacheid);
 throw(MAL, "geom.wkbsubCollect", MAL_MALLOC_FAIL);
 }
-for (i = 0; i < ngrp; i++)
-empty_geoms[i] = 
geos2wkb(GEOSGeom_createEmptyCollection(wkbGeometryCollection_mdb - 1));
+for (i = 0; i < ngrp; i++) {
+GEOSGeometry* emptyCol = 
GEOSGeom_createEmptyCollection(wkbGeometryCollection_mdb - 1);
+empty_geoms[i] = geos2wkb(emptyCol);
+GEOSGeom_destroy(emptyCol);
+}
 
 msg = BATgroupWKBWKBtoWKB(outBAT_id, b, g, e, skip_nils, min, max, ngrp, 
start, end, empty_geoms, wkbCollectAppend, "wkbsubCollect");
BBPkeepref(*outBAT_id);
 
+for (i = 0; i < ngrp; i++)
+GDKfree(empty_geoms[i]);
 GDKfree(empty_geoms);
 BBPunfix(b->batCacheid);
 BBPunfix(g->batCacheid);
@@ -8047,6 +8063,8 @@ wkbAsX3D(str *res, wkb **geomWKB, int *m
GEOSGeom geom = NULL;
 int srid;
bit empty;
+int dimension = 0;
+int type = -1;
 
 //check if the geometry is empty
if ((ret = wkbIsEmpty(, geomWKB)) != MAL_SUCCEED) {
@@ -8070,7 +8088,12 @@ wkbAsX3D(str *res, wkb **geomWKB, int *m
 }
 }
 
-
+dimension= GEOS_getWKBOutputDims(geom);
+type = GEOSGeomTypeId(geom)+1;
+
+if (dimension == 2 && type == wkbMultiPolygon_mdb) {
+throw(MAL, "geom.wkbAsX3D", "For a MultiPolygon the dimension should 
be 3.");
+}
 
if ( (*res = geom_to_x3d_3(geom, *maxDecDigits, *option, defid)) == 
NULL )
throw(MAL, "geom.wkbAsX3D", "Failed, XML returned is NULL!!!");
@@ -8332,6 +8355,7 @@ IsValidsubselect_intern(bat *lresBAT_id,
 
 BBPunfix(lBAT->batCacheid);
 GDKfree(lBAT_iters);
+GDKfree(outs);
 if (*slBAT_id != bat_nil) {
 GDKfree(slBAT_iters);
 BBPunfix(slBAT->batCacheid);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2016 - fixed leftjoin problem / bug 4049

2016-08-11 Thread Niels Nes
Changeset: 0d2c55c221c2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0d2c55c221c2
Modified Files:
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/test/BugTracker-2016/Tests/innerjoin-leftjoin-or.Bug-4049.sql
sql/test/BugTracker-2016/Tests/innerjoin-leftjoin-or.Bug-4049.stable.out

sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out
Branch: Jun2016
Log Message:

fixed leftjoin problem / bug 4049


diffs (253 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -6647,56 +6647,6 @@ add_nulls(mvc *sql, sql_rel *rel, sql_re
}
 }
 
-static int
-exp_is_select(sql_exp *e, sql_rel *r)
-{
-   if (e->type == e_cmp && exp_card(e->r) <= CARD_AGGR &&
-   rel_find_exp(r, e->l) && !e->f)
-   return 0;
-   if (e->type == e_cmp && e->flag == cmp_or) {
-   list *l = e->l;
-   node *n;
-   int ok = 1;
-
-   for (n = l->h; n && ok; n = n->next)
-   ok &= (exp_is_select(n->data, r) == 0);
-   l = e->r;
-   for (n = l->h; n && ok; n = n->next)
-   ok &= (exp_is_select(n->data, r) == 0);
-   if (ok)
-   return 0;
-   }
-   return -1;
-}
-
-static sql_rel *
-rel_split_outerjoin_exps(int *changes, mvc *sql, sql_rel *rel)
-{
-   if (rel->op == op_left  && list_length(rel->exps)) { 
-   /* find select expressions on left hand relation  */
-   list *exps = list_select(rel->exps, rel->l, (fcmp) 
_is_select, (fdup)NULL);
-   /* if so introduce select operator and move these expressions */
-   if (!list_empty(exps)) { 
-   list_remove_list(rel->exps, exps);
-   rel = rel_select(sql->sa, rel, NULL);
-   rel->exps = exps;
-   (*changes)++;
-   }
-   } 
-   if (rel->op == op_right && list_length(rel->exps)) { 
-   /* find select expressions on right hand relation  */
-   list *exps = list_select(rel->exps, rel->r, (fcmp) 
_is_select, (fdup)NULL);
-   /* if so introduce select operator and move these expressions */
-   if (!list_empty(exps)) { 
-   list_remove_list(rel->exps, exps);
-   rel = rel_select(sql->sa, rel, NULL);
-   rel->exps = exps;
-   (*changes)++;
-   }
-   }
-   return rel;
-}
-   
 static sql_rel *
 rel_split_outerjoin(int *changes, mvc *sql, sql_rel *rel)
 {
@@ -7910,8 +7860,6 @@ static sql_rel *
gp.cnt[op_left] || gp.cnt[op_right] || gp.cnt[op_full] || 
gp.cnt[op_semi] || gp.cnt[op_anti] ||
gp.cnt[op_select]) {
-   if (level <= 0 && 0)
-   rel = rewrite(sql, rel, _split_outerjoin_exps, 
);
rel = rewrite(sql, rel, _find_range, );
rel = rel_project_reduce_casts(, sql, rel);
rel = rewrite(sql, rel, _reduce_casts, );
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -1046,6 +1046,8 @@ rel_or(mvc *sql, sql_rel *l, sql_rel *r,

rel_destroy(r);
append(nl, e);
+   if (is_outerjoin(l->op) && is_processed(l)) 
+   l = rel_select(sql->sa, l, NULL);
l->exps = nl;
return l;
}
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1406,7 +1406,7 @@ rel_filter(mvc *sql, sql_rel *rel, list 
/* push select into the given relation */
return rel_push_select(sql, rel, L, e);
} else { /* join */
-   if (is_semi(rel->op) || is_outerjoin(rel->op)) {
+   if (is_semi(rel->op) || (is_outerjoin(rel->op) && 
!is_processed(rel))) {
rel_join_add_exp(sql->sa, rel, e);
return rel;
}
@@ -2020,7 +2020,7 @@ rel_logical_exp(mvc *sql, sql_rel *rel, 
lr = rel;
rr = rel_dup(lr);
 
-   if (is_outerjoin(rel->op)) {
+   if (is_outerjoin(rel->op) && !is_processed(rel)) {
int pushdown = sql->pushdown;
 
exps = rel->exps;
diff --git a/sql/test/BugTracker-2016/Tests/innerjoin-leftjoin-or.Bug-4049.sql 
b/sql/test/BugTracker-2016/Tests/innerjoin-leftjoin-or.Bug-4049.sql
--- a/sql/test/BugTracker-2016/Tests/innerjoin-leftjoin-or.Bug-4049.sql
+++ b/sql/test/BugTracker-2016/Tests/innerjoin-leftjoin-or.Bug-4049.sql
@@ -43,7 +43,7 @@ where dd.c = 1
or dd.c = 3
   and 

MonetDB: default - Correction: do not set scale of static object...

2016-08-11 Thread Martin van Dinther
Changeset: 50d236396981 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=50d236396981
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
Branch: default
Log Message:

Correction: do not set scale of static object BigDecimal.ZERO in case of 
NumberFormatException


diffs (16 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -647,10 +647,11 @@ public class MonetResultSet extends Mone
BigDecimal bd;
try {
bd = new BigDecimal(decimal);
+   bd.setScale(scale);
} catch (NumberFormatException e) {
bd = BigDecimal.ZERO;
}
-   return bd.setScale(scale);
+   return bd;
}
}
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Implement a faster version of ResultSet.getOb...

2016-08-11 Thread Martin van Dinther
Changeset: 1f2731776e1b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f2731776e1b
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
Branch: default
Log Message:

Implement a faster version of ResultSet.getObject(int columnIndex).
The previous implementation invoked the complex and slow method: getObject(int 
i, Map map)
As this method is used and called a lot (mostly by generic JDBC applications)
it is important to make it as fast as possible.
Simple tests showed it is now 25% faster.


diffs (189 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -1670,31 +1670,176 @@ public class MonetResultSet extends Mone
/**
 * Gets the value of the designated column in the current row of this
 * ResultSet object as an Object in the Java programming language.
-* 
+*
 * This method will return the value of the given column as a Java 
object.
 * The type of the Java object will be the default Java object type
 * corresponding to the column's SQL type, following the mapping for
 * built-in types specified in the JDBC specification. If the value is
 * an SQL NULL, the driver returns a Java null.
-* 
+*
 * This method may also be used to read database-specific abstract data
 * types. In the JDBC 2.0 API, the behavior of method getObject is 
extended
 * to materialize data of SQL user-defined types. When a column 
contains a
 * structured or distinct value, the behavior of this method is as if it
-* were a call to: getObject(columnIndex,
-* this.getStatement().getConnection().getTypeMap()).
+* were a call to: getObject(columnIndex, 
this.getStatement().getConnection().getTypeMap()).
 *
 * @param columnIndex the first column is 1, the second is 2, ...
-* @return a java.lang.Object holding the column value
+* @return a java.lang.Object holding the column value or null
 * @throws SQLException if a database access error occurs
 */
@Override
public Object getObject(int columnIndex) throws SQLException {
-   /* statement is null for MonetVirtualResultSet such as the ones 
that hold generated keys */
-   if (this.getStatement() == null) {
-   return getObject(columnIndex, new HashMap());
+   // Many generic JDBC programs use getObject(colnr) to retrieve 
value objects from a resultset
+   // For speed the implementation should be as fast as possible, 
so avoid method calls (by inlining code) where possible
+   final String MonetDBType;
+   final int JdbcType;
+   try {
+   if (tlp.values[columnIndex - 1] == null) {
+   lastColumnRead = columnIndex - 1;
+   return null;
+   }
+   MonetDBType = types[columnIndex - 1];
+   JdbcType = getJavaType(MonetDBType);
+   } catch (IndexOutOfBoundsException e) {
+   throw new SQLException("No such column " + columnIndex, 
"M1M05");
}
-   return getObject(columnIndex, 
this.getStatement().getConnection().getTypeMap());
+
+   // for a few JdbcType cases we do not inline its code but 
invoke their getXxx(i) method:
+   switch(JdbcType) {
+   case Types.DATE:
+   return getDate(columnIndex);
+   case Types.TIME:
+   return getTime(columnIndex);
+   case Types.TIMESTAMP:
+   return getTimestamp(columnIndex);
+   case Types.BINARY:
+   case Types.VARBINARY:
+   case Types.LONGVARBINARY: // MonetDB doesn't use type 
LONGVARBINARY, it's here for completeness
+   return getBytes(columnIndex);
+   // for other cases continue and use inline code
+   }
+
+   // get the String value once and use it in all below JdbcType 
cases
+   final String val = getString(columnIndex);
+   if (val == null)
+   return null;
+
+   switch(JdbcType) {
+   case Types.BIT: // MonetDB doesn't use type BInary 
digiT, it's here for completeness
+   case Types.TINYINT:
+   case Types.SMALLINT:
+   try {
+   return Short.valueOf(val);
+  

MonetDB: default - Approvals after changeset adf3902d0382.

2016-08-11 Thread Sjoerd Mullender
Changeset: 1ffab51267bd for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ffab51267bd
Modified Files:
sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/check.stable.out
sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128
sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128
sql/test/emptydb-upgrade/Tests/check.stable.out
sql/test/emptydb-upgrade/Tests/check.stable.out.int128
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

Approvals after changeset adf3902d0382.


diffs (truncated from 648 to 300 lines):

diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
@@ -1861,12 +1861,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "ifthenelse",   "ifthenelse",   "calc", 0,  1,  false,  
false,  false   ]
 [ "sys",   "ilike","create filter function \"ilike\"(val string, 
pat string) external name algebra.\"ilike\";","algebra",  1,  4,
  true,   false,  false   ]
 [ "sys",   "ilike","create filter function \"ilike\"(val string, 
pat string, esc string) external name algebra.\"ilike\";","algebra",
  1,  4,  true,   false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
 [ "sys",   "imprintsize",  "create function sys.imprintsize(i bigint, nme 
string) returns bigint begin if nme = 'boolean' or nme = 'tinyint' or nme = 
'smallint' or nme = 'int' or nme = 'bigint' or nme = 'hugeint' or nme = 
'decimal' or nme = 'date' or nme = 'timestamp' or nme = 'real' or nme = 
'double' then return cast(i * 0.12 as bigint); end if ; return 0; end;", 
"user", 2,  1,  false,  false,  false   ]
 [ "sys",   "in",   "in",   "calc", 0,  1,  false,  false,  false   
]
 [ "sys",   "index","index","calc", 0,  1,  false,  
false,  false   ]
@@ -1917,12 +1911,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "levenshtein",  "levenshtein",  "txtsim",   0,  1,  
false,  false,  false   ]
 [ "sys",   "like", "create filter function \"like\"(val string, pat 
string) external name algebra.\"like\";",  "algebra",  1,  4,  
true,   false,  false   ]
 [ "sys",   "like", "create filter function \"like\"(val string, pat 
string, esc string) external name algebra.\"like\";",  "algebra",  1,  
4,  true,   false,  false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
 [ "sys",   "local_timezone",   "local_timezone",   "mtime",
0,  1,  false,  false,  false   ]
 [ "sys",   "localtime","current_time", "sql",  0,  1,  false,  
false,  false   ]
 [ "sys",   "localtimestamp",   "current_timestamp","sql",  0,  
1,  false,  false,  false   ]
@@ -3575,12 +3563,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "hour", "arg_1","timetz",   7,  0,  1,  
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL
]
 [ "sys",   "identity", 

MonetDB: default - approved output now that the F_FUNC version o...

2016-08-11 Thread Niels Nes
Changeset: dfd249a2aa31 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dfd249a2aa31
Modified Files:
clients/Tests/SQL-dump.stable.out
clients/Tests/SQL-dump.stable.out.int128
sql/test/Tests/systemfunctions.stable.out
sql/test/Tests/systemfunctions.stable.out.int128
Branch: default
Log Message:

approved output now that the F_FUNC version of like/ilike isn't needed anymore


diffs (280 lines):

diff --git a/clients/Tests/SQL-dump.stable.out 
b/clients/Tests/SQL-dump.stable.out
--- a/clients/Tests/SQL-dump.stable.out
+++ b/clients/Tests/SQL-dump.stable.out
@@ -2012,12 +2012,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "ifthenelse",   "ifthenelse",   "calc", 0,  1,  false,  
false,  false   ]
 [ "sys",   "ilike","create filter function \"ilike\"(val string, 
pat string) external name algebra.\"ilike\";","algebra",  1,  4,
  true,   false,  false   ]
 [ "sys",   "ilike","create filter function \"ilike\"(val string, 
pat string, esc string) external name algebra.\"ilike\";","algebra",
  1,  4,  true,   false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
-[ "sys",   "ilike","ilike","algebra",  0,  1,  
false,  false,  false   ]
 [ "sys",   "imprintsize",  "create function sys.imprintsize(i bigint, nme 
string) returns bigint begin if nme = 'boolean' or nme = 'tinyint' or nme = 
'smallint' or nme = 'int' or nme = 'bigint' or nme = 'hugeint' or nme = 
'decimal' or nme = 'date' or nme = 'timestamp' or nme = 'real' or nme = 
'double' then return cast(i * 0.12 as bigint); end if ; return 0; end;", 
"user", 2,  1,  false,  false,  false   ]
 [ "sys",   "in",   "in",   "calc", 0,  1,  false,  false,  false   
]
 [ "sys",   "index","index","calc", 0,  1,  false,  
false,  false   ]
@@ -2066,12 +2060,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "levenshtein",  "levenshtein",  "txtsim",   0,  1,  
false,  false,  false   ]
 [ "sys",   "like", "create filter function \"like\"(val string, pat 
string) external name algebra.\"like\";",  "algebra",  1,  4,  
true,   false,  false   ]
 [ "sys",   "like", "create filter function \"like\"(val string, pat 
string, esc string) external name algebra.\"like\";",  "algebra",  1,  
4,  true,   false,  false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
-[ "sys",   "like", "like", "algebra",  0,  1,  false,  false,  
false   ]
 [ "sys",   "listdir",  "create procedure listdir(dirname string) 
external name fits.listdir;", "fits", 1,  2,  true,   false,  false   ]
 [ "sys",   "listdirpat",   "create procedure listdirpat(dirname string,pat 
string) external name fits.listdirpattern;","fits", 1,  2,  true,   
false,  false   ]
 [ "sys",   "local_timezone",   "local_timezone",   "mtime",
0,  1,  false,  false,  false   ]
@@ -3566,12 +3554,6 @@ drop function pcre_replace(string, strin
 [ "sys",   "hour", "arg_1","timetz",   7,  0,  1,  
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL
]
 [ "sys",   "identity", "arg_1","any",  0,  0,  1,  
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   

MonetDB: default - like/ilike removed, ie less output in leak tests

2016-08-11 Thread Niels Nes
Changeset: ac4e7ca0a21b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ac4e7ca0a21b
Modified Files:
sql/test/leaks/Tests/check1.stable.out.int128
sql/test/leaks/Tests/check2.stable.out.int128
sql/test/leaks/Tests/check3.stable.out.int128
sql/test/leaks/Tests/check4.stable.out.int128
sql/test/leaks/Tests/check5.stable.out.int128
Branch: default
Log Message:

like/ilike removed, ie less output in leak tests


diffs (truncated from 335 to 300 lines):

diff --git a/sql/test/leaks/Tests/check1.stable.out.int128 
b/sql/test/leaks/Tests/check1.stable.out.int128
--- a/sql/test/leaks/Tests/check1.stable.out.int128
+++ b/sql/test/leaks/Tests/check1.stable.out.int128
@@ -43,10 +43,10 @@ Ready.
 [ "bit",   5   ]
 [ "bit",   56  ]
 [ "bit",   383 ]
-[ "bit",   1729]
-[ "bit",   1729]
-[ "bit",   1729]
-[ "bte",   4895]
+[ "bit",   1717]
+[ "bit",   1717]
+[ "bit",   1717]
+[ "bte",   4853]
 [ "int",   0   ]
 [ "int",   0   ]
 [ "int",   0   ]
@@ -119,18 +119,18 @@ Ready.
 [ "int",   383 ]
 [ "int",   383 ]
 [ "int",   383 ]
-[ "int",   1729]
-[ "int",   1729]
-[ "int",   1729]
-[ "int",   1729]
-[ "int",   1729]
+[ "int",   1717]
+[ "int",   1717]
+[ "int",   1717]
+[ "int",   1717]
+[ "int",   1717]
 [ "int",   3911]
 [ "int",   3911]
-[ "int",   4895]
-[ "int",   4895]
-[ "int",   4895]
-[ "int",   4895]
-[ "int",   4895]
+[ "int",   4853]
+[ "int",   4853]
+[ "int",   4853]
+[ "int",   4853]
+[ "int",   4853]
 [ "lng",   0   ]
 [ "lng",   0   ]
 [ "lng",   0   ]
@@ -289,14 +289,14 @@ Ready.
 [ "str",   383 ]
 [ "str",   383 ]
 [ "str",   383 ]
-[ "str",   1729]
-[ "str",   1729]
-[ "str",   1729]
+[ "str",   1717]
+[ "str",   1717]
+[ "str",   1717]
 [ "str",   3911]
 [ "str",   3911]
 [ "str",   3911]
-[ "str",   4895]
-[ "str",   4895]
+[ "str",   4853]
+[ "str",   4853]
 [ "timestamp", 0   ]
 [ "timestamp", 0   ]
 #select 'transient', count(*) from bbp() as bbp where kind like 'tran%';
diff --git a/sql/test/leaks/Tests/check2.stable.out.int128 
b/sql/test/leaks/Tests/check2.stable.out.int128
--- a/sql/test/leaks/Tests/check2.stable.out.int128
+++ b/sql/test/leaks/Tests/check2.stable.out.int128
@@ -43,10 +43,10 @@ Ready.
 [ "bit",   5   ]
 [ "bit",   56  ]
 [ "bit",   383 ]
-[ "bit",   1729]
-[ "bit",   1729]
-[ "bit",   1729]
-[ "bte",   4895]
+[ "bit",   1717]
+[ "bit",   1717]
+[ "bit",   1717]
+[ "bte",   4853]
 [ "int",   0   ]
 [ "int",   0   ]
 [ "int",   0   ]
@@ -119,18 +119,18 @@ Ready.
 [ "int",   383 ]
 [ "int",   383 ]
 [ "int",   383 ]
-[ "int",   1729]
-[ "int",   1729]
-[ "int",   1729]
-[ "int",   1729]
-[ "int",   1729]
+[ "int",   1717]
+[ "int",   1717]
+[ "int",   1717]
+[ "int",   1717]
+[ "int",   1717]
 [ "int",   3911]
 [ "int",   3911]
-[ "int",   4895]
-[ "int",   4895]
-[ "int",   4895]
-[ "int",   4895]
-[ "int",   4895]
+[ "int",   4853]
+[ "int",   4853]
+[ "int",   4853]
+[ "int",   4853]
+[ "int",   4853]
 [ "lng",   0   ]
 [ "lng",   0   ]
 [ "lng",   0   ]
@@ -289,14 +289,14 @@ Ready.
 [ "str",   383 ]
 [ "str",   383 ]
 [ "str",   383 ]
-[ "str",   1729]
-[ "str",   1729]
-[ "str",   1729]
+[ "str",   1717]
+[ "str",   1717]
+[ "str",   1717]
 [ "str",   3911]
 [ "str",   3911]
 [ "str",   3911]
-[ "str",   4895]
-[ "str",   4895]
+[ "str",   4853]
+[ "str",   4853]
 [ "timestamp", 0   ]
 [ "timestamp", 0   ]
 #select 'transient', count(*) from bbp() as bbp where kind like 'tran%';
diff --git a/sql/test/leaks/Tests/check3.stable.out.int128 
b/sql/test/leaks/Tests/check3.stable.out.int128
--- a/sql/test/leaks/Tests/check3.stable.out.int128
+++ b/sql/test/leaks/Tests/check3.stable.out.int128
@@ -43,10 +43,10 @@ Ready.
 [ "bit",   5   ]
 [ "bit",   57  ]
 [ "bit",   385 ]
-[ "bit",   1729]
-[ "bit",   1729]
-[ "bit",   1729]
-[ "bte",   4895]
+[ "bit",   1717]
+[ "bit",   1717]
+[ "bit",   1717]
+[ "bte",   4853]
 [ "int",   0   ]
 [ "int",   0   ]
 [ "int",   0   ]
@@ -119,18 

MonetDB: default - handle the projection case of filter function...

2016-08-11 Thread Niels Nes
Changeset: adf3902d0382 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=adf3902d0382
Modified Files:
sql/common/sql_types.c
sql/server/rel_select.c
Branch: default
Log Message:

handle the projection case of filter functions properly.


diffs (truncated from 412 to 300 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -35,6 +35,7 @@ list *types = NULL;
 list *aggrs = NULL;
 list *funcs = NULL;
 
+static sql_type *BIT = NULL;
 static list *localtypes = NULL;
 
 int digits2bits(int digits) 
@@ -636,7 +637,10 @@ sql_dup_subfunc(sql_allocator *sa, sql_f
sql_subfunc *fres = SA_ZNEW(sa, sql_subfunc);
 
fres->func = f;
-   if (IS_FUNC(f) || IS_UNION(f) || IS_ANALYTIC(f)) { /* not needed for 
PROC/FILT */
+   if (IS_FILT(f)) {
+   fres->res = sa_list(sa);
+   list_append(fres->res, sql_bind_localtype("bit"));
+   } else if (IS_FUNC(f) || IS_UNION(f) || IS_ANALYTIC(f)) { /* not needed 
for PROC */
unsigned int mscale = 0, mdigits = 0;
 
if (ops) for (tn = ops->h; tn; tn = tn->next) {
@@ -710,6 +714,7 @@ sql_find_func(sql_allocator *sa, sql_sch
int key = hash_key(sqlfname);
sql_hash_e *he;
int found = 0;
+   int filt = (type == F_FUNC)?F_FILT:type;
 
assert(nrargs);
MT_lock_set(>ht_lock);
@@ -724,7 +729,7 @@ sql_find_func(sql_allocator *sa, sql_sch
for (; he; he = he->chain) {
sql_func *f = he->value;
 
-   if (f->type != type) 
+   if (f->type != type && f->type != filt) 
continue;
if ((fres = func_cmp(sa, f, sqlfname, nrargs )) != NULL) {
MT_lock_unset(>ht_lock);
@@ -754,7 +759,7 @@ sql_find_func(sql_allocator *sa, sql_sch
for (; he; he = he->chain) {
sql_func *f = he->value;
 
-   if (f->type != type)
+   if (f->type != type && f->type != filt) 
continue;
if ((fres = func_cmp(sa, f, sqlfname, 
nrargs )) != NULL) {

MT_lock_unset(>funcs.set->ht_lock);
@@ -775,7 +780,7 @@ sql_find_func(sql_allocator *sa, sql_sch
for (; n; n = n->next) {
sql_func *f = n->data;
 
-   if (f->type != type)
+   if (f->type != type && f->type != filt) 
continue;
if ((fres = func_cmp(sa, f, sqlfname, 
nrargs )) != NULL)
return fres;
@@ -806,7 +811,7 @@ sql_bind_member(sql_allocator *sa, sql_s
for (; n; n = n->next) {
sql_func *f = n->data;
 
-   if (!f->res)
+   if (!f->res && !IS_FILT(f))
continue;
if (strcmp(f->base.name, sqlfname) == 0) {
if (list_length(f->ops) == nrargs && is_subtypeof(tp, 
&((sql_arg *) f->ops->h->data)->type)) 
@@ -829,7 +834,7 @@ sql_bind_member(sql_allocator *sa, sql_s
for (; n; n = n->next) {
sql_func *f = n->data;
 
-   if (!f->res)
+   if (!f->res && !IS_FILT(f))
continue;
if (strcmp(f->base.name, sqlfname) == 0) {
if (list_length(f->ops) == nrargs && 
is_subtypeof(tp, &((sql_arg *) f->ops->h->data)->type)) 
@@ -876,12 +881,13 @@ sql_subfunc *
 sql_bind_func_(sql_allocator *sa, sql_schema *s, const char *sqlfname, list 
*ops, int type)
 {
node *n = funcs->h;
+   int filt = (type == F_FUNC)?F_FILT:type;
 
(void)s;
for (; n; n = n->next) {
sql_func *f = n->data;
 
-   if (f->type != type) 
+   if (f->type != type && f->type != filt) 
continue;
if (strcmp(f->base.name, sqlfname) == 0) {
if (list_cmp(f->ops, ops, (fcmp) _subtype_cmp) == 
0) 
@@ -894,7 +900,7 @@ sql_bind_func_(sql_allocator *sa, sql_sc
if (s->funcs.set) for (n=s->funcs.set->h; n; n = n->next) {
sql_func *f = n->data;
 
-   if (f->type != type) 
+   if (f->type != type && f->type != filt) 
continue;
if (strcmp(f->base.name, sqlfname) == 0) {
if (list_cmp(f->ops, ops, (fcmp) 
_subtype_cmp) == 0) 
@@ -947,9 +953,9 @@ sql_bind_func_result_(sql_allocator *sa,

MonetDB: protocol - Fix compilation issue for systems without LZ4.

2016-08-11 Thread Mark Raasveldt
Changeset: c22620e63894 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c22620e63894
Modified Files:
common/stream/stream.c
Branch: protocol
Log Message:

Fix compilation issue for systems without LZ4.


diffs (13 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -4039,8 +4039,8 @@ decompress_stream_data(bs2 *s) {
return -1;
 #endif
} else if (s->comp == COMPRESSION_LZ4) {
+#ifdef HAVE_LIBLZ4
int uncompressed_length = (int) s->bufsiz;
-#ifdef HAVE_LIBLZ4
if ((uncompressed_length = LZ4_decompress_safe(s->compbuf, 
s->buf, s->itotal, uncompressed_length)) <= 0) {
s->s->errnr = uncompressed_length;
return -1;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: protocol - Proper cleanup.

2016-08-11 Thread Mark Raasveldt
Changeset: 1a13fada1eeb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a13fada1eeb
Modified Files:
sql/backends/monet5/sql_result.c
Branch: protocol
Log Message:

Proper cleanup.


diffs (171 lines):

diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1870,21 +1870,24 @@ static int mvc_export_resultset_prot10(r
size_t row = 0;
size_t srow = 0;
size_t varsized = 0;
-   lng *var_col_len;
-   BATiter *iterators;
+   lng *var_col_len = NULL;
+   BATiter *iterators = NULL;
lng fixed_lengths = 0;
+   int fres = -1;
 
-   iterators = GDKmalloc(sizeof(BATiter) * t->nr_cols);
-   var_col_len = GDKmalloc(sizeof(lng) * t->nr_cols);
+   iterators = GDKzalloc(sizeof(BATiter) * t->nr_cols);
+   var_col_len = GDKzalloc(sizeof(lng) * t->nr_cols);
 
if (!iterators || !var_col_len) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
 
if (t->order) {
order = BBPquickdesc(t->order, FALSE);
if (!order) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
count = BATcount(order);
} else {
@@ -1892,7 +1895,8 @@ static int mvc_export_resultset_prot10(r
}
 
if (!mnstr_writeStr(s, "*\n") || !mnstr_writeInt(s, t->id) || 
!mnstr_writeLng(s, count) || !mnstr_writeLng(s, (lng) t->nr_cols)) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
 
for (i = 0; i < (size_t) t->nr_cols; i++) {
@@ -1930,7 +1934,8 @@ static int mvc_export_resultset_prot10(r
break;
#endif
default:
-   return -1;
+   fres = -1;
+   goto cleanup;
}
if (res == MAL_SUCCEED) {
mtype = TYPE_dbl;
@@ -1938,7 +1943,8 @@ static int mvc_export_resultset_prot10(r
BBPunfix(iterators[i].b->batCacheid);
iterators[i].b = BATdescriptor(result);
} else {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
}
 
@@ -1956,12 +1962,14 @@ static int mvc_export_resultset_prot10(r
if (!mnstr_writeLng(s, (lng)(strlen(c->tn) + strlen(c->name) + 
strlen(c->type.type->sqlname) + sizeof(int) + 3)) ||
!write_str_term(s, c->tn) || !write_str_term(s, 
c->name) || !write_str_term(s, c->type.type->sqlname) ||
!mnstr_writeInt(s, typelen)) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
// write NULL values for this column to the stream
// NULL values are encoded as   ( 
is always  for fixed size columns)
if (!mnstr_writeInt(s, nil_len)) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
 
switch(ATOMstorage(mtype)) {
@@ -1992,10 +2000,12 @@ static int mvc_export_resultset_prot10(r
break;
default:
assert(0);
-   return -1;
+   fres = -1;
+   goto cleanup;
}
if (!retval) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
}
mnstr_flush(s);
@@ -2052,7 +2062,8 @@ static int mvc_export_resultset_prot10(r
 
if (!mnstr_readChr(c, _req)) {
fprintf(stderr, "Received cancellation message.\n");
-   return -1;
+   fres = -1;
+   goto cleanup;
}
 
// consume flush from client
@@ -2072,7 +2083,8 @@ static int mvc_export_resultset_prot10(r
assert(bs2_buffer(s).pos == 0);
 
if (!mnstr_writeLng(s, (lng)(row - srow))) {
-   return -1;
+   fres = -1;
+   goto cleanup;
}
 
for (i = 0; i < (size_t) t->nr_cols; i++) {
@@ -2092,14 +2104,16 @@ static int mvc_export_resultset_prot10(r
fprintf(stderr, "Write strings to %zu\n", 
bufpos);
 #endif
if (!mnstr_writeLng(s, var_col_len[i])) {
-   return -1;
+   fres = -1;
+ 

MonetDB: default - Resolving javac -Xlint warnings:

2016-08-11 Thread Martin van Dinther
Changeset: de6ad32925eb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=de6ad32925eb
Modified Files:
java/src/main/java/nl/cwi/monetdb/mcl/parser/HeaderLineParser.java
java/src/main/java/nl/cwi/monetdb/mcl/parser/TupleLineParser.java
Branch: default
Log Message:

Resolving javac -Xlint warnings:
./nl/cwi/monetdb/mcl/parser/HeaderLineParser.java:94: warning: [fallthrough] 
possible fall-through into case
case 'l':
^
./nl/cwi/monetdb/mcl/parser/HeaderLineParser.java:102: warning: [fallthrough] 
possible fall-through into case
case 't':
^
./nl/cwi/monetdb/mcl/parser/HeaderLineParser.java:116: warning: [fallthrough] 
possible fall-through into case
default:
^
./nl/cwi/monetdb/mcl/parser/TupleLineParser.java:144: warning: [fallthrough] 
possible fall-through into case

default:

^
4 warnings


diffs (58 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/mcl/parser/HeaderLineParser.java 
b/java/src/main/java/nl/cwi/monetdb/mcl/parser/HeaderLineParser.java
--- a/java/src/main/java/nl/cwi/monetdb/mcl/parser/HeaderLineParser.java
+++ b/java/src/main/java/nl/cwi/monetdb/mcl/parser/HeaderLineParser.java
@@ -89,30 +89,29 @@ public class HeaderLineParser extends MC
{
getValues(chrLine, 2, pos - 3);
type = NAME;
-   break;
}
+   break;
case 'l':
if (len - pos == 6 &&
source.regionMatches(pos + 1, 
"length", 1, 5))
{
getIntValues(chrLine, 2, pos - 3);
type = LENGTH;
-   break;
}
+   break;
case 't':
if (len - pos == 4 &&
source.regionMatches(pos + 1, 
"type", 1, 3))
{
getValues(chrLine, 2, pos - 3);
type = TYPE;
-   break;
} else if (len - pos == 10 &&
source.regionMatches(pos + 1, 
"table_name", 1, 9))
{
getValues(chrLine, 2, pos - 3);
type = TABLE;
-   break;
}
+   break;
default:
throw new MCLParseException("unknown header: " +
(new String(chrLine, pos, len - 
pos)));
diff --git a/java/src/main/java/nl/cwi/monetdb/mcl/parser/TupleLineParser.java 
b/java/src/main/java/nl/cwi/monetdb/mcl/parser/TupleLineParser.java
--- a/java/src/main/java/nl/cwi/monetdb/mcl/parser/TupleLineParser.java
+++ b/java/src/main/java/nl/cwi/monetdb/mcl/parser/TupleLineParser.java
@@ -134,13 +134,15 @@ public class TupleLineParser extends MCL

try {

uesc.append((char)(Integer.parseInt("" + chrLine[pos] + 
chrLine[pos + 1] + chrLine[pos + 2], 8)));

pos += 2;
-   
break;

} catch (NumberFormatException e) {

// hmmm, this point should never be reached actually...

throw new AssertionError("Flow error, should never try 
to parse non-number");

}
+   
} else {
+   
// do default action if number seems 

MonetDB: default - Resolving javac -Xlint warnings:

2016-08-11 Thread Martin van Dinther
Changeset: 8b7f26f21725 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b7f26f21725
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
Branch: default
Log Message:

Resolving javac -Xlint warnings:
./nl/cwi/monetdb/jdbc/MonetPreparedStatement.java:832: warning: [rawtypes] 
found raw type: Map
Map map = getConnection().getTypeMap();
^
  missing type arguments for generic class Map
  where K,V are type-variables:
K extends Object declared in interface Map
V extends Object declared in interface Map
./nl/cwi/monetdb/jdbc/MonetPreparedStatement.java:833: warning: [rawtypes] 
found raw type: Class
Class c;
^
  missing type arguments for generic class Class
  where T is a type-variable:
T extends Object declared in class Class
./nl/cwi/monetdb/jdbc/MonetPreparedStatement.java:1225: warning: [cast] 
redundant cast to int
setCharacterStream(parameterIndex, reader, (int)0);
   ^
./nl/cwi/monetdb/jdbc/MonetPreparedStatement.java:1873: warning: [cast] 
redundant cast to int
setInt(parameterIndex, (int)(val ? 1 : 
0));
   ^
./nl/cwi/monetdb/jdbc/MonetPreparedStatement.java:1883: warning: [cast] 
redundant cast to double
setDouble(parameterIndex, (double)(val 
? 1.0 : 0.0));
  ^
./nl/cwi/monetdb/jdbc/MonetPreparedStatement.java:2390: warning: [dep-ann] 
deprecated item is not annotated with @Deprecated
public void setUnicodeStream(int parameterIndex, InputStream x, int 
length)
^
6 warnings


diffs (49 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -829,8 +829,8 @@ public class MonetPreparedStatement
 */
@Override
public String getParameterClassName(int param) throws 
SQLException {
-   Map map = getConnection().getTypeMap();
-   Class c;
+   Map map = 
getConnection().getTypeMap();
+   Class c;
if 
(map.containsKey(monetdbType[getParamIdx(param)])) {
c = 
(Class)map.get(monetdbType[getParamIdx(param)]);
} else {
@@ -1222,7 +1222,7 @@ public class MonetPreparedStatement
public void setCharacterStream(int parameterIndex, Reader reader)
throws SQLException
{
-   setCharacterStream(parameterIndex, reader, (int)0);
+   setCharacterStream(parameterIndex, reader, 0);
}
 
/**
@@ -1870,7 +1870,7 @@ public class MonetPreparedStatement
setShort(parameterIndex, (short)(val ? 
1 : 0));
break;
case Types.INTEGER:
-   setInt(parameterIndex, (int)(val ? 1 : 
0));
+   setInt(parameterIndex, (val ? 1 : 0));  
// do not cast to (int) as it generates a compiler warning
break;
case Types.BIGINT:
setLong(parameterIndex, (long)(val ? 1 
: 0));
@@ -1880,7 +1880,7 @@ public class MonetPreparedStatement
break;
case Types.FLOAT:
case Types.DOUBLE:
-   setDouble(parameterIndex, (double)(val 
? 1.0 : 0.0));
+   setDouble(parameterIndex, (val ? 1.0 : 
0.0));  // do no cast to (double) as it generates a compiler warning
break;
case Types.DECIMAL:
case Types.NUMERIC:
@@ -2387,6 +2387,7 @@ public class MonetPreparedStatement
 * @throws SQLException if a database access error occurs
 */
@Override
+   @Deprecated
public void setUnicodeStream(int parameterIndex, InputStream x, int 
length)
throws SQLException
{
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Resolving javac -Xlint warnings:

2016-08-11 Thread Martin van Dinther
Changeset: 78bd12b3d1f5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=78bd12b3d1f5
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
java/src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java
Branch: default
Log Message:

Resolving javac -Xlint warnings:
./nl/cwi/monetdb/jdbc/MonetStatement.java:721: error: cannot find symbol
return new MonetVirtualResultSet(columns, types, 
results);
   ^
  symbol:   class MonetVirtualResultSet
  location: class MonetStatement
./nl/cwi/monetdb/jdbc/MonetResultSet.java:1592: warning: [rawtypes] found raw 
type: Map
Map map = conn.getTypeMap();
^
  missing type arguments for generic class Map
  where K,V are type-variables:
K extends Object declared in interface Map
V extends Object declared in interface Map
./nl/cwi/monetdb/jdbc/MonetResultSet.java:1700: warning: [rawtypes] found raw 
type: Class
private boolean classImplementsSQLData(Class cl) {
   ^
  missing type arguments for generic class Class
  where T is a type-variable:
T extends Object declared in class Class
./nl/cwi/monetdb/jdbc/MonetResultSet.java:1701: warning: [rawtypes] found raw 
type: Class
Class[] cls = cl.getInterfaces();
^
  missing type arguments for generic class Class
  where T is a type-variable:
T extends Object declared in class Class
./nl/cwi/monetdb/jdbc/MonetResultSet.java:1794: warning: [unchecked] unchecked 
call to getConstructor(Class...) as a member of the raw type Class
((Class)type).getConstructor();
^
  where T is a type-variable:
T extends Object declared in class Class
./nl/cwi/monetdb/jdbc/MonetResultSet.java:1794: warning: [unchecked] unchecked 
conversion
((Class)type).getConstructor();
^
  required: Constructor
  found:Constructor


diffs (237 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -1589,7 +1589,7 @@ public class MonetResultSet extends Mone
}
}
if (conn != null) {
-   Map map = conn.getTypeMap();
+   Map map = 
conn.getTypeMap();
if (map != null && 
map.containsKey(MonetDBtype)) {
type = 
(Class)map.get(MonetDBtype);
}
@@ -1697,8 +1697,8 @@ public class MonetResultSet extends Mone
return getObject(columnIndex, 
this.getStatement().getConnection().getTypeMap());
}
 
-   private boolean classImplementsSQLData(Class cl) {
-   Class[] cls = cl.getInterfaces();
+   private boolean classImplementsSQLData(Class cl) {
+   Class[] cls = cl.getInterfaces();
for (int i = 0; i < cls.length; i++) {
if (cls[i] == SQLData.class)
return true;
@@ -1736,6 +1736,7 @@ public class MonetResultSet extends Mone
 * @throws SQLException if a database access error occurs
 */
@Override
+   @SuppressWarnings("unchecked")
public Object getObject(int i, Map map)
throws SQLException
{
@@ -1801,6 +1802,8 @@ public class MonetResultSet extends Mone
throw new SQLException(iae.getMessage(), 
"M0M27");
} catch (InvocationTargetException ite) {
throw new SQLException(ite.getMessage(), 
"M0M27");
+   } catch (SecurityException se) {
+   throw new SQLException(se.getMessage(), 
"M0M27");
}
final int colnum = i;
final boolean valwasnull = wasNull();
@@ -3448,95 +3451,3 @@ public class MonetResultSet extends Mone
}
 }
 
-/**
- * This internal subclass is not intended for normal use. Therefore it is 
restricted to
- * classes from the very same package only.
- *
- * Known issues with this class: some methods of the ResultSetMetaData object 
(obtained via getMetaData())
- * require that its statement argument (accessed via getStatement()) has a 
valid Statement object set.
- * Instances of this subclass do not have a valid Statement (see special 

MonetDB: default - Resolving javac -Xlint warnings:

2016-08-11 Thread Martin van Dinther
Changeset: 2b890a362e85 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b890a362e85
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
Branch: default
Log Message:

Resolving javac -Xlint warnings:
nl/cwi/monetdb/jdbc/MonetConnection.java:1724: warning: [cast] redundant cast 
to String[]
name = 
(String[])(hlp.values.clone());
   ^
nl/cwi/monetdb/jdbc/MonetConnection.java:1728: warning: [cast] redundant cast 
to int[]
columnLengths = 
(int[])(hlp.intValues.clone());
^
nl/cwi/monetdb/jdbc/MonetConnection.java:1732: warning: [cast] redundant cast 
to String[]
type = 
(String[])(hlp.values.clone());
   ^
nl/cwi/monetdb/jdbc/MonetConnection.java:1736: warning: [cast] redundant cast 
to String[]
tableNames = 
(String[])(hlp.values.clone());
 ^
nl/cwi/monetdb/jdbc/MonetConnection.java:2568: warning: [fallthrough] possible 
fall-through into case
case 
BufferedMCLReader.ERROR:
^


diffs (35 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -1721,19 +1721,19 @@ public class MonetConnection extends Mon
try {
switch (hlp.parse(tmpLine)) {
case HeaderLineParser.NAME:
-   name = 
(String[])(hlp.values.clone());
+   name = hlp.values.clone();
isSet[NAMES] = true;
break;
case HeaderLineParser.LENGTH:
-   columnLengths = 
(int[])(hlp.intValues.clone());
+   columnLengths = 
hlp.intValues.clone();
isSet[LENS] = true;
break;
case HeaderLineParser.TYPE:
-   type = 
(String[])(hlp.values.clone());
+   type = hlp.values.clone();
isSet[TYPES] = true;
break;
case HeaderLineParser.TABLE:
-   tableNames = 
(String[])(hlp.values.clone());
+   tableNames = hlp.values.clone();
isSet[TABLES] = true;
break;
}
@@ -2357,6 +2357,7 @@ public class MonetConnection extends Mon
 * @param the query to execute
 * @throws SQLException if a database error occurs
 */
+   @SuppressWarnings("fallthrough")
void executeQuery(String[] templ, String query)
throws SQLException
{
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: protocol - Prevent the writes from exactly filling up t...

2016-08-11 Thread Mark Raasveldt
Changeset: 5278f4cadd32 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5278f4cadd32
Modified Files:
sql/backends/monet5/sql_result.c
Branch: protocol
Log Message:

Prevent the writes from exactly filling up the buffer.

If the buffer is exactly filled up, the write will itself perform a flush, 
after which we do a manual flush. The two flushes mess up our reading on the 
client side.


diffs (12 lines):

diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -2002,7 +2002,7 @@ static int mvc_export_resultset_prot10(r
 
while (row < (size_t) count){
size_t crow = 0;
-   size_t bytes_left = bsize - sizeof(lng);
+   size_t bytes_left = bsize - sizeof(lng) - 1;
char cont_req, dummy;
 #ifdef PROT10_DEBUG
size_t bufpos;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: jit - Merge with default branch.

2016-08-11 Thread Sjoerd Mullender
Changeset: b914f37ea7c8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b914f37ea7c8
Added Files:
sql/backends/monet5/Tests/pyloader06.sql
sql/backends/monet5/Tests/pyloader06.stable.err
sql/backends/monet5/Tests/pyloader06.stable.out
sql/benchmarks/tpch/Tests/02-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/02-plan.stable.out.32bit
sql/benchmarks/tpch/Tests/13-plan.stable.out.32bit
sql/benchmarks/tpch/Tests/16-plan.stable.out.32bit

sql/test/BugTracker-2010/Tests/offset_limited_32bit.SF-2950579.stable.err.32bit

sql/test/BugTracker-2010/Tests/offset_limited_32bit.SF-2950579.stable.out.32bit
sql/test/BugTracker-2016/Tests/trigger_bulk.Bug-4045.sql
sql/test/BugTracker-2016/Tests/trigger_bulk.Bug-4045.stable.err
sql/test/BugTracker-2016/Tests/trigger_bulk.Bug-4045.stable.out
sql/test/copy/Tests/columns.sql
sql/test/copy/Tests/columns.stable.err
sql/test/copy/Tests/columns.stable.out
sql/test/lateral/Tests/All
sql/test/lateral/Tests/lateral.sql
sql/test/lateral/Tests/lateral.stable.err
sql/test/lateral/Tests/lateral.stable.out
sql/test/orderidx/Tests/simpletable.stable.out.32bit
sql/test/orderidx/Tests/smalltable.stable.out.32bit
sql/test/pg_regress/Tests/oid.stable.out.32bit
sql/test/pg_regress/Tests/without_oid.stable.out.32bit
Removed Files:
monetdb5/modules/mal/Tests/zorder.malC
monetdb5/modules/mal/Tests/zorder.stable.err
monetdb5/modules/mal/Tests/zorder.stable.out
monetdb5/modules/mal/zorder.c
monetdb5/modules/mal/zorder.h
monetdb5/modules/mal/zorder.mal
sql/benchmarks/tpch/Tests/01-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/04-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/13-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/21-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/22-explain.stable.out.32bit
sql/scripts/24_zorder.sql

sql/test/BugTracker-2010/Tests/group-by_ordered_column.Bug-2564.stable.out.32bit

sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out.32bit

sql/test/BugTracker-2010/Tests/prepare_stmt.Bug-2533.Bug-2534.stable.out.32bit

sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.32bit
sql/test/BugTracker-2016/Tests/rename_exps.Bug-3974.stable.out.32bit
sql/test/Dependencies/Tests/Dependencies.stable.out.int128
Modified Files:
NT/installer32/MonetDB5-SQL-Installer.vdproj
NT/installer64/MonetDB5-SQL-Installer.vdproj
NT/monetdb_config.h.in
NT/rules.msc
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/SQL-dump.stable.out
clients/Tests/SQL-dump.stable.out.int128
clients/Tests/exports.stable.out
clients/Tests/malcheck.stable.out
clients/mapiclient/dump.c
clients/mapiclient/mclient.c
clients/odbc/driver/README
clients/odbc/driver/SQLBindParameter.c
clients/odbc/driver/SQLBulkOperations.c
clients/odbc/driver/SQLCopyDesc.c
clients/odbc/driver/SQLDescribeParam.c
clients/odbc/driver/SQLEndTran.c
clients/odbc/driver/SQLExtendedFetch.c
clients/odbc/driver/SQLFetchScroll.c
clients/odbc/driver/SQLGetEnvAttr.c
clients/odbc/driver/SQLGetFunctions.c
clients/odbc/driver/SQLNumParams.c
clients/odbc/driver/SQLSetDescRec.c
clients/odbc/driver/SQLSetEnvAttr.c
common/stream/stream.c
configure.ag
gdk/gdk_aggr.c
gdk/gdk_atoms.h
gdk/gdk_calc.h
gdk/gdk_cross.c
gdk/gdk_heap.c
gdk/gdk_posix.c
gdk/gdk_unique.c
gdk/gdk_utils.c
java/src/main/java/nl/cwi/monetdb/jdbc/MonetBlob.java
java/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
monetdb5/ChangeLog

monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows

monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows.single

monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.single
monetdb5/extras/mal_optimizer_template/opt_sql_append.c
monetdb5/extras/mal_optimizer_template/opt_sql_append.h
monetdb5/mal/mal.h
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_listing.c
monetdb5/mal/mal_module.c
monetdb5/mal/mal_module.h
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_runtime.c
monetdb5/modules/atoms/batxml.c
monetdb5/modules/atoms/json.c
monetdb5/modules/atoms/uuid.c

MonetDB: jit - Merge with default branch.

2016-08-11 Thread Sjoerd Mullender
Changeset: aed319615092 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aed319615092
Modified Files:
sql/test/BugTracker-2016/Tests/storagemodel.stable.out
Branch: jit
Log Message:

Merge with default branch.


diffs (28 lines):

diff --git a/sql/test/BugTracker-2016/Tests/storagemodel.stable.out 
b/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
--- a/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
+++ b/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
@@ -73,8 +73,8 @@ Ready.
 % 3,   7,  13, 8,  8,  2,  1,  5,  1,  5 # 
length
 [ "sys",   "_tables",  "id",   "int",  "writable", 4,  0,  
false,  0,  true]
 [ "sys",   "_tables",  "name", "varchar",  "writable", 8,  
0,  false,  0,  false   ]
-[ "sys",   "_tables",  "schema_id","int",  "writable", 4,  
0,  false,  0,  false   ]
-[ "sys",   "_tables",  "query","varchar",  "writable", 
34, 0,  false,  0,  NULL]
+[ "sys",   "_tables",  "schema_id","int",  "writable", 4,  
0,  false,  0,  NULL]
+[ "sys",   "_tables",  "query","varchar",  "writable", 
45, 0,  false,  0,  NULL]
 [ "sys",   "_tables",  "type", "smallint", "writable", 2,  
0,  false,  0,  NULL]
 [ "sys",   "_tables",  "system",   "boolean",  "writable", 
1,  0,  false,  0,  NULL]
 [ "sys",   "_tables",  "commit_action","smallint", 
"writable", 2,  0,  false,  0,  NULL]
@@ -96,10 +96,10 @@ Ready.
 % schema,  table,  column, type,   mode,   typewidth,  hashes, phash,  
imprints,   sorted # name
 % clob,clob,   clob,   clob,   clob,   int,bigint, boolean,
bigint, boolean # type
 % 3,   7,  13, 8,  8,  2,  4,  5,  1,  5 # 
length
-[ "sys",   "_tables",  "id",   "int",  "writable", 4,  1064,   
false,  0,  NULL]
+[ "sys",   "_tables",  "id",   "int",  "writable", 4,  2600,   
false,  0,  NULL]
 [ "sys",   "_tables",  "name", "varchar",  "writable", 8,  
0,  false,  0,  false   ]
-[ "sys",   "_tables",  "schema_id","int",  "writable", 4,  
0,  false,  0,  false   ]
-[ "sys",   "_tables",  "query","varchar",  "writable", 
33, 0,  false,  0,  NULL]
+[ "sys",   "_tables",  "schema_id","int",  "writable", 4,  
0,  false,  0,  NULL]
+[ "sys",   "_tables",  "query","varchar",  "writable", 
45, 0,  false,  0,  NULL]
 [ "sys",   "_tables",  "type", "smallint", "writable", 2,  
0,  false,  0,  NULL]
 [ "sys",   "_tables",  "system",   "boolean",  "writable", 
1,  0,  false,  0,  NULL]
 [ "sys",   "_tables",  "commit_action","smallint", 
"writable", 2,  0,  false,  0,  NULL]
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list