dongjoon-hyun commented on code in PR #53024:
URL: https://github.com/apache/spark/pull/53024#discussion_r2528684890
##########
sql/connect/server/src/test/scala/org/apache/spark/sql/connect/pipelines/PythonPipelineSuite.scala:
##########
@@ -414,12 +457,94 @@ class PythonPipelineSuite
|@dp.materialized_view
|def c():
| return spark.readStream.table("spark_catalog.default.src")
+ |
+ |@dp.materialized_view
+ |def d():
+ | return spark.sql("SELECT * FROM spark_catalog.default.src")
+ |
+ |@dp.table
+ |def e():
+ | return spark.sql("SELECT * FROM STREAM spark_catalog.default.src")
|""".stripMargin).resolve()
+ assert(graph.resolutionFailedFlows.size == 5)
graph.resolutionFailedFlows.foreach { flow =>
- assert(flow.failure.head.getMessage.contains("[TABLE_OR_VIEW_NOT_FOUND]
The table or view"))
+
assert(flow.failure.head.getMessage.contains("[TABLE_OR_VIEW_NOT_FOUND]"))
+
assert(flow.failure.head.getMessage.contains("`spark_catalog`.`default`.`src`"))
}
}
+ test("reading external datasets outside query function works") {
+ sql("CREATE TABLE spark_catalog.default.src AS SELECT * FROM RANGE(5)")
+ val graph = buildGraph(s"""
+ |spark_sql_df = spark.sql("SELECT * FROM
spark_catalog.default.src")
Review Comment:
Indentation?
##########
sql/connect/server/src/test/scala/org/apache/spark/sql/connect/pipelines/PythonPipelineSuite.scala:
##########
@@ -902,4 +1027,82 @@ class PythonPipelineSuite
s"Table should have no transforms, but got: ${stTransforms.mkString(",
")}")
}
}
+
+ // List of unsupported SQL commands that should result in a failure.
+ private val unsupportedSqlCommandList: Seq[String] = Seq(
+ "SET CATALOG some_catalog",
+ "USE SCHEMA some_schema",
+ "SET `test_conf` = `true`",
+ "CREATE TABLE some_table (id INT)",
+ "CREATE VIEW some_view AS SELECT * FROM some_table",
+ "INSERT INTO some_table VALUES (1)",
+ "ALTER TABLE some_table RENAME TO some_new_table",
+ "CREATE NAMESPACE some_namespace",
+ "DROP VIEW some_view",
+ "CREATE MATERIALIZED VIEW some_view AS SELECT * FROM some_table",
+ "CREATE STREAMING TABLE some_table AS SELECT * FROM some_table")
+
+ gridTest("Unsupported SQL command outside query function should result in a
failure")(
+ unsupportedSqlCommandList) { unsupportedSqlCommand =>
+ val ex = intercept[RuntimeException] {
+ buildGraph(s"""
+ |spark.sql("$unsupportedSqlCommand")
Review Comment:
indentation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]