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

    https://github.com/apache/spark/pull/3470#discussion_r21201664
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/sources/interfaces.scala ---
    @@ -37,7 +37,7 @@ import 
org.apache.spark.sql.catalyst.expressions.{Expression, Attribute}
     @DeveloperApi
     trait RelationProvider {
       /** Returns a new base relation with the given parameters. */
    -  def createRelation(sqlContext: SQLContext, parameters: Map[String, 
String]): BaseRelation
    +  def createRelation(sqlContext: SQLContext, parameters: 
CaseInsensitiveMap): BaseRelation
    --- End diff --
    
    Hmm, how about revert to ```Map``` here and make case insensitive 
configurable, so we can write like this:
    ```
    private[sql] class DefaultSource extends RelationProvider {
      /** Returns a new base relation with the given parameters. */
      override def createRelation(
          sqlContext: SQLContext,
          parameters: Map[String, String]): BaseRelation = {
        val caseSensitive = sqlContext.getConf("spark.sql.caseSensitive", 
"false").toBoolean
        val paras =
        if (caseSensitive) {
          parameters
        } else {
          new CaseInsensitiveMap(parameters)
        }
        val fileName = paras.getOrElse("path", sys.error("Option 'path' not 
specified"))
        val samplingRatio = 
paras.get("samplingRatio").map(_.toDouble).getOrElse(1.0)
    
        JSONRelation(fileName, samplingRatio)(sqlContext)
      }
    }
    ```


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