You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/10/29 02:10:32 UTC

[GitHub] [spark] teeyog commented on a change in pull request #25287: [SPARK-28552][SQL]Identification of different dialects insensitive to case by JDBC URL prefix

teeyog commented on a change in pull request #25287: [SPARK-28552][SQL]Identification of different dialects insensitive to case by JDBC URL prefix
URL: https://github.com/apache/spark/pull/25287#discussion_r339867433
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
 ##########
 @@ -56,13 +57,26 @@ case class JdbcType(databaseTypeDefinition : String, jdbcNullType : Int)
  */
 @DeveloperApi
 abstract class JdbcDialect extends Serializable {
+  /**
+   * The tag of the database, it must be lowercase, the subsequent will match
+   * the corresponding dialect through this tag, so it must be strictly one-to-one
+   * correspondence with jdbc url,such as:
+   * mysql  url:  jdbc:mysql://localhost/db  dbTag: mysql
+   * oracle url:  jdbc:oracle://localhost/db dbTag: oracle
+   * db2    url:  jdbc:db2://localhost/db    dbTag: db2
+   * ......
+   */
+  def dbTag: String
 
 Review comment:
   So how do you look like this, the canHandle in each implementation is cover to lowercase
   ```
   private case object MySQLDialect extends JdbcDialect {
   
     override def canHandle(url : String): Boolean =
         url.toLowerCase(Locale.ROOT).startsWith("jdbc:mysql")
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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