cqlsh 'Select' 语句不存在 return 数据
cqlsh 'Select' statement does not return the data that exists
我有以下 Cassandra table:
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
以下语句returns无数据:
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 集群)。
由于我的评论已得到答案,我将 post 将其作为答案:
我会先通过 运行
检查是否是空格问题
select * from flights_by_airport2 where origin contains 'MSY';
如果这仍然是一个问题,那么您可以尝试使用 trim
,或者只是清理数据。
我有以下 Cassandra table:
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
以下语句returns无数据:
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 集群)。
由于我的评论已得到答案,我将 post 将其作为答案:
我会先通过 运行
检查是否是空格问题select * from flights_by_airport2 where origin contains 'MSY';
如果这仍然是一个问题,那么您可以尝试使用 trim
,或者只是清理数据。