Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/10884#discussion_r50627984
--- 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 --
As an experiment, I just tried adding a new test which drops the `src`
table, then runs
```
positionTest("unresolved attribute new test",
"""SELECT x,
|key FROM src
""".stripMargin, "key")
```
and it looks like this actually does fail with
```
[info] - unresolved attribute 4 *** FAILED *** (47 milliseconds)
[info] 1 did not equal 2 wrong line (ErrorPositionSuite.scala:153)
```
I guess that the attribute resolution order doesn't relate to the order in
which the attributes appear in the query: I think `x` is always resolved before
`key`, which is why this test always passes irrespective of whether `key`
exists.
---
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]