@Override public void setField(Block block, int position) { long millisUtc = TimestampType.TIMESTAMP.getLong(block, position); value.setTime(millisUtc); rowInspector.setStructFieldData(row, field, value); } }
public TimestampWritable evaluate(TimestampWritable t) { if (t == null) { return null; } final long originalTimestamp = t.getTimestamp().getTime(); // default final long originalTimestampUTC = new DateTime(originalTimestamp) .withZoneRetainFields(DateTimeZone.UTC).getMillis(); // default -> utc final long newTimestampUTC = granularity.truncate(originalTimestampUTC); // utc final long newTimestamp = new DateTime(newTimestampUTC, DateTimeZone.UTC) .withZoneRetainFields(DateTimeZone.getDefault()).getMillis(); // utc -> default result.setTime(newTimestamp); return result; }
case TIMESTAMP: TimestampWritable timestampWritable = new TimestampWritable(); timestampWritable.setTime(TS_PARSER.get().parseMillis(value.textValue())); return timestampWritable;
@Override public void setField(Block block, int position) { long millisUtc = TimestampType.TIMESTAMP.getLong(block, position); value.setTime(millisUtc); rowInspector.setStructFieldData(row, field, value); } }
@Override public void setField(Block block, int position) { long millisUtc = TimestampType.TIMESTAMP.getLong(block, position); value.setTime(millisUtc); rowInspector.setStructFieldData(row, field, value); } }
case TIMESTAMP: TimestampWritable timestampWritable = new TimestampWritable(); timestampWritable.setTime(TS_PARSER.get().parseMillis(value.textValue())); return timestampWritable;
public static Writable convertDatum2Writable(Datum value) { switch(value.kind()) { case INT1: return new ByteWritable(value.asByte()); case INT2: return new ShortWritable(value.asInt2()); case INT4: return new IntWritable(value.asInt4()); case INT8: return new LongWritable(value.asInt8()); case FLOAT4: return new FloatWritable(value.asFloat4()); case FLOAT8: return new DoubleWritable(value.asFloat8()); // NOTE: value should be DateDatum case DATE: return new DateWritable(value.asInt4() - DateTimeConstants.UNIX_EPOCH_JDATE); // NOTE: value should be TimestampDatum case TIMESTAMP: TimestampWritable result = new TimestampWritable(); result.setTime(DateTimeUtil.julianTimeToJavaTime(value.asInt8())); return result; case CHAR: { String str = value.asChars(); return new HiveCharWritable(new HiveChar(str, str.length())); } case TEXT: return new Text(value.asChars()); case VARBINARY: return new BytesWritable(value.asByteArray()); case NULL_TYPE: return null; } throw new TajoRuntimeException(new NotImplementedException(TypeStringEncoder.encode(value.type()))); }
LazyObjectBase lz = fields[fieldID]; if (lz instanceof LazyTimestamp) { ((LazyTimestamp) lz).getWritableObject().setTime(timestamp); } else { ((LazyLong) lz).getWritableObject().set(timestamp);