Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/9173#discussion_r42543055
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
---
@@ -1782,6 +1782,34 @@ class SQLQuerySuite extends QueryTest with
SharedSQLContext {
}
}
+ test("run sql directly on files") {
+ val df = sqlContext.range(100)
+ withTempPath(f => {
+ df.write.json(f.getCanonicalPath)
+ checkAnswer(sql(s"select id from json.`${f.getCanonicalPath}`"),
+ df)
+ checkAnswer(sql(s"select id from
`org.apache.spark.sql.json`.`${f.getCanonicalPath}`"),
+ df)
+ checkAnswer(sql(s"select a.id from json.`${f.getCanonicalPath}` as
a"),
+ df)
+ })
+
+ val e1 = intercept[AnalysisException] {
+ sql("select * from in_valid_table")
+ }
+ assert(e1.message.contains("Table Not Found"))
+
+ val e2 = intercept[AnalysisException] {
+ sql("select * from no_db.no_table")
+ }
+ assert(e2.message.contains("Table Not Found"))
+
+ val e3 = intercept[AnalysisException] {
+ sql("select * from json.invalid_file")
+ }
+ assert(e3.message.contains("No input paths specified"))
--- End diff --
This is the existing behavior, different data source will have different
messages. This error message came from Hadoop, I think.
---
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]