diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala | 2 | ||||
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/execution/SortPrefixUtils.scala | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala index 9fe877f10f..afecf881c7 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala @@ -61,6 +61,8 @@ case class SortPrefix(child: SortOrder) extends UnaryExpression { (Long.MinValue, s"$input ? 1L : 0L") case _: IntegralType => (Long.MinValue, s"(long) $input") + case DateType | TimestampType => + (Long.MinValue, s"(long) $input") case FloatType | DoubleType => (DoublePrefixComparator.computePrefix(Double.NegativeInfinity), s"$DoublePrefixCmp.computePrefix((double)$input)") diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/SortPrefixUtils.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/SortPrefixUtils.scala index 17d4166af5..676656518f 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/SortPrefixUtils.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/SortPrefixUtils.scala @@ -38,9 +38,11 @@ object SortPrefixUtils { sortOrder.dataType match { case StringType if sortOrder.isAscending => PrefixComparators.STRING case StringType if !sortOrder.isAscending => PrefixComparators.STRING_DESC - case BooleanType | ByteType | ShortType | IntegerType | LongType if sortOrder.isAscending => + case BooleanType | ByteType | ShortType | IntegerType | LongType | DateType | TimestampType + if sortOrder.isAscending => PrefixComparators.LONG - case BooleanType | ByteType | ShortType | IntegerType | LongType if !sortOrder.isAscending => + case BooleanType | ByteType | ShortType | IntegerType | LongType | DateType | TimestampType + if !sortOrder.isAscending => PrefixComparators.LONG_DESC case FloatType | DoubleType if sortOrder.isAscending => PrefixComparators.DOUBLE case FloatType | DoubleType if !sortOrder.isAscending => PrefixComparators.DOUBLE_DESC |