com.facebook.presto.spi.block.Block.getLong()方法的使用及代码示例

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

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

Block.getLong介绍

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

代码示例

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

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

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

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

代码示例来源:origin: prestodb/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: prestodb/presto

@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: prestodb/presto

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

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

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

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

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

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

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

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

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

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

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

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

private static OptionalLong getTimestampValue(DateTimeZone timeZone, Block block)
{
  // TODO #7122
  return block.isNull(0) ? OptionalLong.empty() : OptionalLong.of(MILLISECONDS.toSeconds(timeZone.convertUTCToLocal(block.getLong(0, 0))));
}

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

@Override
public long getLong(int position, int offset)
{
  checkReadablePosition(position);
  return getBlock().getLong(position + start, offset);
}

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

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

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

@Override
public Object getObjectValue(ConnectorSession session, Block block, int position)
{
  if (block.isNull(position)) {
    return null;
  }
  long unscaledValue = block.getLong(position, 0);
  return new SqlDecimal(BigInteger.valueOf(unscaledValue), getPrecision(), getScale());
}

代码示例来源:origin: prestodb/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: prestodb/presto

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

代码示例来源:origin: prestodb/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: prestodb/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: prestodb/presto

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: prestodb/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);
}

相关文章