[SPARK-21588][SQL] SQLContext.getConf(key, null) should return null
## What changes were proposed in this pull request? In SQLContext.get(key,null) for a key that is not defined in the conf, and doesn't have a default value defined, throws a NPE. Int happens only when conf has a value converter Added null check on defaultValue inside SQLConf.getConfString to avoid calling entry.valueConverter(defaultValue) ## How was this patch tested? Added unit test Author: vinodkc <vinod.kc.in@gmail.com> Closes #18852 from vinodkc/br_Fix_SPARK-21588. (cherry picked from commit 1ba967b2) Signed-off-by:gatorsmile <gatorsmile@gmail.com>
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala 6 additions, 4 deletions...rc/main/scala/org/apache/spark/sql/internal/SQLConf.scala
- sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala 11 additions, 0 deletions...st/scala/org/apache/spark/sql/internal/SQLConfSuite.scala
Please register or sign in to comment