MCPcopy Create free account
hub / github.com/apache/cloudberry / array_contains_nulls

Function array_contains_nulls

src/backend/utils/adt/arrayfuncs.c:3657–3692  ·  view source on GitHub ↗

* array_contains_nulls --- detect whether an array has any null elements * * This gives an accurate answer, whereas testing ARR_HASNULL only tells * if the array *might* contain a null. */

Source from the content-addressed store, hash-verified

3655 * if the array *might* contain a null.
3656 */
3657bool
3658array_contains_nulls(ArrayType *array)
3659{
3660 int nelems;
3661 bits8 *bitmap;
3662 int bitmask;
3663
3664 /* Easy answer if there's no null bitmap */
3665 if (!ARR_HASNULL(array))
3666 return false;
3667
3668 nelems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
3669
3670 bitmap = ARR_NULLBITMAP(array);
3671
3672 /* check whole bytes of the bitmap byte-at-a-time */
3673 while (nelems >= 8)
3674 {
3675 if (*bitmap != 0xFF)
3676 return true;
3677 bitmap++;
3678 nelems -= 8;
3679 }
3680
3681 /* check last partial byte */
3682 bitmask = 1;
3683 while (nelems > 0)
3684 {
3685 if ((*bitmap & bitmask) == 0)
3686 return true;
3687 bitmask <<= 1;
3688 nelems--;
3689 }
3690
3691 return false;
3692}
3693
3694
3695/*

Callers 15

cube_a_f8_f8Function · 0.85
cube_a_f8Function · 0.85
cube_subsetFunction · 0.85
sanity_check_tid_arrayFunction · 0.85
array_iteratorFunction · 0.85
_lt_q_regexFunction · 0.85
_lcaFunction · 0.85
_ltree_compressFunction · 0.85
_arrq_consFunction · 0.85
lt_q_regexFunction · 0.85
arrq_consFunction · 0.85
get_path_allFunction · 0.85

Calls 1

ArrayGetNItemsFunction · 0.85

Tested by

no test coverage detected