MonetDB: default - BATsample(): added missing cast;

2014-06-22 Thread Stefan Manegold
Changeset: b4f5d57b42ca for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b4f5d57b42ca
Modified Files:
gdk/gdk_sample.c
Branch: default
Log Message:

BATsample(): added missing cast;

thanks to Microsoft compiler for reminding us.


diffs (12 lines):

diff --git a/gdk/gdk_sample.c b/gdk/gdk_sample.c
--- a/gdk/gdk_sample.c
+++ b/gdk/gdk_sample.c
@@ -149,7 +149,7 @@ BATsample(BAT *b, BUN n) {
struct oidtreenode* ttree;
do {
/* generate a new random OID */
-   candoid = minoid + DRAND * (maxoid - minoid);
+   candoid = (BUN) (minoid + DRAND * (maxoid - 
minoid));
/* if that candidate OID was already generated, 
try again */
} while (OIDTreeLookup(tree, candoid));
ttree = OIDTreeInsert(tree, candoid);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - more 64 bit logger fixes.

2014-06-22 Thread Niels Nes
Changeset: 5758831bafd3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5758831bafd3
Modified Files:
gdk/gdk_logger.c
Branch: default
Log Message:

more 64 bit logger fixes.


diffs (32 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1780,8 +1780,8 @@ log_delta(logger *lg, BAT *b, char *name
 
l.tid = lg-tid;
nr = (BUNlast(b) - BUNfirst(b));
-   assert(nr = GDK_int_max);
-   l.nr = (int) nr;
+   assert(nr = GDK_lng_max);
+   l.nr = nr;
lg-changes += l.nr;
 
if (l.nr) {
@@ -1823,7 +1823,7 @@ log_bat(logger *lg, BAT *b, char *name)
}
 
l.tid = lg-tid;
-   l.nr = (int) (BUNlast(b) - b-batInserted);
+   l.nr = (BUNlast(b) - b-batInserted);
lg-changes += l.nr;
 
if (l.nr) {
@@ -1856,7 +1856,7 @@ log_bat(logger *lg, BAT *b, char *name)
if (lg-debug  1)
fprintf(stderr, #Logged %s  LLFMT  inserts\n, name, 
l.nr);
}
-   l.nr = (int) (b-batFirst - b-batDeleted);
+   l.nr = (b-batFirst - b-batDeleted);
lg-changes += l.nr;
 
if (l.nr  ok == GDK_SUCCEED) {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: rdf - Only consider small CS for dimension CS.

2014-06-22 Thread Minh-Duc Pham
Changeset: 29a04b178d38 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=29a04b178d38
Modified Files:
monetdb5/extras/rdf/rdfschema.c
monetdb5/extras/rdf/rdfschema.h
Branch: rdf
Log Message:

Only consider small CS for dimension CS.

In merging two CSs, if one of them is Dimension CS, then the merged CS is also 
an dimension CS.
(This works particularly for LUBM).
Currently, only S1 allows merging for Dimension CS


diffs (48 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
@@ -542,7 +542,7 @@ void getIRNums(CSrel *csrelSet, CSset *f
for (i = 0; i  num; i++){
lastIRScores[i] = curIRScores[i]; 
}
-
+   
/*
printf(  After %d iteration \n, k); 
for (i = 0; i  num; i++){
@@ -573,9 +573,12 @@ void updateFreqCStype(CSset *freqCSset, 
 
printf(List of dimension tables: \n);
for (i = 0; i  num; i++){
+   #if ONLY_SMALLTBL_DIMENSIONTBL
+   if (freqCSset-items[i].support  MINIMUM_TABLE_SIZE) continue; 
+   #endif
if (refCount[i]  freqCSset-items[i].support) continue; 
if (curIRScores[i]  threshold) continue; 
-
+   
freqCSset-items[i].type = DIMENSIONCS;
//printf(A dimension CS with IR score = %f \n, 
curIRScores[i]);
printf( %d  , i);
@@ -1630,7 +1633,7 @@ CS* mergeTwoCSs(CS cs1, CS cs2, int freq
int numCombineP = 0; 
 
CS *mergecs = (CS*) malloc (sizeof (CS)); 
-   if (cs1.type == DIMENSIONCS  cs2.type == DIMENSIONCS)
+   if (cs1.type == DIMENSIONCS || cs2.type == DIMENSIONCS)
 mergecs-type = DIMENSIONCS; 
else
mergecs-type = (char)MERGECS; 
diff --git a/monetdb5/extras/rdf/rdfschema.h b/monetdb5/extras/rdf/rdfschema.h
--- a/monetdb5/extras/rdf/rdfschema.h
+++ b/monetdb5/extras/rdf/rdfschema.h
@@ -135,7 +135,8 @@ typedef struct PropStat {
 
 /*  For detecting dimension table */
 #defineNUM_ITERATION_FOR_IR3   /* Number of iteration for 
indirect referrences to a CS (table) */
-
+#define ONLY_SMALLTBL_DIMENSIONTBL 1   /* Only small tables are considered to 
be dimension table 
+   Small table is the one that have 
support  MINIMUM_TABLE_SIZE */
 #define IR_DIMENSION_THRESHOLD_PERCENTAGE 0.10
 //#define IR_DIMENSION_THRESHOLD_PERCENTAGE0.02//  Score of indirect 
references that the CS can be considered as a dimension CS 
//   
IR_DIMENSION_THRESHOLD_PERCENTAGE * totalFrequency 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - more 64/32 bit fixes for logger structures

2014-06-22 Thread Niels Nes
Changeset: 6d2a1683974c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6d2a1683974c
Modified Files:
gdk/gdk_logger.h
Branch: default
Log Message:

more 64/32 bit fixes for logger structures


diffs (12 lines):

diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h
--- a/gdk/gdk_logger.h
+++ b/gdk/gdk_logger.h
@@ -49,7 +49,7 @@ typedef void (*postversionfix_fptr)(void
 
 typedef struct logger {
int debug;
-   size_t changes;
+   lng changes;
int version;
lng id;
int tid;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - fix compilation on windows

2014-06-22 Thread Niels Nes
Changeset: c43ef3958880 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c43ef3958880
Modified Files:
gdk/gdk_logger.c
Branch: default
Log Message:

fix compilation on windows


diffs (12 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -832,7 +832,7 @@ logger_readlog(logger *lg, char *filenam
case LOG_START:
if (l.nr  lg-tid)
lg-tid = l.nr;
-   tr = tr_create(tr, l.nr);
+   tr = tr_create(tr, (int)l.nr);
if (lg-debug  1)
fprintf(stderr, #logger tstart %d\n, tr-tid);
break;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - some comment

2014-06-22 Thread Foteini Alvanaki
Changeset: 15b6ee09f366 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=15b6ee09f366
Modified Files:
sql/server/sql_scan.h
Branch: geo
Log Message:

some comment


diffs (16 lines):

diff --git a/sql/server/sql_scan.h b/sql/server/sql_scan.h
--- a/sql/server/sql_scan.h
+++ b/sql/server/sql_scan.h
@@ -28,9 +28,9 @@
 typedef enum { LINE_1, LINE_N } prot;
 
 struct scanner {
-   bstream *rs;
-   stream *ws;
-   stream *log;
+   bstream *rs;/* input stream */
+   stream *ws; /* output stream */
+   stream *log;/* log stream */
 
int yynext; /* next token, lr(1) isn't powerful enough for 
sql */
int yylast; /* previous token, to detect superfluous 
semi-colons */
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - trying transform

2014-06-22 Thread Foteini Alvanaki
Changeset: 0cca40091c2c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0cca40091c2c
Modified Files:
geom/lib/libgeom.h
geom/monetdb5/Makefile.ag
geom/monetdb5/geom.c
geom/monetdb5/geom.mal
geom/sql/40_geom.sql
monetdb5/mal/mal_client.h
Branch: geo
Log Message:

trying transform


diffs (truncated from 320 to 300 lines):

diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -38,7 +38,7 @@
 #endif
 
 #include geos_c.h
-//#include proj_api.h //it is needed to transform from one srid to another
+#include proj_api.h //it is needed to transform from one srid to another
 
 typedef struct mbr {
float xmin;
diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag
--- a/geom/monetdb5/Makefile.ag
+++ b/geom/monetdb5/Makefile.ag
@@ -36,7 +36,7 @@ lib__geom = {
   ../../gdk/libbat \
   ../../common/stream/libstream \
   ../../monetdb5/tools/libmonetdb5 \
-  $(GEOS_LIBS)
+  $(GEOS_LIBS) $(PROJ_LIBS)
 }
 
 headers_mal = {
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -32,7 +32,6 @@
 #include mal_exception.h
 #include mal_client.h
 #include stream.h
-#include sql_scenario.h
 
 
 #include stdio.h
@@ -151,85 +150,52 @@ geom_export str wkbBuffer(wkb **out, wkb
 geom_export str wkbGeometryN(wkb** out, wkb** geom, int* geometryNum); 
 geom_export str wkbNumGeometries(int* out, wkb** geom);
 
-/*
-//geom_export str wkbTransform(wkb**, wkb*, int*);
-geom_export str wkbTransform(void);
-
-static str executeQuery(char** result, char* query) {
-   // input from GDKin
-   bstream* fin = NULL; 
-
-   // output to user buffer
-   stream* fout = NULL;
-   struct buffer* resultsBuffer = NULL;
-
-   Client c = NULL;
-   str qmsg = MAL_SUCCEED;
-
-   char* resultstring = NULL;
-   int len = 0;
-
-   //create the output stream
-   resultsBuffer = buffer_create(BLOCK);
-   fout = buffer_wastream(resultsBuffer, resultsring);
-   
-   //create a client
-   c = MCinitClient(CONSOLE, fin, fout);
-   qmsg = SQLstatementIntern(c, query, queryName, TRUE, TRUE);
-
-if (qmsg == MAL_SUCCEED) {
-resultstring = buffer_get_buf(resultsBuffer);
-*result = GDKstrdup(resultstring);
-free(resultstring);
-} else {
-len = strlen(qmsg) + 19;
-resultstring = malloc(len);
-snprintf(resultstring, len, { \error\: \%s\ }\n, qmsg);
-*result = GDKstrdup(resultstring);
-free(resultstring);
-}
-buffer_destroy(resultsBuffer);
-fprintf(stderr, %s\n, resultstring);
-   
-   //destroy client when done
-   SQLexitClient(c);
-
-
-   return qmsg;
-
-}
-
-str wkbTransform(void) {
-   char* query = SELECT count(*) FROM spatial_ref_sys;
-   char** result = NULL;
-
-   executeQuery(result, query);
-
-   return MAL_SUCCEED;
-}*/
+geom_export str wkbTransform(wkb**, wkb*, int*, char**, char**);
 
 /* It gets a geometry and transforms its coordinates to the provided srid */
-//str wkbTransform(wkb** trasformedWKB, wkb* geomWKB, int* srid) {
-/*str wkbTransform(wkb* geomWKB, int* srid) {
-   projPJ input_pj, output_pj;
-   GEOSGeom geosGeometry;
+str wkbTransform(wkb** transformedWKB, wkb* geomWKB, int* srid, char** 
proj4_src_str, char** proj4_dst_str) {
+   projPJ proj4_src, proj4_dst;
+   double x=10, y=10, z=10;
+
+
+if(geomWKB == NULL) 
+   fprintf(stderr, NULL wkb\n);
+*transformedWKB = wkb_nil;
+
+fprintf(stderr, SRID=%d SRC=%s DEST=%s\n, *srid, *proj4_src_str, 
*proj4_dst_str);
+
+proj4_src = pj_init_plus(*proj4_src_str);
+proj4_dst = pj_init_plus(*proj4_dst_str);
+
+fprintf(stderr, BEFORE: (%f, %f, %f)\n, x, y, z);
+pj_transform(proj4_src, proj4_dst, 1, 0, x, y, z);
+fprintf(stderr, AFTER: (%f, %f, %f)\n, x, y, z);
+
+pj_free(proj4_src);
+pj_free(proj4_dst);
+
+//for each geometry in a multigeometry
+//for each point in the geometry
+//pj_transform(proj_src, proj_dst, 1, 0, x, y, z)
+
+
 // str qmsg = MAL_SUCCEED;
 
//check if the new srid is the same with the old one
-   if(geomWKB-srid == *srid)
-   fprintf(stderr, New and old srids are the same\n);
-
-   //get GEOSGeometry from WKB 
-   geosGeometry = wkb2geos(geomWKB);
-   if(geosGeometry == NULL)
-   throw(MAL, geom.Transform, wkb2geos failed);
-   
-   //read the projection information from spatial_ref_sys  
-
+// if(geomWKB-srid == *srid)
+// fprintf(stderr, New and old srids are the same\n);
+//
+// //get GEOSGeometry from WKB 
+// geosGeometry = wkb2geos(geomWKB);
+// if(geosGeometry == NULL)
+// throw(MAL, geom.Transform, wkb2geos failed);
+// 
+// //read the 

MonetDB: geo - megred with stephan's changes

2014-06-22 Thread Foteini Alvanaki
Changeset: ca07e4240dc1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ca07e4240dc1
Modified Files:
geom/monetdb5/Makefile.ag
Branch: geo
Log Message:

megred with stephan's changes


diffs (16 lines):

diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag
--- a/geom/monetdb5/Makefile.ag
+++ b/geom/monetdb5/Makefile.ag
@@ -26,6 +26,12 @@ INCLUDES = ../lib \
   ../../monetdb5/modules/mal \
   ../../monetdb5/optimizer \
   ../../monetdb5/scheduler \
+  ../../sql/backends/monet5 \
+  ../../sql/include \
+  ../../sql/server \
+  ../../sql/common \
+  ../../sql/storage \
+  ../../clients/mapilib \
   $(GEOS_INCS)
 
 lib__geom = {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: geo - fixed includes and added proj library, everything...

2014-06-22 Thread Foteini Alvanaki
Changeset: 6b9f233d728b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b9f233d728b
Modified Files:
configure.ag
geom/lib/Makefile.ag
geom/monetdb5/Makefile.ag
Branch: geo
Log Message:

fixed includes and added proj library, everything should compile and link 
correctly


diffs (79 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2388,6 +2388,36 @@ AC_SUBST(MSEED_CFLAGS, $MSEED_CFLAGS)
 AC_SUBST(MSEED_LIBS, $MSEED_LIBS)
 AM_CONDITIONAL(HAVE_MSEED, test x$have_mseed != xno)
 
+#proj only used in geom module
+have_proj=''
+PROJ_INCS=''
+PROJ_LIBS=''
+AC_ARG_WITH(proj,
+   AS_HELP_STRING([--with-proj=DIR],
+   [proj library is installed in DIR]),
+   have_proj=$withval)
+case $enable_geom in
+yes|auto)
+   if test x$have_proj != xno; then
+   PROJ_INCS=-I$have_proj/include
+   PROJ_LIBS=-L$have_proj/lib -lproj
+   fi
+   if test x$have_proj = xno; then
+   if test x$enable_geon = xyes; then
+   AC_MSG_ERROR([proj library required for geom module])
+   fi
+   # no proj, so don't compile geom
+   enable_geom=no
+   if test x$disable_geom = x; then
+   disable_geom=(proj library required for geom module)
+   fi
+   fi
+   ;;
+esac
+AC_SUBST(PROJ_INCS)
+AC_SUBST(PROJ_LIBS)
+
+
 # geos, only used in geom module
 org_have_geos=auto
 have_geos=$org_have_geos
diff --git a/geom/lib/Makefile.ag b/geom/lib/Makefile.ag
--- a/geom/lib/Makefile.ag
+++ b/geom/lib/Makefile.ag
@@ -16,7 +16,7 @@
 # All Rights Reserved.
 
 MTSAFE
-INCLUDES = ../../common/options ../../common/stream ../../gdk $(GEOS_INCS)
+INCLUDES = ../../common/options ../../common/stream ../../gdk $(GEOS_INCS) 
$(PROJ_INCS)
 
 lib_geom = {
NOINST
diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag
--- a/geom/monetdb5/Makefile.ag
+++ b/geom/monetdb5/Makefile.ag
@@ -17,22 +17,7 @@
 
 MTSAFE
 INCLUDES = ../lib \
-  ../../common/options \
-  ../../common/stream \
-  ../../gdk \
-  ../../monetdb5/modules/atoms \
-  ../../monetdb5/modules/kernel \
-  ../../monetdb5/mal \
-  ../../monetdb5/modules/mal \
-  ../../monetdb5/optimizer \
-  ../../monetdb5/scheduler \
-  ../../sql/backends/monet5 \
-  ../../sql/include \
-  ../../sql/server \
-  ../../sql/common \
-  ../../sql/storage \
-  ../../clients/mapilib \
-  $(GEOS_INCS)
+  $(GEOS_INCS) $(PROJ_INCS)
 
 lib__geom = {
MODULE
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list