Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-24008

SQL/Hive Context fails with NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Incomplete
    • 1.6.3
    • None
    • Spark Core

    Description

      SQL / Hive Context fails with NullPointerException while getting configuration from SQLConf. This happens when the MemoryStore is filled with lot of broadcast and started dropping and then SQL / Hive Context is created and broadcast. When using this Context to access a table fails with below NullPointerException.

      Repro is attached - the Spark Example which fills the MemoryStore with broadcasts and then creates and accesses a SQL Context.

      java.lang.NullPointerException
              at org.apache.spark.sql.SQLConf.getConf(SQLConf.scala:638)
              at org.apache.spark.sql.SQLConf.defaultDataSourceName(SQLConf.scala:558)
              at org.apache.spark.sql.DataFrameReader.<init>(DataFrameReader.scala:362)
              at org.apache.spark.sql.SQLContext.read(SQLContext.scala:623)
              at SparkHiveExample$.main(SparkHiveExample.scala:76)
              at SparkHiveExample.main(SparkHiveExample.scala)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
      
      
      18/04/06 14:17:42 ERROR ApplicationMaster: User class threw exception: java.lang.NullPointerException 
      java.lang.NullPointerException 
      at org.apache.spark.sql.SQLConf.getConf(SQLConf.scala:638) 
      at org.apache.spark.sql.SQLContext.getConf(SQLContext.scala:153) 
      at org.apache.spark.sql.hive.HiveContext.hiveMetastoreVersion(HiveContext.scala:166) 
      at org.apache.spark.sql.hive.HiveContext.metadataHive$lzycompute(HiveContext.scala:258) 
      at org.apache.spark.sql.hive.HiveContext.metadataHive(HiveContext.scala:255) 
      at org.apache.spark.sql.hive.HiveContext$$anon$2.<init>(HiveContext.scala:475) 
      at org.apache.spark.sql.hive.HiveContext.catalog$lzycompute(HiveContext.scala:475) 
      at org.apache.spark.sql.hive.HiveContext.catalog(HiveContext.scala:474) 
      at org.apache.spark.sql.hive.HiveContext.catalog(HiveContext.scala:90) 
      at org.apache.spark.sql.SQLContext.table(SQLContext.scala:831) 
      at org.apache.spark.sql.SQLContext.table(SQLContext.scala:827) 
      
      

      MemoryStore got filled and started dropping the blocks.

      18/04/17 08:03:43 INFO MemoryStore: 2 blocks selected for dropping
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_14 stored as values in memory (estimated size 78.1 MB, free 64.4 MB)
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_14_piece0 stored as bytes in memory (estimated size 1522.0 B, free 64.4 MB)
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_15 stored as values in memory (estimated size 350.9 KB, free 64.1 MB)
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_15_piece0 stored as bytes in memory (estimated size 29.9 KB, free 64.0 MB)
      18/04/17 08:03:43 INFO MemoryStore: 10 blocks selected for dropping
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_16 stored as values in memory (estimated size 78.1 MB, free 64.7 MB)
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_16_piece0 stored as bytes in memory (estimated size 1522.0 B, free 64.7 MB)
      18/04/17 08:03:43 INFO MemoryStore: Block broadcast_1 stored as values in memory (estimated size 136.0 B, free 64.7 MB)
      18/04/17 08:03:44 INFO MemoryStore: MemoryStore cleared
      18/04/17 08:03:20 INFO MemoryStore: MemoryStore started with capacity 511.1 MB
      18/04/17 08:03:44 INFO MemoryStore: MemoryStore cleared
      18/04/17 08:03:57 INFO MemoryStore: MemoryStore started with capacity 511.1 MB
      18/04/17 08:04:23 INFO MemoryStore: MemoryStore cleared
      

      Fix is to remove broadcasting SQL/Hive Context or Increasing the Driver memory.

      Attachments

        1. Repro
          3 kB
          Prabhu Joseph

        Activity

          People

            Unassigned Unassigned
            prabhujoseph Prabhu Joseph
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: