Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public void sparkRTest() throws IOException {
}
}

// @Test
@Test
public void pySparkTest() throws IOException {
// create new note
Note note = null;
Expand All @@ -412,6 +412,14 @@ public void pySparkTest() throws IOException {
note.run(p.getId(), true);
assertEquals(Status.FINISHED, p.getStatus());
assertEquals("55\n", p.getReturn().message().get(0).getData());

// simple form via local properties
p = note.addNewParagraph(anonymous);
p.setText("%spark.pyspark(form=simple) print('name_' + '${name=abc}')");
note.run(p.getId(), true);
assertEquals(Status.FINISHED, p.getStatus());
assertEquals("name_abc\n", p.getReturn().message().get(0).getData());

if (!isSpark2()) {
// run sqlContext test
p = note.addNewParagraph(anonymous);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,8 @@ protected InterpreterResult jobRun() throws Throwable {

// inject form
String script = this.scriptText;
if (interpreter.getFormType() == FormType.NATIVE) {
settings.clear();
} else if (interpreter.getFormType() == FormType.SIMPLE) {
if ("simple".equalsIgnoreCase(localProperties.get("form")) ||
interpreter.getFormType() == FormType.SIMPLE) {
// inputs will be built from script body
LinkedHashMap<String, Input> inputs = Input.extractSimpleQueryForm(script, false);
LinkedHashMap<String, Input> noteInputs = Input.extractSimpleQueryForm(script, true);
Expand All @@ -490,6 +489,8 @@ protected InterpreterResult jobRun() throws Throwable {
}
script = Input.getSimpleQuery(note.getNoteParams(), scriptBody, true);
script = Input.getSimpleQuery(settings.getParams(), script, false);
} else {
settings.clear();
}

LOGGER.debug("RUN : " + script);
Expand Down