use of com.facebook.presto.spi.type.TimestampType in project carbondata by apache.
the class CarbondataRecordCursor method getLong.
@Override
public long getLong(int field) {
Object obj = getFieldValue(field);
Long timeStr = 0L;
if (obj instanceof Integer) {
timeStr = ((Integer) obj).longValue();
} else if (obj instanceof Long) {
timeStr = (Long) obj;
} else {
timeStr = Math.round(Double.parseDouble(obj.toString()));
}
Type actual = getType(field);
if (actual instanceof TimestampType) {
return new Timestamp(timeStr).getTime() / 1000;
} else if (isShortDecimal(actual)) {
return shortDecimalPartitionKey(obj.toString(), (DecimalType) actual, columnHandles.get(field).getColumnName());
}
// suppose the
return timeStr;
}
Aggregations