Changeset: b2290f99fab2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b2290f99fab2
Modified Files:
        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_reader.c
Branch: pp_hashjoin
Log Message:

more big endian fixes


diffs (261 lines):

diff --git a/sql/backends/monet5/vaults/parquet/parquet.c 
b/sql/backends/monet5/vaults/parquet/parquet.c
--- a/sql/backends/monet5/vaults/parquet/parquet.c
+++ b/sql/backends/monet5/vaults/parquet/parquet.c
@@ -715,11 +715,11 @@ PARQUETread_large(BAT **R, pqc_creader *
                                assert(h->size >= size);
                        }
                        dict = rb->twidth;
-                       if (dict > 2)
-                               offset = h->free;
-                       else if (plain)
-                               offset = h->free - GDK_STRHASHTABLE * 
sizeof(stridx_t);
-                       if ((rsz = pqc_read_chunk(r->c[pse->ccnr], wnr, 
((char*)rb->theap->base)+(tsz*dict), ((char*)h->base)+h->free, sz-tsz, &offset, 
&dict)) < 0) {
+                       if (plain) {
+                               if (dict > 2 || !is_string)
+                                       offset = h->free;
+                       }
+                       if ((rsz = pqc_read_chunk(r->c[pse->ccnr], wnr, 
((char*)rb->theap->base)+(tsz*dict), ((char*)h->base)+(dict?0:h->free), sz-tsz, 
&offset, &dict)) < 0) {
                                BBPreclaim(rb);
                                const char *err = 
pqc_get_error(r->c[pse->ccnr]);
                                if (err)
diff --git a/sql/backends/monet5/vaults/parquet/pqc_dict_lookup.h 
b/sql/backends/monet5/vaults/parquet/pqc_dict_lookup.h
--- a/sql/backends/monet5/vaults/parquet/pqc_dict_lookup.h
+++ b/sql/backends/monet5/vaults/parquet/pqc_dict_lookup.h
@@ -59,13 +59,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                        pos += (sh)/8;
                        } else if (nr_bits < 16) {
                                for(; i < nrows && j < cr->remaining; j++, i++) 
{
-                                       uint16_t v = *(uint16_t*)(data+pos);
+                                       uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 16) {
                                                pos+=2;
                                                sh -= 16;
-                                               uint16_t v = 
*(uint16_t*)(data+pos);
+                                               uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -75,13 +75,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                        pos += (sh)/8;
                        } else if (nr_bits < 32) {
                                for(; i < nrows && j < cr->remaining; j++, i++) 
{
-                                       uint32_t v = *(uint32_t*)(data+pos);
+                                       uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 32) {
                                                pos+=4;
                                                sh -= 32;
-                                               uint32_t v = 
*(uint32_t*)(data+pos);
+                                               uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -145,13 +145,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                }
                        } else if (nr_bits < 16) {
                                for (; i < nrows && j < m; j++, i++) {
-                                       uint16_t v = *(uint16_t*)(data+pos);
+                                       uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 16) {
                                                pos+=2;
                                                sh -= 16;
-                                               uint16_t v = 
*(uint16_t*)(data+pos);
+                                               uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -166,13 +166,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                }
                        } else if (nr_bits < 32) {
                                for (; i < nrows && j < m; j++, i++) {
-                                       uint32_t v = *(uint32_t*)(data+pos);
+                                       uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 32) {
                                                pos+=4;
                                                sh -= 32;
-                                               uint32_t v = 
*(uint32_t*)(data+pos);
+                                               uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -210,7 +210,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                        }
                } else if (nr_bits <= 16) { /* rle */
                        len>>=1;
-                       uint16_t idx = *(uint16_t*)(data+pos);
+                       uint16_t idx = pqc_sht(*(uint16_t*)(data+pos));
                        idx &= mask;
                        uint32_t j = 0;
                        pos += 2;
@@ -223,7 +223,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                        }
                } else if (nr_bits <= 24) { /* rle */
                        len>>=1;
-                       uint32_t idx = *(uint32_t*)(data+pos);
+                       uint32_t idx = pqc_int(*(uint32_t*)(data+pos));
                        idx &= mask;
                        uint32_t j = 0;
                        pos += 3;
diff --git a/sql/backends/monet5/vaults/parquet/pqc_dict_lookup_var.h 
b/sql/backends/monet5/vaults/parquet/pqc_dict_lookup_var.h
--- a/sql/backends/monet5/vaults/parquet/pqc_dict_lookup_var.h
+++ b/sql/backends/monet5/vaults/parquet/pqc_dict_lookup_var.h
@@ -60,13 +60,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                        pos += (sh)/8;
                        } else if (nr_bits < 16) {
                                for(; i < nrows && j < cr->remaining; j++, i++) 
{
-                                       uint16_t v = *(uint16_t*)(data+pos);
+                                       uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 16) {
                                                pos+=2;
                                                sh -= 16;
-                                               uint16_t v = 
*(uint16_t*)(data+pos);
+                                               uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -76,13 +76,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                        pos += (sh)/8;
                        } else if (nr_bits < 32) {
                                for(; i < nrows && j < cr->remaining; j++, i++) 
{
-                                       uint32_t v = *(uint32_t*)(data+pos);
+                                       uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 32) {
                                                pos+=4;
                                                sh -= 32;
-                                               uint32_t v = 
*(uint32_t*)(data+pos);
+                                               uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -156,13 +156,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                }
                        } else if (nr_bits < 16) {
                                for (; i < nrows && j < m; j++, i++) {
-                                       uint16_t v = *(uint16_t*)(data+pos);
+                                       uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 16) {
                                                pos+=2;
                                                sh -= 16;
-                                               uint16_t v = 
*(uint16_t*)(data+pos);
+                                               uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -177,13 +177,13 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                }
                        } else if (nr_bits < 32) {
                                for (; i < nrows && j < m; j++, i++) {
-                                       uint32_t v = *(uint32_t*)(data+pos);
+                                       uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                        uint32_t idx = (v >> sh)&mask;
                                        sh += nr_bits;
                                        if (sh >= 32) {
                                                pos+=4;
                                                sh -= 32;
-                                               uint32_t v = 
*(uint32_t*)(data+pos);
+                                               uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                                idx |= (v << (nr_bits-sh))&mask;
                                        }
                                        assert(idx < cr->dict_num_values);
@@ -219,7 +219,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                        }
                } else if (nr_bits <= 16) { /* rle */
                        len>>=1;
-                       uint16_t idx = *(uint16_t*)(data+pos);
+                       uint16_t idx = pqc_sht(*(uint16_t*)(data+pos));
                        pos += 2;
                        for(; i < nrows && j < len; j++, i++)
                                dst[i] = offset+offsets[idx];
@@ -228,6 +228,17 @@ pqc_dict_lookup( pqc_creader_t *cr, void
                                cr->remaining = len - j;
                                cr->idx = idx;
                        }
+               } else if (nr_bits <= 32) { /* rle */
+                       len>>=1;
+                       uint32_t idx = pqc_int(*(uint32_t*)(data+pos));
+                       pos += 4;
+                       for(; i < nrows && j < len; j++, i++)
+                               dst[i] = offset+offsets[idx];
+                       if (j < len) {
+                               cr->is_rle = true;
+                               cr->remaining = len - j;
+                               cr->idx = idx;
+                       }
                }
                j = 0;
        }
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
@@ -1186,6 +1186,8 @@ pqc_dict_lookup( pqc_reader_t *r, pqc_cr
        /* asume rle data page */
        if (r->pse->precision == 0 && !output) {
                if (ssize) {
+                       if (dict)
+                               *dict = 1; /* we still have a dict */
                        *ssize = dictsize;
                        assert(cr->dictsize);
                        return 0;
@@ -1258,13 +1260,13 @@ pqc_dict_lookup( pqc_reader_t *r, pqc_cr
                                } else if (nr_bits < 16) {
                                        int m = len*8;
                                        for (int64_t j = 0; i < nrows && j < m; 
j++, i++) {
-                                               uint16_t v = 
*(uint16_t*)(data+pos);
+                                               uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                                uint32_t idx = (v >> sh)&mask;
                                                sh += nr_bits;
                                                if (sh >= 16) {
                                                        pos+=2;
                                                        sh -= 16;
-                                                       uint16_t v = 
*(uint16_t*)(data+pos);
+                                                       uint16_t v = 
pqc_sht(*(uint16_t*)(data+pos));
                                                        idx |= (v << 
(nr_bits-sh))&mask;
                                                        if (j==(m-1) && sh >= 8)
                                                                pos++;
@@ -1277,13 +1279,13 @@ pqc_dict_lookup( pqc_reader_t *r, pqc_cr
                                } else if (nr_bits < 32) {
                                        int m = len*8;
                                        for (int64_t j = 0; i < nrows && j < m; 
j++, i++) {
-                                               uint32_t v = 
*(uint32_t*)(data+pos);
+                                               uint32_t v = 
pqc_int(*(uint32_t*)(data+pos));
                                                uint32_t idx = (v >> sh)&mask;
                                                sh += nr_bits;
                                                if (sh >= 32) {
                                                        pos+=2;
                                                        sh -= 32;
-                                                       uint32_t v = 
*(uint32_t*)(data+pos);
+                                                       uint32_t v = 
pqc_sht(*(uint32_t*)(data+pos));
                                                        idx |= (v << 
(nr_bits-sh))&mask;
                                                        if (j==(m-1) && sh >= 8)
                                                                pos++;
@@ -1317,7 +1319,7 @@ pqc_dict_lookup( pqc_reader_t *r, pqc_cr
                                }
                        } else if (nr_bits <= 16) { /* rle */
                                len>>=1;
-                               uint16_t idx = *(uint16_t*)(data+pos);
+                               uint16_t idx = pqc_sht(*(uint16_t*)(data+pos));
                                uint32_t j = 0;
                                pos += 2;
                                for(; i < nrows && j < len; j++, i++)
@@ -1329,7 +1331,7 @@ pqc_dict_lookup( pqc_reader_t *r, pqc_cr
                                }
                        } else if (nr_bits <= 32) { /* rle */
                                len>>=1;
-                               uint32_t idx = *(uint32_t*)(data+pos);
+                               uint32_t idx = pqc_int(*(uint32_t*)(data+pos));
                                uint32_t j = 0;
                                pos += 4;
                                for(; i < nrows && j < len; j++, i++)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to