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

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

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

Block.getByte介绍

[英]Gets a byte at offset in the value at position.
[中]获取位置处的值的偏移量处的字节。

代码示例

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

@Override
public long hash(Block block, int position)
{
  boolean value = block.getByte(position, 0) != 0;
  return value ? 1231 : 1237;
}

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

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

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

@Override
public boolean getBoolean(Block block, int position)
{
  return block.getByte(position, 0) != 0;
}

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

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

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

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

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

@Override
public byte getByte(int position, int offset)
{
  return block.getByte(position, offset);
}

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

@Override
public int compareTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
  // WARNING: the correctness of InCodeGenerator is dependent on the implementation of this
  // function being the equivalence of internal long representation.
  byte leftValue = leftBlock.getByte(leftPosition, 0);
  byte rightValue = rightBlock.getByte(rightPosition, 0);
  return Byte.compare(leftValue, rightValue);
}

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

@Override
public int compareTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
  boolean leftValue = leftBlock.getByte(leftPosition, 0) != 0;
  boolean rightValue = rightBlock.getByte(rightPosition, 0) != 0;
  return Boolean.compare(leftValue, rightValue);
}

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

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

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

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

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

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

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

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

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

@Override
public byte getByte(int position, int offset)
{
  return dictionary.getByte(getId(position), offset);
}

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

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

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

@Override
public byte getByte(int position, int offset)
{
  position = getAbsolutePosition(position);
  if (position % 2 == 0) {
    return getRawKeyBlock().getByte(position / 2, offset);
  }
  else {
    return getRawValueBlock().getByte(position / 2, offset);
  }
}

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

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

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

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

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

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

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

@Override
public void appendTo(Block block, int position, BlockBuilder blockBuilder)
{
  if (block.isNull(position)) {
    blockBuilder.appendNull();
  }
  else {
    blockBuilder.writeByte(block.getByte(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.writeByte(block.getByte(position, 0));
    }
  }
}

相关文章