-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix event value is truncated #15408
Merged
Fix event value is truncated #15408
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
14 changes: 7 additions & 7 deletions
14
...API/tests/System/expected/test_AutoSuggestAPITest_eventValue__VisitsSummary.get_range.xml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<result> | ||
<nb_visits>0</nb_visits> | ||
<nb_actions>0</nb_actions> | ||
<nb_visits_converted>0</nb_visits_converted> | ||
<nb_visits>4</nb_visits> | ||
<nb_actions>20</nb_actions> | ||
<nb_visits_converted>4</nb_visits_converted> | ||
<bounce_count>0</bounce_count> | ||
<sum_visit_length>0</sum_visit_length> | ||
<max_actions>0</max_actions> | ||
<sum_visit_length>6492</sum_visit_length> | ||
<max_actions>5</max_actions> | ||
<bounce_rate>0%</bounce_rate> | ||
<nb_actions_per_visit>0</nb_actions_per_visit> | ||
<avg_time_on_site>0</avg_time_on_site> | ||
<nb_actions_per_visit>5</nb_actions_per_visit> | ||
<avg_time_on_site>1623</avg_time_on_site> | ||
</result> |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this test didn't used to work. Ran the test with float and double and in both cases the value looked like they were stored correctly.
This is what the fixture data looks like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't work as the comparison
custom_float = '345.678'
doesn't return any results when the field is a float. The number seems not to be stored accurate enough to be able to compare it correctly. When changing the column toDOUBLE
it gets converted to345.6780090332031
.Not sure if it would make sense to truncate some minor fraction digits after changing the type 🤔
Using a
DOUBLE
the number is stored accurate enough to be compared correctlyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use something like
DOUBLE(15,5)
or so and limit it to 5 numbers after the dot. I just tested it and the problem is that then a similar issue as with decimal happens that all numbers are formatted to have 5 digits after dotThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe additionally run a script like
UPDATE log_link_visit_action SET custom_float = TRUNCATE(custom_float, 5)
after it was converted to double? That should throw away all fraction digits after the fifth one 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgiehl from what I see mysql stores also new values like this.
and truncate seems to ensure there's always that many zeros too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgiehl not sure I understand this fully? If we just use
DOUBLE
then this shouldn't be needed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we currently have a value like
345.678
and the field is converted toDOUBLE
, the new value will be something like345.6780090332031
. That's the reason why I suggested to run something like a TRUNCATE, so we have a similar value as beforeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which MySQL version is that? This wasn't happening for me on MySQL 8. Or maybe I'm not checking correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mysql 5.7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, can reproduce it on
10.2-MariaDB
. I just created 3 rows with values 3, 4.1 and 4.12. After converting to float I got this:After executing your suggested query I got this:
So it's still changing the values quite a bit.
It seems there might not be a safe way to change the field? I wonder if it's worth it or maybe we rather create an FAQ for people needing more accuracy and only try to change it for new installs.
@mattab there doesn't seem to be an easy way to change the field for this column. I reckon we could really rather only change it for new installs maybe and create an FAQ for all other cases. any thoughts?