title: Cassandra Range queries on Map values using timestamp
body: <p>I have below Cassandra  table. </p>
  
  <pre><code> create table person( 
     id int PRIMARY KEY,  
     name text, 
     imp_dates map&lt;text,timestamp&gt;
   );
  </code></pre>
  
  <p>Data inserted as below </p>
  
  <pre><code>insert into person(id,name,imp_dates) values(1,'one',{'birth':'1982-04-01','marriage':'2018-04-01'});
  insert into person(id,name,imp_dates) values(2,'two',{'birth':'1980-04-01','marriage':'2010-04-01'});
  insert into person(id,name,imp_dates) values(3,'three',{'birth':'1980-04-01','graduation':'2012-04-01'});
  
   id | name  | imp_dates
  ----+-------+-----------------------------------------------------------------------------------------------
    1 |   one |   {'birth': '1982-03-31 18:30:00.000000+0000', 'marriage': '2018-03-31 18:30:00.000000+0000'}
    2 |   two |   {'birth': '1980-03-31 18:30:00.000000+0000', 'marriage': '2010-03-31 18:30:00.000000+0000'}
    3 | three | {'birth': '1980-03-31 18:30:00.000000+0000', 'graduation': '2012-03-31 18:30:00.000000+0000'}
  </code></pre>
  
  <p>I have requirement to write query as below. This required range on map value column.</p>
  
  <pre><code> select id,name,imp_dates from person where id =1 and imp_dates['birth'] &lt; '2000-04-01';
  </code></pre>
  
  <p>I get following error</p>
  
  <pre><code> Error from server: code=2200 [Invalid query] message="Only EQ relations are supported on map entries"
  </code></pre>
  
  <p>The possible solution I can think of is:</p>
  
  <p>1) Make map flat into multiple columns and then make it part of primary key. this will work but its not flexible since I may have to alter the schema</p>
  
  <p>2) I can create another table  person_id_by_important_dates to replace Map but then I loose read consistency as I have to read from two tables and join myself.</p>
  
  <p>I do not wish to include imp_dates (map) part of primary key as it will create new row every time I insert with new values. </p>
  
  <p>Appreciate help with this.
  Thanks</p>