@Test
public void test_null_value_in_row() {

  repl.interpret("import org.apache.spark.sql._", context);
  if (isDataFrameSupported()) {
    repl.interpret(
        "import org.apache.spark.sql.types.{StructType,StructField,StringType,IntegerType}",
        context);
  }
  repl.interpret(
      "def toInt(s:String): Any = {try { s.trim().toInt} catch {case e:Exception => null}}",
      context);
  repl.interpret(
      "val schema = StructType(Seq(StructField(\"name\", StringType, false),StructField(\"age\" , IntegerType, true),StructField(\"other\" , StringType, false)))",
      context);
  repl.interpret(
      "val csv = sc.parallelize(Seq((\"jobs, 51, apple\"), (\"gates, , microsoft\")))",
      context);
  repl.interpret(
      "val raw = csv.map(_.split(\",\")).map(p => Row(p(0),toInt(p(1)),p(2)))",
      context);
  repl.interpret("val people = z.sqlContext.applySchema(raw, schema)",
      context);
  if (isDataFrameSupported()) {
    repl.interpret("people.toDF.registerTempTable(\"people\")", context);
  } else {
    repl.interpret("people.registerTempTable(\"people\")", context);
  }
  InterpreterResult ret = sql.interpret(
      "select name, age from people where name = 'gates'", context);
  System.err.println("RET=" + ret.message());
  assertEquals(InterpreterResult.Code.SUCCESS, ret.code());
  assertEquals(Type.TABLE, ret.type());
  assertEquals("name\tage\ngates\tnull\n", ret.message());
}