@Override Object extractValue(Block block, int position) { return TIMESTAMP.getLong(block, position); }
@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 writeJsonValue(JsonGenerator jsonGenerator, Block block, int position, ConnectorSession session) throws IOException { if (block.isNull(position)) { jsonGenerator.writeNull(); } else { long value = TIMESTAMP.getLong(block, position); jsonGenerator.writeString(printTimestampWithoutTimeZone(session.getTimeZoneKey(), value)); } } }
@SqlType(StandardTypes.BOOLEAN) public static boolean isDistinctFrom( @BlockPosition @SqlType(value = StandardTypes.TIMESTAMP, nativeContainerType = long.class) Block left, @BlockIndex int leftPosition, @BlockPosition @SqlType(value = StandardTypes.TIMESTAMP, nativeContainerType = long.class) Block right, @BlockIndex int rightPosition) { if (left.isNull(leftPosition) != right.isNull(rightPosition)) { return true; } if (left.isNull(leftPosition)) { return false; } return notEqual(TIMESTAMP.getLong(left, leftPosition), TIMESTAMP.getLong(right, rightPosition)); } }
long mills = TIMESTAMP.getLong(block, position); if (mills > -1000 && mills < 0) { return AbstractLongType.hash(mills + 1000);
@Override Object extractValue(Block block, int position) { return TIMESTAMP.getLong(block, position); }
public int getDay(Type type, Block block, int position) { if (type.equals(DATE)) { return toIntExact(DATE.getLong(block, position)); } if (type.equals(TIMESTAMP)) { long millis = TIMESTAMP.getLong(block, position); long local = timeZone.convertUTCToLocal(millis); long days = MILLISECONDS.toDays(local); return toIntExact(days); } throw new IllegalArgumentException("Wrong type for temporal column: " + type); }
@Override public void setField(Block block, int position) { long millisUtc = TimestampType.TIMESTAMP.getLong(block, position); value.setTime(millisUtc); rowInspector.setStructFieldData(row, field, value); } }
long mills = TIMESTAMP.getLong(block, position); if (mills > -1000 && mills < 0) { return AbstractLongType.hash(mills + 1000);
return Ints.checkedCast(days); case TIMESTAMP: long millisSinceEpoch = TIMESTAMP.getLong(block, position);