Q:

String comparison in Cassandra Select query is not working

select * from customer where cust_city = 'Mumbai' allow filtering;

when I run this query, the result shows only the column names, Instead of that if I give an integer value in where clause, I'm getting the output.
select * from customer where payment_amt=7000 allow filtering;

Table data
 cust_code   | agent_code   | cust_city     | cust_country   | cust_name     | grade | opening_amt | outstanding_amt | payment_amt | phone_no       | receiveamt | working_area
-------------+--------------+---------------+----------------+---------------+-------+-------------+-----------------+-------------+----------------+------------+----------------
  C00011     |  A010        |  Chennai      |  India         |  Sundariya    |     3 |        7000 |           11000 |        7000 |  PPHGRTS       |       1000 |  Chennai
  C00012     |  A012        |  San Jose     |  USA           |  Steven       |     1 |        5000 |            3000 |        9000 |  KRFYGJK       |        000 |  San Jose
  C00013     |  A003        |  London       |  UK            |  Holmes       |     2 |        6000 |            4000 |        7000 |  BBBBBBB       |        000 |  London
  C00014     |  A001        |  Bangalore    |  India         |  Rangarappa   |     2 |        8000 |           12000 |        7000 |  AAAATGF       |       1000 |  Bangalore
  C00018     |  A005        |  Brisban      |  Australia     |  Fleming      |     2 |        7000 |            5000 |        9000 |  NHBGVFC       |        000 |  Brisban
  C00015     |  A003        |  London       |  UK            |  Stuart       |     1 |        6000 |           11000 |        3000 |  GFSGERS       |        000 |  London
  C00004     |  A005        |  Brisban      |  Australia     |  Winston      |     1 |        5000 |            6000 |        7000 |  AAAAAAA       |        000 |  Brisban
  C00022     |  A002        |  Mumbai       |  India         |  Avinash      |     2 |        7000 |            9000 |        9000 |  113-12345678  |       1000 |  Mumbai
  C00001     |  A008        |  New York     |  USA           |  Micheal      |     2 |        3000 |            6000 |        2000 |  CCCCCCC       |        000 |  New York
  C00021     |  A005        |  Brisban      |  Australia     |  Jacks        |     1 |        7000 |            7000 |        7000 |  WERTGDF       |        000 |  Brisban
  C00023     |  A006        |  London       |  UK            |  Karl         |     0 |        4000 |            3000 |        7000 |  AAAABAA       |        000 |  London
  C00006     |  A004        |  Torento      |  Canada        |  Shilton      |     1 |       10000 |           11000 |        6000 |  DDDDDDD       |        000 |  Torento
  C00008     |  A004        |  Torento      |  Canada        |  Karolina     |     1 |        7000 |            5000 |        9000 |  HJKORED       |        000 |  Torento
  C00016     |  A007        |  Bangalore    |  India         |  Venkatpati   |     2 |        8000 |           12000 |        7000 |  JRTVFDD       |       1000 |  Bangalore
  C00002     |  A008        |  New York     |  USA           |  Bolt         |     3 |        5000 |            3000 |        9000 |  DDNRDRH       |        000 |  New York
  C00019     |  A010        |  Chennai      |  India         |  Yearannaidu  |     1 |        8000 |            8000 |        7000 |  ZZZZBFV       |        000 |  Chennai
  C00010     |  A009        |  Hampshair    |  UK            |  Charles      |     3 |        6000 |            5000 |        5000 |  MMMMMMM       |        000 |  Hampshair
  C00009     |  A002        |  Mumbai       |  India         |  Ramesh       |     3 |        8000 |           12000 |        3000 |  Phone No      |        000 |  Mumbai
  C00020     |  A008        |  New York     |  USA           |  Albert       |     3 |        5000 |            6000 |        6000 |  BBBBSBB       |        000 |  New York
  C00017     |  A007        |  Bangalore    |  India         |  Srinivas     |     2 |        8000 |            9000 |        3000 |  AAAAAAB       |        000 |  Bangalore
  C00025     |  A011        |  Bangalore    |  India         |  Ravindran    |     2 |        5000 |            8000 |        4000 |  AVAVAVA       |        000 |  Bangalore
  C00005     |  A002        |  Mumbai       |  India         |  Sasikant     |     1 |        7000 |           11000 |        7000 |  147-25896312  |       1000 |  Mumbai
  C00003     |  A004        |  Torento      |  Canada        |  Martin       |     2 |        8000 |            8000 |        7000 |  MJYURFD       |        000 |  Torento
  C00024     |  A006        |  London       |  UK            |  Cook         |     2 |        4000 |            6000 |        7000 |  FSDDSDF       |        000 |  London
  C00007     |  A010        |  Chennai      |  India         |  Ramanathan   |     1 |        7000 |            9000 |        9000 |  GHRDWSD       |       1000 |  Chennai

