Java Code Examples for org.apache.kudu.client.PartialRow#getInt()

The following examples show how to use org.apache.kudu.client.PartialRow#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KuduTableProperties.java    From presto with Apache License 2.0 6 votes vote down vote up
private static Object toValue(Schema schema, PartialRow bound, Integer idx)
{
    Type type = schema.getColumnByIndex(idx).getType();
    switch (type) {
        case UNIXTIME_MICROS:
            long millis = bound.getLong(idx) / 1000;
            return ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC).print(millis);
        case STRING:
            return bound.getString(idx);
        case INT64:
            return bound.getLong(idx);
        case INT32:
            return bound.getInt(idx);
        case INT16:
            return bound.getShort(idx);
        case INT8:
            return (short) bound.getByte(idx);
        case BOOL:
            return bound.getBoolean(idx);
        case BINARY:
            return bound.getBinaryCopy(idx);
        default:
            throw new IllegalStateException("Unhandled type " + type + " for range partition");
    }
}
 
Example 2
Source File: KuduTableProperties.java    From presto-kudu with Apache License 2.0 6 votes vote down vote up
private static Object toValue(Schema schema, PartialRow bound, Integer idx) {
    Type type = schema.getColumnByIndex(idx).getType();
    switch (type) {
        case UNIXTIME_MICROS:
            long millis = bound.getLong(idx) / 1000;
            return ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC).print(millis);
        case STRING:
            return bound.getString(idx);
        case INT64:
            return bound.getLong(idx);
        case INT32:
            return bound.getInt(idx);
        case INT16:
            return bound.getShort(idx);
        case INT8:
            short s = bound.getByte(idx);
            return s;
        case BOOL:
            return bound.getBoolean(idx);
        case BINARY:
            return bound.getBinaryCopy(idx);
        default:
            throw new IllegalStateException("Unhandled type " + type + " for range partition");
    }
}