-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Null string is encoded as "null" in incremental index #2765
Conversation
Is it possible to include a test that would have caught this? |
{ | ||
return String.valueOf(o); | ||
return o == null ? null : String.valueOf(o); |
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.
can you explain in your PR description why this line is not enough to fix the problem. What is the purpose of the remaining changes?
Can we remove the changes not related to the String null handling? The code being refactored is being redone in #2760, e.g. those value transformers in IncrementalIndex are removed. |
@jon-wei sure |
0f5a845
to
f0e55f5
Compare
Is this a bug that affects 0.9.0, or just 0.9.1? |
@drcrallen it's from #2263, which is not included in any released versions. |
@drcrallen it'll just be for 0.9.1, the code being changed was from #2263, which isn't in 0.9.0 |
👍 |
@@ -101,7 +101,7 @@ | |||
@Override | |||
public String apply(final Object o) | |||
{ | |||
return String.valueOf(o); | |||
return o == null ? null : String.valueOf(o); |
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.
Should this be converting ""
to null
or is something else doing that?
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 think it's fine, null/empty dim values will end up as "" via a nullToEmpty() call when added to the dictionary:
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.
ah ok, this looks good then. thanks
👍 |
try { | ||
return Long.valueOf((String) o); | ||
return s.isEmpty() ? null : Long.valueOf(s); |
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.
does this change any current behavior that might map empty strings to 0 for numeric values?
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 don't think it could, since with the old code, Long.valueOf("")
would have thrown an exception. The new code would return null.
I've found null values for string type is encoded as "null", which seemed not intended behavior.