Changeset: cd7456707103 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cd7456707103
Modified Files:
        monetdb5/modules/atoms/json.c
Branch: default
Log Message:

fix problem with corner case in json aggregate


diffs (32 lines):

diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -1809,10 +1809,24 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                        break;
                                }
                                if (!v||strNil(v)) {
-                                       if (skip_nils)
-                                               continue;
-                                       strncpy(buf, str_nil, buflen);
-                                       isnil = 1;
+                                       if (skip_nils) {
+                                               /*
+                                                * if q is 1 and the value is
+                                                * null, then we need to fill
+                                                * in a value. Otherwise
+                                                * BATproject will fail.
+                                                */
+                                               if ((p == 0 ) && (q == 1)) {
+                                                       strncpy(buf, "[ null 
]", maxlen - buflen);
+                                                       buflen += strlen("[ 
null ]");
+                                                       isnil = 1;
+                                               } else {
+                                                       continue;
+                                               }
+                                       } else {
+                                               strncpy(buf, str_nil, buflen);
+                                               isnil = 1;
+                                       }
                                } else {
                                        len = strlen(v);
                                        if (len >= maxlen - buflen) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to