title: Spark SQL fails because "Constant pool has grown past JVM limit of 0xFFFF"
body: <p>I am running this code on EMR 4.6.0 + Spark 1.6.1 :</p>
  
  <pre><code>val sqlContext = SQLContext.getOrCreate(sc)
  val inputRDD = sqlContext.read.json(input)
  
  try {
      inputRDD.filter("`first_field` is not null OR `second_field` is not null").toJSON.coalesce(10).saveAsTextFile(output)
      logger.info("DONE!")
  } catch {
      case e : Throwable =&gt; logger.error("ERROR" + e.getMessage)
  }
  </code></pre>
  
  <p>In the last stage of <code>saveAsTextFile</code>, it fails with this error:</p>
  
  <pre><code>16/07/15 08:27:45 ERROR codegen.GenerateUnsafeProjection: failed to compile: org.codehaus.janino.JaninoRuntimeException: Constant pool has grown past JVM limit of 0xFFFF
  /* 001 */
  /* 002 */ public java.lang.Object generate(org.apache.spark.sql.catalyst.expressions.Expression[] exprs) {
  /* 003 */   return new SpecificUnsafeProjection(exprs);
  /* 004 */ }
  (...)
  </code></pre>
  
  <p>What could be the reason? Thanks</p>