Changeset: ab4afd904e1e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ab4afd904e1e Modified Files: sql/backends/monet5/UDF/pyapi/conversion.c Branch: default Log Message:
Also create nullmask properly for blobs and other types. diffs (44 lines): diff --git a/sql/backends/monet5/UDF/pyapi/conversion.c b/sql/backends/monet5/UDF/pyapi/conversion.c --- a/sql/backends/monet5/UDF/pyapi/conversion.c +++ b/sql/backends/monet5/UDF/pyapi/conversion.c @@ -105,7 +105,8 @@ PyObject *PyMaskedArray_FromBAT(PyInput // data array and a mask array // The mask array is a boolean array that has the value 'True' when the // element is NULL, and 'False' otherwise - // If the BAT has Null values, we construct this masked array + // if we know for sure that the BAT has no NULL values, we can skip the construction + // of this masked array. Otherwise, we create it. if (!(b->tnil == 0 && b->tnonil == 1)) { PyObject *mask; PyObject *mafunc = PyObject_GetAttrString( @@ -113,7 +114,10 @@ PyObject *PyMaskedArray_FromBAT(PyInput PyObject *maargs; PyObject *nullmask = PyNullMask_FromBAT(b, t_start, t_end); - if (nullmask == Py_None) { + if (!nullmask) { + msg = createException(MAL, "pyapi.eval", "Failed to create mask for some reason"); + goto wrapup; + } else if (nullmask == Py_None) { maargs = PyTuple_New(1); PyTuple_SetItem(maargs, 0, vararray); } else { @@ -448,17 +452,13 @@ PyObject *PyNullMask_FromBAT(BAT *b, siz CreateNullMask(hge); break; #endif - case TYPE_str: { + default: { int (*atomcmp)(const void *, const void *) = ATOMcompare(b->ttype); for (j = 0; j < count; j++) { mask_data[j] = (*atomcmp)(BUNtail(bi, (BUN)(j)), nil) == 0; found_nil = found_nil || mask_data[j]; } - break; } - default: - // todo: do something with the error? - return NULL; } if (!found_nil) { _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list