Cassandra cqlsh - how to show microseconds/milliseconds for timestamp columns?

前端 未结 5 1698
名媛妹妹
名媛妹妹 2020-12-02 17:28

I\'m inserting into a Cassandra table with timestamp columns. The data I have comes with microsecond precision, so the time data string looks like this:

2015

5条回答
  •  星月不相逢
    2020-12-02 18:03

    I think by "microseconds" (e.g 03.234567) you mean "milliseconds" (e.g. (03.234).

    The issue here was a cqlsh bug that failed to support fractional seconds when dealing with timestamps.

    So, while your millisecond value was preserved in the actual persistence layer (cassandra), the shell (cqlsh) failed to display them.

    This was true even if you were to change time_format in .cqlshrc to display fractional seconds with an %f directive (e.g. %Y-%m-%d %H:%M:%S.%f%z). In this configuration cqlsh would render 3.000000 for our 3.234 value, since the issue was in how cqlsh loaded the datetime objects without loading the partial seconds.

    That all being said, this issue was fixed in CASSANDRA-10428, and released in Cassandra 3.4.

提交回复
热议问题