'How does LOGICAL_AND function manage NULL values when casting in Bigquery?

I'm using this query to check date fields actually contain dates.

SELECT  id,
ActivityDate 
FROM Database.Table  
WHERE (SELECT LOGICAL_AND(ActivityDate IS NULL OR SAFE_CAST(ActivityDate  AS DATE)
IS NOT NULL ) 
FROM Database.Table)=FALSE;

I know that i have NULLL values so the 'SAFE_CAST(ActivityDate AS DATE) IS NOT NULL ' section of the query should be returning FALSE, and ActivityDate IS NULL should be returning TRUE.

As i understand it because both of the logical operations do not return TRUE i should have some results with FALSE, however i do not.

I'm wondering if this is to do with the safe_cast of the NULL values.

Is it saying the cast has evaluated successfully so therefore it is not NULL?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source