Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-23483 Feature parity for Python vs Scala APIs
  3. SPARK-23706

spark.conf.get(value, default=None) should produce None in PySpark

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.3.0
    • 2.3.1, 2.4.0
    • PySpark
    • None

    Description

      Scala:

      scala> spark.conf.get("hey")
      java.util.NoSuchElementException: hey
        at org.apache.spark.sql.internal.SQLConf$$anonfun$getConfString$2.apply(SQLConf.scala:1600)
        at org.apache.spark.sql.internal.SQLConf$$anonfun$getConfString$2.apply(SQLConf.scala:1600)
        at scala.Option.getOrElse(Option.scala:121)
        at org.apache.spark.sql.internal.SQLConf.getConfString(SQLConf.scala:1600)
        at org.apache.spark.sql.RuntimeConfig.get(RuntimeConfig.scala:74)
        ... 49 elided
      
      scala> spark.conf.get("hey", null)
      res1: String = null
      
      scala> spark.conf.get("spark.sql.sources.partitionOverwriteMode", null)
      res2: String = null
      

      Python:

      >>> spark.conf.get("hey")
      ...
      py4j.protocol.Py4JJavaError: An error occurred while calling o30.get.
      : java.util.NoSuchElementException: hey
      ...
      
      >>> spark.conf.get("hey", None)
      ...
      py4j.protocol.Py4JJavaError: An error occurred while calling o30.get.
      : java.util.NoSuchElementException: hey
      ...
      
      >>> spark.conf.get("spark.sql.sources.partitionOverwriteMode", None)
      u'STATIC'
      

      Attachments

        Activity

          People

            gurwls223 Hyukjin Kwon
            gurwls223 Hyukjin Kwon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: