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/24 05:54:39 UTC

[GitHub] [spark] maropu commented on a change in pull request #26230: [SPARK-21287][SQL] Move the validation of fetch size from JDBCOptions to JdbcDialect

maropu commented on a change in pull request #26230: [SPARK-21287][SQL] Move the validation of fetch size from JDBCOptions to JdbcDialect
URL: https://github.com/apache/spark/pull/26230#discussion_r338391122
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
 ##########
 @@ -150,6 +151,30 @@ abstract class JdbcDialect extends Serializable {
   def beforeFetch(connection: Connection, properties: Map[String, String]): Unit = {
   }
 
+  /**
+   * Do some extra properties validation work in addition to the validation in [[JDBCOptions]],
+   * eg. [[validateFetchSize()]].
+   * @param properties The connection properties.  This is passed through from the relation.
+   */
+  def validateProperties(properties: Map[String, String]): Unit = {
+    val fetchSize = properties.getOrElse(JDBCOptions.JDBC_BATCH_FETCH_SIZE, "0").toInt
+    validateFetchSize(fetchSize)
+  }
+
+  /**
+   * This is to validate the fetch size specified via [[JDBCOptions.JDBC_BATCH_FETCH_SIZE]].
+   * The implementation here requires the fetch size >= 0, sub classes may override it to meet
+   * requirement of different dialects.
+   * @param size the fetch size to validate.
+   */
+  protected def validateFetchSize(size: Int): Unit = {
 
 Review comment:
   How about just making this IF public in JdbcDialect? Then, dropping `validateProperties`.

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