write/point: run convertField when AddField re-sets an existing key - #428
Open
c-tonneslan wants to merge 1 commit into
Open
c-tonneslan wants to merge 1 commit into
c-tonneslan wants to merge 1 commit into
Conversation
Adding a field for the first time goes through convertField (so an int32(5) lands as int64(5), a time.Time as its RFC3339Nano string, etc). Re-setting the same key did m.fields[i].Value = v with the raw input, so the canonical-type guarantee silently disappeared on update. Easiest to see with non-int64 ints, where the line-protocol encoder downstream expects int64. Pulled convertField out front so both branches use the same value. Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #428 +/- ##
=======================================
Coverage 92.99% 92.99%
=======================================
Files 25 25
Lines 2326 2327 +1
=======================================
+ Hits 2163 2164 +1
Misses 123 123
Partials 40 40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while reading api/write/point.go.
AddFieldruns the input value throughconvertFieldwhen appending a new field, so e.g.int32(5)lands in the point asint64(5), atime.Timeas its RFC3339Nano string, etc. But the re-set path on the existing key did:with the raw
v. So the canonical-type guarantee quietly disappeared on update. Easiest to see with non-int64ints, where the line-protocol encoder downstream expectsint64:Pulled the convertField call out front so both branches use the same value. Added a regression test on the int32 case.