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

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

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

Block.bytesCompare介绍

[英]Compares the byte sequences at offset in the value at positionto the byte sequence at otherOffset in otherSlice. This method must be implemented if @{code getSlice} is implemented.
[中]将位置处的值中偏移量处的字节序列与其他切片中其他偏移量处的字节序列进行比较。如果实现了@{code getSlice},则必须实现此方法。

代码示例

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  return block.bytesCompare(position, offset, length, otherSlice, otherOffset, otherLength);
}

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  return value.bytesCompare(0, offset, length, otherSlice, otherOffset, otherLength);
}

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  assureLoaded();
  return block.bytesCompare(position,
      offset,
      length,
      otherSlice,
      otherOffset,
      otherLength);
}

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  return dictionary.bytesCompare(getId(position), offset, length, otherSlice, otherOffset, otherLength);
}

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  position = getAbsolutePosition(position);
  if (position % 2 == 0) {
    return getRawKeyBlock().bytesCompare(position / 2, offset, length, otherSlice, otherOffset, otherLength);
  }
  else {
    return getRawValueBlock().bytesCompare(position / 2, offset, length, otherSlice, otherOffset, otherLength);
  }
}

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkFieldIndex(position);
  return getRawFieldBlock(position).bytesCompare(rowIndex, offset, length, otherSlice, otherOffset, otherLength);
}

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

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  return getBlock().bytesCompare(position + start, offset, length, otherSlice, otherOffset, otherLength);
}

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

@Override
public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  if (fixedSize < length) {
    throw new IllegalArgumentException("Length longer than value length");
  }
  int thisOffset = valueOffset(position) + offset;
  return -otherBlock.bytesCompare(otherPosition, otherOffset, otherLength, getRawSlice(), thisOffset, length);
}

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

@Override
public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  Slice rawSlice = getRawSlice(position);
  if (getSliceLength(position) < length) {
    throw new IllegalArgumentException("Length longer than value length");
  }
  return -otherBlock.bytesCompare(otherPosition, otherOffset, otherLength, rawSlice, getPositionOffset(position) + offset, length);
}

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

protected void assertSlicePosition(Block block, int position, Slice expectedSliceValue)
{
  int length = block.getSliceLength(position);
  assertEquals(length, expectedSliceValue.length());
  Block expectedBlock = toSingeValuedBlock(expectedSliceValue);
  for (int offset = 0; offset < length - 3; offset++) {
    assertEquals(block.getSlice(position, offset, 3), expectedSliceValue.slice(offset, 3));
    assertTrue(block.bytesEqual(position, offset, expectedSliceValue, offset, 3));
    // if your tests fail here, please change your test to not use this value
    assertFalse(block.bytesEqual(position, offset, Slices.utf8Slice("XXX"), 0, 3));
    assertEquals(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 3), 0);
    assertTrue(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 2) > 0);
    Slice greaterSlice = createGreaterValue(expectedSliceValue, offset, 3);
    assertTrue(block.bytesCompare(position, offset, 3, greaterSlice, 0, greaterSlice.length()) < 0);
    assertTrue(block.equals(position, offset, expectedBlock, 0, offset, 3));
    assertEquals(block.compareTo(position, offset, 3, expectedBlock, 0, offset, 3), 0);
    BlockBuilder blockBuilder = VARBINARY.createBlockBuilder(null, 1);
    block.writeBytesTo(position, offset, 3, blockBuilder);
    blockBuilder.closeEntry();
    Block segment = blockBuilder.build();
    assertTrue(block.equals(position, offset, segment, 0, 0, 3));
  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  return block.bytesCompare(position, offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  return value.bytesCompare(0, offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  assureLoaded();
  return block.bytesCompare(position,
      offset,
      length,
      otherSlice,
      otherOffset,
      otherLength);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  return dictionary.bytesCompare(getId(position), offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  position = getAbsolutePosition(position);
  if (position % 2 == 0) {
    return getRawKeyBlock().bytesCompare(position / 2, offset, length, otherSlice, otherOffset, otherLength);
  }
  else {
    return getRawValueBlock().bytesCompare(position / 2, offset, length, otherSlice, otherOffset, otherLength);
  }
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  return getBlock().bytesCompare(position + start, offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  if (fixedSize < length) {
    throw new IllegalArgumentException("Length longer than value length");
  }
  int thisOffset = valueOffset(position) + offset;
  return -otherBlock.bytesCompare(otherPosition, otherOffset, otherLength, getRawSlice(), thisOffset, length);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkFieldIndex(position);
  return getRawFieldBlock(position).bytesCompare(rowIndex, offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  Slice rawSlice = getRawSlice(position);
  if (getSliceLength(position) < length) {
    throw new IllegalArgumentException("Length longer than value length");
  }
  return -otherBlock.bytesCompare(otherPosition, otherOffset, otherLength, rawSlice, getPositionOffset(position) + offset, length);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

assertEquals(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 3), 0);
assertTrue(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 2) > 0);
Slice greaterSlice = createGreaterValue(expectedSliceValue, offset, 3);
assertTrue(block.bytesCompare(position, offset, 3, greaterSlice, 0, greaterSlice.length()) < 0);

相关文章