yihua commented on code in PR #12452:
URL: https://github.com/apache/hudi/pull/12452#discussion_r1926526952
##########
hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HiveHoodieReaderContext.java:
##########
@@ -264,12 +270,27 @@ public UnaryOperator<ArrayWritable> projectRecord(Schema
from, Schema to, Map<St
}
@Override
- public Comparable castValue(Comparable value, Schema.Type newType) {
- //TODO: [HUDI-8261] actually do casting here
+ public Comparable convertValueToEngineType(Comparable value) {
if (value instanceof WritableComparable) {
return value;
}
- return (WritableComparable)
HoodieRealtimeRecordReaderUtils.avroToArrayWritable(value,
Schema.create(newType));
+ //TODO: [HUDI-8261] cover more types
+ if (value == null) {
+ return null;
+ } else if (value instanceof String) {
+ return new Text((String) value);
+ } else if (value instanceof Integer) {
+ return new IntWritable((int) value);
+ } else if (value instanceof Long) {
+ return new LongWritable((long) value);
+ } else if (value instanceof Float) {
+ return new FloatWritable((float) value);
+ } else if (value instanceof Double) {
+ return new DoubleWritable((double) value);
+ } else if (value instanceof Boolean) {
Review Comment:
It should work as we use `#compareTo` to compare the ordering value of
particular types. And `(integer) 0` is handled separately and is not used to
compared with actual ordering value.
--
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]