我们可以在一个查询中使用多个cassandra CQL集合(集合、列表、映射)吗?
为了执行,应该进行哪些更改?当然可以,但需要进行一些调整: 1如果列的类型未通过下划线链接到列名,则会有所帮助。而不是:我们可以在一个查询中使用多个cassandra CQL集合(集合、列表、映射)吗?,cassandra,cql,cqlsh,Cassandra,Cql,Cqlsh,为了执行,应该进行哪些更改?当然可以,但需要进行一些调整: 1如果列的类型未通过下划线链接到列名,则会有所帮助。而不是: create table seller( seller_id int primary key, seller_name text, seller_email set<text>, seller_address map<text>, seller_phone list<text>, prod
create table seller(
seller_id int primary key,
seller_name text,
seller_email set<text>,
seller_address map<text>,
seller_phone list<text>,
product_id int,
product_title_text,
product_description text,
product_trackno int,
product_bidoption text,
bid_startdate date,
bid_closedate date,
bid_startprice int,
bid_withdrawdate date);
SyntaxException: line 1:110 mismatched input '>' expecting ',' (...<text>,
seller_address map<text[>],...)
product_title text,
这将有助于:
product_title_text,
seller_address map<TEXT>,
2您还需要为地图集合提供这两种类型。而不是:
create table seller(
seller_id int primary key,
seller_name text,
seller_email set<text>,
seller_address map<text>,
seller_phone list<text>,
product_id int,
product_title_text,
product_description text,
product_trackno int,
product_bidoption text,
bid_startdate date,
bid_closedate date,
bid_startprice int,
bid_withdrawdate date);
SyntaxException: line 1:110 mismatched input '>' expecting ',' (...<text>,
seller_address map<text[>],...)
product_title text,
这将有助于:
product_title_text,
seller_address map<TEXT>,
完整CQL:
seller_address map<TEXT,TEXT>,
另外,您真的只需要按卖家id查询这个表吗?如果没有,您可能需要重新考虑主键定义。当然可以,但需要做一些调整: 1如果列的类型未通过下划线链接到列名,则会有所帮助。而不是:
create table seller(
seller_id int primary key,
seller_name text,
seller_email set<text>,
seller_address map<text>,
seller_phone list<text>,
product_id int,
product_title_text,
product_description text,
product_trackno int,
product_bidoption text,
bid_startdate date,
bid_closedate date,
bid_startprice int,
bid_withdrawdate date);
SyntaxException: line 1:110 mismatched input '>' expecting ',' (...<text>,
seller_address map<text[>],...)
product_title text,
这将有助于:
product_title_text,
seller_address map<TEXT>,
2您还需要为地图集合提供这两种类型。而不是:
create table seller(
seller_id int primary key,
seller_name text,
seller_email set<text>,
seller_address map<text>,
seller_phone list<text>,
product_id int,
product_title_text,
product_description text,
product_trackno int,
product_bidoption text,
bid_startdate date,
bid_closedate date,
bid_startprice int,
bid_withdrawdate date);
SyntaxException: line 1:110 mismatched input '>' expecting ',' (...<text>,
seller_address map<text[>],...)
product_title text,
这将有助于:
product_title_text,
seller_address map<TEXT>,
完整CQL:
seller_address map<TEXT,TEXT>,
另外,您真的只需要按卖家id查询这个表吗?如果没有,您可能需要重新考虑主键定义