Symptom
There is a String field with date value replicated from a source system with values "0000-00-00" and this field is converted to Date datatype using TO_DATE function and it shows up as NULL value in Data Preview. Further down in the view when you try to check for IS NULL the expression does not produce the desired result.
Environment
SAP Datasphere
Reproducing the Issue
- Create/Replicated data to Datasphere having string field with value "0000-00-00"
- In the view created use the TO_DATE function to convert it to Date value. Click on preview and there are NULL values as expected
- Further down in the view check for NULL value using the expression IS NULL. The data preview does not bring the show the entities with NULL values
Cause
In DateTime data type a NULL is not actually a NULL value.
Resolution
This behavior is documented under HANA SQL reference DateTime Data Type
========
An empty date (0000-00-00) is a special value in SAP HANA. Even though an empty date looks like a NULL or unknown value, it is not. For example, the empty date can be represented as '', which behaves like an empty string. It also satisfies a IS NOT NULL predicate.
==========
See Also
- DateTime Data Type
- 1807542 - HANA excludes NULL values in results when filtering or joining using '<>' or '=' operator
Keywords
NULL, datetime, date, IS NULL, String, datasphere , KBA , DS-DI-VIW , View Persistency and Runtime , Problem