“在输入处没有可行的选择”查询cassndra表时出错 [英] "no viable alternative at input" error when querying cassndra table
本文介绍了“在输入处没有可行的选择”查询cassndra表时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Cassandra中有一个这样的表:
I have a table in Cassandra like this:
CREATE TABLE vroc.sensor_data (
dpnode text,
year int,
month int,
day int,
data_timestamp bigint,
data_sensor text,
dsnode text,
data_quality double,
data_value blob,
PRIMARY KEY ((dpnode, year, month, day), data_timestamp, data_sensor, dsnode)
) WITH read_repair_chance = 0.0
AND dclocal_read_repair_chance = 0.1
AND gc_grace_seconds = 864000
AND bloom_filter_fp_chance = 0.01
AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
AND comment = ''
AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 }
AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
AND default_time_to_live = 0
AND speculative_retry = '99PERCENTILE'
AND min_index_interval = 128
AND max_index_interval = 2048
AND crc_check_chance = 1.0;
但是,当我在以下查询中运行时:
However, when I run below query:
SELECT dpnode, "year", "month", "day", data_timestamp, data_sensor, dsnode, data_quality, data_value
FROM vroc.sensor_data
WHERE dpnode="PSACAB" and "year"=2016 and "month"=11 and day=28;
我收到此异常:
com.datastax.driver.core.exceptions.SyntaxError: line 2:44 no viable alternative at input 'and' (...FROM vroc.sensor_data where dpnode=["PSACA]B" and...)
com.datastax.driver.core.exceptions.SyntaxError: line 2:44 no viable alternative at input 'and' (...FROM vroc.sensor_data where dpnode=["PSACA]B" and...)
我不确定在这里我在做什么错吗? $ b
I am not sure what am I doing wrong here?
推荐答案
这应该可以解决问题:
select dpnode, year, month, day, data_timestamp, data_sensor, dsnode, data_quality, data_value from vroc.sensor_data where dpnode='PSACAB' and year = 2016 and month = 1 and day = 28;
基本上,应使用'
这篇关于“在输入处没有可行的选择”查询cassndra表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文