Changeset: 97532d11d118 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=97532d11d118
Modified Files:
monetdb5/extras/jaql/json.c
Branch: Jul2012
Log Message:
unwrap: fix handing of empty arrays
Don't just overwrite previous results when an empty array is
encountered. Multiple arrays are possibly in the array being checked,
hence there can also be empty ones in there after non-empty ones. This
also reveals a thinko: the type of the empty result doesn't have to be
lng, because it doesn't have to be the only array processed!
diffs (41 lines):
diff --git a/monetdb5/extras/jaql/json.c b/monetdb5/extras/jaql/json.c
--- a/monetdb5/extras/jaql/json.c
+++ b/monetdb5/extras/jaql/json.c
@@ -1433,6 +1433,8 @@ JSONunwrap(Client cntxt, MalBlkPtr mb, M
break;
}
}
+ if (BATcount(b) == 0)
+ BUNins(r, &v, str_nil, FALSE);
break;
case TYPE_dbl:
if (r == NULL)
@@ -1468,6 +1470,10 @@ JSONunwrap(Client cntxt, MalBlkPtr mb, M
break;
}
}
+ if (BATcount(b) == 0) {
+ d = dbl_nil;
+ BUNins(r, &v, &d, FALSE);
+ }
break;
case TYPE_lng:
if (r == NULL)
@@ -1503,13 +1509,12 @@ JSONunwrap(Client cntxt, MalBlkPtr mb, M
break;
}
}
+ if (BATcount(b) == 0) {
+ l = lng_nil;
+ BUNins(r, &v, &l, FALSE);
+ }
break;
}
- if (BATcount(b) == 0) {
- r = BATnew(TYPE_oid, TYPE_lng, 1);
- l = lng_nil;
- BUNins(r, &v, &l, FALSE);
- }
}
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list