cqlsh'Select'语句不返回存在的数据

时间:2018-05-27 21:25:38

标签: scala apache-spark cassandra apache-spark-sql datastax-enterprise

我有以下Cassandra表:

CREATE TABLE myflights.flights_by_airport2 (
origin text,
dep_time timestamp,
fl_date timestamp,
airline_id int,
carrier text,
fl_num int,
PRIMARY KEY ((origin), dep_time)
) WITH CLUSTERING ORDER BY (dep_time ASC);


cqlsh:myflights> select * from flights_by_airport2 limit 5;

 origin | dep_time                        | airline_id | carrier | fl_date                         | fl_num
--------+---------------------------------+------------+---------+---------------------------------+--------
    MSY | 2012-01-01 05:57:00.000000+0000 |      19977 |      UA | 2012-01-01 00:00:00.000000+0000 |    275
    MSY | 2012-01-01 06:01:00.000000+0000 |      20409 |      B6 | 2012-01-01 00:00:00.000000+0000 |    110
    MSY | 2012-01-01 06:13:00.000000+0000 |      19790 |      DL | 2012-01-01 00:00:00.000000+0000 |    551
    MSY | 2012-01-01 06:45:00.000000+0000 |      19805 |      AA | 2012-01-01 00:00:00.000000+0000 |   1190
    MSY | 2012-01-01 06:46:00.000000+0000 |      19977 |      UA | 2012-01-01 00:00:00.000000+0000 |   1184

以下语句不返回任何数据:

cqlsh:myflights>  select * from flights_by_airport2 where origin = 'MSY';

 origin | dep_time | airline_id | carrier | fl_date | fl_num
--------+----------+------------+---------+---------+--------

(0 rows)

我在Ubuntu VM上安装了单节点Cassandra和Spark(DSE 6群集)。

1 个答案:

答案 0 :(得分:0)

由于我的评论得出了答案,我将把它作为答案发布:

我首先要通过运行

检查它是否是空白问题
select * from flights_by_airport2 where origin contains 'MSY';

如果仍然存在问题,那么您可以尝试使用trim,或者只是清理数据。