You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "urosstan-db (via GitHub)" <gi...@apache.org> on 2024/12/06 16:45:41 UTC

[PR] [SPARK-] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

urosstan-db opened a new pull request, #49095:
URL: https://github.com/apache/spark/pull/49095

   TableCatalog listTables API accepts `namespace`, not the pattern of schema
   But JDBC Table Catalog use provided `namespace` parameter as schema pattern instead of a name.
   
   ### What changes were proposed in this pull request?
   - Treat received namespace as schema name instead of schema pattern in `JDBCTableCatalog`
   
   
   ### Why are the changes needed?
   To align derived and base class API
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, users of DataSource V2 API for JDBC (probably not many users use it, since JDBC connectors still use RelationProvider for spark.read.format("jdbc")) needs to provide schema name now instead of schema pattern.
   
   
   ### How was this patch tested?
   No suitable tests exists, since change is simple, I did not introduce new tests
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1881209126


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   The abstraction we need is: the dialect should tell us how to escape special chars in the schema string of `conn.getMetaData.getTables`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1881210147


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   note: we don't need this abstraction if there is no difference between dialects, or we can reuse `V2ExpressionSQLBuilder#escapeSpecialCharsForLikePattern`



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1879464775


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   Do we expect anyone to extend `JDBCTableCatalog`? I don't think so. It's the catalog implementation for all JDBC dialects.
   
   To be safe, we can add a new method in `JdbcDialect` for the escaping in this JDBC API, which is different from the one in `V2ExpressionSQLBuilder`. I hope they are always the same so that we can save an API.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1880141977


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   Hmm, I would not make such design, this is just extension point for `listingTables` and it is coupled with table catalog functionalities.
   Dialect became bunch of methods that belongs to couple of different logical units.
   If some connector wants to list tables differently, it would override `listTables`, we just use a "template method" and extension point which will scope down escaping and avoid overriding of `listTables`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #49095:
