SteNicholas commented on code in PR #537:
URL: https://github.com/apache/flink-table-store/pull/537#discussion_r1106646269
##########
flink-table-store-format/src/main/java/org/apache/flink/table/store/format/orc/filter/OrcPredicateFunctionVisitor.java:
##########
@@ -157,20 +158,34 @@ private Optional<OrcFilters.Predicate> convertBinary(
if (litType == null) {
return Optional.empty();
}
-
- String colName = fieldRef.name();
-
// fetch literal and ensure it is serializable
Object orcObj = toOrcObject(litType, literal);
- Serializable serializableLiteral;
// validate that literal is serializable
- if (orcObj instanceof Serializable) {
- serializableLiteral = (Serializable) orcObj;
- } else {
+ return orcObj instanceof Serializable
+ ? Optional.of(func.apply(fieldRef.name(), litType,
(Serializable) orcObj))
+ : Optional.empty();
+ }
+
+ private Optional<OrcFilters.Predicate> convertIn(FieldRef fieldRef,
List<Object> literals) {
+ PredicateLeaf.Type litType = toOrcType(fieldRef.type());
+ if (litType == null || CollectionUtils.isEmpty(literals)) {
return Optional.empty();
}
-
- return Optional.of(func.apply(colName, litType, serializableLiteral));
+ return Optional.of(
+ new OrcFilters.In(
+ fieldRef.name(),
+ litType,
+ literals.stream()
+ .map(
+ literal -> {
+ // fetch literal and ensure it is
serializable
+ Object orcObj =
toOrcObject(litType, literal);
+ // validate that literal is
serializable
+ return orcObj instanceof
Serializable
+ ? (Serializable) orcObj
+ : null;
Review Comment:
Make sense to me. Keeps the consistence with the non-serializable object of
`convertBinary`.
--
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]