Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address review comment
  • Loading branch information
kiszk committed Jun 27, 2018
commit 1330fa6e3ad5ffd38e2f2c10c1561951a6ef221f
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ private[spark] class ExternalSorter[K, V, C](
val bufferedIters = iterators.filter(_.hasNext).map(_.buffered)
type Iter = BufferedIterator[Product2[K, C]]
val heap = new mutable.PriorityQueue[Iter]()(new Ordering[Iter] {
// Use the reverse of comparator.compare because PriorityQueue dequeues the max
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we keep this comment? we still use reverse order here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe: Use the reverse order because PriorityQueue dequeues the max.

override def compare(x: Iter, y: Iter): Int = comparator.compare(y.head._1, x.head._1)
})
heap.enqueue(bufferedIters: _*) // Will contain only the iterators with hasNext = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ object CaseWhen {
case cond :: value :: Nil => Some((cond, value))
case value :: Nil => None
}.toArray.toSeq // force materialization to make the seq serializable
// avoid false positive of IM_BAD_CHECK_FOR_ODD by SpotBugs
val elseValue = if (branches.size % 2 != 0) Some(branches.last) else None
CaseWhen(cases, elseValue)
}
Expand All @@ -310,7 +309,6 @@ object CaseKeyWhen {
case Seq(cond, value) => Some((EqualTo(key, cond), value))
case Seq(value) => None
}.toArray.toSeq // force materialization to make the seq serializable
// avoid false positive of IM_BAD_CHECK_FOR_ODD by SpotBugs
val elseValue = if (branches.size % 2 != 0) Some(branches.last) else None
CaseWhen(cases, elseValue)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,6 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging
case "TIMESTAMP" =>
Literal(Timestamp.valueOf(value))
case "X" =>
// avoid false positive of IM_BAD_CHECK_FOR_ODD by SpotBugs
val padding = if (value.length % 2 != 0) "0" else ""
Literal(DatatypeConverter.parseHexBinary(padding + value))
case other =>
Expand Down