Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Group by Cassandra 3.11.4不工作的CQL组_Group By_Cassandra_Cql_Cassandra 3.0_Cqlsh - Fatal编程技术网

Group by Cassandra 3.11.4不工作的CQL组

Group by Cassandra 3.11.4不工作的CQL组,group-by,cassandra,cql,cassandra-3.0,cqlsh,Group By,Cassandra,Cql,Cassandra 3.0,Cqlsh,我可能遗漏了一些非常基本的东西,或者有一些非常错误的东西; 我使用的是ApacheCassandra 3.11.4。版本详情如下: Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.7.0 | CQL spec 3.4.2 | Native protocol v4] 我有下表,我想得到个人公民船舶状态的计数 CREATE TABLE population.residents ( residentId

我可能遗漏了一些非常基本的东西,或者有一些非常错误的东西; 我使用的是ApacheCassandra 3.11.4。版本详情如下:

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.7.0 | CQL spec 3.4.2 | Native protocol v4]
我有下表,我想得到个人公民船舶状态的计数

CREATE TABLE population.residents (
residentId bigint,
name varchar,
office varchar,
dob date,
citizen text,
PRIMARY KEY((residentId), dob)
);

CREATE MATERIALIZED VIEW population.residents_citizen AS
    SELECT citizen, dob, residentid, name, office
    FROM population.residents
    WHERE citizen IS NOT NULL AND residentid IS NOT NULL AND dob IS NOT NULL
    PRIMARY KEY (citizen, dob, residentid);
在尝试查询时出现以下错误:

cqlsh> select citizen, count(residentId) from population.residents_citizen GROUP BY citizen;
SyntaxException: line 1:68 missing EOF at 'GROUP' (...(residentId) from population.residents_citizen [GROUP] BY...)
cqlsh> select citizen, count(residentId) from population.residents_citizen_1 
GROUP BY citizen, residentId;
SyntaxException: line 1:70 missing EOF at 'GROUP' (...(residentId) from population.residents_citizen_1 [GROUP] BY...)
cqlsh> select citizen, count(residentId) from population.residents_citizen_1 GROUP BY residentId, citizen;
SyntaxException: line 1:70 missing EOF at 'GROUP' (...(residentId) from population.residents_citizen_1 [GROUP] BY...)
cqlsh> select citizen, count(residentId) from population.residents_citizen_1 GROUP BY citizen, dob, residentId;
SyntaxException: line 1:70 missing EOF at 'GROUP' (...(residentId) from population.residents_citizen_1 [GROUP] BY...)
我的数据如下所示:

cqlsh> select * from population.residents;

 residentid | dob        | citizen | name              | office
------------+------------+---------+-------------------+----------------------------------------
      25966 | 2019-01-04 |       N |        Carl Sykes |              Leo Cras Vehicula Limited
     921412 | 2018-12-13 |       N |    Brady Harrison |          Nulla In Tincidunt Consulting
     521367 | 2019-11-18 |       Y |      Aaron Norton |      Pharetra Sed Hendrerit Associates
     843096 | 2020-02-03 |       N |      Preston Leon |                        A Felis Limited
     460162 | 2019-01-17 |       N |      Neville Good |                   Odio Aliquam Company
     187360 | 2018-12-09 |       Y |     Emery Pittman |                Arcu Ac Orci Foundation

非常感谢您的建议

你能试试这个吗?从population.residents\u citizen GROUP BY residentId,citizen中选择citizen,count(residentId);让我知道它是否有效。不。编辑了这个问题。@elixir嗨,有没有可能看看这个,看看我们是否可以复制?@Chris Lohfink有没有可能帮忙?我想知道是否可以用上面给出的信息复制给其他人?你能试试这个吗-从人口中选择公民,计数(residentId)。居民\u按residentId划分的公民组,公民;让我知道它是否有效。不。编辑了这个问题。@elixir嗨,有没有可能看看这个,看看我们是否可以复制?@Chris Lohfink有没有可能帮忙?我想知道,如果上面给出的信息可以复制给其他人?