Open DimDroll opened 4 months ago
Thanks @DimDroll . We are using a library to do the parsing here so any fix would likely need to be upstream in https://github.com/chronotope/chrono.
Thank you @jszwedko ,
I dug a little and found similar case reported earlier: https://github.com/vectordotdev/vrl/issues/117 which you had checked as well.
It seems like you raised this case with chrono in the past and it had been worked on recently, I summarized related links and cautiously asked in the following thread if there is a progress planned: https://github.com/chronotope/chrono/issues/1399
In the meantime will stick with aforementioned workaround.
Just as a note, workaround will be:
.@timestamp = from_unix_timestamp!(9007199254740993, unit: "nanoseconds")
However, I will keep this open as parse_timestamp is supposed to support it as well. I would assume once it is fixed from_unix_timestamp and to_unix_timestamp could be deprecated as parse_timestamp and format_timestamp should suffice. It will help parse_timestamp could have "unit" precision modifier added for the full replacability.
@jszwedko please share if it make sense for the long-term?
Just as a note, workaround will be:
.@timestamp = from_unix_timestamp!(9007199254740993, unit: "nanoseconds")
However, I will keep this open as parse_timestamp is supposed to support it as well. I would assume once it is fixed from_unix_timestamp and to_unix_timestamp could be deprecated as parse_timestamp and format_timestamp should suffice. It will help parse_timestamp could have "unit" precision modifier added for the full replacability.
@jszwedko please share if it make sense for the long-term?
That works too. from_unix_timestamp
and to_unix_timestamp
are more efficient, given they deal with integers and not parsing / encoding strings, and so I think they are still useful on their own even if parse_timestamp
and format_timestamp
could handle them correctly.
A note for the community
Problem
Hello,
We have a case when we need to parse nanoseconds timestamp like 1712312062676735437 using parse_timestamp function:
.2_timestamp = parse_timestamp!("1712312062676735437", "%s%f")
Which gives error:The workaround is to add space in between timestamp and nanoseconds part:
.4_timestamp = parse_timestamp!("1712312062 676735437", "%s %f")
Following is VRL code that can be executed in playground:
I assume same happens during real-time run.
Configuration
No response
Version
VRL Version: 0.13.0
Debug Output
No response
Example Data
No response
Additional Context
No response
References
No response