Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/10884#discussion_r50627933
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala ---
@@ -19,20 +19,34 @@ package org.apache.spark.sql.hive
import scala.util.Try
-import org.scalatest.BeforeAndAfter
+import org.scalatest.BeforeAndAfterEach
import org.apache.spark.sql.{AnalysisException, QueryTest}
import org.apache.spark.sql.catalyst.parser.ParseDriver
import org.apache.spark.sql.catalyst.util.quietly
import org.apache.spark.sql.hive.test.TestHiveSingleton
-class ErrorPositionSuite extends QueryTest with TestHiveSingleton with
BeforeAndAfter {
+class ErrorPositionSuite extends QueryTest with TestHiveSingleton with
BeforeAndAfterEach {
import hiveContext.implicits._
- before {
+ override protected def beforeEach(): Unit = {
+ super.beforeEach()
+ if (sqlContext.tableNames().contains("src")) {
+ sqlContext.dropTempTable("src")
+ }
+ Seq((1, "")).toDF("key", "value").registerTempTable("src")
--- End diff --
I was thinking about the following tests:
```scala
positionTest("unresolved attribute 1",
"SELECT x FROM src", "x")
```
and
```scala
positionTest("unresolved attribute 3",
"SELECT key, x FROM src", "x")
```
and
```scala
positionTest("unresolved attribute 4",
"""SELECT key,
|x FROM src
""".stripMargin, "x")
```
In the second and third tests, it looks like the assert is trying to check
that "x" is used when positioning the error message and not "key". Therefore, I
think it matters that the table has a column named "key" in order for this test
to be meaningful.
---
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]