[BUG] Precision issue using ts_format and ts_strftime in bloblang
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- data-engineering
Research direction
Start by reproducing the issue's Bloblang mapping with ts_format and ts_strftime using the provided millisecond timestamp and compare the actual and expected outputs. Trace the implementation or entry points for these two methods; done means both preserve the expected millisecond precision without relying on the timestamp offset workaround.
Written by the indexing model from the issue text.
Description
I have encountered a precision issue using ts_format in bloblang mapping.
Input
root.time = (1555234838050/1000).ts_format("2006-01-02T15:04:05.999-07:00", "UTC")
Expected output
{
"time": "2019-04-14T09:40:38.050+00:00"
}
Actual output
{
"time": "2019-04-14T09:40:38.049+00:00"
}
Version
4.53.0
The same problem occurs using ts_strftime(). I read that these two methods support nanosecond precision, so ms precision shouldn't be a problem.
PS: I currently use a dirty trick to fix this problem and avoiding heavily string operation at the same time (which is critical for my high frequency use case):
root.time = (1555234838050/1000+0.0004).ts_format("2006-01-02T15:04:05.999-07:00", "UTC")
But I guess this can't be 100% safe as trying to build a feature on a bug.
- Dominant language
- Go
- Stars
- 573
- Forks
- 122
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from redpanda-data/benthos
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
redpanda-data/benthos#404 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
redpanda-data/benthos#503 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
redpanda-data/benthos#502 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 72/100
redpanda-data/benthos#481 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
redpanda-data/benthos#469 ·
Maintainers usually reply within 1 day
All issues in redpanda-data/benthos
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
status: ready for dev
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
hyperledger-labs/fabric-smart-client#2004 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/datasketches-go#189 ·
Maintainers usually reply within 1 day