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

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

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

Block.getInt介绍

[英]Gets a little endian int at offset in the value at position.
[中]

代码示例

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

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

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

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

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

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

代码示例来源: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.
  int leftValue = leftBlock.getInt(leftPosition, 0);
  int rightValue = rightBlock.getInt(rightPosition, 0);
  return Integer.compare(leftValue, rightValue);
}

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

@Override
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
  float leftValue = intBitsToFloat(leftBlock.getInt(leftPosition, 0));
  float rightValue = intBitsToFloat(rightBlock.getInt(rightPosition, 0));
  // direct equality is correct here
  // noinspection FloatingPointEquality
  return leftValue == rightValue;
}

代码示例来源: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.
  float leftValue = intBitsToFloat(leftBlock.getInt(leftPosition, 0));
  float rightValue = intBitsToFloat(rightBlock.getInt(rightPosition, 0));
  return Float.compare(leftValue, rightValue);
}

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

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

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

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

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

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

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

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

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

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

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

@Override
public long hash(Block block, int position)
{
  // convert to canonical NaN if necessary
  return hash(floatToIntBits(intBitsToFloat(block.getInt(position, 0))));
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章