【发布时间】:2015-11-23 14:37:45
【问题描述】:
在 cassandra ([cqlsh 5.0.1 | Cassandra 2.2.0 | CQL spec 3.3.0 | Native protocol v4]) 中我创建了下表
create table flotilla.events1 (
f1 int,
f2 int,
f3 int,
f4 timestamp,
f5 text,
f6 text,
f7 text,
f8 int,
f9 text,
f10 double,
f11 int,
primary key (f2, f1)
);
并尝试插入以下数据 (/tmp/b.csv):
f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11
1,751168360,0,'2014-04-01T09:56:13.491','a','G','G',296,'G',242,242
2,751168360,0,'2014-04-01T09:56:13.491','a','G','G',296,'G',8,8
3,751168360,0,'2014-04-01T09:56:13.491','a','G','G',296,'G',0,0
4,751168360,0,'2014-04-01T09:56:13.491','a','G','G',296,'G',1,1
5,751168360,0,'2014-04-01T09:56:13.491','a','G','G',296,'G',0,0
6,751168360,0,'2014-04-01T09:56:13.491','a','G','G',296,'G',0,0
7,751168360,0,'2014-04-01T09:56:13.491','a','A','A',279,'P',2.55,255
8,751168360,0,'2014-04-01T09:56:13.491','a','A','A',279,'P',0,0
使用以下命令:
copy flotilla.events1 (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) from '/tmp/b.csv' with header=true;
卡珊德拉说:
8 rows imported in 0.550 seconds.
当我检查表格时:
SELECT * from flotilla.events1 ;
f2 | f1 | f10 | f11 | f3 | f4 | f5 | f6 | f7 | f8 | f9
----+----+-----+-----+----+----+----+----+----+----+----
(0 rows)
没有任何错误。什么黑客?
但是,如果我在第一行插入 INSERT INTO:
insert into flotilla.events1 (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) values (1,751168360,0,'2014-04-01T09:56:13.123','a','G','G',296,'G',242,242) ; select * from flotilla.events1;
f2 | f1 | f10 | f11 | f3 | f4 | f5 | f6 | f7 | f8 | f9
-----------+----+-----+-----+----+--------------------------+----+----+----+-----+----
751168360 | 1 | 242 | 242 | 0 | 2014-04-01 09:56:13+0200 | a | G | G | 296 | G
(1 rows)
什么技巧?
【问题讨论】: