Changeset: f1c26daf1de4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f1c26daf1de4
Modified Files:
cmake/monetdb-defines.cmake
common/utils/mstring.h
gdk/gdk_string.c
monetdb5/modules/atoms/str.c
monetdb5/modules/mal/pipeline.c
monetdb5/modules/mal/pipeline.h
monetdb_config.h.in
sql/backends/monet5/copy.c
sql/backends/monet5/copy.h
sql/backends/monet5/copy_convert.c
sql/backends/monet5/copy_convert_num.h
sql/backends/monet5/copy_scan.c
sql/backends/monet5/generator/generator.c
sql/backends/monet5/sql_bincopyconvert.c
sql/backends/monet5/vaults/parquet/parquet.c
sql/backends/monet5/vaults/parquet/pqc_dict_lookup.h
sql/backends/monet5/vaults/parquet/pqc_dict_lookup_var.h
sql/backends/monet5/vaults/parquet/pqc_filemetadata.c
sql/backends/monet5/vaults/parquet/pqc_filemetadata.h
sql/backends/monet5/vaults/parquet/pqc_reader.c
sql/backends/monet5/vaults/parquet/pqc_reader.h
sql/backends/monet5/vaults/parquet/pqc_thrift.c
sql/backends/monet5/vaults/parquet/pqc_thrift.h
tools/monetdbe/monetdbe.c
Branch: pp_hashjoin
Log Message:
Steps towards getting this to build on Windows.
diffs (truncated from 1991 to 300 lines):
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -18,6 +18,7 @@ function(monetdb_configure_defines)
check_include_file("fcntl.h" HAVE_FCNTL_H)
# use find_path for getopt.h since we need the path on Windows
find_path(HAVE_GETOPT_H "getopt.h")
+ check_include_file("glob.h" HAVE_GLOB_H)
check_include_file("kvm.h" HAVE_KVM_H)
check_include_file("mach/mach_init.h" HAVE_MACH_MACH_INIT_H)
check_include_file("mach/task.h" HAVE_MACH_TASK_H)
diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -194,13 +194,14 @@ mutils_export ssize_t strtconcat(char *r
* U+D800..U+DFFF are not allowed to be encoded.
*/
static inline bool
-checkUTF8(const char *v)
+checkUTF8(const char *v, size_t *ncp)
{
/* It is unlikely that this functions returns false, because it is
* likely that the string presented is a correctly coded UTF-8
* string. So we annotate the tests that are very (un)likely to
* succeed, i.e. the ones that lead to a return of false. This can
* help the compiler produce more efficient code. */
+ size_t n = 0; /* count number of code points
*/
if (v != NULL) {
if (v[0] != '\200' || v[1] != '\0') {
/* check that string is correctly encoded UTF-8 */
@@ -239,9 +240,12 @@ checkUTF8(const char *v)
} else {
return false;
}
+ n++;
}
}
}
+ if (ncp)
+ *ncp = n;
return true;
}
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -269,7 +269,7 @@ strPut(BAT *b, var_t *dst, const void *V
* need to do this earlier: if the string was found above, it
* must have gone through here in the past */
#ifndef NDEBUG
- if (!checkUTF8(v)) {
+ if (!checkUTF8(v, NULL)) {
GDKerror("incorrectly encoded UTF-8\n");
return (var_t) -1;
}
@@ -794,7 +794,7 @@ strWrite(const char *a, stream *s, size_
(void) cnt;
assert(cnt == 1);
- if (!checkUTF8(a)) {
+ if (!checkUTF8(a, NULL)) {
GDKerror("incorrectly encoded UTF-8\n");
return GDK_FAIL;
}
@@ -9854,7 +9854,7 @@ fstrPut(BAT *b, var_t *dst, const void *
}
#ifndef NDEBUG
- if (!checkUTF8(v)) {
+ if (!checkUTF8(v, NULL)) {
GDKerror("incorrectly encoded UTF-8\n");
return (var_t) -1;
}
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -67,7 +67,7 @@
#include "mutf8.h"
#include "bigram.h"
-#define UTF8_assert(s) assert(checkUTF8(s))
+#define UTF8_assert(s) assert(checkUTF8(s, NULL))
/* return the number of codepoints in `s' before `end'. */
static inline int
diff --git a/monetdb5/modules/mal/pipeline.c b/monetdb5/modules/mal/pipeline.c
--- a/monetdb5/modules/mal/pipeline.c
+++ b/monetdb5/modules/mal/pipeline.c
@@ -93,19 +93,27 @@ BATswap_heaps(BAT *u, BAT *b, Pipeline *
static void
sleep_ns( int ns)
{
+#ifdef NATIVE_WIN32
+ if (ns < 1000000)
+ ns = 1;
+ else
+ ns /= 1000000;
+ Sleep(ns);
+#else
#ifdef HAVE_NANOSLEEP
- struct timespec ts;
+ struct timespec ts;
- ts.tv_sec = (time_t) 0;
- ts.tv_nsec = ns;
- while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
- ;
+ ts.tv_sec = (time_t) 0;
+ ts.tv_nsec = ns;
+ while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
+ ;
#else
- struct timeval tv;
+ struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = ((ns+999)/1000);
- (void) select(0, NULL, NULL, NULL, &tv);
+ tv.tv_sec = 0;
+ tv.tv_usec = ((ns+999)/1000);
+ (void) select(0, NULL, NULL, NULL, &tv);
+#endif
#endif
}
diff --git a/monetdb5/modules/mal/pipeline.h b/monetdb5/modules/mal/pipeline.h
--- a/monetdb5/modules/mal/pipeline.h
+++ b/monetdb5/modules/mal/pipeline.h
@@ -34,7 +34,7 @@
extern int BATupgrade(BAT *r, BAT *b, bool locked);
extern void BATswap_heaps(BAT *u, BAT *b, Pipeline *p);
-extern void counter_wait(Sink *s, int nr, Pipeline *p);
-extern void counter_next(Sink *s);
+mal_export void counter_wait(Sink *s, int nr, Pipeline *p);
+mal_export void counter_next(Sink *s);
#endif /*_PIPELINE_H_*/
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -69,6 +69,7 @@
#cmakedefine HAVE_DLFCN_H 1
#cmakedefine HAVE_FCNTL_H 1
#cmakedefine HAVE_GETOPT_H 1
+#cmakedefine HAVE_GLOB_H 1
#cmakedefine HAVE_KVM_H 1
#cmakedefine HAVE_MACH_MACH_INIT_H 1
#cmakedefine HAVE_MACH_O_DYLD_H 1
diff --git a/sql/backends/monet5/copy.c b/sql/backends/monet5/copy.c
--- a/sql/backends/monet5/copy.c
+++ b/sql/backends/monet5/copy.c
@@ -498,22 +498,31 @@ end:
static void
sleep_ns( int ns)
{
+#ifdef NATIVE_WIN32
+ if (ns < 1000000)
+ ns = 1;
+ else
+ ns /= 1000000;
+ Sleep(ns);
+#else
#ifdef HAVE_NANOSLEEP
- struct timespec ts;
+ struct timespec ts;
- ts.tv_sec = (time_t) 0;
- ts.tv_nsec = ns;
- while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
- ;
+ ts.tv_sec = (time_t) 0;
+ ts.tv_nsec = ns;
+ while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
+ ;
#else
- struct timeval tv;
+ struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = ((ns+999)/1000);
- (void) select(0, NULL, NULL, NULL, &tv);
+ tv.tv_sec = 0;
+ tv.tv_usec = ((ns+999)/1000);
+ (void) select(0, NULL, NULL, NULL, &tv);
+#endif
#endif
}
+
static str
COPYsplitlines(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
diff --git a/sql/backends/monet5/copy.h b/sql/backends/monet5/copy.h
--- a/sql/backends/monet5/copy.h
+++ b/sql/backends/monet5/copy.h
@@ -102,7 +102,7 @@ void dump_block(const char *msg, BAT *b)
////////////////////////////////////////////////////////////////////////
// copy_convert.c
-typedef void (*bulk_converter)(struct error_handling*, void *parms, int count,
void *dest, char *data, int *offsets);
+typedef void (*bulk_converter)(struct error_handling*, void *parms, BUN count,
void *dest, char *data, int *offsets);
extern str parse_fixed_width_column(bat *ret, struct error_handling *errors,
const char *fname, bat block_bat_id, Pipeline *p, bat offsets_bat_id, int tpe,
bulk_converter f, void *parms);
extern str COPYparse_generic(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
diff --git a/sql/backends/monet5/copy_convert.c
b/sql/backends/monet5/copy_convert.c
--- a/sql/backends/monet5/copy_convert.c
+++ b/sql/backends/monet5/copy_convert.c
@@ -42,7 +42,7 @@ COPYparse_generic(Client cntxt, MalBlkPt
bat rows = *getArgReference_bat(stk, pci, 5);
int col_no = *getArgReference_int(stk, pci, 6);
const char *col_name = *getArgReference_str(stk, pci, 7);
- int n;
+ BUN n;
void *buffer = NULL;
size_t buffer_len;
const void *nil_ptr;
@@ -67,7 +67,7 @@ COPYparse_generic(Client cntxt, MalBlkPt
const char *start = (char*)r->bs->buf[p->wid];
const int *offsetp = (int*)Tloc(indices, 0);
allocator *ma = cntxt->curprg->def->ma;
- for (int i = 0; i < n; i++) {
+ for (BUN i = 0; i < n; i++) {
gdk_return ok = GDK_SUCCEED;
int offset = offsetp[i];
const char *src = start + offset;
@@ -75,15 +75,15 @@ COPYparse_generic(Client cntxt, MalBlkPt
if (is_int_nil(offset)) {
to_insert = nil_ptr;
- } else if (!checkUTF8(src)) {
- ok = copy_report_error(&errors, i, -1, "incorrectly
encoded UTF-8");
+ } else if (!checkUTF8(src, NULL)) {
+ ok = copy_report_error(&errors, (lng) i, -1,
"incorrectly encoded UTF-8");
to_insert = nil_ptr;
} else {
ssize_t len = BATatoms[tpe].atomFromStr(ma, src,
&buffer_len, &buffer, false);
if (len >= 0) {
to_insert = buffer;
} else {
- ok = copy_report_error(&errors, i, -1, "invalid
%s: %s", ATOMname(tpe), src);
+ ok = copy_report_error(&errors, (lng) i, -1,
"invalid %s: %s", ATOMname(tpe), src);
GDKclrerr();
to_insert = nil_ptr;
}
@@ -177,7 +177,7 @@ COPYparse_float(Client cntxt, MalBlkPtr
const char *col_name = *getArgReference_str(stk, pci, 7);
str dec_sep = *getArgReference_str(stk, pci, 8);
str dec_skip = *getArgReference_str(stk, pci, 9);
- int n;
+ BUN n;
dbl localdbl;
void *buffer = &localdbl;
size_t buffer_len = sizeof(dbl);
@@ -205,7 +205,7 @@ COPYparse_float(Client cntxt, MalBlkPtr
const char *start = (char*)r->bs->buf[p->wid];
const int *offsetp = (int*)Tloc(indices, 0);
allocator *ma = cntxt->curprg->def->ma;
- for (int i = 0; i < n; i++) {
+ for (BUN i = 0; i < n; i++) {
gdk_return ok = GDK_SUCCEED;
int offset = offsetp[i];
const char *src = start + offset;
@@ -222,7 +222,7 @@ COPYparse_float(Client cntxt, MalBlkPtr
if (len >= 0) {
to_insert = buffer;
} else {
- ok = copy_report_error(&errors, i, -1, "invalid
%s: %s", ATOMname(tpe), src);
+ ok = copy_report_error(&errors, (lng) i, -1,
"invalid %s: %s", ATOMname(tpe), src);
GDKclrerr();
to_insert = nil_ptr;
nils++;
@@ -264,65 +264,6 @@ end:
return msg;
}
-static inline bool
-checkUTF8str(const char *v, size_t maxlen, int *err)
-{
- /* It is unlikely that this functions returns false, because
- * it is likely that the string presented is a correctly coded
- * UTF-8 string. So we annotate the tests that are very
- * unlikely to succeed, i.e. the ones that lead to a return of
- * false, as being expected to return 0 using the
- * __builtin_expect function. */
- size_t j = 0;
- if (v != NULL) {
- for (; v[j] && (v[j] & 0x80) == 0; j++)
- ;
- /* check that string is correctly encoded UTF-8 */
- for (size_t i = j; v[i]; i++, j++) {
- /* we do not annotate all tests, only the ones
- * leading directly to an unlikely return
- * statement */
- if ((v[i] & 0x80) == 0) {
- ;
- } else if ((v[i] & 0xE0) == 0xC0) {
- if (__builtin_expect(((v[i] & 0x1E) == 0), 0))
- return false;
- if (__builtin_expect(((v[++i] & 0xC0) != 0x80),
0))
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]