public TimestampLocalTZWritable(TimestampTZ tstz) { set(tstz); }
public TimestampLocalTZWritable(byte[] bytes, int offset, ZoneId timeZone) { set(bytes, offset, timeZone); }
@Override public void init(ByteArrayRef bytes, int start, int length) { data.set(bytes.getData(), start, timeZone); } }
@Override public Object set(Object o, byte[] bytes, int offset) { ((TimestampLocalTZWritable) o).set(bytes, offset, ((TimestampLocalTZTypeInfo) typeInfo).timeZone()); return o; }
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; }
@Override public void init(ByteArrayRef bytes, int start, int length) { String s = null; if (!LazyUtils.isDateMaybe(bytes.getData(), start, length)) { isNull = true; return; } TimestampTZ t = null; try { s = new String(bytes.getData(), start, length, StandardCharsets.US_ASCII); if (s.equals("NULL")) { isNull = true; logExceptionMessage(bytes, start, length, serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME.toUpperCase()); } else { t = TimestampTZUtil.parse(s, timeZone); isNull = false; } } catch (DateTimeParseException e) { isNull = true; logExceptionMessage(bytes, start, length, serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME.toUpperCase()); } data.set(t); }
@Override public Object set(Object o, TimestampTZ t) { if (t == null) { return null; } TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime(t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } ((TimestampLocalTZWritable) o).set(t); return o; }
@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(TimestampTZ tstz) { set(tstz); }
public TimestampLocalTZWritable(byte[] bytes, int offset, ZoneId timeZone) { set(bytes, offset, timeZone); }
@Override public Object set(Object o, byte[] bytes, int offset) { ((TimestampLocalTZWritable) o).set(bytes, offset, ((TimestampLocalTZTypeInfo) typeInfo).timeZone()); return o; }
@Override public void init(ByteArrayRef bytes, int start, int length) { data.set(bytes.getData(), start, timeZone); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { String s = null; if (!LazyUtils.isDateMaybe(bytes.getData(), start, length)) { isNull = true; return; } TimestampTZ t = null; try { s = new String(bytes.getData(), start, length, "US-ASCII"); if (s.equals("NULL")) { isNull = true; logExceptionMessage(bytes, start, length, serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME.toUpperCase()); } else { t = TimestampTZUtil.parse(s, timeZone); isNull = false; } } catch (UnsupportedEncodingException e) { isNull = true; LOG.error("Unsupported encoding found ", e); } catch (DateTimeParseException e) { isNull = true; logExceptionMessage(bytes, start, length, serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME.toUpperCase()); } data.set(t); }
@Override public Object set(Object o, TimestampTZ t) { if (t == null) { return null; } TimestampLocalTZTypeInfo timestampTZTypeInfo = (TimestampLocalTZTypeInfo) typeInfo; if (!t.getZonedDateTime().getZone().equals(timestampTZTypeInfo.timeZone())) { t.setZonedDateTime(t.getZonedDateTime().withZoneSameInstant(timestampTZTypeInfo.timeZone())); } ((TimestampLocalTZWritable) o).set(t); return o; }
@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; }