pan3793 commented on code in PR #52819:
URL: https://github.com/apache/spark/pull/52819#discussion_r2510275201
##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectDatabaseMetaData.scala:
##########
@@ -299,11 +304,59 @@ class SparkConnectDatabaseMetaData(conn:
SparkConnectConnection) extends Databas
new SparkConnectResultSet(df.collectResult())
}
- override def getSchemas: ResultSet =
- throw new SQLFeatureNotSupportedException
+ override def getSchemas: ResultSet = {
+ conn.checkOpen()
- override def getSchemas(catalog: String, schemaPattern: String): ResultSet =
- throw new SQLFeatureNotSupportedException
+ getSchemas(null, null)
+ }
+
+ // Schema of the returned DataFrame is:
+ // |-- TABLE_SCHEM: string (nullable = false)
+ // |-- TABLE_CATALOG: string (nullable = false)
+ private def getSchemasDataFrame(
+ catalog: String, schemaPattern: String): connect.DataFrame = {
+
+ val schemaFilterClause =
+ if (isNullOrWildcard(schemaPattern)) "1=1" else s"TABLE_SCHEM LIKE
'$schemaPattern'"
+
+ def internalGetSchemas(
+ catalogOpt: Option[String],
Review Comment:
not exactly, for `''` it passes `None` to indicate using the current catalog
> "" retrieves those without a catalog;
##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectDatabaseMetaData.scala:
##########
@@ -299,11 +304,59 @@ class SparkConnectDatabaseMetaData(conn:
SparkConnectConnection) extends Databas
new SparkConnectResultSet(df.collectResult())
}
- override def getSchemas: ResultSet =
- throw new SQLFeatureNotSupportedException
+ override def getSchemas: ResultSet = {
+ conn.checkOpen()
- override def getSchemas(catalog: String, schemaPattern: String): ResultSet =
- throw new SQLFeatureNotSupportedException
+ getSchemas(null, null)
+ }
+
+ // Schema of the returned DataFrame is:
+ // |-- TABLE_SCHEM: string (nullable = false)
+ // |-- TABLE_CATALOG: string (nullable = false)
+ private def getSchemasDataFrame(
+ catalog: String, schemaPattern: String): connect.DataFrame = {
+
+ val schemaFilterClause =
+ if (isNullOrWildcard(schemaPattern)) "1=1" else s"TABLE_SCHEM LIKE
'$schemaPattern'"
+
+ def internalGetSchemas(
+ catalogOpt: Option[String],
Review Comment:
not exactly, for `""` it passes `None` to indicate using the current catalog
> "" retrieves those without a catalog;
--
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]