@Test public void anyNullTest() { { BinaryRow row = new BinaryRow(3); BinaryRowWriter writer = new BinaryRowWriter(row); assertFalse(row.anyNull()); row.setHeader((byte) 1); assertFalse(row.anyNull()); writer.setNullAt(2); assertTrue(row.anyNull()); writer.setNullAt(0); assertTrue(row.anyNull(new int[]{0, 1, 2})); assertFalse(row.anyNull(new int[]{1})); writer.setNullAt(1); assertTrue(row.anyNull()); } int numFields = 80; for (int i = 0; i < numFields; i++) { BinaryRow row = new BinaryRow(numFields); BinaryRowWriter writer = new BinaryRowWriter(row); row.setHeader((byte) 17); assertFalse(row.anyNull()); writer.setNullAt(i); assertTrue(row.anyNull()); } }
public boolean anyNull() { if ((segments[0].getLong(0) & FIRST_BYTE_ZERO) != 0) { return true; } for (int i = 8; i < nullBitsSizeInBytes; i += 8) { if (segments[0].getLong(i) != 0) { return true; } } return false; }
BinaryRow extends BinaryFormat implements BaseRow { public boolean anyNull() { if ((segments[0].getLong(0) & FIRST_BYTE_ZERO) != 0) { return true; } for (int i = 8; i < nullBitsSizeInBytes; i += 8) { if (segments[0].getLong(i) != 0) { return true; } } return false; } }
BinaryRow extends BinaryFormat implements BaseRow { public boolean anyNull() { if ((segments[0].getLong(0) & FIRST_BYTE_ZERO) != 0) { return true; } for (int i = 8; i < nullBitsSizeInBytes; i += 8) { if (segments[0].getLong(i) != 0) { return true; } } return false; } BinaryRow(int arity); }
BinaryRow extends BinaryFormat implements BaseRow { public boolean anyNull() { if ((segments[0].getLong(0) & FIRST_BYTE_ZERO) != 0) { return true; } for (int i = 8; i < nullBitsSizeInBytes; i += 8) { if (segments[0].getLong(i) != 0) { return true; } } return false; } BinaryRow(int arity); static int calculateBitSetWidthInBytes(int arity); static int calculateFixPartSizeInBytes(int arity); static boolean isInFixedLengthPart(LogicalType type); static boolean isMutable(LogicalType type); int getFixedLengthPartSize(); @Override int getArity(); @Override byte getHeader(); @Override void setHeader(byte header); void setTotalSize(int sizeInBytes); @Override boolean isNullAt(int pos); @Override void setNullAt(int i); @Override void setInt(int pos, int value); @Override void setLong(int pos, long value); @Override void setDouble(int pos, double value); @Override void setDecimal(int pos, Decimal value, int precision); @Override void setBoolean(int pos, boolean value); @Override void setShort(int pos, short value); @Override void setByte(int pos, byte value); @Override void setFloat(int pos, float value); @Override boolean getBoolean(int pos); @Override byte getByte(int pos); @Override short getShort(int pos); @Override int getInt(int pos); @Override long getLong(int pos); @Override float getFloat(int pos); @Override double getDouble(int pos); @Override BinaryString getString(int pos); @Override Decimal getDecimal(int pos, int precision, int scale); @Override BinaryGeneric<T> getGeneric(int pos); @Override byte[] getBinary(int pos); @Override BaseArray getArray(int pos); @Override BaseMap getMap(int pos); @Override BaseRow getRow(int pos, int numFields); boolean anyNull(); boolean anyNull(int[] fields); BinaryRow copy(); BinaryRow copy(BinaryRow reuse); void clear(); @Override int hashCode(); String toOriginString(LogicalType... types); static String toOriginString(BaseRow row, LogicalType[] types); boolean equalsWithoutHeader(BaseRow o); }
BinaryRow extends BinaryFormat implements BaseRow { public boolean anyNull() { if ((segments[0].getLong(0) & FIRST_BYTE_ZERO) != 0) { return true; } for (int i = 8; i < nullBitsSizeInBytes; i += 8) { if (segments[0].getLong(i) != 0) { return true; } } return false; } BinaryRow(int arity); static int calculateBitSetWidthInBytes(int arity); static int calculateFixPartSizeInBytes(int arity); static boolean isInFixedLengthPart(LogicalType type); static boolean isMutable(LogicalType type); int getFixedLengthPartSize(); @Override int getArity(); @Override byte getHeader(); @Override void setHeader(byte header); void setTotalSize(int sizeInBytes); @Override boolean isNullAt(int pos); @Override void setNullAt(int i); @Override void setInt(int pos, int value); @Override void setLong(int pos, long value); @Override void setDouble(int pos, double value); @Override void setDecimal(int pos, Decimal value, int precision); @Override void setBoolean(int pos, boolean value); @Override void setShort(int pos, short value); @Override void setByte(int pos, byte value); @Override void setFloat(int pos, float value); @Override boolean getBoolean(int pos); @Override byte getByte(int pos); @Override short getShort(int pos); @Override int getInt(int pos); @Override long getLong(int pos); @Override float getFloat(int pos); @Override double getDouble(int pos); @Override BinaryString getString(int pos); @Override Decimal getDecimal(int pos, int precision, int scale); @Override BinaryGeneric<T> getGeneric(int pos); @Override byte[] getBinary(int pos); @Override BaseArray getArray(int pos); @Override BaseMap getMap(int pos); @Override BaseRow getRow(int pos, int numFields); boolean anyNull(); boolean anyNull(int[] fields); BinaryRow copy(); BinaryRow copy(BinaryRow reuse); void clear(); @Override int hashCode(); String toOriginString(LogicalType... types); static String toOriginString(BaseRow row, LogicalType[] types); boolean equalsWithoutHeader(BaseRow o); static final boolean LITTLE_ENDIAN; static final int HEADER_SIZE_IN_BITS; }