Skip to content

Commit

Permalink
[HUDI-1662] Fix hive date type conversion for mor table (#2634)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiarixiaoyao committed Mar 8, 2021
1 parent 5cf2f26 commit 0207323
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.serde2.io.DoubleWritable;
import org.apache.hadoop.hive.serde2.io.DateWritable;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
Expand Down Expand Up @@ -166,6 +167,9 @@ public static Writable avroToArrayWritable(Object value, Schema schema) {
case BYTES:
return new BytesWritable(((ByteBuffer)value).array());
case INT:
if (schema.getLogicalType() != null && schema.getLogicalType().getName().equals("date")) {
return new DateWritable((Integer) value);
}
return new IntWritable((Integer) value);
case LONG:
return new LongWritable((Long) value);
Expand Down

0 comments on commit 0207323

Please sign in to comment.