Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static org.apache.kudu.Type toKuduClientType(Type type)
if (type instanceof VarcharType) {
return org.apache.kudu.Type.STRING;
}
if (type == TimestampType.TIMESTAMP) {
if (type.equals(TimestampType.TIMESTAMP)) {
return org.apache.kudu.Type.UNIXTIME_MICROS;
}
if (type == BigintType.BIGINT) {
Expand Down Expand Up @@ -131,7 +131,7 @@ public static Object getJavaValue(Type type, Object nativeValue)
if (type instanceof VarcharType) {
return ((Slice) nativeValue).toStringUtf8();
}
if (type == TimestampType.TIMESTAMP) {
if (type.equals(TimestampType.TIMESTAMP)) {
return ((Long) nativeValue) * 1000;
}
if (type == BigintType.BIGINT) {
Expand Down Expand Up @@ -177,7 +177,7 @@ public static Object getObject(Type type, RowResult row, int field)
if (type instanceof VarcharType) {
return row.getString(field);
}
if (type == TimestampType.TIMESTAMP) {
if (type.equals(TimestampType.TIMESTAMP)) {
return row.getLong(field) / 1000;
}
if (type == BigintType.BIGINT) {
Expand Down Expand Up @@ -212,7 +212,7 @@ public static Object getObject(Type type, RowResult row, int field)

public static long getLong(Type type, RowResult row, int field)
{
if (type == TimestampType.TIMESTAMP) {
if (type.equals(TimestampType.TIMESTAMP)) {
return row.getLong(field) / 1000;
}
if (type == BigintType.BIGINT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static Optional<Collection<Object>> extractDiscreteValues(ValueSet valueS
@VisibleForTesting
public static boolean checkInBloomFilter(BloomFilter bloomFilter, Object predicateValue, Type sqlType)
{
if (sqlType == TINYINT || sqlType == SMALLINT || sqlType == INTEGER || sqlType == BIGINT || sqlType == DATE || sqlType == TIMESTAMP) {
if (sqlType == TINYINT || sqlType == SMALLINT || sqlType == INTEGER || sqlType == BIGINT || sqlType == DATE || sqlType.equals(TIMESTAMP)) {
return bloomFilter.testLong(((Number) predicateValue).longValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public RaptorPageSink(
if (temporalColumnHandle.isPresent() && columnIds.contains(temporalColumnHandle.get().getColumnId())) {
temporalColumnIndex = OptionalInt.of(columnIds.indexOf(temporalColumnHandle.get().getColumnId()));
temporalColumnType = Optional.of(columnTypes.get(temporalColumnIndex.getAsInt()));
checkArgument(temporalColumnType.get() == DATE || temporalColumnType.get() == TIMESTAMP,
checkArgument(temporalColumnType.get() == DATE || temporalColumnType.get().equals(TIMESTAMP),
"temporalColumnType can only be DATE or TIMESTAMP");
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ private Type getType(ColumnMetadata<OrcType> types, OrcColumnId columnId)
static Type toOrcFileType(Type raptorType, TypeManager typeManager)
{
// TIMESTAMPS are stored as BIGINT to void the poor encoding in ORC
if (raptorType == TimestampType.TIMESTAMP) {
if (raptorType.equals(TimestampType.TIMESTAMP)) {
return BIGINT;
}
if (raptorType instanceof ArrayType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final long getLong()

Type type = columnHandle.getType();

if (type == TIME || type == TIME_WITH_TIME_ZONE) {
if (type.equals(TIME) || type.equals(TIME_WITH_TIME_ZONE)) {
if (millis < 0 || millis >= TimeUnit.DAYS.toMillis(1)) {
throw new PrestoException(
DECODER_CONVERSION_NOT_SUPPORTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ public long getLong()

try {
String textValue = value.asText();
if (columnType == TIMESTAMP) {
if (columnType.equals(TIMESTAMP)) {
// Equivalent to: ISO_DATE_TIME.parse(textValue, LocalDateTime::from).toInstant(UTC).toEpochMilli();
TemporalAccessor parseResult = ISO_DATE_TIME.parse(textValue);
return TimeUnit.DAYS.toMillis(parseResult.getLong(EPOCH_DAY)) + parseResult.getLong(MILLI_OF_DAY);
}
if (columnType == TIMESTAMP_WITH_TIME_ZONE) {
if (columnType.equals(TIMESTAMP_WITH_TIME_ZONE)) {
// Equivalent to:
// ZonedDateTime dateTime = ISO_OFFSET_DATE_TIME.parse(textValue, ZonedDateTime::from);
// packDateTimeWithZone(dateTime.toInstant().toEpochMilli(), getTimeZoneKey(dateTime.getZone().getId()));
TemporalAccessor parseResult = ISO_OFFSET_DATE_TIME.parse(textValue);
return packDateTimeWithZone(parseResult.getLong(INSTANT_SECONDS) * 1000 + parseResult.getLong(MILLI_OF_SECOND), getTimeZoneKey(ZoneId.from(parseResult).getId()));
}
if (columnType == TIME) {
if (columnType.equals(TIME)) {
return ISO_TIME.parse(textValue).getLong(MILLI_OF_DAY);
}
if (columnType == TIME_WITH_TIME_ZONE) {
if (columnType.equals(TIME_WITH_TIME_ZONE)) {
TemporalAccessor parseResult = ISO_OFFSET_TIME.parse(textValue);
return packDateTimeWithZone(parseResult.get(MILLI_OF_DAY), getTimeZoneKey(ZoneId.from(parseResult).getId()));
}
Expand Down