You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by am...@apache.org on 2011/05/17 12:06:27 UTC
svn commit: r1104096 - in /hive/trunk:
hwi/src/java/org/apache/hadoop/hive/hwi/
metastore/src/java/org/apache/hadoop/hive/metastore/
ql/src/java/org/apache/hadoop/hive/ql/optimizer/
ql/src/java/org/apache/hadoop/hive/ql/optimizer/unionproc/ ql/src/java...
Author: amareshwari
Date: Tue May 17 10:06:27 2011
New Revision: 1104096
URL: http://svn.apache.org/viewvc?rev=1104096&view=rev
Log:
HIVE-2160. Miscellaneous code improvements in the metastore,hwi and ql packages. Contributed by Chinna Rao Lalam
Modified:
hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java
hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMRUnion1.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/unionproc/UnionProcessor.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/FetchWork.java
Modified: hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java
URL: http://svn.apache.org/viewvc/hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java (original)
+++ hive/trunk/hwi/src/java/org/apache/hadoop/hive/hwi/HWISessionItem.java Tue May 17 10:06:27 2011
@@ -333,7 +333,7 @@ public class HWISessionItem implements R
Driver qp = (Driver) proc;
qp.setTryCount(Integer.MAX_VALUE);
try {
- queryRet.add(new Integer(qp.run(cmd).getResponseCode()));
+ queryRet.add(Integer.valueOf(qp.run(cmd).getResponseCode()));
ArrayList<String> res = new ArrayList<String>();
try {
while (qp.getResults(res)) {
@@ -367,7 +367,7 @@ public class HWISessionItem implements R
}
} else {
try {
- queryRet.add(new Integer(proc.run(cmd_1).getResponseCode()));
+ queryRet.add(Integer.valueOf(proc.run(cmd_1).getResponseCode()));
} catch (CommandNeedRetryException e) {
// this should never happen if there is no bug
l4j.error(getSessionName() + " Exception when executing", e);
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Tue May 17 10:06:27 2011
@@ -667,7 +667,7 @@ public class HiveMetaStore extends Thrif
Path path = new Path(db.getLocationUri()).getParent();
if (!wh.isWritable(path)) {
throw new MetaException("Database not dropped since " +
- path + " is not writable by " +
+ path + " is not writable by " +
hiveConf.getUser());
}
if (ms.dropDatabase(name)) {
@@ -1040,7 +1040,7 @@ public class HiveMetaStore extends Thrif
tblPath = new Path(tbl.getSd().getLocation());
if (!wh.isWritable(tblPath.getParent())) {
throw new MetaException("Table metadata not deleted since " +
- tblPath.getParent() + " is not writable by " +
+ tblPath.getParent() + " is not writable by " +
hiveConf.getUser());
}
}
@@ -1147,7 +1147,6 @@ public class HiveMetaStore extends Thrif
Path partLocation = null;
try {
ms.openTransaction();
- part = new Partition();
part.setDbName(dbName);
part.setTableName(tableName);
part.setValues(part_vals);
@@ -1428,7 +1427,7 @@ public class HiveMetaStore extends Thrif
archiveParentDir = MetaStoreUtils.getOriginalLocation(part);
if (!wh.isWritable(archiveParentDir.getParent())) {
throw new MetaException("Table partition not deleted since " +
- archiveParentDir.getParent() + " is not writable by " +
+ archiveParentDir.getParent() + " is not writable by " +
hiveConf.getUser());
}
}
@@ -1440,7 +1439,7 @@ public class HiveMetaStore extends Thrif
partPath = new Path(part.getSd().getLocation());
if (!wh.isWritable(partPath.getParent())) {
throw new MetaException("Table partition not deleted since " +
- partPath.getParent() + " is not writable by " +
+ partPath.getParent() + " is not writable by " +
hiveConf.getUser());
}
}
@@ -2314,7 +2313,7 @@ public class HiveMetaStore extends Thrif
tblPath = new Path(tbl.getSd().getLocation());
if (!wh.isWritable(tblPath.getParent())) {
throw new MetaException("Index table metadata not deleted since " +
- tblPath.getParent() + " is not writable by " +
+ tblPath.getParent() + " is not writable by " +
hiveConf.getUser());
}
}
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java Tue May 17 10:06:27 2011
@@ -1225,7 +1225,6 @@ public class ObjectStore implements RawS
q.declareParameters("java.lang.String t1, java.lang.String t2");
q.setResult("partitionName");
Collection names = (Collection) q.execute(dbName, tableName);
- pns = new ArrayList<String>();
for (Iterator i = names.iterator(); i.hasNext();) {
pns.add((String) i.next());
}
@@ -1771,7 +1770,6 @@ public class ObjectStore implements RawS
q.declareParameters("java.lang.String t1, java.lang.String t2");
q.setResult("indexName");
Collection names = (Collection) q.execute(dbName, origTableName);
- pns = new ArrayList<String>();
for (Iterator i = names.iterator(); i.hasNext();) {
pns.add((String) i.next());
}
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java Tue May 17 10:06:27 2011
@@ -650,7 +650,7 @@ public final class ColumnPrunerProcFacto
List<TableDesc> valueTableDescs = new ArrayList<TableDesc>();
for (int pos = 0; pos < op.getParentOperators().size(); pos++) {
List<ExprNodeDesc> valueCols = conf.getExprs()
- .get(new Byte((byte) pos));
+ .get(Byte.valueOf((byte) pos));
StringBuilder keyOrder = new StringBuilder();
for (int i = 0; i < valueCols.size(); i++) {
keyOrder.append("+");
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMRUnion1.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMRUnion1.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMRUnion1.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMRUnion1.java Tue May 17 10:06:27 2011
@@ -137,7 +137,6 @@ public class GenMRUnion1 implements Node
ctx.setUnionTask(union, uCtxTask);
} else {
uTask = uCtxTask.getUTask();
- uPlan = (MapredWork) uTask.getWork();
}
// If there is a mapjoin at position 'pos'
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/MapJoinProcessor.java Tue May 17 10:06:27 2011
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,7 +44,6 @@ import org.apache.hadoop.hive.ql.exec.Re
import org.apache.hadoop.hive.ql.exec.RowSchema;
import org.apache.hadoop.hive.ql.exec.ScriptOperator;
import org.apache.hadoop.hive.ql.exec.SelectOperator;
-import org.apache.hadoop.hive.ql.exec.TableScanOperator;
import org.apache.hadoop.hive.ql.exec.UnionOperator;
import org.apache.hadoop.hive.ql.lib.DefaultRuleDispatcher;
import org.apache.hadoop.hive.ql.lib.Dispatcher;
@@ -353,7 +351,7 @@ public class MapJoinProcessor implements
}
}
- valueExprMap.put(new Byte((byte) pos), values);
+ valueExprMap.put(Byte.valueOf((byte) pos), values);
}
Map<Byte, List<ExprNodeDesc>> filterMap = desc.getFilters();
@@ -392,7 +390,7 @@ public class MapJoinProcessor implements
newPar[pos++] = o;
}
- List<ExprNodeDesc> keyCols = keyExprMap.get(new Byte((byte) 0));
+ List<ExprNodeDesc> keyCols = keyExprMap.get(Byte.valueOf((byte) 0));
StringBuilder keyOrder = new StringBuilder();
for (int i = 0; i < keyCols.size(); i++) {
keyOrder.append("+");
@@ -405,14 +403,14 @@ public class MapJoinProcessor implements
List<TableDesc> valueFiltedTableDescs = new ArrayList<TableDesc>();
for (pos = 0; pos < newParentOps.size(); pos++) {
- List<ExprNodeDesc> valueCols = valueExprMap.get(new Byte((byte) pos));
+ List<ExprNodeDesc> valueCols = valueExprMap.get(Byte.valueOf((byte) pos));
int length = valueCols.size();
List<ExprNodeDesc> valueFilteredCols = new ArrayList<ExprNodeDesc>(length);
// deep copy expr node desc
for (int i = 0; i < length; i++) {
valueFilteredCols.add(valueCols.get(i).clone());
}
- List<ExprNodeDesc> valueFilters = filterMap.get(new Byte((byte) pos));
+ List<ExprNodeDesc> valueFilters = filterMap.get(Byte.valueOf((byte) pos));
if (valueFilters != null && valueFilters.size() != 0 && pos != mapJoinPos) {
ExprNodeColumnDesc isFilterDesc = new ExprNodeColumnDesc(TypeInfoFactory
@@ -483,7 +481,7 @@ public class MapJoinProcessor implements
/**
* Get a list of big table candidates. Only the tables in the returned set can
* be used as big table in the join operation.
- *
+ *
* The logic here is to scan the join condition array from left to right. If
* see a inner join, and the bigTableCandidates is empty or the outer join
* that we last saw is a right outer join, add both side of this inner join to
@@ -496,8 +494,8 @@ public class MapJoinProcessor implements
* the right side of a right outer join always win. If see a full outer join,
* return null immediately (no one can be the big table, can not do a
* mapjoin).
- *
- *
+ *
+ *
* @param condns
* @return
*/
@@ -507,7 +505,7 @@ public class MapJoinProcessor implements
boolean seenOuterJoin = false;
Set<Integer> seenPostitions = new HashSet<Integer>();
Set<Integer> leftPosListOfLastRightOuterJoin = new HashSet<Integer>();
-
+
// is the outer join that we saw most recently is a right outer join?
boolean lastSeenRightOuterJoin = false;
for (JoinCondDesc condn : condns) {
@@ -527,7 +525,7 @@ public class MapJoinProcessor implements
if(bigTableCandidates.size() == 0) {
bigTableCandidates.add(condn.getLeft());
}
-
+
lastSeenRightOuterJoin = false;
} else if (joinType == JoinDesc.RIGHT_OUTER_JOIN) {
seenOuterJoin = true;
@@ -539,7 +537,7 @@ public class MapJoinProcessor implements
bigTableCandidates.clear();
bigTableCandidates.add(condn.getRight());
- } else if (joinType == JoinDesc.INNER_JOIN) {
+ } else if (joinType == JoinDesc.INNER_JOIN) {
if (!seenOuterJoin || lastSeenRightOuterJoin) {
// is the left was at the left side of a right outer join?
if (!leftPosListOfLastRightOuterJoin.contains(condn.getLeft())) {
@@ -698,10 +696,10 @@ public class MapJoinProcessor implements
// the operator stack.
// The dispatcher generates the plan from the operator tree
Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>();
- opRules.put(new RuleRegExp(new String("R0"), "MAPJOIN%"), getCurrentMapJoin());
- opRules.put(new RuleRegExp(new String("R1"), "MAPJOIN%.*FS%"), getMapJoinFS());
- opRules.put(new RuleRegExp(new String("R2"), "MAPJOIN%.*RS%"), getMapJoinDefault());
- opRules.put(new RuleRegExp(new String("R4"), "MAPJOIN%.*UNION%"), getMapJoinDefault());
+ opRules.put(new RuleRegExp("R0", "MAPJOIN%"), getCurrentMapJoin());
+ opRules.put(new RuleRegExp("R1", "MAPJOIN%.*FS%"), getMapJoinFS());
+ opRules.put(new RuleRegExp("R2", "MAPJOIN%.*RS%"), getMapJoinDefault());
+ opRules.put(new RuleRegExp("R4", "MAPJOIN%.*UNION%"), getMapJoinDefault());
// The dispatcher fires the processor corresponding to the closest matching
// rule and passes the context along
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/unionproc/UnionProcessor.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/unionproc/UnionProcessor.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/unionproc/UnionProcessor.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/unionproc/UnionProcessor.java Tue May 17 10:06:27 2011
@@ -41,7 +41,7 @@ import org.apache.hadoop.hive.ql.parse.S
* the sub-query involves a map-reduce job, a FS is introduced on top of the
* UNION. This can be later optimized to clone all the operators above the
* UNION.
- *
+ *
* The parse Context is not changed.
*/
public class UnionProcessor implements Transform {
@@ -55,7 +55,7 @@ public class UnionProcessor implements T
/**
* Transform the query tree. For each union, store the fact whether both the
* sub-queries are map-only
- *
+ *
* @param pCtx
* the current parse context
*/
@@ -63,13 +63,13 @@ public class UnionProcessor implements T
// create a walker which walks the tree in a DFS manner while maintaining
// the operator stack.
Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>();
- opRules.put(new RuleRegExp(new String("R1"), "RS%.*UNION%"),
+ opRules.put(new RuleRegExp("R1", "RS%.*UNION%"),
UnionProcFactory.getMapRedUnion());
- opRules.put(new RuleRegExp(new String("R2"), "UNION%.*UNION%"),
+ opRules.put(new RuleRegExp("R2", "UNION%.*UNION%"),
UnionProcFactory.getUnknownUnion());
- opRules.put(new RuleRegExp(new String("R3"), "TS%.*UNION%"),
+ opRules.put(new RuleRegExp("R3", "TS%.*UNION%"),
UnionProcFactory.getMapUnion());
- opRules.put(new RuleRegExp(new String("R3"), "MAPJOIN%.*UNION%"),
+ opRules.put(new RuleRegExp("R3", "MAPJOIN%.*UNION%"),
UnionProcFactory.getMapJoinUnion());
// The dispatcher fires the processor for the matching rule and passes the
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/FetchWork.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/FetchWork.java?rev=1104096&r1=1104095&r2=1104096&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/FetchWork.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/FetchWork.java Tue May 17 10:06:27 2011
@@ -208,7 +208,7 @@ public class FetchWork implements Serial
return "null fetchwork";
}
- String ret = new String("partition = ");
+ String ret = "partition = ";
for (String part : partDir) {
ret = ret.concat(part);
}