io.prestosql.spi.block.Block.getLong()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中io.prestosql.spi.block.Block.getLong()方法的一些代码示例,展示了Block.getLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getLong()方法的具体详情如下:
包路径:io.prestosql.spi.block.Block
类名称:Block
方法名:getLong

Block.getLong介绍

[英]Gets a little endian long at offset in the value at position.
[中]在位置处的值的偏移量处获取一点endian长度。

代码示例

代码示例来源:origin: prestosql/presto

@Override
public long hash(Block block, int position)
{
  return block.getLong(position, 0);
}

代码示例来源:origin: io.prestosql/presto-main

@Override
public long getLong(int position, int offset)
{
  return block.getLong(position, offset);
}

代码示例来源:origin: prestosql/presto

@Override
public double getDouble(Block block, int position)
{
  return longBitsToDouble(block.getLong(position, 0));
}

代码示例来源:origin: prestosql/presto

@Override
public long hash(Block block, int position)
{
  long low = block.getLong(position, 0);
  long high = block.getLong(position, SIZE_OF_LONG);
  return UnscaledDecimal128Arithmetic.hash(low, high);
}

代码示例来源:origin: prestosql/presto

@Override
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
  long leftValue = unpackMillisUtc(leftBlock.getLong(leftPosition, 0));
  long rightValue = unpackMillisUtc(rightBlock.getLong(rightPosition, 0));
  return leftValue == rightValue;
}

代码示例来源:origin: prestosql/presto

@Override
public long getLong(Block block, int position)
{
  return block.getLong(position, 0);
}

代码示例来源:origin: prestosql/presto

@Override
public long hash(Block block, int position)
{
  // convert to canonical NaN if necessary
  return AbstractLongType.hash(doubleToLongBits(longBitsToDouble(block.getLong(position, 0))));
}

代码示例来源:origin: prestosql/presto

@Override
public Object getObjectValue(ConnectorSession session, Block block, int position)
{
  if (block.isNull(position)) {
    return null;
  }
  return block.getLong(position, 0);
}

代码示例来源:origin: io.prestosql/presto-spi

@Override
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
  long leftValue = leftBlock.getLong(leftPosition, 0);
  long rightValue = rightBlock.getLong(rightPosition, 0);
  return leftValue == rightValue;
}

代码示例来源:origin: io.prestosql/presto-spi

@Override
public long hash(Block block, int position)
{
  return block.getLong(position, 0);
}

代码示例来源:origin: io.prestosql/presto-spi

@Override
public long getLong(Block block, int position)
{
  return block.getLong(position, 0);
}

代码示例来源:origin: io.prestosql/presto-main

@Override
  public int getPartition(Page page, int position)
  {
    long value = page.getBlock(valueChannel).getLong(position, 0);
    return toIntExact(Math.abs(value) % partitionCount);
  }
}

代码示例来源:origin: prestosql/presto

private void assertBlockEquals(Block block, List<Long> expected)
{
  assertEquals(block.getPositionCount(), expected.size());
  for (int i = 0; i < expected.size(); i++) {
    if (expected.get(i) == null) {
      assertTrue(block.isNull(i));
    }
    else {
      assertEquals(block.getLong(i, 0), expected.get(i).longValue());
    }
  }
}

代码示例来源:origin: io.prestosql/presto-thrift-api

private void assertBlockEquals(Block block, List<Long> expected)
{
  assertEquals(block.getPositionCount(), expected.size());
  for (int i = 0; i < expected.size(); i++) {
    if (expected.get(i) == null) {
      assertTrue(block.isNull(i));
    }
    else {
      assertEquals(block.getLong(i, 0), expected.get(i).longValue());
    }
  }
}

代码示例来源:origin: prestosql/presto

@Override
public void writeBlock(BlockEncodingSerde blockEncodingSerde, SliceOutput sliceOutput, Block block)
{
  int positionCount = block.getPositionCount();
  sliceOutput.appendInt(positionCount);
  encodeNullsAsBits(sliceOutput, block);
  for (int position = 0; position < positionCount; position++) {
    if (!block.isNull(position)) {
      sliceOutput.writeLong(block.getLong(position, 0));
    }
  }
}

代码示例来源:origin: io.prestosql/presto-spi

@Override
public void appendTo(Block block, int position, BlockBuilder blockBuilder)
{
  if (block.isNull(position)) {
    blockBuilder.appendNull();
  }
  else {
    blockBuilder.writeLong(block.getLong(position, 0)).closeEntry();
  }
}

代码示例来源:origin: prestosql/presto

@Override
public void appendTo(Block block, int position, BlockBuilder blockBuilder)
{
  if (block.isNull(position)) {
    blockBuilder.appendNull();
  }
  else {
    blockBuilder.writeLong(block.getLong(position, 0)).closeEntry();
  }
}

代码示例来源:origin: io.prestosql/presto-main

private static Block getRowNumberColumn(List<Page> pages)
{
  BlockBuilder builder = BIGINT.createBlockBuilder(null, pages.size() * 100);
  for (Page page : pages) {
    int rowNumberChannel = page.getChannelCount() - 1;
    for (int i = 0; i < page.getPositionCount(); i++) {
      BIGINT.writeLong(builder, page.getBlock(rowNumberChannel).getLong(i, 0));
    }
  }
  return builder.build();
}

代码示例来源:origin: prestosql/presto

private static void testFilter(DictionaryAwarePageFilter filter, Block block, boolean filterRange)
{
  IntSet actualSelectedPositions = toSet(filter.filter(null, new Page(block)));
  block = block.getLoadedBlock();
  IntSet expectedSelectedPositions = new IntArraySet(block.getPositionCount());
  for (int position = 0; position < block.getPositionCount(); position++) {
    if (isSelected(filterRange, block.getLong(position, 0))) {
      expectedSelectedPositions.add(position);
    }
  }
  assertEquals(actualSelectedPositions, expectedSelectedPositions);
}

代码示例来源:origin: io.prestosql/presto-main

private static void testFilter(DictionaryAwarePageFilter filter, Block block, boolean filterRange)
{
  IntSet actualSelectedPositions = toSet(filter.filter(null, new Page(block)));
  block = block.getLoadedBlock();
  IntSet expectedSelectedPositions = new IntArraySet(block.getPositionCount());
  for (int position = 0; position < block.getPositionCount(); position++) {
    if (isSelected(filterRange, block.getLong(position, 0))) {
      expectedSelectedPositions.add(position);
    }
  }
  assertEquals(actualSelectedPositions, expectedSelectedPositions);
}

相关文章