【发布时间】:2017-04-02 23:04:03
【问题描述】:
我正在尝试从 csv 文件中复制,我有 1 个时间戳和一个时间列。 尝试从几行开始测试:
cqlsh:tests> CREATE TABLE testts (
... ID int PRIMARY KEY,
... mdate timestamp,
... ttime time);
cqlsh:tests> INSERT INTO testts (ID , mdate, ttime )
... VALUES (1, '2015-10-12', '1055') ;
cqlsh:tests> INSERT INTO testts (ID , mdate, ttime )
... VALUES (2, '2014-06-25', '920') ;
cqlsh:tests> select * from testts;
id | mdate | ttime
----+--------------------------+--------------------
1 | 2015-10-12 07:00:00+0000 | 00:00:00.000001055
2 | 2014-06-25 07:00:00+0000 | 00:00:00.000000920
(2 rows)
以上工作,现在我尝试导入文件
cqlsh:tests> COPY testts ( ID,
... mdate,
... ttime)
... FROM 'c:\cassandra228\testtime.csv' WITH HEADER = FALSE AND DELIMITER = ',' AND DATETIMEFORMAT='%Y/%m/%d';
Using 3 child processes
Starting copy of tests.testts with columns [id, mdate, ttime].
Failed to import 1 rows: ParseError - Failed to parse 1130 : can't interpret '1130' as a time, given up without retries
Failed to import 1 rows: ParseError - Failed to parse 1230 : can't interpret '1230' as a time, given up without retries
Failed to import 1 rows: ParseError - Failed to parse 930 : can't interpret '930' as a time, given up without retries
Failed to process 3 rows; failed rows written to import_tests_testts.err
Processed: 3 rows; Rate: 0 rows/s; Avg. rate: 1 rows/s
3 rows imported from 1 files in 3.269 seconds (0 skipped).
我的 Timestamp coulmn 的格式是 YYYY/MM/DD ,直到我给出这个 DATETIMEFORMAT='%Y/%m/%d' 我会在时间戳列上得到错误,但在此之后那个错误停了下来。
CSV 文件: 3,2010/02/08,930 4,2015/05/20,1130 5,2016/08/15,1230
我该如何解决这个问题。
非常感谢
【问题讨论】:
-
向我们展示您的架构和 csv 中的某些行
-
这就是全部内容
-
你使用的是哪个 cassandra cql 版本?
-
它适用于 [cqlsh 5.0.1 |卡桑德拉 2.2.4 | CQL 规范 3.3.1 |原生协议 v4]
-
**5.01 和 2.2.8**
Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 2.2.8 | CQL spec 3.3.1 | Native protocol v4]
标签: time cassandra copy timestamp cqlsh