Java Code Examples for io.prestosql.spi.block.Block#equals()
The following examples show how to use
io.prestosql.spi.block.Block#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DictionaryBuilder.java From presto with Apache License 2.0 | 6 votes |
/** * Get slot position of element at {@code position} of {@code block} */ private long getHashPositionOfElement(Block block, int position) { checkArgument(!block.isNull(position), "position is null"); int length = block.getSliceLength(position); long hashPosition = getMaskedHash(block.hash(position, 0, length)); while (true) { int blockPosition = blockPositionByHash.get(hashPosition); if (blockPosition == EMPTY_SLOT) { // Doesn't have this element return hashPosition; } if (elementBlock.getSliceLength(blockPosition) == length && block.equals(position, 0, elementBlock, blockPosition, 0, length)) { // Already has this element return hashPosition; } hashPosition = getMaskedHash(hashPosition + 1); } }
Example 2
Source File: JsonOperators.java From presto with Apache License 2.0 | 6 votes |
@SqlType(BOOLEAN) public static boolean isDistinctFrom( @BlockPosition @SqlType(value = JSON, nativeContainerType = Slice.class) Block left, @BlockIndex int leftPosition, @BlockPosition @SqlType(value = JSON, nativeContainerType = Slice.class) Block right, @BlockIndex int rightPosition) { if (left.isNull(leftPosition) != right.isNull(rightPosition)) { return true; } if (left.isNull(leftPosition)) { return false; } int leftLength = left.getSliceLength(leftPosition); int rightLength = right.getSliceLength(rightPosition); if (leftLength != rightLength) { return true; } return !left.equals(leftPosition, 0, right, rightPosition, 0, leftLength); }
Example 3
Source File: VarcharOperators.java From presto with Apache License 2.0 | 6 votes |
@LiteralParameters({"x", "y"}) @SqlType(StandardTypes.BOOLEAN) public static boolean isDistinctFrom( @BlockPosition @SqlType(value = "varchar(x)", nativeContainerType = Slice.class) Block left, @BlockIndex int leftPosition, @BlockPosition @SqlType(value = "varchar(y)", nativeContainerType = Slice.class) Block right, @BlockIndex int rightPosition) { if (left.isNull(leftPosition) != right.isNull(rightPosition)) { return true; } if (left.isNull(leftPosition)) { return false; } int leftLength = left.getSliceLength(leftPosition); int rightLength = right.getSliceLength(rightPosition); if (leftLength != rightLength) { return true; } return !left.equals(leftPosition, 0, right, rightPosition, 0, leftLength); }
Example 4
Source File: VarbinaryOperators.java From presto with Apache License 2.0 | 6 votes |
@SqlType(StandardTypes.BOOLEAN) public static boolean isDistinctFrom( @BlockPosition @SqlType(value = StandardTypes.VARBINARY, nativeContainerType = Slice.class) Block left, @BlockIndex int leftPosition, @BlockPosition @SqlType(value = StandardTypes.VARBINARY, nativeContainerType = Slice.class) Block right, @BlockIndex int rightPosition) { if (left.isNull(leftPosition) != right.isNull(rightPosition)) { return true; } if (left.isNull(leftPosition)) { return false; } int leftLength = left.getSliceLength(leftPosition); int rightLength = right.getSliceLength(rightPosition); if (leftLength != rightLength) { return true; } return !left.equals(leftPosition, 0, right, rightPosition, 0, leftLength); }
Example 5
Source File: CharOperators.java From presto with Apache License 2.0 | 6 votes |
@LiteralParameters("x") @SqlType(StandardTypes.BOOLEAN) public static boolean isDistinctFrom( @BlockPosition @SqlType(value = "char(x)", nativeContainerType = Slice.class) Block left, @BlockIndex int leftPosition, @BlockPosition @SqlType(value = "char(x)", nativeContainerType = Slice.class) Block right, @BlockIndex int rightPosition) { if (left.isNull(leftPosition) != right.isNull(rightPosition)) { return true; } if (left.isNull(leftPosition)) { return false; } int leftLength = left.getSliceLength(leftPosition); int rightLength = right.getSliceLength(rightPosition); if (leftLength != rightLength) { return true; } return !left.equals(leftPosition, 0, right, rightPosition, 0, leftLength); }
Example 6
Source File: ObjectIdType.java From presto with Apache License 2.0 | 5 votes |
@Override public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { int leftLength = leftBlock.getSliceLength(leftPosition); int rightLength = rightBlock.getSliceLength(rightPosition); if (leftLength != rightLength) { return false; } return leftBlock.equals(leftPosition, 0, rightBlock, rightPosition, 0, leftLength); }
Example 7
Source File: VarbinaryType.java From presto with Apache License 2.0 | 5 votes |
@Override public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { int leftLength = leftBlock.getSliceLength(leftPosition); int rightLength = rightBlock.getSliceLength(rightPosition); if (leftLength != rightLength) { return false; } return leftBlock.equals(leftPosition, 0, rightBlock, rightPosition, 0, leftLength); }
Example 8
Source File: VarcharType.java From presto with Apache License 2.0 | 5 votes |
@Override public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { int leftLength = leftBlock.getSliceLength(leftPosition); int rightLength = rightBlock.getSliceLength(rightPosition); if (leftLength != rightLength) { return false; } return leftBlock.equals(leftPosition, 0, rightBlock, rightPosition, 0, leftLength); }
Example 9
Source File: CharType.java From presto with Apache License 2.0 | 5 votes |
@Override public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { int leftLength = leftBlock.getSliceLength(leftPosition); int rightLength = rightBlock.getSliceLength(rightPosition); if (leftLength != rightLength) { return false; } return leftBlock.equals(leftPosition, 0, rightBlock, rightPosition, 0, leftLength); }