Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/6519#discussion_r31395074
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
---
@@ -210,13 +210,25 @@ case class EqualNullSafe(left: Expression, right:
Expression) extends BinaryComp
case class LessThan(left: Expression, right: Expression) extends
BinaryComparison {
override def symbol: String = "<"
- lazy val ordering: Ordering[Any] = {
+ lazy val orderings: Either[Ordering[Any], (Int, Ordering[Any])] = {
if (left.dataType != right.dataType) {
throw new TreeNodeException(this,
s"Types do not match ${left.dataType} != ${right.dataType}")
}
left.dataType match {
- case i: AtomicType => i.ordering.asInstanceOf[Ordering[Any]]
+ case i: AtomicType => Left(i.ordering.asInstanceOf[Ordering[Any]])
+ case s: StructType =>
+ var i = -1
+ val f = s.fields.find { f =>
+ i += 1
--- End diff --
We shouldn't rely on side-effect of functions like this. Can you just use
`indexOf`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]