address comments

This commit is contained in:
Jeff Zhang 2016-10-10 08:27:08 +08:00
parent c85a09031a
commit e858301bdf
4 changed files with 14 additions and 9 deletions

View file

@ -164,9 +164,13 @@ elif [[ "${INTERPRETER_ID}" == "pig" ]]; then
fi
# autodetect TEZ_CONF_DIR
TEZ_CONF_DIR = ${TEZ_CONF_DIR:=/etc/tez/conf}
echo "TEZ_CONF_DIR:${TEZ_CONF_DIR}"
ZEPPELIN_INTP_CLASSPATH+=":${TEZ_CONF_DIR}"
if [[ -n "${TEZ_CONF_DIR}" ]]; then
ZEPPELIN_INTP_CLASSPATH+=":${TEZ_CONF_DIR}"
elif [[ -d "/etc/tez/conf" ]]; then
ZEPPELIN_INTP_CLASSPATH+=":/etc/tez/conf"
else
echo "TEZ_CONF_DIR is not set, configuration might not be loaded"
fi
fi
addJarInDirForIntp "${LOCAL_INTERPRETER_REPO}"

View file

@ -59,7 +59,8 @@ public class PigInterpreter extends BasePigInterpreter {
try {
pigServer = new PigServer(execType);
} catch (IOException e) {
throw new RuntimeException("Fail to launch PigServer", e);
LOGGER.error("Fail to initialize PigServer", e);
throw new RuntimeException("Fail to initialize PigServer", e);
}
}
@ -106,6 +107,7 @@ public class PigInterpreter extends BasePigInterpreter {
return new InterpreterResult(Code.ERROR, errorMsg);
}
}
LOGGER.error("Fail to run pig script.", e);
return new InterpreterResult(Code.ERROR, ExceptionUtils.getStackTrace(e));
} finally {
System.setOut(originalStdOut);
@ -122,9 +124,6 @@ public class PigInterpreter extends BasePigInterpreter {
outputBuilder.append(jobStats);
}
}
if (!outputBuilder.toString().isEmpty() || !bytesOutput.toString().isEmpty()) {
outputBuilder.append("------------- Pig Output --------------\n");
}
outputBuilder.append(bytesOutput.toString());
return new InterpreterResult(Code.SUCCESS, outputBuilder.toString());
}

View file

@ -65,6 +65,7 @@ public class PigQueryInterpreter extends BasePigInterpreter {
@Override
public InterpreterResult interpret(String st, InterpreterContext context) {
// '-' is invalid for pig alias
String alias = "paragraph_" + context.getParagraphId().replace("-", "_");
String[] lines = st.split("\n");
List<String> queries = new ArrayList<String>();
@ -126,7 +127,7 @@ public class PigQueryInterpreter extends BasePigInterpreter {
if (e instanceof FrontendException) {
FrontendException fe = (FrontendException) e;
if (!fe.getMessage().contains("Backend error :")) {
LOGGER.error("Fail to run pig script.", e);
LOGGER.error("Fail to run pig query.", e);
return new InterpreterResult(Code.ERROR, ExceptionUtils.getStackTrace(e));
}
}
@ -137,6 +138,7 @@ public class PigQueryInterpreter extends BasePigInterpreter {
return new InterpreterResult(Code.ERROR, errorMsg);
}
}
LOGGER.error("Fail to run pig query.", e);
return new InterpreterResult(Code.ERROR, ExceptionUtils.getStackTrace(e));
} finally {
listenerMap.remove(context.getParagraphId());

View file

@ -35,7 +35,7 @@
"zeppelin.pig.maxResult": {
"envName": null,
"propertyName": "zeppelin.pig.maxResult",
"defaultValue": "20",
"defaultValue": "1000",
"description": "max row number for %pig.query"
}
},