I have a requirement of writing a filter to query Druid which has the following criteria:
There are 2 fields A and B.
I want to filter A=10 but if A is null then i want to apply the filter B=10.
Is there a way i can achieve this with Druid query.
In Druid SQL try: WHERE (A IS NULL AND B = 10) OR A = 10
Keep in mind, though, that numeric types in Druid are by default not nullable. So “A IS NULL” will only ever be true for string types. See “data types and casts” here for details: http://druid.io/docs/latest/querying/sql
Thank you for the response. We are not using Druid Sql, we are using normal Druid Query and I am trying to use some filters.
Let me know if we can have solution using the normal Druid Query.
Anything Druid SQL can do, the native queries can too (it just plans into them). For that query I pasted it’d be a mix of boolean filters and selector filters. You could also run an “EXPLAIN PLAN FOR” on that SQL query to see how Druid SQL would run it as a native query.