pan3793 commented on code in PR #52995:
URL: https://github.com/apache/spark/pull/52995#discussion_r2516554741


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectDatabaseMetaData.scala:
##########
@@ -355,20 +356,124 @@ class SparkConnectDatabaseMetaData(conn: 
SparkConnectConnection) extends Databas
   override def getSchemas(catalog: String, schemaPattern: String): ResultSet = 
{
     conn.checkOpen()
 
-    val df = getSchemasDataFrame(catalog, schemaPattern)
+    val df = getSchemasDataFrame(catalog, Some(schemaPattern))
       .orderBy("TABLE_CATALOG", "TABLE_SCHEM")
     new SparkConnectResultSet(df.collectResult())
   }
 
-  override def getTableTypes: ResultSet =
-    throw new SQLFeatureNotSupportedException
+  override def getTableTypes: ResultSet = {
+    conn.checkOpen()
+
+    val df = TABLE_TYPES.toDF("TABLE_TYPE")
+      .orderBy("TABLE_TYPE")
+    new SparkConnectResultSet(df.collectResult())
+  }
+
+  // Schema of the returned DataFrame is:
+  // |-- TABLE_CAT: string (nullable = false)
+  // |-- TABLE_SCHEM: string (nullable = false)
+  // |-- TABLE_NAME: string (nullable = false)
+  // |-- TABLE_TYPE: string (nullable = false)
+  // |-- REMARKS: string (nullable = false)
+  // |-- TYPE_CAT: string (nullable = false)
+  // |-- TYPE_SCHEM: string (nullable = false)
+  // |-- TYPE_NAME: string (nullable = false)
+  // |-- SELF_REFERENCING_COL_NAME: string (nullable = false)
+  // |-- REF_GENERATION: string (nullable = false)
+  private def getTablesDataFrame(
+      catalog: String,
+      schemaPattern: String,
+      tableNamePattern: String): connect.DataFrame = {
+
+    val catalogSchemasDf = if (schemaPattern == "") {

Review Comment:
   `null` is allowed here, see line 323



-- 
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]

Reply via email to