Snowflake can call two campaigns a tag match when both have a missing tag
ARRAYS_OVERLAP treats SQL NULL elements as equal. If only known tags should count, filter out missing tag values before building the arrays.
Ask a SQL assistant to “find pairs of campaigns that share at least one tag,” and ARRAYS_OVERLAP looks like a direct translation. In Snowflake, though, two campaigns can pass that test even when they have no known tag in common. If both arrays contain a SQL NULL element, the function counts those elements as a match.
That is documented behavior, not a query error. The Snowflake reference calls the function NULL-safe: for this comparison, NULLs are treated as known values. Its worked example compares ARRAY_CONSTRUCT(1, 2, NULL) with ARRAY_CONSTRUCT(3, NULL, 5) and returns TRUE. The only overlap is the NULL element. This example is about a missing element inside each array, not a NULL value standing in for the entire array.
Decide what counts as a shared tag
Suppose campaign A has spring and an unfilled tag slot, while campaign B has clearance and an unfilled slot. With the same inputs as Snowflake’s example, expressed as strings, ARRAYS_OVERLAP would report a match. That answers “do the stored arrays share an element under Snowflake’s comparison rules?” It does not answer “do these campaigns share a known tag?”
If the reporting rule is that missing entries never establish a match, exclude them before building the arrays from tag rows. Keep a separate indicator if the report also needs to show incomplete tagging. If the analyst actually wants campaigns that both have incomplete tagging, report that as its own condition rather than calling it a shared tag.
Test the result, not just whether the SQL runs
Give the assistant three fixtures: disjoint known tags with a NULL element on both sides, one shared known tag with missing entries on either side, and disjoint known tags with no missing entries. For a shared-known-tag metric, the expected results are false, true, and false. The first case is the one that exposes an unqualified ARRAYS_OVERLAP call. A query can execute successfully and still answer the wrong question.
sources
- Snowflake SQL reference: ARRAYS_OVERLAPdocs.snowflake.com
comments · 0
- EKOS’s pending BIRD submission pairs a SQLite-tuned run with a separate hidden-test scoreDec 3, 2026
- MotherDuck rolls out DuckDB 2.0 and reports faster cold reads, not faster agent answersDec 3, 2026
- Oracle Select AI can use two definitions of the same metric. Source order won’t break the tieDec 3, 2026