In SQL, NULL not equal to anyone - not even yourself.
Gordon's answer contains some reasonable suggestions, but note that BigQuery only supports join conditions, which are equal unions, which excludes the use of OR or IS NULL .
Can you use a non-zero checkpoint value? For example, if you replace NULL an empty string (or the string "null" or something else that does not happen elsewhere in your data), the connection will work as you would expect. You can even do this on the fly using a subquery with minimal performance overhead.
SELECT t1.k1, t1.k2, t1.v3, t2.v4 FROM (SELECT IFNULL(k1, "null") k1, IFNULL(k2, "null") k2 FROM [Table1]) t1 LEFT OUTER JOIN EACH (SELECT IFNULL(v3, "null") v3, IFNULL(v4, "null") v4 FROM [Table2]) t2 ON t1.k1 = t2.k1 AND t1.k2 = t2.k2
You can add an external selection to turn the string "null" back to real NULL .
Obviously, this only works if the string "null" does not occur elsewhere in your data.
source share