Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/13161#discussion_r63637193
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala
---
@@ -64,49 +64,57 @@ case class SortOrder(child: Expression, direction:
SortDirection)
}
/**
- * An expression to generate a 64-bit long prefix used in sorting.
+ * An expression to generate a 64-bit long prefix used in sorting. If the
sort must operate over
+ * null keys as well, this.nullValue can be used in place of emitted null
prefixes in the sort.
*/
case class SortPrefix(child: SortOrder) extends UnaryExpression {
+ val nullValue = child.child.dataType match {
+ case BooleanType | DateType | TimestampType | _: IntegralType =>
+ Long.MinValue
+ case dt: DecimalType if dt.precision - dt.scale <=
Decimal.MAX_LONG_DIGITS =>
+ Long.MinValue
+ case dt: DecimalType =>
+ DoublePrefixComparator.computePrefix(Double.NegativeInfinity)
--- End diff --
It seems `dt` is not used here. Maybe this could be as below:
```scala
case _: DecimalType =>
DoublePrefixComparator.computePrefix(Double.NegativeInfinity)
```
---
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]