title: Distinct select with where filter on ClickHouse distributed table failed
body: <p>I met a problem when I am testing a query on a distributed table. </p>
  
  <p>The SQL is like this:</p>
  
  <pre><code>select distinct OriginCityName from on_time.ontime_all t where t."OriginStateName" = 'California'
  </code></pre>
  
  <p>'on_time.ontime_all' is a distributed table with column OriginCityName, OriginStateName and some others. And the error:</p>
  
  <pre><code>Received exception from server (version 1.1.54381):
  Code: 171. DB::Exception: Received from localhost:9000, ::1. DB::Exception: Block structure mismatch in UNION stream: different number of columns:
  OriginCityName String String(size = 0)
  OriginCityName String String(size = 0), OriginStateName String String(size = 0). 
  
  0 rows in set. Elapsed: 0.186 sec. 
  </code></pre>
  
  <p>However, if I do one of the following to the SQL, the error dissapears:</p>
  
  <ul>
  <li>remove distinct</li>
  <li>remove the where clause</li>
  <li>replace where with prewhere</li>
  <li>add the "OriginStateName" column in the where clause to the select part as well</li>
  <li>change select part to <code>select distinct *</code></li>
  </ul>
  
  <p>This kind of SQL is important to my application, so could anybody help me solve this? Is it a bug or is it a limitation of ClickHouse? Thank you very much.</p>