Skip to content

Commit

Permalink
Merge pull request #25 from marmbrus/rowOrderingWhile
Browse files Browse the repository at this point in the history
Replace foreach with while in RowOrdering. Fixes #23
  • Loading branch information
rxin committed Jan 26, 2014
2 parents 0b31176 + be1fff7 commit 4e50679
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/scala/catalyst/expressions/Row.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class GenericRow(input: Seq[Any]) extends Row {

class RowOrdering(ordering: Seq[SortOrder]) extends Ordering[Row] {
def compare(a: Row, b: Row): Int = {
ordering.foreach { order =>
var i = 0
while(i < ordering.size) {
val order = ordering(i)
val left = Evaluate(order.child, Vector(a))
val right = Evaluate(order.child, Vector(b))

Expand All @@ -101,6 +103,7 @@ class RowOrdering(ordering: Seq[SortOrder]) extends Ordering[Row] {
}
if (comparison != 0) return comparison
}
i += 1
}
return 0
}
Expand Down

0 comments on commit 4e50679

Please sign in to comment.