Skip to content

Commit 4230df4

Browse files
committed
[SPARK-2785][SQL] Remove assertions that throw when users try unsupported Hive commands.
Author: Michael Armbrust <[email protected]> Closes #1742 from marmbrus/asserts and squashes the following commits: 5182d54 [Michael Armbrust] Remove assertions that throw when users try unsupported Hive commands. (cherry picked from commit 198df11) Signed-off-by: Michael Armbrust <[email protected]>
1 parent 3b9f25f commit 4230df4

File tree

1 file changed

+9
-4
lines changed
  • sql/hive/src/main/scala/org/apache/spark/sql/hive

1 file changed

+9
-4
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,11 @@ private[hive] object HiveQl {
297297
matches.headOption
298298
}
299299

300-
assert(remainingNodes.isEmpty,
301-
s"Unhandled clauses: ${remainingNodes.map(dumpTree(_)).mkString("\n")}")
300+
if (remainingNodes.nonEmpty) {
301+
sys.error(
302+
s"""Unhandled clauses: ${remainingNodes.map(dumpTree(_)).mkString("\n")}.
303+
|You are likely trying to use an unsupported Hive feature."""".stripMargin)
304+
}
302305
clauses
303306
}
304307

@@ -748,15 +751,17 @@ private[hive] object HiveQl {
748751
case Token(allJoinTokens(joinToken),
749752
relation1 ::
750753
relation2 :: other) =>
751-
assert(other.size <= 1, s"Unhandled join child $other")
754+
if (!(other.size <= 1)) {
755+
sys.error(s"Unsupported join operation: $other")
756+
}
757+
752758
val joinType = joinToken match {
753759
case "TOK_JOIN" => Inner
754760
case "TOK_RIGHTOUTERJOIN" => RightOuter
755761
case "TOK_LEFTOUTERJOIN" => LeftOuter
756762
case "TOK_FULLOUTERJOIN" => FullOuter
757763
case "TOK_LEFTSEMIJOIN" => LeftSemi
758764
}
759-
assert(other.size <= 1, "Unhandled join clauses.")
760765
Join(nodeToRelation(relation1),
761766
nodeToRelation(relation2),
762767
joinType,

0 commit comments

Comments
 (0)