Skip to content

Commit a4bd5a5

Browse files
committed
Impl methods
1 parent 228f735 commit a4bd5a5

File tree

6 files changed

+54
-0
lines changed

6 files changed

+54
-0
lines changed

common/src/java/org/apache/hadoop/hive/common/type/TimestampNano.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@
1919
package org.apache.hadoop.hive.common.type;
2020

2121
public class TimestampNano extends Timestamp {
22+
23+
public TimestampNano(Timestamp ts) {
24+
super(ts);
25+
}
2226
}

common/src/java/org/apache/hadoop/hive/common/type/TimestampNanoTZ.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,10 @@
1818

1919
package org.apache.hadoop.hive.common.type;
2020

21+
import java.time.ZonedDateTime;
22+
2123
public class TimestampNanoTZ extends TimestampTZ {
24+
public TimestampNanoTZ(ZonedDateTime zonedDateTime) {
25+
super(zonedDateTime);
26+
}
2227
}

iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergNanosecondTimestampObjectInspectorHive3.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
package org.apache.iceberg.mr.hive.serde.objectinspector;
2121

22+
import org.apache.hadoop.hive.common.type.Timestamp;
23+
import org.apache.hadoop.hive.common.type.TimestampNano;
24+
import org.apache.hadoop.hive.serde2.io.TimestampNanoWritable;
2225
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
2326

2427
public class IcebergNanosecondTimestampObjectInspectorHive3 extends IcebergTimestampObjectInspectorHive3 {
@@ -34,4 +37,18 @@ private IcebergNanosecondTimestampObjectInspectorHive3() {
3437
super(TypeInfoFactory.timestampNanoTypeInfo);
3538
}
3639

40+
@Override
41+
public TimestampNano getPrimitiveJavaObject(Object o) {
42+
Timestamp timestamp = super.getPrimitiveJavaObject(o);
43+
if (timestamp == null) {
44+
return null;
45+
}
46+
return new TimestampNano(timestamp);
47+
}
48+
49+
@Override
50+
public TimestampNanoWritable getPrimitiveWritableObject(Object o) {
51+
TimestampNano ts = getPrimitiveJavaObject(o);
52+
return ts == null ? null : new TimestampNanoWritable(ts);
53+
}
3754
}

iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergNanosecondTimestampWithZoneObjectInspectorHive3.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
package org.apache.iceberg.mr.hive.serde.objectinspector;
2121

22+
import org.apache.hadoop.hive.common.type.TimestampNanoTZ;
23+
import org.apache.hadoop.hive.common.type.TimestampTZ;
24+
import org.apache.hadoop.hive.serde2.io.TimestampNanoTZWritable;
2225
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
2326

2427
public class IcebergNanosecondTimestampWithZoneObjectInspectorHive3
@@ -34,4 +37,19 @@ public static IcebergNanosecondTimestampWithZoneObjectInspectorHive3 get() {
3437
private IcebergNanosecondTimestampWithZoneObjectInspectorHive3() {
3538
super(TypeInfoFactory.timestampNanosTZTypeInfo);
3639
}
40+
41+
@Override
42+
public TimestampNanoTZ getPrimitiveJavaObject(Object o) {
43+
TimestampTZ ttz = super.getPrimitiveJavaObject(o);
44+
if (ttz == null) {
45+
return null;
46+
}
47+
return new TimestampNanoTZ(ttz.getZonedDateTime());
48+
}
49+
50+
@Override
51+
public TimestampNanoTZWritable getPrimitiveWritableObject(Object o) {
52+
TimestampNanoTZ tsTz = getPrimitiveJavaObject(o);
53+
return tsTz == null ? null : new TimestampNanoTZWritable(tsTz);
54+
}
3755
}

serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampNanoTZWritable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,10 @@
1818

1919
package org.apache.hadoop.hive.serde2.io;
2020

21+
import org.apache.hadoop.hive.common.type.TimestampNanoTZ;
22+
2123
public class TimestampNanoTZWritable extends TimestampLocalTZWritable {
24+
public TimestampNanoTZWritable(TimestampNanoTZ tsTz) {
25+
super(tsTz);
26+
}
2227
}

serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampNanoWritable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,10 @@
1818

1919
package org.apache.hadoop.hive.serde2.io;
2020

21+
import org.apache.hadoop.hive.common.type.TimestampNano;
22+
2123
public class TimestampNanoWritable extends TimestampWritableV2 {
24+
public TimestampNanoWritable(TimestampNano ts) {
25+
super(ts);
26+
}
2227
}

0 commit comments

Comments
 (0)