@Override public Block toBlock(Type desiredType) { checkArgument(BIGINT.equals(desiredType), "type doesn't match: %s", desiredType); int numberOfRecords = numberOfRecords(); return new LongArrayBlock( numberOfRecords, Optional.ofNullable(nulls), longs == null ? new long[numberOfRecords] : longs); }
@Override public long hashPosition(int position, Page page) { return BigintType.BIGINT.getLong(page.getBlock(hashChannel), position); }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = BIGINT.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { BIGINT.writeLong(blockBuilder, i); } return new Block[] {blockBuilder.build()}; }
private static Block buildSequenceBlock(long start, int count) { BlockBuilder builder = BIGINT.createFixedSizeBlockBuilder(count); for (int i = 0; i < count; i++) { BIGINT.writeLong(builder, start + i); } return builder.build(); }
public static Signature dereferenceSignature(Type returnType, RowType rowType) { return internalScalarFunction(DEREFERENCE, returnType.getTypeSignature(), ImmutableList.of(rowType.getTypeSignature(), BigintType.BIGINT.getTypeSignature())); } }
@Override public void processRow(BlockBuilder output, boolean newPeerGroup, int peerGroupCount, int currentPosition) { if (newPeerGroup) { rank++; } BIGINT.writeLong(output, rank); } }
public GetGroupIdsWork(Block block) { this.block = requireNonNull(block, "block is null"); // we know the exact size required for the block this.blockBuilder = BIGINT.createFixedSizeBlockBuilder(block.getPositionCount()); }
public TestPageProjectionWork(DriverYieldSignal yieldSignal, Page page, SelectedPositions selectedPositions) { this.yieldSignal = yieldSignal; this.block = page.getBlock(0); this.selectedPositions = selectedPositions; this.blockBuilder = BIGINT.createBlockBuilder(null, selectedPositions.size()); }
public static Block createLongSequenceBlock(int start, int end) { BlockBuilder builder = BIGINT.createFixedSizeBlockBuilder(end - start); for (int i = start; i < end; i++) { BIGINT.writeLong(builder, i); } return builder.build(); }
public static Signature dereferenceSignature(Type returnType, RowType rowType) { return internalScalarFunction(DEREFERENCE, returnType.getTypeSignature(), ImmutableList.of(rowType.getTypeSignature(), BigintType.BIGINT.getTypeSignature())); } }
@Override public void processRow(BlockBuilder output, boolean newPeerGroup, int peerGroupCount, int currentPosition) { if (newPeerGroup) { rank++; } BIGINT.writeLong(output, rank); } }
public GetNonDictionaryGroupIdsWork(Page page) { this.page = requireNonNull(page, "page is null"); // we know the exact size required for the block this.blockBuilder = BIGINT.createFixedSizeBlockBuilder(page.getPositionCount()); }
public TestPageProjectionWork(DriverYieldSignal yieldSignal, Page page, SelectedPositions selectedPositions) { this.yieldSignal = yieldSignal; this.block = page.getBlock(0); this.selectedPositions = selectedPositions; this.blockBuilder = BIGINT.createBlockBuilder(null, selectedPositions.size()); }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = BIGINT.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { BIGINT.writeLong(blockBuilder, i); } return new Block[] {blockBuilder.build()}; }
@Override Object extractValue(Block block, int position) { return BIGINT.getLong(block, position); }
public static Block createLongRepeatBlock(int value, int length) { BlockBuilder builder = BIGINT.createFixedSizeBlockBuilder(length); for (int i = 0; i < length; i++) { BIGINT.writeLong(builder, value); } return builder.build(); }
@Override protected List<? extends OperatorFactory> createOperatorFactories() { OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "orderkey"); InternalAggregationFunction countFunction = localQueryRunner.getMetadata().getFunctionRegistry().getAggregateFunctionImplementation( new Signature("count", AGGREGATE, BIGINT.getTypeSignature())); AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, new PlanNodeId("test"), Step.SINGLE, ImmutableList.of(countFunction.bind(ImmutableList.of(0), Optional.empty())), false); return ImmutableList.of(tableScanOperator, aggregationOperator); }
@Override public Block toBlock(Type desiredType) { checkArgument(desiredType.getTypeParameters().size() == 1 && BIGINT.equals(desiredType.getTypeParameters().get(0)), "type doesn't match: %s", desiredType); int numberOfRecords = numberOfRecords(); return ArrayBlock.fromElementBlock( numberOfRecords, Optional.of(nulls == null ? new boolean[numberOfRecords] : nulls), calculateOffsets(sizes, nulls, numberOfRecords), values != null ? values.toBlock(BIGINT) : new LongArrayBlock(0, Optional.empty(), new long[] {})); }
@OutputFunction(StandardTypes.BIGINT) public static void evaluateFinal(BooleanDistinctState state, BlockBuilder out) { BIGINT.writeLong(out, Integer.bitCount(state.getByte())); } }
public GetNonDictionaryGroupIdsWork(Page page) { this.page = requireNonNull(page, "page is null"); // we know the exact size required for the block this.blockBuilder = BIGINT.createFixedSizeBlockBuilder(page.getPositionCount()); }