Java Code Examples for io.airlift.slice.Slices#wrappedLongArray()
The following examples show how to use
io.airlift.slice.Slices#wrappedLongArray() .
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: DecimalColumnReader.java From presto with Apache License 2.0 | 6 votes |
private Block readLongNotNullBlock() throws IOException { verifyNotNull(decimalStream); verifyNotNull(scaleStream); long[] data = new long[nextBatchSize * 2]; decimalStream.nextLongDecimal(data, nextBatchSize); for (int offset = 0; offset < data.length; offset += 2) { long sourceScale = scaleStream.next(); if (sourceScale != type.getScale()) { Slice decimal = Slices.wrappedLongArray(data[offset], data[offset + 1]); UnscaledDecimal128Arithmetic.rescale(decimal, (int) (type.getScale() - sourceScale), Slices.wrappedLongArray(data, offset, 2)); } } return new Int128ArrayBlock(nextBatchSize, Optional.empty(), data); }
Example 2
Source File: DecimalColumnReader.java From presto with Apache License 2.0 | 5 votes |
private Block readLongNullBlock(boolean[] isNull, int nonNullCount) throws IOException { verifyNotNull(decimalStream); verifyNotNull(scaleStream); int minTempSize = minNonNullValueSize(nonNullCount) * 2; if (nonNullValueTemp.length < minTempSize) { nonNullValueTemp = new long[minTempSize]; systemMemoryContext.setBytes(sizeOf(nonNullValueTemp)); } decimalStream.nextLongDecimal(nonNullValueTemp, nonNullCount); // rescale if necessary for (int offset = 0; offset < nonNullCount * 2; offset += 2) { long sourceScale = scaleStream.next(); if (sourceScale != type.getScale()) { Slice decimal = Slices.wrappedLongArray(nonNullValueTemp[offset], nonNullValueTemp[offset + 1]); UnscaledDecimal128Arithmetic.rescale(decimal, (int) (type.getScale() - sourceScale), Slices.wrappedLongArray(nonNullValueTemp, offset, 2)); } } long[] result = unpackInt128Nulls(nonNullValueTemp, isNull); return new Int128ArrayBlock(nextBatchSize, Optional.of(isNull), result); }
Example 3
Source File: TestLongDecimalStream.java From presto with Apache License 2.0 | 5 votes |
@Override protected Slice readValue(DecimalInputStream valueStream) throws IOException { long[] decimal = new long[2]; valueStream.nextLongDecimal(decimal, 1); return Slices.wrappedLongArray(decimal); }
Example 4
Source File: UuidType.java From presto with Apache License 2.0 | 5 votes |
@Override public final Slice getSlice(Block block, int position) { return Slices.wrappedLongArray( block.getLong(position, 0), block.getLong(position, SIZE_OF_LONG)); }
Example 5
Source File: IpAddressType.java From presto with Apache License 2.0 | 5 votes |
@Override public final Slice getSlice(Block block, int position) { return Slices.wrappedLongArray( block.getLong(position, 0), block.getLong(position, SIZE_OF_LONG)); }
Example 6
Source File: TestApproximateCountDistinctLongDecimal.java From presto with Apache License 2.0 | 5 votes |
@Override protected Object randomValue() { long low = ThreadLocalRandom.current().nextLong(); long high = ThreadLocalRandom.current().nextLong(); return Slices.wrappedLongArray(low, high); }
Example 7
Source File: UnscaledDecimal128Arithmetic.java From presto with Apache License 2.0 | 5 votes |
public static Slice unscaledDecimal(long unscaledValue) { long[] longs = new long[NUMBER_OF_LONGS]; if (unscaledValue < 0) { longs[0] = -unscaledValue; longs[1] = SIGN_LONG_MASK; } else { longs[0] = unscaledValue; } return Slices.wrappedLongArray(longs); }
Example 8
Source File: LongDecimalType.java From presto with Apache License 2.0 | 5 votes |
@Override public Slice getSlice(Block block, int position) { return Slices.wrappedLongArray( block.getLong(position, 0), block.getLong(position, SIZE_OF_LONG)); }
Example 9
Source File: TestUuidType.java From presto with Apache License 2.0 | 4 votes |
@Override protected Object getGreaterValue(Object value) { Slice slice = (Slice) value; return Slices.wrappedLongArray(slice.getLong(0), slice.getLong(1) + 1); }
Example 10
Source File: TestUuidType.java From presto with Apache License 2.0 | 4 votes |
@Override protected Object getNonNullValue() { return Slices.wrappedLongArray(0, 0); }