SparkSqlInterpreter extends AbstractInterpreter { public void setResultLimits(long number){ getIntpContext().getLocalProperties().put("limit", String.valueOf(number)); } SparkSqlInterpreter(Properties properties);  SparkSqlInterpreter(); @Override boolean test(); void setResultLimits(long number);  }
@Test public void testMaxResults() throws InterpreterException { sparkInterpreter.interpret("case class P(age:Int)"); sparkInterpreter.interpret( "val gr = sc.parallelize(Seq(P(1),P(2),P(3),P(4),P(5),P(6),P(7),P(8),P(9),P(10),P(11)))"); sparkInterpreter.interpret("gr.toDF.registerTempTable(\"gr\")"); InterpreterResult ret = sqlInterpreter.interpret("select * from gr"); assertEquals(InterpreterResult.Code.SUCCESS, ret.code()); assertEquals(11, ret.message().get(0).getData().split("\n").length); assertTrue(ret.message().get(1).getData().contains("alert-warning")); sqlInterpreter.setResultLimits(5); ret = sqlInterpreter.interpret("select * from gr"); assertEquals(InterpreterResult.Code.SUCCESS, ret.code()); assertEquals(6, ret.message().get(0).getData().split("\n").length); }