Skip to content

Commit fe6f31b

Browse files
committed
Apply comments
1 parent d943c04 commit fe6f31b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/src/main/java/org/apache/spark/util/collection/unsafe/sort/PrefixComparators.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public static long computePrefix(byte[] bytes) {
7575
*/
7676
final int minLen = Math.min(bytes.length, 8);
7777
long p = 0;
78-
for (int i = 1; i <= minLen; ++i) {
79-
p |= (128L + PlatformDependent.UNSAFE.getByte(bytes, BYTE_ARRAY_OFFSET + i - 1))
80-
<< (64 - 8 * i);
78+
for (int i = 0; i < minLen; ++i) {
79+
p |= (128L + PlatformDependent.UNSAFE.getByte(bytes, BYTE_ARRAY_OFFSET + i))
80+
<< (56 - 8 * i);
8181
}
8282
return p;
8383
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ case class SortPrefix(child: SortOrder) extends UnaryExpression {
7878
(DoublePrefixComparator.computePrefix(Double.NegativeInfinity),
7979
s"$DoublePrefixCmp.computePrefix((double)$input)")
8080
case StringType => (0L, s"$input.getPrefix()")
81-
case BinaryType => (0L, s"$BinaryPrefixCmp.computePrefix((byte[])$input)")
81+
case BinaryType => (0L, s"$BinaryPrefixCmp.computePrefix($input)")
8282
case dt: DecimalType if dt.precision - dt.scale <= Decimal.MAX_LONG_DIGITS =>
8383
val prefix = if (dt.precision <= Decimal.MAX_LONG_DIGITS) {
8484
s"$input.toUnscaledLong()"

0 commit comments

Comments
 (0)