Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kiszk committed Jul 14, 2017
1 parent e33ec8e commit 08776e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ class PrefixComparatorsSuite extends SparkFunSuite with PropertyChecks {
(prefixComparisonResult > 0 && compareBinary(x, y) > 0))
}

val binaryRegressionTests = Seq(
(Array[Byte](1), Array[Byte](-1)),
(Array[Byte](1, 1, 1, 1, 1), Array[Byte](1, 1, 1, 1, -1)),
(Array[Byte](1, 1, 1, 1, 1, 1, 1, 1, 1), Array[Byte](1, 1, 1, 1, 1, 1, 1, 1, -1)),
(Array[Byte](1), Array[Byte](1, 1, 1, 1)),
(Array[Byte](1, 1, 1, 1, 1), Array[Byte](1, 1, 1, 1, 1, 1, 1, 1, 1)),
(Array[Byte](-1), Array[Byte](-1, -1, -1, -1)),
(Array[Byte](-1, -1, -1, -1, -1), Array[Byte](-1, -1, -1, -1, -1, -1, -1, -1, -1))
)
binaryRegressionTests.foreach { case (b1, b2) =>
testPrefixComparison(b1, b2)
}

// scalastyle:off
val regressionTests = Table(
("s1", "s2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,10 @@ class OrderingSuite extends SparkFunSuite with ExpressionEvalHelper {
(Array[Byte](1, 1, 1, 1, 1, 1, 1, 1, 1), Array[Byte](1, 1, 1, 1, 1, 1, 1, 1, -1))
)
data.foreach { case (b1, b2) =>
val rowOrdering = InterpretedOrdering.forSchema(Seq(BinaryType, BinaryType))
val rowOrdering = InterpretedOrdering.forSchema(Seq(BinaryType))
val genOrdering = GenerateOrdering.generate(
BoundReference(0, BinaryType, nullable = true).asc ::
BoundReference(1, BinaryType, nullable = true).asc :: Nil)
val rowType = StructType(
StructField("b1", BinaryType, nullable = true) ::
StructField("b2", BinaryType, nullable = true) :: Nil)
BoundReference(0, BinaryType, nullable = true).asc :: Nil)
val rowType = StructType(StructField("b", BinaryType, nullable = true) :: Nil)
val toCatalyst = CatalystTypeConverters.createToCatalystConverter(rowType)
val rowB1 = toCatalyst(Row(b1)).asInstanceOf[InternalRow]
val rowB2 = toCatalyst(Row(b2)).asInstanceOf[InternalRow]
Expand Down

0 comments on commit 08776e1

Please sign in to comment.