clintropolis opened a new pull request, #13573:
URL: https://github.com/apache/druid/pull/13573

   ### Description
   This PR expands `StringDimensionIndexer` to handle conversion of `byte[]` to 
base64 encoded strings, rather than the current behavior of calling java 
`toString`. 
   
   This issue was uncovered by a regression of sorts introduced by #13519, 
which updated the protobuf extension to directly convert stuff to java types, 
resulting in `bytes` typed values being converted as `byte[]` instead of a 
base64 string which the previous JSON based conversion created. While 
outputting `byte[]` is more consistent with other input formats, and preferable 
when the bytes can be consumed directly (such as complex types serde), when fed 
to a `StringDimensionIndexer`, it resulted in an ugly java `toString` because 
`processRowValsToUnsortedEncodedKeyComponent` is fed the output of 
`row.getRaw(..)`. Converting `byte[]` to a base64 string within 
`StringDimensionIndexer` is consistent with the behavior of calling 
`row.getDimension(..)` which does do this coercion (and why many tests on 
binary types appeared to be doing the expected thing).
   
   I added some protobuf `bytes` tests, but they don't really hit the new 
`StringDimensionIndexer` behavior because they operate on the `InputRow` 
directly, and call `getDimension` to validate stuff. The parser based version 
still uses the old conversion mechanisms, so when not using a flattener 
incorrectly calls `toString` on the `ByteString`. I have encoded this behavior 
in the test for now, if we either update the parser to use the new flattener or 
just .. remove parsers we can remove this test stuff.
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not 
all of these items apply to every PR. Remove the items which are not done or 
not relevant to the PR. None of the items from the checklist below are strictly 
necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [ ] been self-reviewed.
      - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to