Skip to content

Commit d1131bc

Browse files
yliousrowen
authored andcommitted
[MINOR][SQL][FOLLOW-UP] Add assertion to FixedLengthRowBasedKeyValueBatch
### What changes were proposed in this pull request? Adds an assert to `FixedLengthRowBasedKeyValueBatch#appendRow` method to check the incoming vlen and klen by comparing them with the lengths stored as member variables as followup to apache#30788 ### Why are the changes needed? Add assert statement to catch similar bugs in future. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Ran some tests locally, though not easy to test. Closes apache#31447 from yliou/SPARK-33726-Assert. Authored-by: yliou <yliou@berkeley.edu> Signed-off-by: Sean Owen <srowen@gmail.com>
1 parent 037bfb2 commit d1131bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ private long getKeyOffsetForFixedLengthRecords(int rowId) {
4646
public UnsafeRow appendRow(Object kbase, long koff, int klen,
4747
Object vbase, long voff, int vlen) {
4848
// if run out of max supported rows or page size, return null
49+
assert(vlen == this.vlen);
50+
assert(klen == this.klen);
4951
if (numRows >= capacity || page == null || page.size() - pageCursor < recordLength) {
5052
return null;
5153
}

0 commit comments

Comments
 (0)