HeartSaVioR commented on a change in pull request #29767:
URL: https://github.com/apache/spark/pull/29767#discussion_r500195642
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/streaming/test/DataStreamTableAPISuite.scala
##########
@@ -169,6 +171,150 @@ class DataStreamTableAPISuite extends StreamTest with
BeforeAndAfter {
}
}
}
+
+ test("write: write to table with custom catalog & no namespace") {
+ val tableIdentifier = "testcat.table_name"
+
+ spark.sql(s"CREATE TABLE $tableIdentifier (id bigint, data string) USING
foo")
+ checkAnswer(spark.table(tableIdentifier), Seq.empty)
+
+ runTestWithStreamAppend(tableIdentifier)
+ }
+
+ test("write: write to table with custom catalog & namespace") {
+ spark.sql("CREATE NAMESPACE testcat.ns")
+
+ val tableIdentifier = "testcat.ns.table_name"
+
+ spark.sql(s"CREATE TABLE $tableIdentifier (id bigint, data string) USING
foo")
+ checkAnswer(spark.table(tableIdentifier), Seq.empty)
+
+ runTestWithStreamAppend(tableIdentifier)
+ }
+
+ test("write: write to table with default session catalog") {
+ val v2Source = classOf[FakeV2Provider].getName
+ spark.conf.set(SQLConf.V2_SESSION_CATALOG_IMPLEMENTATION.key,
+ classOf[InMemoryTableSessionCatalog].getName)
+
+ spark.sql("CREATE NAMESPACE ns")
+
+ val tableIdentifier = "ns.table_name"
+ spark.sql(s"CREATE TABLE $tableIdentifier (id bigint, data string) USING
$v2Source")
+ checkAnswer(spark.table(tableIdentifier), Seq.empty)
+
+ runTestWithStreamAppend(tableIdentifier)
+ }
+
+ test("write: write to non-exist table with custom catalog") {
+ val tableIdentifier = "testcat.nonexisttable"
+ val existTableIdentifier = "testcat.ns.nonexisttable"
+
+ spark.sql("CREATE NAMESPACE testcat.ns")
+ spark.sql(s"CREATE TABLE $existTableIdentifier (id bigint, data string)
USING foo")
Review comment:
Yeah we don't need it. Nice finding. Will remove.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]