Github user bersprockets commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21231#discussion_r187192485
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala
 ---
    @@ -147,7 +148,40 @@ case class SortPrefix(child: SortOrder) extends 
UnaryExpression {
           (!child.isAscending && child.nullOrdering == NullsLast)
       }
     
    -  override def eval(input: InternalRow): Any = throw new 
UnsupportedOperationException
    +  private lazy val calcPrefix: Any => Long = child.child.dataType match {
    +    case BooleanType => (raw) =>
    +      if (raw.asInstanceOf[Boolean]) 1 else 0
    +    case DateType | TimestampType | _: IntegralType => (raw) =>
    --- End diff --
    
    I'm a little apprehensive about changing existing and properly functioning 
code (in doGenCode), even though it would make it slightly more readable. If 
you think I should, though, I will.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to