Hi All,

I have the following query and I was wondering if spark sql evaluates the
same condition twice in the case statement below? I did .explain(true) and
all I get is a table scan so not sure if spark sql evaluates the same
condition twice? if it does, is there a way to return multiple values where
each value belongs to a separate column?

SELECT
  CASE WHEN <condition 1> THEN <a1> WHEN <condition 2> THEN <a2> ELSE
<a3> END AS result1,
  CASE WHEN <condition 1> THEN <b1> WHEN <condition 2> THEN <b2> ELSE
<b3> END AS result2FROM
  <table>


Thanks,

Reply via email to