wangzhigang1999 commented on code in PR #7419:
URL: https://github.com/apache/kyuubi/pull/7419#discussion_r3153561176


##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/dialect/JdbcDialect.scala:
##########
@@ -82,6 +82,20 @@ abstract class JdbcDialect extends SupportServiceLoader with 
Logging {
 
   def getSchemaHelper(): SchemaHelper
 
+  /**
+   * Switch the current database on the backend connection.
+   *
+   * Called during session open when the client specified a database in the 
connection URL
+   * (populated by the Hive JDBC driver into `USE_DATABASE`). Dialects that 
support an
+   * in-session database context switch (e.g. MySQL's `USE db`) should 
override this and
+   * return `true` on success; the default is a no-op that returns `false`, 
meaning the
+   * backend has no notion of "current database" that applies to this session.
+   *
+   * The return value is used by `JdbcOperationManager` to decide whether the 
requested
+   * database can be treated as the effective schema filter for metadata 
operations.
+   */
+  def setCurrentDatabase(connection: Connection, database: String): Boolean = 
false

Review Comment:
   Looked into DBeaver source. The root cause isn't on the client side — both 
DBeaver and the Hive driver are spec-correct (`null` schemaPattern legitimately 
means "all schemas"). The real issue is that the engine was discarding the 
URL's database entirely: not switching the backend connection, not using it as 
the default metadata scope. Engine-side fix is the right place.
   
   Will follow up with the API cleanup you suggested (default `setSchema`, 
override Phoenix/Impala if needed, drop the boolean).
   



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