Changeset: fc0c011d2ba0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fc0c011d2ba0
Modified Files:
monetdb5/modules/mal/tablet.c
Branch: nested
Log Message:
made sure to not continue outputting complex types after end of bat
diffs (76 lines):
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -373,14 +373,14 @@ output_multiset_dense(allocator *ma, cha
{
nr_attrs -= (multiset == MS_ARRAY)?2:1;
Column *msid = fmt + nr_attrs;
- int *idp = (int*)Tloc(msid->c, msid->p);
+ int *idp = (int*)Tloc(msid->c, msid->p), *ep = idp + (BATcount(msid->c)
- msid->p);
int first = 1;
if (!quoted)
(*buf)[fill++] = '\'';
(*buf)[fill++] = '{';
(*buf)[fill] = 0;
- for (; *idp == id && fill > 0; idp++, msid->p++) {
+ for (; *idp == id && idp < ep && fill > 0; idp++, msid->p++) {
if (!first)
(*buf)[fill++] = ',';
if (composite) {
@@ -408,7 +408,7 @@ output_multiset_sorted(allocator *ma, ch
Column *msid = fmt + nr_attrs;
/* how to also keep prev id */
BUN pos = msid->p;
- int *idp = (int*)Tloc(msid->c, pos);
+ int *idp = (int*)Tloc(msid->c, pos), *ep = idp + (BATcount(msid->c) -
pos);
int first = 1;
if (id >= 0 && msid->p) {
@@ -423,17 +423,18 @@ output_multiset_sorted(allocator *ma, ch
(*buf)[fill++] = '\'';
(*buf)[fill++] = '{';
(*buf)[fill] = 0;
- if (id >= 0)
- for (; *idp == id && fill > 0; idp++, msid->p++, pos++) {
- if (!first)
- (*buf)[fill++] = ',';
- if (composite) {
- fill = output_composite(ma, buf, len, fill, localbuf,
locallen, fmt, nr_attrs, composite, true);
- } else {
- fmt->p = pos;
- fill = output_value(ma, buf, len, fill, localbuf,
locallen, fmt);
+ if (id >= 0) {
+ for (; *idp == id && idp < ep && fill > 0; idp++, msid->p++,
pos++) {
+ if (!first)
+ (*buf)[fill++] = ',';
+ if (composite) {
+ fill = output_composite(ma, buf, len, fill,
localbuf, locallen, fmt, nr_attrs, composite, true);
+ } else {
+ fmt->p = pos;
+ fill = output_value(ma, buf, len, fill,
localbuf, locallen, fmt);
+ }
+ first = 0;
}
- first = 0;
}
if (fill < 0)
return fill;
@@ -452,7 +453,7 @@ output_multiset(allocator *ma, char **bu
Column *msid = fmt + nr_attrs;
/* how to also keep prev id */
BUN pos = msid->p;
- int *idp = (int*)Tloc(msid->c, pos);
+ int *idp = (int*)Tloc(msid->c, pos), *ep = idp + (BATcount(msid->c) -
pos);
int first = 1;
if (id >= 0 && msid->p) {
@@ -468,7 +469,7 @@ output_multiset(allocator *ma, char **bu
(*buf)[fill++] = '{';
(*buf)[fill] = 0;
if (id >= 0)
- for (; *idp == id && fill > 0; idp++, msid->p++, pos++) {
+ for (; *idp == id && idp < ep && fill > 0; idp++, msid->p++, pos++) {
if (!first)
(*buf)[fill++] = ',';
if (composite) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]