Output 1(string)
 cust_code | agent_code | cust_city | cust_country | cust_name | grade | opening_amt | outstanding_amt | payment_amt | phone_no | receive_amt | working_area
-----------+------------+-----------+--------------+-----------+-------+-------------+-----------------+-------------+----------+-------------+--------------

(0 rows)

Output 2(Integer)
 cust_code   | agent_code   | cust_city     | cust_country   | cust_name     | grade | opening_amt | outstanding_amt | payment_amt | phone_no       | receive_amt | working_area
-------------+--------------+---------------+----------------+---------------+-------+-------------+-----------------+-------------+----------------+-------------+----------------
  C00011     |  A010        |  Chennai      |  India         |  Sundariya    |     3 |        7000 |           11000 |        7000 |  PPHGRTS       |       11000 |  Chennai
  C00013     |  A003        |  London       |  UK            |  Holmes       |     2 |        6000 |            4000 |        7000 |  BBBBBBB       |        5000 |  London
  C00014     |  A001        |  Bangalore    |  India         |  Rangarappa   |     2 |        8000 |           12000 |        7000 |  AAAATGF       |       11000 |  Bangalore
  C00004     |  A005        |  Brisban      |  Australia     |  Winston      |     1 |        5000 |            6000 |        7000 |  AAAAAAA       |        8000 |  Brisban
  C00021     |  A005        |  Brisban      |  Australia     |  Jacks        |     1 |        7000 |            7000 |        7000 |  WERTGDF       |        7000 |  Brisban
  C00023     |  A006        |  London       |  UK            |  Karl         |     0 |        4000 |            3000 |        7000 |  AAAABAA       |        6000 |  London
  C00016     |  A007        |  Bangalore    |  India         |  Venkatpati   |     2 |        8000 |           12000 |        7000 |  JRTVFDD       |       11000 |  Bangalore
  C00019     |  A010        |  Chennai      |  India         |  Yearannaidu  |     1 |        8000 |            8000 |        7000 |  ZZZZBFV       |        7000 |  Chennai
  C00005     |  A002        |  Mumbai       |  India         |  Sasikant     |     1 |        7000 |           11000 |        7000 |  147-25896312  |       11000 |  Mumbai
  C00003     |  A004        |  Torento      |  Canada        |  Martin       |     2 |        8000 |            8000 |        7000 |  MJYURFD       |        7000 |  Torento
  C00024     |  A006        |  London       |  UK            |  Cook         |     2 |        4000 |            6000 |        7000 |  FSDDSDF       |        9000 |  London

(11 rows)

Can someone help on this. 

A:

Make sure make sure there is no leading and trailing space in the cust_city field
You are using allow filtering. Be careful. Executing this query with allow filtering might not be a good idea as it can use a lot of your computing resources and Might not return any result because of timeout. Don't use allow filtering in production Read the datastax doc about using ALLOW FILTERING
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/select_r.html?hl=allow,filter
Instead You should create index on cust_city field.
CREATE INDEX cust_city_index ON customer (cust_city);

Now your select query with cust_city filtering will be faster.
When not to use an index ? 
http://docs.datastax.com/en/cql/3.1/cql/ddl/ddl_when_use_index_c.html#concept_ds_sgh_yzz_zj__when-no-index

