diff --git ql/src/java/org/apache/hadoop/hive/ql/hooks/Entity.java ql/src/java/org/apache/hadoop/hive/ql/hooks/Entity.java index 0842066..3d7b6e2 100644 --- ql/src/java/org/apache/hadoop/hive/ql/hooks/Entity.java +++ ql/src/java/org/apache/hadoop/hive/ql/hooks/Entity.java @@ -21,6 +21,7 @@ import java.io.Serializable; import java.net.URI; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.metastore.api.Database; @@ -159,6 +160,7 @@ public void setFunctionName(String funcName) { */ public Entity() { name = null; + recordLocation(); } /** @@ -174,6 +176,7 @@ public Entity(Database database, boolean complete) { this.typ = Type.DATABASE; this.name = computeName(); this.complete = complete; + recordLocation(); } /** @@ -189,6 +192,7 @@ public Entity(Table t, boolean complete) { typ = Type.TABLE; name = computeName(); this.complete = complete; + recordLocation(); } /** @@ -204,6 +208,7 @@ public Entity(Partition p, boolean complete) { typ = Type.PARTITION; name = computeName(); this.complete = complete; + recordLocation(); } public Entity(DummyPartition p, boolean complete) { @@ -213,6 +218,7 @@ public Entity(DummyPartition p, boolean complete) { typ = Type.DUMMYPARTITION; name = computeName(); this.complete = complete; + recordLocation(); } public Entity(Path d, boolean islocal, boolean complete) { @@ -226,6 +232,7 @@ public Entity(Path d, boolean islocal, boolean complete) { } name = computeName(); this.complete = complete; + recordLocation(); } /** @@ -244,8 +251,15 @@ public Entity(Database database, String strObj, Type type) { this.typ = type; this.complete = true; name = computeName(); + recordLocation(); } + public Exception location = null; + private static AtomicInteger timeStamp = new AtomicInteger(0); + private void recordLocation() { + location = new Exception(this.getClass().getSimpleName() + "(ts=)" + + timeStamp.getAndIncrement() + ":" + getName()); + } /** * Get the parameter map of the Entity. */ diff --git ql/src/java/org/apache/hadoop/hive/ql/hooks/PreExecutePrinter.java ql/src/java/org/apache/hadoop/hive/ql/hooks/PreExecutePrinter.java index 232c62d..7fc20bd 100644 --- ql/src/java/org/apache/hadoop/hive/ql/hooks/PreExecutePrinter.java +++ ql/src/java/org/apache/hadoop/hive/ql/hooks/PreExecutePrinter.java @@ -30,12 +30,15 @@ import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.hive.ql.session.SessionState.LogHelper; import org.apache.hadoop.security.UserGroupInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Implementation of a pre execute hook that simply prints out its parameters to * standard output. */ public class PreExecutePrinter implements ExecuteWithHookContext { + private static final Logger LOG = LoggerFactory.getLogger(PreExecutePrinter.class); @Override public void run(HookContext hookContext) throws Exception { @@ -75,12 +78,23 @@ public void run(QueryState queryState, Set inputs, static void printEntities(LogHelper console, Set entities, String prefix) { List strings = new ArrayList(); + int idx = 0; for (Object o : entities) { strings.add(o.toString()); } Collections.sort(strings); for (String s : strings) { console.printError(prefix + s); + if(idx > 0) { + if(s.equalsIgnoreCase(strings.get(idx - 1))) { + for(Object o : entities) { + if(o.toString().equalsIgnoreCase(s)) { + LOG.error("Dumping locaion: ", ((Entity)o).location); + } + } + } + } + idx++; } } }