@@ -167,6 +167,7 @@ public UnsafeRow() {}
167167 */
168168 public void pointTo (Object baseObject , long baseOffset , int sizeInBytes ) {
169169 assert numFields >= 0 : "numFields (" + numFields + ") should >= 0" ;
170+ assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8" ;
170171 this .baseObject = baseObject ;
171172 this .baseOffset = baseOffset ;
172173 this .sizeInBytes = sizeInBytes ;
@@ -183,6 +184,7 @@ public void pointTo(byte[] buf, int sizeInBytes) {
183184 }
184185
185186 public void setTotalSize (int sizeInBytes ) {
187+ assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8" ;
186188 this .sizeInBytes = sizeInBytes ;
187189 }
188190
@@ -538,6 +540,7 @@ public void copyFrom(UnsafeRow row) {
538540 row .baseObject , row .baseOffset , this .baseObject , this .baseOffset , row .sizeInBytes );
539541 // update the sizeInBytes.
540542 this .sizeInBytes = row .sizeInBytes ;
543+ assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8" ;
541544 }
542545
543546 /**
@@ -664,6 +667,7 @@ public void writeExternal(ObjectOutput out) throws IOException {
664667 public void readExternal (ObjectInput in ) throws IOException , ClassNotFoundException {
665668 this .baseOffset = BYTE_ARRAY_OFFSET ;
666669 this .sizeInBytes = in .readInt ();
670+ assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8" ;
667671 this .numFields = in .readInt ();
668672 this .bitSetWidthInBytes = calculateBitSetWidthInBytes (numFields );
669673 this .baseObject = new byte [sizeInBytes ];
@@ -682,6 +686,7 @@ public void write(Kryo kryo, Output out) {
682686 public void read (Kryo kryo , Input in ) {
683687 this .baseOffset = BYTE_ARRAY_OFFSET ;
684688 this .sizeInBytes = in .readInt ();
689+ assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8" ;
685690 this .numFields = in .readInt ();
686691 this .bitSetWidthInBytes = calculateBitSetWidthInBytes (numFields );
687692 this .baseObject = new byte [sizeInBytes ];
0 commit comments