1
0

[HUDI-617] Add support for types implementing CharSequence (#1339)

- Data types extending CharSequence implement a #toString method which provides an easy way to convert them to String. 
- For example, org.apache.avro.util.Utf8 is easily convertible into String if we use the toString() method. It's better to make the support more generic to support a wider range of data types as partitionKey.
This commit is contained in:
amitsingh-10
2020-02-19 00:49:44 +05:30
committed by GitHub
parent 8c6138cb01
commit c2b08cdfc9

View File

@@ -103,7 +103,7 @@ public class TimestampBasedKeyGenerator extends SimpleKeyGenerator {
unixTime = ((Float) partitionVal).longValue();
} else if (partitionVal instanceof Long) {
unixTime = (Long) partitionVal;
} else if (partitionVal instanceof String) {
} else if (partitionVal instanceof CharSequence) {
unixTime = inputDateFormat.parse(partitionVal.toString()).getTime() / 1000;
} else {
throw new HoodieNotSupportedException(