Skip to content

Commit

Permalink
[fix-##1334] orc timestamp type write error
Browse files Browse the repository at this point in the history
  • Loading branch information
liumengkai committed Dec 7, 2022
1 parent 2327b6f commit c3c444a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chunjun-connectors/chunjun-connector-hdfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<name>ChunJun : Connectors : HDFS</name>

<properties>
<hive.version>3.0.0</hive.version>
<hive.version>3.1.3</hive.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,13 @@ protected ISerializationConverter<Object[]> createExternalConverter(String type)
case "CHAR":
return (rowData, index, data) -> data[index] = rowData.getString(index).toString();
case "TIMESTAMP":
return (rowData, index, data) ->
data[index] = rowData.getTimestamp(index, 6).toTimestamp();
return (rowData, index, data) -> {
Timestamp ts = rowData.getTimestamp(index, 6).toTimestamp();
int nanos = ts.getNanos();
data[index] =
org.apache.hadoop.hive.common.type.Timestamp.ofEpochMilli(
ts.getTime(), nanos);
};
case "DATE":
return (rowData, index, data) ->
data[index] = new Date(rowData.getTimestamp(index, 6).getMillisecond());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static ObjectInspector columnTypeToObjectInspetor(ColumnType columnType)
case TIMESTAMP:
objectInspector =
ObjectInspectorFactory.getReflectionObjectInspector(
java.sql.Timestamp.class,
org.apache.hadoop.hive.common.type.Timestamp.class,
ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
break;
case DATE:
Expand Down

0 comments on commit c3c444a

Please sign in to comment.