Java Code Examples for org.apache.kudu.client.RowResult#getByte()
The following examples show how to use
org.apache.kudu.client.RowResult#getByte() .
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: TypeHelper.java From presto-kudu with Apache License 2.0 | 6 votes |
public static long getLong(Type type, RowResult row, int field) { if (type == TimestampType.TIMESTAMP) { return row.getLong(field) / 1000; } else if (type == BigintType.BIGINT) { return row.getLong(field); } else if (type == IntegerType.INTEGER) { return row.getInt(field); } else if (type == SmallintType.SMALLINT) { return row.getShort(field); } else if (type == TinyintType.TINYINT) { return row.getByte(field); } else if (type == RealType.REAL) { return floatToRawIntBits(row.getFloat(field)); } else if (type instanceof DecimalType) { DecimalType dtype = (DecimalType) type; if (dtype.isShort()) { return row.getDecimal(field).unscaledValue().longValue(); } else { throw new IllegalStateException("getLong not supported for long decimal: " + type); } } else { throw new IllegalStateException("getLong not implemented for " + type); } }
Example 2
Source File: TypeHelper.java From presto with Apache License 2.0 | 5 votes |
public static Object getObject(Type type, RowResult row, int field) { if (row.isNull(field)) { return null; } if (type instanceof VarcharType) { return row.getString(field); } if (type.equals(TimestampType.TIMESTAMP)) { return row.getLong(field) / 1000; } if (type == BigintType.BIGINT) { return row.getLong(field); } if (type == IntegerType.INTEGER) { return row.getInt(field); } if (type == SmallintType.SMALLINT) { return row.getShort(field); } if (type == TinyintType.TINYINT) { return row.getByte(field); } if (type == DoubleType.DOUBLE) { return row.getDouble(field); } if (type == RealType.REAL) { return row.getFloat(field); } if (type == BooleanType.BOOLEAN) { return row.getBoolean(field); } if (type instanceof VarbinaryType) { return Slices.wrappedBuffer(row.getBinary(field)); } if (type instanceof DecimalType) { return row.getDecimal(field); } throw new IllegalStateException("getObject not implemented for " + type); }
Example 3
Source File: TypeHelper.java From presto with Apache License 2.0 | 5 votes |
public static long getLong(Type type, RowResult row, int field) { if (type.equals(TimestampType.TIMESTAMP)) { return row.getLong(field) / 1000; } if (type == BigintType.BIGINT) { return row.getLong(field); } if (type == IntegerType.INTEGER) { return row.getInt(field); } if (type == SmallintType.SMALLINT) { return row.getShort(field); } if (type == TinyintType.TINYINT) { return row.getByte(field); } if (type == RealType.REAL) { return floatToRawIntBits(row.getFloat(field)); } if (type instanceof DecimalType) { DecimalType dtype = (DecimalType) type; if (dtype.isShort()) { return row.getDecimal(field).unscaledValue().longValue(); } throw new IllegalStateException("getLong not supported for long decimal: " + type); } throw new IllegalStateException("getLong not implemented for " + type); }
Example 4
Source File: TypeHelper.java From presto-kudu with Apache License 2.0 | 5 votes |
public static Object getObject(Type type, RowResult row, int field) { if (row.isNull(field)) { return null; } else { if (type instanceof VarcharType) { return row.getString(field); } else if (type == TimestampType.TIMESTAMP) { return row.getLong(field) / 1000; } else if (type == BigintType.BIGINT) { return row.getLong(field); } else if (type == IntegerType.INTEGER) { return row.getInt(field); } else if (type == SmallintType.SMALLINT) { return row.getShort(field); } else if (type == TinyintType.TINYINT) { return row.getByte(field); } else if (type == DoubleType.DOUBLE) { return row.getDouble(field); } else if (type == RealType.REAL) { return row.getFloat(field); } else if (type == BooleanType.BOOLEAN) { return row.getBoolean(field); } else if (type instanceof VarbinaryType) { return Slices.wrappedBuffer(row.getBinary(field)); } else if (type instanceof DecimalType) { return row.getDecimal(field); } else { throw new IllegalStateException("getObject not implemented for " + type); } } }
Example 5
Source File: KuduRow.java From geowave with Apache License 2.0 | 5 votes |
public KuduRow(final RowResult row) { super(getFieldValues(row)); partitionKey = row.getBinaryCopy(KuduField.GW_PARTITION_ID_KEY.getFieldName()); adapterId = row.getShort(KuduField.GW_ADAPTER_ID_KEY.getFieldName()); sortKey = row.getBinaryCopy(KuduField.GW_SORT_KEY.getFieldName()); dataId = row.getBinaryCopy(KuduField.GW_DATA_ID_KEY.getFieldName()); fieldVisibility = row.getBinaryCopy(KuduField.GW_FIELD_VISIBILITY_KEY.getFieldName()); nanoTime = row.getBinaryCopy(KuduField.GW_NANO_TIME_KEY.getFieldName()); fieldMask = row.getBinaryCopy(KuduField.GW_FIELD_MASK_KEY.getFieldName()); value = row.getBinaryCopy(KuduField.GW_VALUE_KEY.getFieldName()); numDuplicates = row.getByte(KuduField.GW_NUM_DUPLICATES_KEY.getFieldName()); }