Changeset: e3cbc1863e60 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e3cbc1863e60
Modified Files:
sql/backends/monet5/bin_partition_by_slice.c
sql/backends/monet5/rel_pptopn.c
sql/backends/monet5/vaults/parquet/pqc_reader.c
Branch: pp_hashjoin
Log Message:
small type fixes for 32 bit
diffs (194 lines):
diff --git a/sql/backends/monet5/bin_partition_by_slice.c
b/sql/backends/monet5/bin_partition_by_slice.c
--- a/sql/backends/monet5/bin_partition_by_slice.c
+++ b/sql/backends/monet5/bin_partition_by_slice.c
@@ -47,11 +47,14 @@ exp_getcard(mvc *sql, sql_rel *rel, sql_
if ((p = find_prop(e->p, PROP_NUNIQUES)))
est = (BUN)p->value.dval;
- if (est == BUN_NONE || (ulng) est > (ulng) GDK_lng_max) {
+ if (est == BUN_NONE
+#if SIZEOF_BUN == SIZEOF_LNG
+ || (ulng) est > (ulng) GDK_lng_max
+#endif
+ )
cnt = 85000000;
- } else {
- cnt = (lng) est;
- }
+ else
+ cnt = (BUN) est;
if (e->type == e_column && t && t->type->localtype == TYPE_str) {
sql_column *c = name_find_column(rel, e->l, e->r, -1, NULL);
@@ -83,11 +86,14 @@ rel_groupby_2_phases(mvc *sql, sql_rel *
lng card = 1, cnt;
bool global = list_empty(rel->r);
- if (est == BUN_NONE || (ulng) est > (ulng) GDK_lng_max) {
+ if (est == BUN_NONE
+#if SIZEOF_BUN == SIZEOF_LNG
+ || (ulng) est > (ulng) GDK_lng_max
+#endif
+ )
cnt = 85000000;
- } else {
- cnt = (lng) est;
- }
+ else
+ cnt = (BUN) est;
if (!list_empty(rel->r)) {
list *l = rel->r;
for( node *n = l->h; n; n = n->next ) {
@@ -208,11 +214,14 @@ rel_groupby_prepare_pp(list **aggrresult
list *shared = NULL;
BUN est = get_rel_count(rel->l);
lng estimate, card = 1;
- if (est == BUN_NONE || (ulng) est > (ulng) GDK_lng_max) {
+ if (est == BUN_NONE
+#if SIZEOF_BUN == SIZEOF_LNG
+ || (ulng) est > (ulng) GDK_lng_max
+#endif
+ )
estimate = 85000000;
- } else {
+ else
estimate = (lng) est;
- }
shared = sa_list(be->mvc->sa); /* list of ints (variable numbers* */
*aggrresults = sa_list(be->mvc->sa);
@@ -381,11 +390,14 @@ rel_groupby_prepare_pp(list **aggrresult
BUN est =
get_rel_count(rel->l);
lng estimate;
- if (est == BUN_NONE ||
(ulng) est > (ulng) GDK_lng_max) {
+ if (est == BUN_NONE
+#if SIZEOF_BUN == SIZEOF_LNG
+ || (ulng) est >
(ulng) GDK_lng_max
+#endif
+ )
estimate =
85000000;
- } else {
- estimate =
(lng) est;
- }
+ else
+ estimate =
(BUN) est;
stmt *s =
stmt_oahash_new(be, t, estimate, grphash, 0);
if (s == NULL)
diff --git a/sql/backends/monet5/rel_pptopn.c b/sql/backends/monet5/rel_pptopn.c
--- a/sql/backends/monet5/rel_pptopn.c
+++ b/sql/backends/monet5/rel_pptopn.c
@@ -159,11 +159,14 @@ rel_topn_prepare_pp(backend *be, sql_rel
if (grouped) { /* create hash tables */
BUN est = get_rel_count(l);
lng estimate, card = 1;
- if (est == BUN_NONE || (ulng) est > (ulng) GDK_lng_max)
{
+ if (est == BUN_NONE
+#if SIZEOF_BUN == SIZEOF_LNG
+ || (ulng) est > (ulng) GDK_lng_max
+#endif
+ )
estimate = 85000000;
- } else {
- estimate = (lng) est;
- }
+ else
+ estimate = (BUN) est;
int curhash = 0;
for(; n; n = n->next ) {
sql_exp *e = n->data;
diff --git a/sql/backends/monet5/vaults/parquet/pqc_reader.c
b/sql/backends/monet5/vaults/parquet/pqc_reader.c
--- a/sql/backends/monet5/vaults/parquet/pqc_reader.c
+++ b/sql/backends/monet5/vaults/parquet/pqc_reader.c
@@ -610,7 +610,6 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
pr->data_allocated = true;
/* for v2 add definition and repetition lengths */
int v2 = pr->cc->cur_page.definition_levels_byte_length
+ pr->cc->cur_page.repetition_levels_byte_length;
- size_t ul = uncompressed_size - v2;
if (v2) {
memcpy(pr->data, pr->buffer+pos, v2);
pos += v2;
@@ -618,6 +617,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
}
if (pr->cc->codec == CC_SNAPPY) {
#ifdef HAVE_SNAPPY
+ size_t ul = uncompressed_size - v2;
if (snappy_uncompress(pr->buffer+pos,
compressed_size, pr->data + v2, &ul) != SNAPPY_OK)
return -10;
assert(uncompressed_size == ul);
@@ -628,6 +628,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_GZIP) {
#ifdef HAVE_LIBZ
+ size_t ul = uncompressed_size - v2;
if (gzip_uncompress(pr->data + v2, ul,
pr->buffer+pos, compressed_size))
return -10;
pos += compressed_size;
@@ -637,6 +638,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_ZSTD) {
#ifdef HAVE_ZSTD
+ size_t ul = uncompressed_size - v2;
if (ZSTD_decompress(pr->data + v2, ul,
pr->buffer+pos, compressed_size) != ul)
return -10;
pos += compressed_size;
@@ -646,6 +648,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_LZ4_RAW) {
#ifdef HAVE_LIBLZ4
+ size_t ul = uncompressed_size - v2;
int iul = (int)ul;
if (LZ4_decompress_safe(pr->buffer+pos,
pr->data + v2, compressed_size, iul) != iul)
return -10;
@@ -656,6 +659,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_BROTLI) {
#ifdef HAVE_BROTLI
+ size_t ul = uncompressed_size - v2;
if (BrotliDecoderDecompress(compressed_size,
(uint8_t*)pr->buffer+pos, &ul, ((uint8_t*)pr->data) + v2) !=
BROTLI_DECODER_RESULT_SUCCESS)
return -10;
pos += compressed_size;
@@ -688,9 +692,9 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
return -1;
pr->dict_allocated = true;
pr->dictsize = uncompressed_size;
- size_t ul = uncompressed_size;
if (pr->cc->codec == CC_SNAPPY) {
#ifdef HAVE_SNAPPY
+ size_t ul = uncompressed_size;
if (snappy_uncompress(pr->buffer+pos,
compressed_size, pr->dict, &ul) != SNAPPY_OK)
return -10;
assert(uncompressed_size == ul);
@@ -701,6 +705,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_GZIP) {
#ifdef HAVE_LIBZ
+ size_t ul = uncompressed_size;
if (gzip_uncompress(pr->dict, ul,
pr->buffer+pos, compressed_size))
return -10;
pos += compressed_size;
@@ -710,6 +715,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_ZSTD) {
#ifdef HAVE_ZSTD
+ size_t ul = uncompressed_size;
if (ZSTD_decompress(pr->dict, ul,
pr->buffer+pos, compressed_size) != ul)
return -10;
pos += compressed_size;
@@ -719,6 +725,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_LZ4_RAW) {
#ifdef HAVE_LIBLZ4
+ size_t ul = uncompressed_size;
int iul = (int)ul;
if (LZ4_decompress_safe(pr->buffer+pos,
pr->dict, compressed_size, iul) != iul)
return -10;
@@ -729,6 +736,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
#endif
} else if (pr->cc->codec == CC_BROTLI) {
#ifdef HAVE_BROTLI
+ size_t ul = uncompressed_size;
if (BrotliDecoderDecompress(compressed_size,
(uint8_t*)pr->buffer+pos, &ul, (uint8_t*)pr->dict) !=
BROTLI_DECODER_RESULT_SUCCESS)
return -10;
pos += compressed_size;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]