CQL查询中的语法错误(Cassandra CQL COPY FROM命令):"输入不匹配"

时间:2015-07-17 21:50:38

标签: cassandra cql

当我尝试将由制表符分隔的CSV文件加载到Cassandra表中时,我收到以下错误:

  

ErrorMessage code = 2000 [CQL查询中的语法错误] message ="第1行:747   输入不匹配' -800'期待')' (... facebook,' 2014-01-01   00:00:00',0,' 0',1 [-800] -...)"在记录#1中止进口。先前   插入的记录仍然存在,之后的一些记录可能是   现在也是。

该文件是一个62列的制表符分隔文件,我尝试通过以下语句加载

COPY alpha_table 
(a,al,e,p,b,ag,ab,au,l,m,aq,aw,g,af,am,s,aj,aa,ad,ak,ah,h,be,y,bh,z,ay,az,as,bi,av,n,v,ac,k,j,x,ax,f,ao,an,o,u,d,ai,bf,ap,bg,i,ar,c,t,bd,bj,at,bc,ba,bb,ae,r,w,q) 
FROM '/tmp/data.csv' WITH DELIMITER='\t'

该表包含int和text字段,如下所示

CREATE TABLE alpha_table ( a int PRIMARY KEY, al text, e int, p text, b int, ag text, ab int, au text, l int, m int, aq text, aw int, g text, af int, am text, s int, aj text, aa int, ad int, ak int, ah text, h text, be text, y int, bh int, z text, ay int, az int, as int, bi int, av int, n text, v int, ac int, k text, j text, x int, ax int, f text, ao text, an text, o int, u int, d text, ai text, bf text, ap int, bg int, i text, ar int, c text, t int, bd text, bj text, at text, bc int, ba int, bb int, ae int, r text, w int, q text)

数据文件有100条记录,这些记录的区别仅在于第一列中的id,在其他方面是相同的。

1000001 "30214" "Abe's House of Chow"   "Abe's House of Chow"   1   "N" "Macon Mall's newest restaurant, Abes House of Chow is holding its official grand opening October 1 2014. City leaders and the owners of the restaurant will gather for the ribbon cutting ceremony as they expect more than more than 500 people at the event. The restaurant sells nearly 8 thousand pulled pork sandwiches a week."  "0" "never leave hungry"    "free wings if you like us on facebook" "2014-01-01 00:00:00"   "0" "0" "1-800-CHOWDWN" 5   "kia"   "f8FJdaM1dYE"   "0" 1   1   1   0   0   0   "0" "HU"    "0" "0" "0" "0" "0" "30"    "0" "abes-house-of-chow"    "Y94L"  "#abeshouseofchow"  0   "2012-06-14 00:00:00"   "2015-03-16 15:20:44"   "2014-01-11 11:15:58"   "abe"   "-3"    "0" 8   "0" "C" "2012-06-14 00:00:00"   "0" "0" "0" 1   1   1   1   "0" "N" "en"    "U" 0

关于这个错误的奇怪之处在于,当我尝试插入所有100个错误时,我得到错误但是如果我创建一个只有前20个的新文件,我就不会这样做。奇怪的是,无论哪种方式,都会说无论是否记录都插入了记录。

  

cqlsh:alpha_keyspace> COPY alpha_table   (A,人,E,P,B,AG,AB,AU,L,M,水溶液,AW,克,AF,AM,S,AJ,AA,广告,AK,啊,H,是,Y,BH ,Z,AY,AZ,如,双,AV,N,v,AC,K,J,X,斧头,F,AO,一个,O,U,d,AI,BF,AP,BG,I,芳,C,T,BD,BJ,在,BC,BA,BB,AE,R,W,q)   FROM' /tmp/data_100.csv' WITH DELIMITER =' \ t';

     

ErrorMessage code = 2000 [CQL查询中的语法错误] message ="第1行:747   输入不匹配' -800'期待')' (... facebook,' 2014-01-01   00:00:00',0,' 0',1 [-800] -...)"在记录#1中止进口。先前   插入的记录仍然存在,之后的一些记录可能是   现在也是。

     

在0.126秒内导入100行。

     

cqlsh:alpha_keyspace> COPY alpha_table   (A,人,E,P,B,AG,AB,AU,L,M,水溶液,AW,克,AF,AM,S,AJ,AA,广告,AK,啊,H,是,Y,BH ,Z,AY,AZ,如,双,AV,N,v,AC,K,J,X,斧头,F,AO,一个,O,U,d,AI,BF,AP,BG,I,芳,C,T,BD,BJ,在,BC,BA,BB,AE,R,W,q)   FROM' /tmp/data_20.csv' WITH DELIMITER =' \ t';

     

在0.122秒内导入20行

我在本地Cassandra 2.1.8实例上使用cqlsh 5.0.1。任何帮助将不胜感激。

0 个答案:

没有答案