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


   ### Description
   Following up on discussion in #11853, this PR introduces a new 
`TypeStrategy` interface which defines binary serde and comparison for values 
of any `TypeSignature`.
   
   The binary serialization methods were consolidated from the static methods 
in `Types`, and the code I think is overall much more simple.
   
   `TypeStrategy` deals in objects, so is not optimal for primitive values like 
longs and doubles, so the static methods for reading/writing these values with 
nulls remain but now live in `TypeStrategies`, along with all of the built-in 
implementations (string, long, double, float, array).
   
   The comparator implementations match the orderings defined in 
`druid-processing`... we may wish to consider bringing some of them into 
`druid-core`, merging `druid-core` and `druid-processing` :trollface: , or 
something else to try to consolidate things a bit better. I'm also unsure if 
the array comparator is good, but nothing should actually be using it yet so 
maybe it isn't the end of the world.
   
   `ObjectByteStrategy` is moved back into `ObjectStrategy`, it's registry 
replaced with one of `TypeStrategy`, and instead `ComplexMetricsSerde` has a 
new default implementation of a method called `getTypeStrategy` which wraps the 
`ObjectStrategy` methods, but could be overridden for more optimal 
implementations.
   
   I think the utility of being able to get binary serde to use for things like 
buffer aggregators is on full display in the `ExprEval` serialization methods, 
so I think overall i'm in favor of this change, since basically anywhere you 
have a ` ColumnInspector` (which includes `RowSignature`) you have the means to 
read, write, and compare values.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `TypeStrategy`
    * `TypeStrategies`
    * `Types`
    * `ComplexMetricsSerde`
    * `ColumnType`
    * `ColumnTypeFactory`
    * `ExpressionType`
   
   <hr>
   
   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.
   - [ ] 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