URL: https://github.com/apache/spark/pull/49095#issuecomment-2526542164

   Mind adding the JIRA


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #49095:
URL: https://github.com/apache/spark/pull/49095#issuecomment-2745933521

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1875824923


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +419,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {
+    schemaName.replace("\\", "\\\\")
+        .replace("%", "\\%")
+        .replace("_", "\\_")

Review Comment:
   Yes, those are defaults in SQL standard of almost all databases.
   JDBC API does not specify exact format, https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getTables-java.lang.String-java.lang.String-java.lang.String-java.lang.String:A-
   
   Responsibility of concrete JDBC driver implementation is to support patterns, so in theory, there maybe some JDBC drivers that use some different escape characters (the only one I know is Oracle, while Postgres, MySQL, teradata, Snowflake, Redshift, etc use only those two special characters).
   
   Under the hood, JDBC drivers usually use LIKE operator for this. Like operators have only those two special characters.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1878748638


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   One advantage of `V2ExpressionSQLBuilder#escapeSpecialCharsForLikePattern` is that each SQL dialect can have its own v2 expression SQL builder, which can override `escapeSpecialCharsForLikePattern` to better support that dialect. Shall we get `JdbcDialect#getJdbcSQLQueryBuilder` and call its `escapeSpecialCharsForLikePattern` method here to do the work?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1879107920


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   There is no specific documentation about it. Oracle Java JDBC does not describe how pattern looks like, I was already checked that.
   Problem with dialect is that / is not escaped, and someone can use different escape character for LIKE operations. Some databases allows that syntax. E.g. SQL Server use brackets for escaping, while `getMetadata`.`getTables` still expects escaping with /. I can add new method in dialect, but I thought there is no reason for that, since this is catalog specific, and because of that, I made this method `protected`, to allow overriding. 



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1880141977


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   Hmm, I would not make such design, this method is coupled with table catalog, it should be responsibility of catalog to define way of escaping schema for pattern listing. Dialect became bunch of methods that belongs to couple of different logical units.
   If some connector wants to `listTables` differently, it would override `listTables`, we just use a "template method" and extension point which will scope down escaping and avoid overriding of `listTables`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1881207947


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   `TableCatalog#listTables` API doc is clear that it should list tables in the given namespace, no pattern syntax should be applied. We shouldn't allow connectors to implement `listTables` differently.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on PR #49095:
URL: https://github.com/apache/spark/pull/49095#issuecomment-2523786555

   > How did this work before? Can you give an example?
   
   Imagine you have next MySQL tables
   `my_schema`.table1
   `myyschema`.table2
   
   And you do next operation in Spark:
   ```
   spark.conf.set("spark.sql.catalog.myCatalog", JDBCTableCatalog.getClass.getName)
   spark.sql("SHOW TABLES IN myCatalog.my_schema")
   ```
   
   Before (because provided name is not escaped):
   `my_schema`.table1
   `myyschema`.table2
   
   After (because we escaped characters):
   `my_schema`.table1


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1878027859


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   Similar to it, but not exactly same, `escapeSpecialCharsForLikePattern` for SqlServer for example can use brackets to escape characters, because default escape character for SqlServer is bracket. `escapeSpecialCharsForLikePattern` have to be paired with `visitStartsWith` and `visitEndsWith`. So some implementation if builder can decide to use different escape characters.
   Default implementation of `escapeSpecialCharsForLikePattern` also don't escape /.
   
   Even it is not documented, almost all well-known JDBC drivers (except Oracle) expects pattern with /,%,_ escaping.
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "urosstan-db (via GitHub)" <gi...@apache.org>.
urosstan-db commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1876342584


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +419,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {
+    schemaName.replace("\\", "\\\\")
+        .replace("%", "\\%")
+        .replace("_", "\\_")

Review Comment:
   I also checked decompiled code of Microsoft SQL Server JDBC driver, they use brackets for escaping in LIKE operations, but actually, interface expects special characters escaped by \, so it seems every driver accepts this form.
   But ofc, I made a method for conversion, so anyone can inherit JDBC Table Catalog and override this behaviour.
   
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1875120160


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +419,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {
+    schemaName.replace("\\", "\\\\")
+        .replace("%", "\\%")
+        .replace("_", "\\_")

Review Comment:
   are both only ones to escape? would be great if we add a comment for the spec



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1879465591


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   > Problem with dialect is that / is not escaped, and someone can use different escape character for LIKE operations.
   
   No, `escapeSpecialCharsForLikePattern` assumes the caller to always use `\` as the escape character.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #49095: [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API
URL: https://github.com/apache/spark/pull/49095


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1878751205


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   This assumes that the JDBC API of table listing follows the same pattern syntax of LIKE, but I may be wrong. Is there a document for `conn.getMetaData.getTables` that defines the pattern syntax of the schema string?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-50521][SQL] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #49095:
URL: https://github.com/apache/spark/pull/49095#discussion_r1876530219


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -418,4 +423,10 @@ class JDBCTableCatalog extends TableCatalog
   private def toSQLId(ident: Identifier): String = {
     toSQLId(ident.namespace.toSeq :+ ident.name)
   }
+
+  protected def convertSchemaNameToPattern(schemaName: String): String = {

Review Comment:
   is it the same as `V2ExpressionSQLBuilder#escapeSpecialCharsForLikePattern`?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "andrej-db (via GitHub)" <gi...@apache.org>.
andrej-db commented on PR #49095:
URL: https://github.com/apache/spark/pull/49095#issuecomment-2523753015

   How did this work before? Can you give an example?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-] Align list table method of JDBCTableCatalog to TableCatalog API [spark]

Posted by "andrej-db (via GitHub)" <gi...@apache.org>.
andrej-db commented on PR #49095:
URL: https://github.com/apache/spark/pull/49095#issuecomment-2523830597

   @urosstan-db Awesome, thanks. Also awesome that you've added it to the description.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org