JRob
03/03/2025, 10:38 PMSELECT *
FROM datasource1
WHERE Id NOT IN (
SELECT DISTINCT Id
FROM datasource2
WHERE <criteria>
)
^ Works when inner query returns 208K results
^ Returns null when inner query returns 400K results
Note: I set maxSubqueryRows to 1 million
Also note: It is not possible to have no results. I double checked by checking both datasources for specific Ids.JRob
03/03/2025, 10:57 PMSELECT *
FROM datasource1
LEFT JOIN (
SELECT DISTINCT Id
FROM datasource2
WHERE <criteria>
) ON datasource1.Id = datasource2.Id
WHERE datasource2.Id IS NULLJohn Kowtko
03/03/2025, 11:58 PMJRob
03/04/2025, 1:15 AMJRob
03/04/2025, 1:21 AMJRob
03/04/2025, 1:21 AMJRob
03/04/2025, 1:22 AMJRob
03/04/2025, 1:22 AMJRob
03/04/2025, 1:24 AMJRob
03/04/2025, 1:29 AMSELECT SUM("count")
FROM datasource1
WHERE __time >= '2024-12-01' AND __time < '2025-01-01'
AND Id NOT IN (
SELECT Id
FROM datasource2
WHERE __time >= '2024-12-01' AND __time < '2025-01-04'
GROUP BY 1
)
Query2:
SELECT SUM("count")
FROM datasource1 ds1
LEFT JOIN (
SELECT Id
FROM datasource2
WHERE __time >= '2024-12-01' AND __time < '2025-01-04'
GROUP BY 1
) ds2 ON ds1.Id = ds2.Id
WHERE __time >= '2024-12-01' AND __time < '2025-01-01'
AND ds2.Id IS NULLJRob
03/04/2025, 1:36 AMAND ds1.Id IS NOT NULL
I can't edit inline but adding the
AND ds1.Id IS NOT NULL
doesn't affect the outcome
What I CAN say is that if the inner query returns less than 100k rows than the NOT IN query works. It seems if the inner query returns too many rows than the NOT IN query just returns NULL.John Kowtko
03/04/2025, 1:47 AMJRob
03/04/2025, 2:33 PMBen Krug
03/05/2025, 7:47 PMdruid.server.http.maxSubqueryRows , maybe related. This sounds like a bug to me.Ben Krug
03/05/2025, 7:48 PMBen Krug
03/05/2025, 8:50 PMBen Krug
03/05/2025, 8:51 PMJohn Kowtko
03/05/2025, 11:20 PM#druid.generic.useDefaultValueForNull=true
#druid.expressions.useStrictBooleans=false
#druid.generic.useThreeValueLogicForNativeFilters=false
and what version of Druid are you running?JRob
03/06/2025, 7:55 PMJRob
03/06/2025, 7:58 PMBen Krug
03/06/2025, 8:00 PMJRob
03/06/2025, 8:02 PMJohn Kowtko
03/06/2025, 8:03 PMuseThreeValueLogicForNativeFilters to see if it makes any difference.JRob
03/06/2025, 8:14 PMJRob
03/06/2025, 8:14 PM