File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
sql/core/src/test/java/test/org/apache/spark/sql/execution/sort Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -293,4 +293,30 @@ public void testBinaryComparatorWhenSubtractionCanOverflowLongValue() throws Exc
293293
294294 assert (compare (0 , 1 ) < 0 );
295295 }
296+
297+ @ Test
298+ public void testBinaryComparatorWhenOnlyTheLastColumnDiffers () throws Exception {
299+ int numFields = 4 ;
300+
301+ UnsafeRow row1 = new UnsafeRow (numFields );
302+ byte [] data1 = new byte [100 ];
303+ row1 .pointTo (data1 , computeSizeInBytes (numFields * 8 ));
304+ row1 .setInt (0 , 11 );
305+ row1 .setDouble (1 , 3.14 );
306+ row1 .setInt (2 , -1 );
307+ row1 .setLong (3 , 0 );
308+
309+ UnsafeRow row2 = new UnsafeRow (numFields );
310+ byte [] data2 = new byte [100 ];
311+ row2 .pointTo (data2 , computeSizeInBytes (numFields * 8 ));
312+ row2 .setInt (0 , 11 );
313+ row2 .setDouble (1 , 3.14 );
314+ row2 .setInt (2 , -1 );
315+ row2 .setLong (3 , 1 );
316+
317+ insertRow (row1 );
318+ insertRow (row2 );
319+
320+ assert (compare (0 , 1 ) < 0 );
321+ }
296322}
You can’t perform that action at this time.
0 commit comments