本文整理了Java中com.facebook.presto.spi.block.Block.getEstimatedDataSizeForStats()
方法的一些代码示例,展示了Block.getEstimatedDataSizeForStats()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getEstimatedDataSizeForStats()
方法的具体详情如下:
包路径:com.facebook.presto.spi.block.Block
类名称:Block
方法名:getEstimatedDataSizeForStats
[英]Returns the estimated in memory data size for stats of position. Do not use it for other purpose.
[中]返回位置统计信息的估计内存中数据大小。请勿将其用于其他用途。
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
return value.getEstimatedDataSizeForStats(0);
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
return block.getEstimatedDataSizeForStats(position);
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
assureLoaded();
return block.getEstimatedDataSizeForStats(position);
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
return dictionary.getEstimatedDataSizeForStats(getId(position));
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
position = getAbsolutePosition(position);
if (position % 2 == 0) {
return getRawKeyBlock().getEstimatedDataSizeForStats(position / 2);
}
else {
return getRawValueBlock().getEstimatedDataSizeForStats(position / 2);
}
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
checkReadablePosition(position);
return getBlock().getEstimatedDataSizeForStats(position + start);
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
checkFieldIndex(position);
return getRawFieldBlock(position).getEstimatedDataSizeForStats(rowIndex);
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
checkReadablePosition(position);
if (isNull(position)) {
return 0;
}
int startValueOffset = getOffset(position);
int endValueOffset = getOffset(position + 1);
long size = 0;
Block rawKeyBlock = getRawKeyBlock();
Block rawValueBlock = getRawValueBlock();
for (int i = startValueOffset; i < endValueOffset; i++) {
size += rawKeyBlock.getEstimatedDataSizeForStats(i);
size += rawValueBlock.getEstimatedDataSizeForStats(i);
}
return size;
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
checkReadablePosition(position);
if (isNull(position)) {
return 0;
}
Block[] rawFieldBlocks = getRawFieldBlocks();
long size = 0;
for (int i = 0; i < numFields; i++) {
size += rawFieldBlocks[i].getEstimatedDataSizeForStats(getFieldBlockOffset(position));
}
return size;
}
代码示例来源:origin: prestodb/presto
protected static void assertEstimatedDataSizeForStats(BlockBuilder blockBuilder, Slice[] expectedSliceValues)
{
Block block = blockBuilder.build();
assertEquals(block.getPositionCount(), expectedSliceValues.length);
for (int i = 0; i < block.getPositionCount(); i++) {
int expectedSize = expectedSliceValues[i] == null ? 0 : expectedSliceValues[i].length();
assertEquals(blockBuilder.getEstimatedDataSizeForStats(i), expectedSize);
assertEquals(block.getEstimatedDataSizeForStats(i), expectedSize);
}
BlockBuilder nullValueBlockBuilder = blockBuilder.newBlockBuilderLike(null).appendNull();
assertEquals(nullValueBlockBuilder.getEstimatedDataSizeForStats(0), 0);
assertEquals(nullValueBlockBuilder.build().getEstimatedDataSizeForStats(0), 0);
}
代码示例来源:origin: prestodb/presto
@Override
public long getEstimatedDataSizeForStats(int position)
{
checkReadablePosition(position);
if (isNull(position)) {
return 0;
}
int startValueOffset = getOffset(position);
int endValueOffset = getOffset(position + 1);
Block rawElementBlock = getRawElementBlock();
long size = 0;
for (int i = startValueOffset; i < endValueOffset; i++) {
size += rawElementBlock.getEstimatedDataSizeForStats(i);
}
return size;
}
代码示例来源:origin: prestodb/presto
@Test
public void testEstimatedDataSizeForStats()
{
int positionCount = 10;
Slice expectedValue = createExpectedValue(5);
Block block = new RunLengthEncodedBlock(createSingleValueBlock(expectedValue), positionCount);
for (int postition = 0; postition < positionCount; postition++) {
assertEquals(block.getEstimatedDataSizeForStats(postition), expectedValue.length());
}
}
代码示例来源:origin: prestodb/presto
@InputFunction
@TypeParameter(value = "T")
public static void input(@AggregationState NullableLongState state, @BlockPosition @SqlType("T") Block block, @BlockIndex int index)
{
update(state, block.getEstimatedDataSizeForStats(index));
}
代码示例来源:origin: prestodb/presto
@InputFunction
@TypeParameter(value = "T")
public static void input(@AggregationState NullableLongState state, @BlockPosition @SqlType("T") Block block, @BlockIndex int index)
{
update(state, block.getEstimatedDataSizeForStats(index));
}
代码示例来源:origin: prestodb/presto
@Test
public void testEstimatedDataSizeForStats()
{
List<Type> fieldTypes = ImmutableList.of(VARCHAR, BIGINT);
List<Object>[] expectedValues = alternatingNullValues(generateTestRows(fieldTypes, 100));
BlockBuilder blockBuilder = createBlockBuilderWithValues(fieldTypes, expectedValues);
Block block = blockBuilder.build();
assertEquals(block.getPositionCount(), expectedValues.length);
for (int i = 0; i < block.getPositionCount(); i++) {
int expectedSize = getExpectedEstimatedDataSize(expectedValues[i]);
assertEquals(blockBuilder.getEstimatedDataSizeForStats(i), expectedSize);
assertEquals(block.getEstimatedDataSizeForStats(i), expectedSize);
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testEstimatedDataSizeForStats()
{
long[][][] expectedValues = alternatingNullValues(createExpectedValues());
BlockBuilder blockBuilder = createBlockBuilderWithValues(expectedValues);
Block block = blockBuilder.build();
assertEquals(block.getPositionCount(), expectedValues.length);
for (int i = 0; i < block.getPositionCount(); i++) {
int expectedSize = getExpectedEstimatedDataSize(expectedValues[i]);
assertEquals(blockBuilder.getEstimatedDataSizeForStats(i), expectedSize);
assertEquals(block.getEstimatedDataSizeForStats(i), expectedSize);
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testEstimatedDataSizeForStats()
{
Map<String, Long>[] expectedValues = alternatingNullValues(createTestMap(9, 3, 4, 0, 8, 0, 6, 5));
BlockBuilder blockBuilder = createBlockBuilderWithValues(expectedValues);
Block block = blockBuilder.build();
assertEquals(block.getPositionCount(), expectedValues.length);
for (int i = 0; i < block.getPositionCount(); i++) {
int expectedSize = getExpectedEstimatedDataSize(expectedValues[i]);
assertEquals(blockBuilder.getEstimatedDataSizeForStats(i), expectedSize);
assertEquals(block.getEstimatedDataSizeForStats(i), expectedSize);
}
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getEstimatedDataSizeForStats(int position)
{
assureLoaded();
return block.getEstimatedDataSizeForStats(position);
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getEstimatedDataSizeForStats(int position)
{
position = getAbsolutePosition(position);
if (position % 2 == 0) {
return getRawKeyBlock().getEstimatedDataSizeForStats(position / 2);
}
else {
return getRawValueBlock().getEstimatedDataSizeForStats(position / 2);
}
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getEstimatedDataSizeForStats(int position)
{
checkFieldIndex(position);
return getRawFieldBlock(position).getEstimatedDataSizeForStats(rowIndex);
}
内容来源于网络,如有侵权,请联系作者删除!