Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13919#discussion_r69030810
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCWriteSuite.scala ---
    @@ -96,6 +98,30 @@ class JDBCWriteSuite extends SharedSQLContext with 
BeforeAndAfter {
           2 === spark.read.jdbc(url, "TEST.BASICCREATETEST", new 
Properties).collect()(0).length)
       }
     
    +  test("Basic CREATE with illegal batchsize") {
    +    val df = spark.createDataFrame(sparkContext.parallelize(arr2x2), 
schema2)
    +
    +    (-1 to 0).foreach { size =>
    +      val properties = new Properties
    +      properties.setProperty(JdbcUtils.JDBC_BATCH_INSERT_SIZE, 
size.toString)
    +      val e = intercept[SparkException] {
    +        df.write.mode(SaveMode.Overwrite).jdbc(url, 
"TEST.BASICCREATETEST", properties)
    +      }.getMessage
    +      assert(e.contains(s"Invalid value `$size` for parameter 
`batchsize`"))
    +    }
    +  }
    +
    +  test("Basic CREATE with batchsize") {
    +    val df = spark.createDataFrame(sparkContext.parallelize(arr2x2), 
schema2)
    +
    +    (1 to 3).foreach { size =>
    +      val properties = new Properties
    +      properties.setProperty(JdbcUtils.JDBC_BATCH_INSERT_SIZE, 
size.toString)
    +      df.write.mode(SaveMode.Overwrite).jdbc(url, "TEST.BASICCREATETEST", 
properties)
    +      assert(2 === spark.read.jdbc(url, "TEST.BASICCREATETEST", new 
Properties).count)
    --- End diff --
    
    Uh... I see. Let me do it. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to