mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
address comments
This commit is contained in:
parent
9cee380d44
commit
d2e1cd4eaa
1 changed files with 9 additions and 3 deletions
|
|
@ -107,12 +107,18 @@ public abstract class BasePigInterpreter extends Interpreter {
|
|||
*/
|
||||
protected String createJobName(String cmd, InterpreterContext context) {
|
||||
String pTitle = context.getParagraphTitle();
|
||||
if (!StringUtils.isEmpty(pTitle)) {
|
||||
if (!StringUtils.isBlank(pTitle)) {
|
||||
return pTitle;
|
||||
} else {
|
||||
// use the last line of pig script as the job name.
|
||||
// use the last non-empty line of pig script as the job name.
|
||||
String[] lines = cmd.split("\n");
|
||||
return lines[lines.length - 1];
|
||||
for (int i = lines.length - 1; i >= 0; --i) {
|
||||
if (!StringUtils.isBlank(lines[i])) {
|
||||
return lines[i];
|
||||
}
|
||||
}
|
||||
// in case all the lines are empty, but usually it is almost impossible
|
||||
return "empty_job";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue