title: sql/spark-sql: if statement syntax in a query
body: <p>I am looking into some existing spark-sql codes, which trying two join to tables as below:</p>
  
  <pre><code>items_t1_t2 as (
      select *,
      if(id_t1 is not Null, True, False) as in_t1,
      if(id_t2 is not Null, True, False) as in_t2
      from item_t2 full join item_t1
      on id_t2 = id_t1)
  </code></pre>
  
  <p>I am wondering why there is three elements in the if parentheses? What does the if statement mean here and how it works here? Thanks a lot!</p>