Case expressions with more conditions

I’m tring to run a query on dremio with multiple Case condition but it works only with the first condition.
This is my query:

COALESCE(SUM(count_blu.NumberAppBlu ), 0) AS count_blu_sum_app_blu
FROM Telepass.Looker.Count_Clients.app_blu AS count_blu

WHEN count_blu.os_blu = ‘and’ THEN RTRIM(‘Android’)
WHEN count_blu.os_blu = ‘ios’ THEN RTRIM(‘Ios’)
END) = ‘Android’)
LIMIT 5000

When i run the query setting the filter to Ios it fail with this error Invalid Query Exception (Query was cancelled because planning time exceeded 60 seconds)

Hello @marco,

  1. What version of Dremio are you using?
  2. Can you attach a profile for the successful query and the unsuccessful one?

Hi @ben,
I’m using Dremio 2.1.6-201809161906440178-edb5b4d (Community Edition)

I’m having the same problem with a very simple query that goes against a not very big file. Although mine has no case in the query.

Here’s the profile: (67.2 KB)

Hi @jhaynie,

You might try disabling a support parameter that changes how Dremio plans queries:

Navigate to Admin --> Support, enter the key “planner.experimental.pclean_logical”, click show, disable this parameter and save.

Try rerunning the query and see if it completes.