title: Why does count( distinct ) with NULL columns return 0 in Hive SQL?
body: <p>I have struggled with an issue in Hive SQL and just found out what the issue was:</p>
  
  <pre><code>select distinct 'A', NULL;        
  </code></pre>
  
  <p>returns 'A', NULL</p>
  
  <pre><code>select count(distinct 'A', NULL);  
  </code></pre>
  
  <p>returns 0      </p>
  
  <pre><code>select count(distinct 'A', coalesce(NULL,''));  
  </code></pre>
  
  <p>returns 1.</p>
  
  <p>I was using the select line inside of a larger query and filtered on the result (=1). With the outcome being 0, I lost a lot of rows.</p>
  
  <p>How come that a row with NULL column does not contribute to the result of a count(distinct) query?</p>