AS_NON_NULLABLE
This page describes the AS_NON_NULLABLE function in Lenses SQL.
AS_NON_NULLABLE(expr)
Returns the provided value with its type changed from the original type to its non-nullable version.
Available in:
using case:
USE `kafka`;
SELECT
CASE
WHEN modified_at IS NULL THEN 0
ELSE AS_NON_NULLABLE(modified_at)
END AS null_value FROM users-events
LIMIT 5;
Output:
{
"value": {
"null_value": "2023-11-07T05:27:04.740600"
}
}
{
"value": {
"null_value": "2023-11-04T07:46:57.045631"
}
}
{
"value": {
"null_value": 0
}
}
{
"value": {
"null_value": 0
}
}
{
"value": {
"null_value": 0
}
}
In case you want to know more about nullability scenarios, see here
.