title: Cassandra: get last with a non-null value in a column
body: <p>I have a Cassandra table where each column can contain a value or a NULL. But if it contains a NULL, I know that all the next values in that column are also NULL.</p>
  
  <p>Something like this:</p>
  
  <pre><code>+------------+---------+---------+---------+
  |       date | column1 | column2 | column3 |
  +------------+---------+---------+---------+
  | 2017-01-01 |       1 |     'a' |    NULL |
  | 2017-01-02 |       2 |     'b' |    NULL |
  | 2017-01-03 |       3 |    NULL |    NULL |
  | 2017-01-04 |       4 |    NULL |    NULL |
  | 2017-01-05 |    NULL |    NULL |    NULL |
  +------------+---------+---------+---------+
  </code></pre>
  
  <p>I need a query that, for a given column, returns the date of the last column with a non-null value. In this case:</p>
  
  <ul>
  <li>For column1, '2017-01-04'</li>
  <li>For column2, '2017-01-02'</li>
  <li>For column3, no result returned.</li>
  </ul>
  
  <p>In SQL it would be something like this:</p>
  
  <pre><code>SELECT date
  FROM my_table
  WHERE column1 IS NOT NULL
  ORDER BY date DESC LIMIT 1
  </code></pre>
  
  <p>Is it possible in any way, or should I break the table into one table for each column to avoid the NULL situation at all?</p>