@Override Object extractValue(Block block, int position) { return BIGINT.getLong(block, position); }
@Override public long hashPosition(int position, Page page) { return BigintType.BIGINT.getLong(page.getBlock(hashChannel), position); }
private static long getRowCount(Collection<ComputedStatistics> computedStatistics) { return computedStatistics.stream() .map(statistics -> statistics.getTableStatistics().get(ROW_COUNT)) .filter(Objects::nonNull) .mapToLong(block -> BIGINT.getLong(block, 0)) .reduce((first, second) -> first + second) .orElse(0L); }
private static long getRowCount(Collection<ComputedStatistics> computedStatistics) { return computedStatistics.stream() .map(statistics -> statistics.getTableStatistics().get(ROW_COUNT)) .filter(Objects::nonNull) .mapToLong(block -> BIGINT.getLong(block, 0)) .reduce((first, second) -> first + second) .orElse(0L); }
public SingleTypedHistogram(Block block, Type type, int expectedSize) { this(type, expectedSize); requireNonNull(block, "block is null"); for (int i = 0; i < block.getPositionCount(); i += 2) { add(i, block, BIGINT.getLong(block, i + 1)); } }
public static FeatureVector toFeatures(Block map) { Map<Integer, Double> features = new HashMap<>(); if (map != null) { for (int position = 0; position < map.getPositionCount(); position += 2) { features.put((int) BIGINT.getLong(map, position), DOUBLE.getDouble(map, position + 1)); } } return new FeatureVector(features); } }
@Override public void setField(Block block, int position) { value.set(BigintType.BIGINT.getLong(block, position)); rowInspector.setStructFieldData(row, field, value); } }
@Override public void deserialize(Block block, int index, NullableLongState state) { state.setNull(false); state.setLong(BIGINT.getLong(block, index)); } }
public long getCurrentJoinPosition(LookupSource lookupSource) { if (currentRowContainsNull()) { return -1; } if (probeHashBlock.isPresent()) { long rawHash = BIGINT.getLong(probeHashBlock.get(), position); return lookupSource.getJoinPosition(position, probePage, page, rawHash); } return lookupSource.getJoinPosition(position, probePage, page); }
private static void assertCurrentBatch(OrcRecordReader reader, int rowIndex, int batchSize) throws IOException { Block block = reader.readBlock(BIGINT, 0); for (int i = 0; i < batchSize; i++) { assertEquals(BIGINT.getLong(block, i), (rowIndex + i) * 3); } }
private static void assertCurrentBatch(OrcRecordReader reader, int rowIndex, int batchSize) throws IOException { Block block = reader.readBlock(BIGINT, 0); for (int i = 0; i < batchSize; i++) { assertEquals(BIGINT.getLong(block, i), (rowIndex + i) * 3); } }
@Override public void deserialize(Block block, int index, MinMaxNState state) { Block currentBlock = (Block) serializedType.getObject(block, index); int capacity = toIntExact(BIGINT.getLong(currentBlock, 0)); Block heapBlock = arrayType.getObject(currentBlock, 1); TypedHeap heap = new TypedHeap(blockComparator, elementType, capacity); heap.addAll(heapBlock); state.setTypedHeap(heap); } }
@Override public void deserialize(Block block, int index, MinMaxNState state) { Block currentBlock = (Block) serializedType.getObject(block, index); int capacity = toIntExact(BIGINT.getLong(currentBlock, 0)); Block heapBlock = arrayType.getObject(currentBlock, 1); TypedHeap heap = new TypedHeap(blockComparator, elementType, capacity); heap.addAll(heapBlock); state.setTypedHeap(heap); } }
public static TypedKeyValueHeap deserialize(Block block, Type keyType, Type valueType, BlockComparator blockComparator) { int capacity = toIntExact(BIGINT.getLong(block, 0)); Block keysBlock = new ArrayType(keyType).getObject(block, 1); Block valuesBlock = new ArrayType(valueType).getObject(block, 2); TypedKeyValueHeap heap = new TypedKeyValueHeap(blockComparator, keyType, valueType, capacity); heap.addAll(keysBlock, valuesBlock); return heap; }
private static void checkArrayItemIsNull(Map<DecoderColumnHandle, FieldValueProvider> decodedRow, DecoderColumnHandle handle, long[] expected) { Block actualBlock = getBlock(decodedRow, handle); assertEquals(actualBlock.getPositionCount(), expected.length); for (int i = 0; i < actualBlock.getPositionCount(); i++) { assertTrue(actualBlock.isNull(i)); assertEquals(BIGINT.getLong(actualBlock, i), expected[i]); } }
private static void checkArrayValue(Map<DecoderColumnHandle, FieldValueProvider> decodedRow, DecoderColumnHandle handle, long[] expected) { Block actualBlock = getBlock(decodedRow, handle); assertEquals(actualBlock.getPositionCount(), expected.length); for (int i = 0; i < actualBlock.getPositionCount(); i++) { assertFalse(actualBlock.isNull(i)); assertEquals(BIGINT.getLong(actualBlock, i), expected[i]); } }
@SqlType(StandardTypes.BIGINT) public static long getBlockPosition(@BlockPosition @SqlType(value = StandardTypes.BIGINT, nativeContainerType = long.class) Block block, @BlockIndex int position) { hitBlockPositionBigint.set(true); return BIGINT.getLong(block, position); }
@SqlType(StandardTypes.BIGINT) public static long getBlockPosition(@BlockPosition @SqlType(value = StandardTypes.BIGINT, nativeContainerType = long.class) Block block, @BlockIndex int position) { hitBlockPositionBigint.set(true); return BIGINT.getLong(block, position); }
private static boolean filter(Page page, int position) { Block discountBlock = page.getBlock(0); Block shipDateBlock = page.getBlock(1); Block quantityBlock = page.getBlock(2); return !shipDateBlock.isNull(position) && DATE.getLong(shipDateBlock, position) >= MIN_SHIP_DATE && !shipDateBlock.isNull(position) && DATE.getLong(shipDateBlock, position) < MAX_SHIP_DATE && !discountBlock.isNull(position) && DOUBLE.getDouble(discountBlock, position) >= 0.05 && !discountBlock.isNull(position) && DOUBLE.getDouble(discountBlock, position) <= 0.07 && !quantityBlock.isNull(position) && BIGINT.getLong(quantityBlock, position) < 24; } }
private static boolean filter(Page page, int position) { Block discountBlock = page.getBlock(0); Block shipDateBlock = page.getBlock(1); Block quantityBlock = page.getBlock(2); return !shipDateBlock.isNull(position) && DATE.getLong(shipDateBlock, position) >= MIN_SHIP_DATE && !shipDateBlock.isNull(position) && DATE.getLong(shipDateBlock, position) < MAX_SHIP_DATE && !discountBlock.isNull(position) && DOUBLE.getDouble(discountBlock, position) >= 0.05 && !discountBlock.isNull(position) && DOUBLE.getDouble(discountBlock, position) <= 0.07 && !quantityBlock.isNull(position) && BIGINT.getLong(quantityBlock, position) < 24; } }