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

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

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

Block.getEncodingName介绍

[英]Get the encoding for this block.
[中]获取此块的编码。

代码示例

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

@Override
public void writeBlock(SliceOutput output, Block block)
{
  while (true) {
    // get the encoding name
    String encodingName = block.getEncodingName();
    // look up the BlockEncoding
    BlockEncoding blockEncoding = blockEncodings.get(encodingName);
    // see if a replacement block should be written instead
    Optional<Block> replacementBlock = blockEncoding.replacementBlockForWrite(block);
    if (replacementBlock.isPresent()) {
      block = replacementBlock.get();
      continue;
    }
    // write the name to the output
    writeLengthPrefixedString(output, encodingName);
    // write the block to the output
    blockEncoding.writeBlock(this, output, block);
    break;
  }
}

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

@Test
public void testBuildingFromLongArrayBlockBuilder()
{
  LongArrayBlockBuilder blockBuilder = new LongArrayBlockBuilder(null, 100);
  populateNullValues(blockBuilder, 100);
  assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}

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

@Test
public void testBuildingFromShortArrayBlockBuilder()
{
  ShortArrayBlockBuilder blockBuilder = new ShortArrayBlockBuilder(null, 100);
  populateNullValues(blockBuilder, 100);
  assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}

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

@Test
public void testBuildingFromIntArrayBlockBuilder()
{
  IntArrayBlockBuilder blockBuilder = new IntArrayBlockBuilder(null, 100);
  populateNullValues(blockBuilder, 100);
  assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}

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

@Test
public void testBuildingFromByteArrayBlockBuilder()
{
  ByteArrayBlockBuilder blockBuilder = new ByteArrayBlockBuilder(null, 100);
  populateNullValues(blockBuilder, 100);
  assertEquals(blockBuilder.build().getEncodingName(), RunLengthBlockEncoding.NAME);
}

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

@Override
public void writeBlock(SliceOutput output, Block block)
{
  while (true) {
    // get the encoding name
    String encodingName = block.getEncodingName();
    // look up the encoding factory
    BlockEncoding blockEncoding = blockEncodings.get(encodingName);
    // see if a replacement block should be written instead
    Optional<Block> replacementBlock = blockEncoding.replacementBlockForWrite(block);
    if (replacementBlock.isPresent()) {
      block = replacementBlock.get();
      continue;
    }
    // write the name to the output
    writeLengthPrefixedString(output, encodingName);
    // write the block to the output
    blockEncoding.writeBlock(this, output, block);
    break;
  }
}

相关文章