Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ trait CheckAnalysis {

aggregateExprs.foreach(checkValidAggregateExpression)

case Sort(orders, _, _) =>
orders.foreach { order =>
order.dataType match {
case t: AtomicType => // OK
case NullType => // OK
case t =>
failAnalysis(s"Sorting is not supported for columns of type ${t.simpleString}")
}
}

case _ => // Fallbacks to the following checks
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ class AnalysisErrorSuite extends SparkFunSuite with BeforeAndAfter {
testRelation.select(Literal(1).cast(BinaryType).as('badCast)),
"cannot cast" :: Literal(1).dataType.simpleString :: BinaryType.simpleString :: Nil)

errorTest(
"sorting by unsupported column types",
listRelation.orderBy('list.asc),
"sorting" :: "type" :: "array<int>" :: Nil)

errorTest(
"non-boolean filters",
testRelation.where(Literal(1)),
Expand Down