gortiz opened a new pull request, #10361: URL: https://github.com/apache/pinot/pull/10361
This PR adds 3 visitors: `DataTypeVisitor`, `SingleValueVisitor` and `MultiValueVisitor`. The [visitor pattern](https://en.wikipedia.org/wiki/Visitor_pattern) is well-known and heavily used in _old_ versions of Java where `switch` statement cannot be applied to classes. With the inclusion of pattern matching and switch expressions in modern Java versions the visitor pattern is not that important. In Apache Pinot it can be useful on a lot of different object domains. In this PR I added to: - FieldSpec.DataType. As explained in the javadoc, given that DataType is an enum we can apply a switch and we actually do it in several places, but the switch has two advantages over switch: it is typesafe and it can be composed. - Some predicates: Here I have added the visitors in order to offer internal typesafe visibility of the predicates. The idea is to be able to extract the matching value of the predicate (for example, the actual literal value we are comparing with in a `Eq` predicate) without having to know anything about the actual predicate apart. The later is quite useful in a proprietary plugin we are developing in StarTree. -- 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]
