Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/16891#discussion_r100864094 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala --- @@ -925,4 +925,53 @@ class JDBCSuite extends SparkFunSuite assert(res.generatedRows.isEmpty) assert(res.outputRows === foobarCnt :: Nil) } + + test("SPARK-19318: Connection properties keys should be case-sensitivie.") { + val parameters = Map( + "url" -> urlWithUserAndPass, + "dbTable" -> "t1", + "numPartitions" -> "10", + "oracle.jdbc.mapDateToTimestamp" -> "false" + ) + + assert(new JDBCOptions(parameters).asConnectionProperties.keySet() + .toArray()(0) == "oracle.jdbc.mapDateToTimestamp") + + val caseInsensitiveMap = new CaseInsensitiveMap(parameters) + assert(new JDBCOptions(caseInsensitiveMap).asConnectionProperties.keySet() + .toArray()(0) == "oracle.jdbc.mapDateToTimestamp") + assert(caseInsensitiveMap.get("dbtable").get == "t1") + + // add new key-value to case-insensitive map + val caseInsensitiveMap1 = caseInsensitiveMap + ("connTimeOut" -> "60") + val connProps = new JDBCOptions(caseInsensitiveMap1).asConnectionProperties + assert(connProps.get("oracle.jdbc.mapDateToTimestamp") == "false") + assert(connProps.get("connTimeOut") == "60") + assert(caseInsensitiveMap1.get("dbtable").get == "t1") + + // remove key from case-insensitive map --- End diff -- key removing is case insensitive, this test doesn't reflect 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org