Java Code Examples for org.apache.zeppelin.interpreter.Interpreter#open()

The following examples show how to use org.apache.zeppelin.interpreter.Interpreter#open() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraInterpreterTest.java    From zeppelin with Apache License 2.0 6 votes vote down vote up
@Test
@Ignore
//TODO(n.a.) activate test when using Java 8 and C* 3.x
public void should_describe_aggregate() throws Exception {
  //Given
  Properties properties = new Properties();
  properties.setProperty(CASSANDRA_HOSTS, "127.0.0.1");
  properties.setProperty(CASSANDRA_PORT,  "9042");
  Interpreter interpreter = new CassandraInterpreter(properties);
  interpreter.open();

  final String query = "DESCRIBE AGGREGATES;";

  //When
  final InterpreterResult actual = interpreter.interpret(query, intrContext);

  //Then
  assertThat(actual.code()).isEqualTo(Code.SUCCESS);
}
 
Example 2
Source File: CassandraInterpreterTest.java    From zeppelin with Apache License 2.0 6 votes vote down vote up
@Test
@Ignore
//TODO(n.a.) activate test when using Java 8 and C* 3.x
public void should_describe_materialized_view() throws Exception {
  //Given
  Properties properties = new Properties();
  properties.setProperty(CASSANDRA_HOSTS, "127.0.0.1");
  properties.setProperty(CASSANDRA_PORT,  "9042");
  Interpreter interpreter = new CassandraInterpreter(properties);
  interpreter.open();

  final String query = "DESCRIBE MATERIALIZED VIEWS;";

  //When
  final InterpreterResult actual = interpreter.interpret(query, intrContext);

  //Then
  assertThat(actual.code()).isEqualTo(Code.SUCCESS);
}
 
Example 3
Source File: RemoteInterpreterServer.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
@Override
public void open(String sessionId, String className) throws TException {
  LOGGER.info(String.format("Open Interpreter %s for session %s ", className, sessionId));
  Interpreter intp = getInterpreter(sessionId, className);
  try {
    intp.open();
  } catch (InterpreterException e) {
    throw new TException("Fail to open interpreter", e);
  }
}
 
Example 4
Source File: CassandraInterpreterTest.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
@Test
@Ignore
//TODO(n.a.) activate test when using Java 8 and C* 3.x
public void should_describe_function() throws Exception {
  //Given
  Properties properties = new Properties();
  properties.setProperty(CASSANDRA_HOSTS, "127.0.0.1");
  properties.setProperty(CASSANDRA_PORT,  "9042");
  Interpreter interpreter = new CassandraInterpreter(properties);
  interpreter.open();

  String createFunction = "CREATE FUNCTION zeppelin.maxof(val1 int,val2 int) " +
          "RETURNS NULL ON NULL INPUT " +
          "RETURNS int " +
          "LANGUAGE java " +
          "AS $$" +
          "    return Math.max(val1, val2);\n" +
          "$$;";
  interpreter.interpret(createFunction, intrContext);
  String query = "DESCRIBE FUNCTION zeppelin.maxOf;";

  //When
  final InterpreterResult actual = interpreter.interpret(query, intrContext);

  //Then
  assertThat(actual.code()).isEqualTo(Code.SUCCESS);
  assertThat(actual.message()).isEqualTo("xxxxx");
}