protected final boolean isNullSequence(Slice slice, int offset, int length) { return nullSequence.equals(0, nullSequence.length(), slice, offset, length); }
/** * 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)); }
@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); }
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); } } }
@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); }
@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); }
@ScalarOperator(NOT_EQUAL) @SqlType(BOOLEAN) @SqlNullable public static Boolean notEqual(@SqlType(JSON) Slice leftJson, @SqlType(JSON) Slice rightJson) { return !leftJson.equals(rightJson); }
@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); }
@ScalarOperator(EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean equal(@SqlType("ObjectId") Slice left, @SqlType("ObjectId") Slice right) { return left.equals(right); }
@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); }
@ScalarOperator(EQUAL) @SqlType(BOOLEAN) @SqlNullable public static Boolean equals(@SqlType(JSON) Slice leftJson, @SqlType(JSON) Slice rightJson) { return leftJson.equals(rightJson); }
@ScalarOperator(NOT_EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean notEqual(@SqlType("ObjectId") Slice left, @SqlType("ObjectId") Slice right) { return !left.equals(right); }
@ScalarOperator(EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean equal(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right) { return left.equals(right); }
@ScalarOperator(EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean equal(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right) { return left.equals(right); }
@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); }
@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); }
@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); }
@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); }
@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(); }
@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(); }