Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Changed to throw HiveException instead of RuntimeException
Browse files Browse the repository at this point in the history
  • Loading branch information
myui committed Jul 29, 2015
1 parent 44d6f83 commit 8520825
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/hivemall/tools/mapred/JobConfGetsUDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.hadoop.hive.ql.exec.MapredContext;
import org.apache.hadoop.hive.ql.exec.MapredContextAccessor;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.UDFType;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
Expand All @@ -38,18 +39,18 @@
@UDFType(deterministic = false, stateful = true)
public class JobConfGetsUDF extends UDF {

public Text evaluate() {
public Text evaluate() throws HiveException {
return evaluate(null);
}

public Text evaluate(@Nullable final String regexKey) {
public Text evaluate(@Nullable final String regexKey) throws HiveException {
MapredContext ctx = MapredContextAccessor.get();
if(ctx == null) {
throw new IllegalStateException("MapredContext is not set");
throw new HiveException("MapredContext is not set");
}
JobConf jobconf = ctx.getJobConf();
if(jobconf == null) {
throw new IllegalStateException("JobConf is not set");
throw new HiveException("JobConf is not set");
}

String dumped = HadoopUtils.toString(jobconf, regexKey);
Expand Down

0 comments on commit 8520825

Please sign in to comment.