插入到具有区分大小写的列名称的列系列中 [英] insert into column family with case sensitive column name

查看:166
本文介绍了插入到具有区分大小写的列名称的列系列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下Cassandra / CQL版本:



[cqlsh 4.0.1 | Cassandra 2.0.1 | CQL规范3.1.1 | Thrift协议19.37.0]



我试图将数据插入到预先存在的CF中,区分大小写的列名。我尝试插入数据时遇到未知标识符错误。



以下是列族的描述:

  CREATE TABLESample_List_CS(
键文本,
column1文本,
fName文本,
ipSubnet文本,
ipSubnetMasktext,
value text,
PRIMARY KEY(key,column1)
)WITH COMPACT STORAGE和
bloom_filter_fp_chance = 0.010000 AND
caching = KEYS_ONLY'AND
comment =''和
dclocal_read_repair_chance = 0.000000 AND
gc_grace_seconds = 0 AND
index_interval = 128 AND
read_repair_chance = 0.000000 AND
replicate_on_write = 'false'AND
populate_io_cache_on_flush ='false'AND
default_time_to_live = 0 AND
speculative_retry ='NONE'AND
memtable_flush_period_in_ms = 0 AND
compaction = {'class' :'SizeTieredCompactionStrategy'} AND
compression = {'sstable_compression':'LZ4Compressor'};

CREATE INDEX ipSubnet ONSample_List_CS(ipSubnet);

insert语句会导致错误:

  cqlsh:Sample_KS> INSERT INTOSample_List_CS(key,column1,fName)VALUES('123','1','myValue'); 
错误的请求:未知的标识符fName

cqlsh:Sample_KS> INSERT INTOSample_List_CS(key,column1,ipSubnet)VALUES('123','1','255');
错误的请求:未知的标识符ipSubnet

任何想法我做错了什么? >

解决方案

根据我的理解,当使用 WITH COMPACT STORAGE 列而不是主键。



手册


使用紧凑存储指令可防止添加超过
one


对于这意味着您只能在表中包含这四列中的一列:




  • fName

  • ipSubnet

  • ipSubnetMask

  • value



(或者,您可以将3个因此,其他三个列导致未知标识符错误是有意义的。

p>

I am using the following Cassandra/CQL versions:

[cqlsh 4.0.1 | Cassandra 2.0.1 | CQL spec 3.1.1 | Thrift protocol 19.37.0]

I am trying to insert data into a pre-existing CF with case sensitive column names. I hit "unknown identifier" errors when trying to insert data.

Following is how the column family is described:

CREATE TABLE "Sample_List_CS" (
  key text,
  column1 text,
  "fName" text,
  "ipSubnet" text,
  "ipSubnetMask" text,
  value text,
  PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE AND
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=0 AND
  index_interval=128 AND
  read_repair_chance=0.000000 AND
  replicate_on_write='false' AND
  populate_io_cache_on_flush='false' AND
  default_time_to_live=0 AND
  speculative_retry='NONE' AND
  memtable_flush_period_in_ms=0 AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};

CREATE INDEX ipSubnet ON "Sample_List_CS" ("ipSubnet");

The insert statements result in errors:

cqlsh:Sample_KS> INSERT INTO "Sample_List_CS" (key,column1,"fName") VALUES    ('123','1','myValue');
Bad Request: Unknown identifier fName

cqlsh:Sample_KS> INSERT INTO "Sample_List_CS" (key,column1,"ipSubnet") VALUES    ('123','1','255');
Bad Request: Unknown identifier ipSubnet

Any idea what I am doing wrong?

解决方案

As I understand it when using WITH COMPACT STORAGE a table may only have one column other than the primary key.

As quoted in the manual:

Using the compact storage directive prevents you from adding more than one column that is not part of the PRIMARY KEY.

For you that means you can only have one of these 4 columns in your table:

  • "fName"
  • "ipSubnet"
  • "ipSubnetMask"
  • value

(Alternatively, you could add 3 of them to the primary key definition.)

Thus it makes sense that the other three columns lead to an Unknown identifier error.

这篇关于插入到具有区分大小写的列名称的列系列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