@Override public int compareTo(TimestampLocalTZWritable o) { return getTimestampTZ().compareTo(o.getTimestampTZ()); }
@Override public int hashCode() { return getTimestampTZ().hashCode(); }
public TimestampLocalTZWritable evaluate(TimestampLocalTZWritable t) { if (t == null) { return null; } final ZonedDateTime localZDT = t.getTimestampTZ().getZonedDateTime(); // default final long originalTimestampUTC = localZDT.withZoneSameLocal(ZoneOffset.UTC) .toInstant().toEpochMilli(); // default -> utc final long newTimestampUTC = granularity.truncate(originalTimestampUTC); // utc final ZonedDateTime newLocalZDT = ZonedDateTime.of( LocalDateTime.ofInstant(Instant.ofEpochMilli(newTimestampUTC), ZoneOffset.UTC), localZDT.getZone()); // utc -> default resultTSLTZ.set(new TimestampTZ(newLocalZDT)); return resultTSLTZ; }
public void set(TimestampLocalTZWritable t) { if (t.bytesEmpty) { set(t.getTimestampTZ()); } else if (t.currentBytes == t.externalBytes) { set(t.currentBytes, t.offset, t.timeZone); } else { set(t.currentBytes, 0, t.timeZone); } }
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampLocalTZWritable t = (TimestampLocalTZWritable) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setTimeZone(timestampTZTypeInfo.timeZone()); } return t.getTimestampTZ(); }
@Override public Object set(Object o, TimestampLocalTZWritable t) { if (t == null) { return null; } TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.getTimestampTZ().setZonedDateTime( t.getTimestampTZ().getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } ((TimestampLocalTZWritable) o).set(t); return o; }
public TimestampLocalTZWritable(TimestampLocalTZWritable other) { this(other.getBytes(), 0, other.getTimestampTZ().getZonedDateTime().getZone()); }
@Override public Object set(Object o, TimestampLocalTZWritable t) { if (t == null) { return null; } ((TimestampTZ) o).setZonedDateTime( t.getTimestampTZ().getZonedDateTime().withZoneSameInstant(((TimestampLocalTZTypeInfo) typeInfo).timeZone())); return o; }
@Override public TimestampLocalTZWritable getPrimitiveWritableObject(Object o) { if (o == null) { return null; } TimestampLocalTZWritable t = (TimestampLocalTZWritable) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setTimeZone(timestampTZTypeInfo.timeZone()); } return t; }
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampTZ t = ((LazyTimestampLocalTZ) o).getWritableObject().getTimestampTZ(); TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime(t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } return t; }
return ((TimestampLocalTZObjectInspector) oi).getPrimitiveWritableObject(o).getTimestampTZ();
assertEquals( new TimestampTZ(Instant.ofEpochMilli(473414400000L).atZone(ZoneId.of("America/Los_Angeles"))), i1.getTimestampTZ()); assertEquals( new TimestampTZ(Instant.ofEpochMilli(489049200000L).atZone(ZoneId.of("America/Los_Angeles"))), i2.getTimestampTZ()); assertEquals( new TimestampTZ(Instant.ofEpochMilli(491727600000L).atZone(ZoneId.of("America/Los_Angeles"))), i3.getTimestampTZ()); assertEquals( new TimestampTZ(Instant.ofEpochMilli(493887600000L).atZone(ZoneId.of("America/Los_Angeles"))), i4.getTimestampTZ()); assertEquals( new TimestampTZ(Instant.ofEpochMilli(494233200000L).atZone(ZoneId.of("America/Los_Angeles"))), i5.getTimestampTZ()); assertEquals( new TimestampTZ(Instant.ofEpochMilli(494240400000L).atZone(ZoneId.of("America/Los_Angeles"))), i6.getTimestampTZ()); assertEquals( new TimestampTZ(Instant.ofEpochMilli(494243220000L).atZone(ZoneId.of("America/Los_Angeles"))), i7.getTimestampTZ()); assertEquals(
case TIMESTAMPLOCALTZ: TimestampTZ tsz = ((TimestampLocalTZWritable) converter.convert(argument.get())) .getTimestampTZ(); return Date.ofEpochMilli(tsz.getEpochSecond() * 1000l); default:
@Override public int compareTo(TimestampLocalTZWritable o) { return getTimestampTZ().compareTo(o.getTimestampTZ()); }
@Override public int hashCode() { return getTimestampTZ().hashCode(); }
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampLocalTZWritable t = (TimestampLocalTZWritable) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setTimeZone(timestampTZTypeInfo.timeZone()); } return t.getTimestampTZ(); }
public void set(TimestampLocalTZWritable t) { if (t.bytesEmpty) { set(t.getTimestampTZ()); } else if (t.currentBytes == t.externalBytes) { set(t.currentBytes, t.offset, t.timeZone); } else { set(t.currentBytes, 0, t.timeZone); } }
@Override public Object set(Object o, TimestampLocalTZWritable t) { if (t == null) { return null; } ((TimestampTZ) o).setZonedDateTime( t.getTimestampTZ().getZonedDateTime().withZoneSameInstant(((TimestampLocalTZTypeInfo) typeInfo).timeZone())); return o; }
@Override public TimestampLocalTZWritable getPrimitiveWritableObject(Object o) { if (o == null) { return null; } TimestampLocalTZWritable t = (TimestampLocalTZWritable) o; TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getTimestampTZ().getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setTimeZone(timestampTZTypeInfo.timeZone()); } return t; }
@Override public TimestampTZ getPrimitiveJavaObject(Object o) { if (o == null) { return null; } TimestampTZ t = ((LazyTimestampLocalTZ) o).getWritableObject().getTimestampTZ(); TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime(t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } return t; }