Since 60288cdee57f72dec84c3fd9f6085561568aad49 we applied an unary_opt kernel to decode timezones. This kernel always returns Some unless the date is outside the 1677-2262.
Unfortunately, even though the kernel is unlikely to return None, applying the kernel always causes the resulting array to get a NullBuffer, even if the source array did not have one.
In order to avoid unnecessarily adding a NullBuffer, this commit first tries to apply a non-nullable kernel; and only falls back to unary_opt in the rare case it fails.
An alternative implementation that does not risk running the kernel twice would be to check the NullBuffer's null_count after running the kernel then strip it if its null_count is zero; but it requires the unnecessary allocation of a NullBuffer.
Since 60288cdee57f72dec84c3fd9f6085561568aad49 we applied an unary_opt kernel to decode timezones. This kernel always returns
Some
unless the date is outside the 1677-2262.Unfortunately, even though the kernel is unlikely to return
None
, applying the kernel always causes the resulting array to get aNullBuffer
, even if the source array did not have one.In order to avoid unnecessarily adding a
NullBuffer
, this commit first tries to apply a non-nullable kernel; and only falls back tounary_opt
in the rare case it fails.An alternative implementation that does not risk running the kernel twice would be to check the
NullBuffer
'snull_count
after running the kernel then strip it if itsnull_count
is zero; but it requires the unnecessary allocation of aNullBuffer
.