Changeset: a0c95ffda18c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a0c95ffda18c
Modified Files:
sql/backends/monet5/vaults/parquet/Tests/test_parquet_reader.test.in
sql/backends/monet5/vaults/parquet/offset_string_read_chunk.h
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: default
Log Message:
fixed null handing
fixed fixed size array types for decimals
diffs (truncated from 550 to 300 lines):
diff --git
a/sql/backends/monet5/vaults/parquet/Tests/test_parquet_reader.test.in
b/sql/backends/monet5/vaults/parquet/Tests/test_parquet_reader.test.in
--- a/sql/backends/monet5/vaults/parquet/Tests/test_parquet_reader.test.in
+++ b/sql/backends/monet5/vaults/parquet/Tests/test_parquet_reader.test.in
@@ -197,7 +197,56 @@ SELECT * FROM '$QTSTSRCDIR/data/arrow/in
query IIIIIIIIII nosort
SELECT * FROM '$QTSTSRCDIR/data/bug687_nulls.parquet' limit 50
----
-500 values hashing to 6b5f21b8d327152ac02f2c0e2ff2909a
+NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+95 42 39 49 16 34 82 7 40 82
+49 92 59 47 49 48 59 18 70 73
+9 31 80 77 94 28 53 93 75 89
+0 90 62 0 56 61 71 46 52 4
+83 60 94 14 38 31 48 67 27 93
+28 91 68 26 14 87 19 96 8 26
+10 38 42 47 90 38 37 55 66 41
+63 96 53 42 1 45 98 11 19 3
+86 48 97 33 36 41 62 58 2 40
+27 24 70 65 91 44 83 70 69 5
+62 25 17 69 20 75 66 33 95 91
+9 67 20 44 89 3 47 16 39 15
+21 8 0 30 38 14 13 41 80 43
+18 4 49 24 4 70 87 4 88 5
+55 58 29 39 58 3 16 80 2 70
+54 26 63 8 19 57 99 80 62 8
+76 33 8 18 46 57 23 49 14 97
+74 60 84 27 16 39 29 30 35 13
+3 51 50 87 86 16 64 45 93 18
+10 72 87 6 66 55 38 62 55 56
+80 47 84 25 100 92 95 43 20 45
+58 66 65 86 19 46 75 100 40 17
+29 64 60 5 32 10 71 41 19 72
+84 100 47 26 22 21 29 25 0 10
+97 71 84 88 99 50 26 45 82 34
+29 89 9 9 57 66 24 1 61 97
+98 58 62 85 2 18 0 75 50 23
+65 60 92 49 60 73 68 40 18 38
+35 34 50 81 56 13 1 94 69 44
+0 90 7 66 62 78 62 5 11 9
+4 96 70 34 83 91 49 23 30 72
+20 49 15 13 3 70 33 74 74 1
+35 26 5 81 55 99 86 74 18 73
+37 74 52 45 18 83 25 54 68 57
+88 42 6 30 39 51 26 35 71 3
+93 53 57 66 40 69 47 91 59 46
+24 97 45 81 78 72 92 46 7 19
+71 7 59 99 39 53 11 91 89 63
+91 89 21 50 50 14 29 70 35 49
+39 43 91 50 64 78 60 70 13 26
+62 59 33 37 14 53 95 0 47 46
+86 15 56 13 65 97 80 80 71 95
+81 74 22 9 87 24 36 96 89 0
+16 98 73 66 20 57 49 53 36 3
+70 87 100 82 29 95 44 59 69 48
+23 99 9 79 58 40 60 37 47 53
+43 69 45 2 12 86 4 48 74 24
+13 73 74 19 61 6 79 54 84 37
+4 94 21 52 43 32 43 51 56 60
query TIII nosort
SELECT * FROM '$QTSTSRCDIR/data/bug1554.parquet' order by 1 limit 50
diff --git a/sql/backends/monet5/vaults/parquet/offset_string_read_chunk.h
b/sql/backends/monet5/vaults/parquet/offset_string_read_chunk.h
--- a/sql/backends/monet5/vaults/parquet/offset_string_read_chunk.h
+++ b/sql/backends/monet5/vaults/parquet/offset_string_read_chunk.h
@@ -15,10 +15,14 @@ offset_string_read_chunk( pqc_reader_t *
char *buf = voutput;
char *data = cr->data + pos;
+ (void)r;
+
+ /*
if (cr->cc->cur_page.stat.null_count) {
memcpy(buf, r->nil, strlen(r->nil));
buf += strlen(r->nil);
}
+ */
if (cr->cc->cur_page.stat.null_count == cr->cc->cur_page.num_values) {
/* all null */
assert(cr->cc->cur_page.num_nulls ==
cr->cc->cur_page.num_values);
for (int64_t i=0; i<nrows; i++)
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
@@ -392,7 +392,14 @@ pqc_find_localtype(const pqc_schema_elem
break;
case decimaltype:
if (pse->size == 0) {
- return TYPE_sht;
+ if (pse->precision <= 4)
+ return TYPE_sht;
+ if (pse->precision <= 9)
+ return TYPE_int;
+ if (pse->precision <= 18)
+ return TYPE_lng;
+ if (pse->precision <= 38)
+ return TYPE_hge;
}
if (pse->size == 32)
return TYPE_int;
@@ -656,7 +663,8 @@ PARQUETread_large(BAT **R, pqc_creader *
if (!r->c[pse->ccnr]) {
pipeline_lock(p);
if (!r->c[pse->ccnr])
- r->c[pse->ccnr] = pqc_reader(NULL, pqc_dup(r->b),
r->nrworkers, r->fmd, colno, r->nrows, ATOMnilptr(localtype));
+ r->c[pse->ccnr] = pqc_reader(NULL, pqc_dup(r->b),
r->nrworkers, r->fmd, colno, r->nrows,
+ ATOMvarsized(localtype) ? NULL :
ATOMnilptr(localtype));
pipeline_unlock(p);
}
pqc_mark_chunk(r->c[pse->ccnr], r->nrworkers, wnr, sz);
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
@@ -115,7 +115,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = (T)dict[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -136,7 +136,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = (T)dict[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -157,7 +157,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = (T)dict[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -178,7 +178,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = (T)dict[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -191,7 +191,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
uint32_t j = 0;
for(; i < nrows && j < len; j++, i++)
dst[i] = (T)dict[0];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
@@ -203,7 +203,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
uint32_t j = 0;
for(; i < nrows && j < len; j++, i++)
dst[i] = (T)dict[idx];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
@@ -216,7 +216,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
pos += 2;
for(; i < nrows && j < len; j++, i++)
dst[i] = (T)dict[idx];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
@@ -229,7 +229,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
pos += 3;
for(; i < nrows && j < len; j++, i++)
dst[i] = (T)dict[idx];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
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
@@ -109,7 +109,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
for (; i < nrows && j < m; j++, i++) {
dst[i] = offset+offsets[0];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = 0;
@@ -126,7 +126,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = offset+offsets[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -147,7 +147,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = offset+offsets[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -168,7 +168,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
assert(idx < cr->dict_num_values);
dst[i] = offset+offsets[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -190,7 +190,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
//assert(((int64_t*)cr->dict)[idx] <
((int64_t) 1 << 8*sizeof(T)));
dst[i] = (T) ((int64_t*)cr->dict)[idx];
}
- if (j < m) {
+ if (j < m && i < nrows) {
cr->is_rle = false;
cr->remaining = m - j;
cr->idx = sh;
@@ -202,7 +202,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
len>>=1;
for(; i < nrows && j < len; j++, i++)
dst[i] = offset+offsets[0];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
@@ -212,7 +212,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
uint8_t idx = data[pos++];
for(; i < nrows && j < len; j++, i++)
dst[i] = offset+offsets[idx];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
@@ -223,7 +223,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
pos += 2;
for(; i < nrows && j < len; j++, i++)
dst[i] = offset+offsets[idx];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
@@ -234,7 +234,7 @@ pqc_dict_lookup( pqc_creader_t *cr, void
pos += 4;
for(; i < nrows && j < len; j++, i++)
dst[i] = offset+offsets[idx];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
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
@@ -756,7 +756,7 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
pr->dict = pr->buffer+pos;
if((((size_t)pr->dict) & 15) != 0) { /* copy for
alignment issues */
char *buf = pr->dict;
- pr->dict = NEW_ARRAY(char, uncompressed_size);
+ pr->dict = NEW_ARRAY(char,
uncompressed_size==0?compressed_size:uncompressed_size);
if (!pr->dict)
return -1;
pr->dict_allocated = true;
@@ -767,8 +767,10 @@ pqc_page_header( pqc_reader_t *r, pqc_cr
if (!uncompressed_size)
pos += compressed_size;
}
- if (r->pse->precision)
+ if (r->pse->precision && r->pse->size)
pr->dict_num_values = pr->dictsize / (r->pse->size/8);
+ else if (r->pse->precision && r->pse->type_length)
+ pr->dict_num_values = pr->dictsize /
r->pse->type_length;
if (num_values && r->pse->type == stringtype) {
if (string_read_dict(pr, num_values) < 0)
return -1;
@@ -1337,7 +1339,7 @@ pqc_dict_lookup( pqc_reader_t *r, pqc_cr
uint32_t j = 0;
for(; i < nrows && j < len; j++, i++)
dst[i] = ((char**)cr->dict)[0];
- if (j < len) {
+ if (j < len && i < nrows) {
cr->is_rle = true;
cr->remaining = len - j;
cr->idx = idx;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]