diff options
author | Reynold Xin <rxin@databricks.com> | 2015-08-03 04:26:18 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-08-03 04:26:18 -0700 |
commit | 8be198c86935001907727fd16577231ff776125b (patch) | |
tree | c10b90020ab2142e22a04c07d81b557d053bec5c /sql/catalyst | |
parent | 191bf2689d127a9dd328b9cc517362fd51eaed3d (diff) | |
download | spark-8be198c86935001907727fd16577231ff776125b.tar.gz spark-8be198c86935001907727fd16577231ff776125b.tar.bz2 spark-8be198c86935001907727fd16577231ff776125b.zip |
Two minor comments from code review on 191bf2689.
Diffstat (limited to 'sql/catalyst')
2 files changed, 3 insertions, 1 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoiner.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoiner.scala index 5f8a6f8871..30b51dd83f 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoiner.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoiner.scala @@ -76,7 +76,7 @@ object GenerateUnsafeRowJoiner extends CodeGenerator[(StructType, StructType), U } else if (i - bitset1Words < bitset2Words - 1) { // combine next two words of bitset2 s"($getLong(obj2, offset2 + ${(i - bitset1Words) * 8}) >>> (64 - $bitset1Remainder))" + - s"| ($getLong(obj2, offset2 + ${(i - bitset1Words + 1) * 8}) << $bitset1Remainder)" + s" | ($getLong(obj2, offset2 + ${(i - bitset1Words + 1) * 8}) << $bitset1Remainder)" } else { // last word of bitset2 s"$getLong(obj2, offset2 + ${(i - bitset1Words) * 8}) >>> (64 - $bitset1Remainder)" diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoinerBitsetSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoinerBitsetSuite.scala index 718a2acc82..aff1bee99f 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoinerBitsetSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoinerBitsetSuite.scala @@ -92,6 +92,8 @@ class GenerateUnsafeRowJoinerBitsetSuite extends SparkFunSuite { private def createUnsafeRow(numFields: Int): UnsafeRow = { val row = new UnsafeRow val sizeInBytes = numFields * 8 + ((numFields + 63) / 64) * 8 + // Allocate a larger buffer than needed and point the UnsafeRow to somewhere in the middle. + // This way we can test the joiner when the input UnsafeRows are not the entire arrays. val offset = numFields * 8 val buf = new Array[Byte](sizeInBytes + offset) row.pointTo(buf, PlatformDependent.BYTE_ARRAY_OFFSET + offset, numFields, sizeInBytes) |