Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/11051#discussion_r51757080
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
---
@@ -1291,4 +1291,14 @@ class DataFrameSuite extends QueryTest with
SharedSQLContext {
Seq(1 -> "a").toDF("i", "j").filter($"i".cast(StringType) === "1"),
Row(1, "a"))
}
+
+ test("SPARK-12982: Add table name validation in temp table
registration") {
+ val rows = List(Row("foo"), Row("bar"))
+ val schema = StructType(Seq(StructField("col", StringType)))
+ val rdd = sparkContext.parallelize(rows)
+ val df = sqlContext.createDataFrame(rdd, schema)
+ assert(intercept[AnalysisException](df.registerTempTable("t~"))
+ .getMessage.contains("NoViableAltException"))
--- End diff --
Catching the analysis exception is fine for now. Lets not rely on an ANTLR
specific error.
---
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]