在微秒内插入值时遇到问题 [英] getting problem in inserting values in microseconds

查看:80
本文介绍了在微秒内插入值时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用timestamp数据类型及时插入,但无法以微秒为单位提供值。

I am inserting in time using timestamp datatype but it cannot give me values in microseconds. Is it possible to insert values in microseconds or it takes values only up to milliseconds.

cqlsh:cassandradb> select * from time_stamp;

 id | name    | t
----+---------+---------------------------------
  1 | deepank | 2015-02-16 06:30:24.000000+0000
  2 |    arun | 2016-02-16 06:35:24.483000+0000

这是我插入的内容不期望这个值。当我在micro中插入时,我只是简单地以毫秒为单位插入了值,这给了我错误,如下
(2行)
cqlsh:cassandradb>从time_ stamp选择id,name,blobAsBigint(timestampAsBlob(t));

this is what I have inserted but I am not expecting this value. I have simply inserted value in milliseconds when I insert in micro it gives me error as following (2 rows) cqlsh:cassandradb> select id, name, blobAsBigint(timestampAsBlob(t)) from time_ stamp;

 id | name    | system.blobasbigint(system.timestampasblob(t))
----+---------+------------------------------------------------
  1 | deepank |                                  1424068224000
  2 |    arun |                                  1455604524483

(2行)
在此,我使用了blob,但我认为它没有

(2 rows) In this, I have used blob but I think it didn't go well.

cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.84325');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2015-02-16 06:30:2.84325' to a formatted date (long)"

cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.8432');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2015-02-16 06:30:2.8432' to a formatted date (long)"

cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.842');``
last value is taken 

我希望它可以以微秒为单位插入值;
,以便输出将是六位数。

I expect that it could insert value in microseconds; so that output will be in six digit.

推荐答案

Cassandra中的时间戳具有毫秒级的分辨率,您应该仅使用时间戳字符串中后的3位数字。微秒级分辨率仅用于记录的WriteTime。

Timestamp in Cassandra has millisecond resolution, and you should use only 3 digits after . in timestamp string. The microsecond resolution is used only for WriteTime of the record.

对于某些我不知道的原因, cqlsh 输出微秒分辨率的数据,恕我直言,这是一个巨大的UX问题...

For some, unknown for me, reason, cqlsh outputs data with microseconds resolution, and imho it's huge UX problem with it...

这篇关于在微秒内插入值时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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