io.airlift.slice.Slice.equals()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(133)

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

Slice.equals介绍

[英]Compares a portion of this slice with a portion of the specified slice. Equality is solely based on the contents of the slice.
[中]将此切片的一部分与指定切片的一部分进行比较。平等完全基于切片的内容。

代码示例

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

protected final boolean isNullSequence(Slice slice, int offset, int length)
{
  return nullSequence.equals(0, nullSequence.length(), slice, offset, length);
}

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

/**
 * Does the file start with the ORC magic bytes?
 */
private static boolean isValidHeaderMagic(OrcDataSource source)
    throws IOException
{
  byte[] headerMagic = new byte[MAGIC.length()];
  source.readFully(0, headerMagic);
  return MAGIC.equals(Slices.wrappedBuffer(headerMagic));
}

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

@Override
public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length)
{
  checkReadablePosition(position);
  int thisOffset = valueOffset(position) + offset;
  return getRawSlice().equals(thisOffset, length, otherSlice, otherOffset, length);
}

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

private void decodeElementValueInto(int depth, BlockBuilder blockBuilder, Slice slice, int offset, int length)
      throws RcFileCorruptionException
  {
    if (nullSequence.equals(0, nullSequence.length(), slice, offset, length)) {
      blockBuilder.appendNull();
    }
    else {
      elementEncoding.decodeValueInto(depth + 1, blockBuilder, slice, offset, length);
    }
  }
}

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

@Override
public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length)
{
  checkReadablePosition(position);
  return getRawSlice(position).equals(getPositionOffset(position) + offset, length, otherSlice, otherOffset, length);
}

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

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

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

@ScalarOperator(NOT_EQUAL)
@SqlType(BOOLEAN)
@SqlNullable
public static Boolean notEqual(@SqlType(JSON) Slice leftJson, @SqlType(JSON) Slice rightJson)
{
  return !leftJson.equals(rightJson);
}

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

@ScalarOperator(NOT_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean notEqual(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right)
{
  return !left.equals(right);
}

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

@ScalarOperator(EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean equal(@SqlType("ObjectId") Slice left, @SqlType("ObjectId") Slice right)
{
  return left.equals(right);
}

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

@ScalarOperator(NOT_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean notEqual(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right)
{
  return !left.equals(right);
}

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

@ScalarOperator(EQUAL)
@SqlType(BOOLEAN)
@SqlNullable
public static Boolean equals(@SqlType(JSON) Slice leftJson, @SqlType(JSON) Slice rightJson)
{
  return leftJson.equals(rightJson);
}

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

@ScalarOperator(NOT_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean notEqual(@SqlType("ObjectId") Slice left, @SqlType("ObjectId") Slice right)
{
  return !left.equals(right);
}

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

@ScalarOperator(EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean equal(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right)
{
  return left.equals(right);
}

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

@ScalarOperator(EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean equal(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right)
{
  return left.equals(right);
}

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

@LiteralParameters("x")
@ScalarOperator(EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean equal(@SqlType("varchar(x)") Slice left, @SqlType("varchar(x)") Slice right)
{
  return left.equals(right);
}

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

@LiteralParameters("x")
@ScalarOperator(NOT_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean notEqual(@SqlType("varchar(x)") Slice left, @SqlType("varchar(x)") Slice right)
{
  return !left.equals(right);
}

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

@LiteralParameters("x")
@ScalarOperator(EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean equal(@SqlType("char(x)") Slice left, @SqlType("char(x)") Slice right)
{
  return left.equals(right);
}

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

@LiteralParameters("x")
@ScalarOperator(NOT_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
@SqlNullable
public static Boolean notEqual(@SqlType("char(x)") Slice left, @SqlType("char(x)") Slice right)
{
  return !left.equals(right);
}

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

@Override
public Block decodeColumn(ColumnData columnData)
{
  int size = columnData.rowCount();
  BlockBuilder builder = type.createBlockBuilder(null, size);
  Slice slice = columnData.getSlice();
  for (int i = 0; i < size; i++) {
    int offset = columnData.getOffset(i);
    int length = columnData.getLength(i);
    if (length == 0 || nullSequence.equals(0, nullSequence.length(), slice, offset, length)) {
      builder.appendNull();
    }
    else {
      type.writeLong(builder, parseTimestamp(slice, offset, length));
    }
  }
  return builder.build();
}

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

@Override
public Block decodeColumn(ColumnData columnData)
{
  int size = columnData.rowCount();
  BlockBuilder builder = type.createBlockBuilder(null, size);
  Slice slice = columnData.getSlice();
  for (int i = 0; i < size; i++) {
    int offset = columnData.getOffset(i);
    int length = columnData.getLength(i);
    if (length == 0 || nullSequence.equals(0, nullSequence.length(), slice, offset, length)) {
      builder.appendNull();
    }
    else {
      type.writeLong(builder, parseLong(slice, offset, length));
    }
  }
  return builder.build();
}

相关文章