FAQ
Author: cws
Date: Fri Jul 29 18:51:42 2011
New Revision: 1152338

URL: http://svn.apache.org/viewvc?rev=1152338&view=rev
Log:
HIVE-2080. Few code improvements in the ql and serde packages (Chinna Rao Lalam via cws)

Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FilterOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TableScanOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeField.java
hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFieldType.java
hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFunction.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/CommonJoinOperator.java Fri Jul 29 18:51:42 2011
@@ -752,7 +752,6 @@ transient boolean newGroupStarted = fals

protected void checkAndGenObject() throws HiveException {
if (condn[0].getType() == JoinDesc.UNIQUE_JOIN) {
- new IntermediateObject(new ArrayList[numAliases], 0);

// Check if results need to be emitted.
// Results only need to be emitted if there is a non-null entry in a table

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java Fri Jul 29 18:51:42 2011
@@ -740,7 +740,7 @@ public class FileSinkOperator extends Te
*/
@Override
public String getName() {
- return new String("FS");
+ return "FS";
}

@Override

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FilterOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FilterOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FilterOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FilterOperator.java Fri Jul 29 18:51:42 2011
@@ -104,7 +104,7 @@ public class FilterOperator extends Oper
*/
@Override
public String getName() {
- return new String("FIL");
+ return "FIL";
}

@Override

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java Fri Jul 29 18:51:42 2011
@@ -451,11 +451,11 @@ public class GroupByOperator extends Ope
**/
private int getSize(int pos, Class<?> c, Field f) {
if (c.isPrimitive()
- || c.isInstance(new Boolean(true))
- || c.isInstance(new Byte((byte) 0))
- || c.isInstance(new Short((short) 0))
- || c.isInstance(new Integer(0))
- || c.isInstance(new Long(0))
+ || c.isInstance(Boolean.valueOf(true))
+ || c.isInstance(Byte.valueOf((byte) 0))
+ || c.isInstance(Short.valueOf((short) 0))
+ || c.isInstance(Integer.valueOf(0))
+ || c.isInstance(Long.valueOf(0))
c.isInstance(new Float(0))
c.isInstance(new Double(0))) {
return javaSizePrimitiveType;
@@ -1051,7 +1051,7 @@ public class GroupByOperator extends Ope
*/
@Override
public String getName() {
- return new String("GBY");
+ return "GBY";
}

@Override

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java Fri Jul 29 18:51:42 2011
@@ -814,7 +814,7 @@ public abstract class Operator<T extends
* @return the name of the operator
*/
public String getName() {
- return new String("OP");
+ return "OP";
}

/**

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java Fri Jul 29 18:51:42 2011
@@ -310,7 +310,7 @@ public class ReduceSinkOperator extends
*/
@Override
public String getName() {
- return new String("RS");
+ return "RS";
}

@Override

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java Fri Jul 29 18:51:42 2011
@@ -89,7 +89,7 @@ public class SelectOperator extends Oper
*/
@Override
public String getName() {
- return new String("SEL");
+ return "SEL";
}

@Override

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TableScanOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TableScanOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TableScanOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TableScanOperator.java Fri Jul 29 18:51:42 2011
@@ -36,9 +36,9 @@ import org.apache.hadoop.hive.ql.stats.S
import org.apache.hadoop.hive.ql.stats.StatsSetupConst;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.ObjectInspectorCopyOption;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.ObjectInspectorCopyOption;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapred.JobConf;

@@ -208,7 +208,7 @@ public class TableScanOperator extends O
**/
@Override
public String getName() {
- return new String("TS");
+ return "TS";
}

// this 'neededColumnIDs' field is included in this operator class instead of

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskFactory.java Fri Jul 29 18:51:42 2011
@@ -85,7 +85,7 @@ public final class TaskFactory {
private static ThreadLocal<Integer> tid = new ThreadLocal<Integer>() {
@Override
protected synchronized Integer initialValue() {
- return new Integer(0);
+ return Integer.valueOf(0);
}
};

@@ -96,7 +96,7 @@ public final class TaskFactory {
}

public static void resetId() {
- tid.set(new Integer(0));
+ tid.set(Integer.valueOf(0));
}

@SuppressWarnings("unchecked")

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java Fri Jul 29 18:51:42 2011
@@ -137,7 +137,7 @@ public class UnionOperator extends Opera
*/
@Override
public String getName() {
- return new String("UNION");
+ return "UNION";
}

@Override

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java Fri Jul 29 18:51:42 2011
@@ -71,7 +71,7 @@ public class ASTNode extends CommonTree
* @see org.apache.hadoop.hive.ql.lib.Node#getName()
*/
public String getName() {
- return (new Integer(super.getToken().getType())).toString();
+ return (Integer.valueOf(super.getToken().getType())).toString();
}

/**

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java Fri Jul 29 18:51:42 2011
@@ -297,7 +297,7 @@ public abstract class BaseSemanticAnalyz
if (val > 127) {
val = val - 256;
}
- bArray[j++] = new Integer(val).byteValue();
+ bArray[j++] = (byte)val;
}

String res = new String(bArray, charSetName);
@@ -557,17 +557,18 @@ public abstract class BaseSemanticAnalyz
if (children <= 0) {
throw new SemanticException("empty struct not allowed.");
}
+ StringBuilder buffer = new StringBuilder(typeStr);
for (int i = 0; i < children; i++) {
ASTNode child = (ASTNode) typeNode.getChild(i);
- typeStr += unescapeIdentifier(child.getChild(0).getText()) + ":";
- typeStr += getTypeStringFromAST((ASTNode) child.getChild(1));
+ buffer.append(unescapeIdentifier(child.getChild(0).getText())).append(":");
+ buffer.append(getTypeStringFromAST((ASTNode) child.getChild(1)));
if (i < children - 1) {
- typeStr += ",";
+ buffer.append(",");
}
}

- typeStr += ">";
- return typeStr;
+ buffer.append(">");
+ return buffer.toString();
}

private static String getUnionTypeStringFromAST(ASTNode typeNode)
@@ -578,13 +579,15 @@ public abstract class BaseSemanticAnalyz
if (children <= 0) {
throw new SemanticException("empty union not allowed.");
}
+ StringBuilder buffer = new StringBuilder(typeStr);
for (int i = 0; i < children; i++) {
- typeStr += getTypeStringFromAST((ASTNode) typeNode.getChild(i));
+ buffer.append(getTypeStringFromAST((ASTNode) typeNode.getChild(i)));
if (i < children - 1) {
- typeStr += ",";
+ buffer.append(",");
}
}
- typeStr += ">";
+ buffer.append(">");
+ typeStr = buffer.toString();
return typeStr;
}


Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java Fri Jul 29 18:51:42 2011
@@ -99,7 +99,7 @@ public class ParseContext {

private HashSet<ReadEntity> semanticInputs;
private List<Task<? extends Serializable>> rootTasks;
-
+
public ParseContext() {
}

@@ -176,7 +176,6 @@ public class ParseContext {
this.uCtx = uCtx;
this.listMapJoinOpsNoReducer = listMapJoinOpsNoReducer;
hasNonPartCols = false;
- this.groupOpToInputTables = new HashMap<GroupByOperator, Set<String>>();
this.groupOpToInputTables = groupOpToInputTables;
this.prunedPartitions = prunedPartitions;
this.opToSamplePruner = opToSamplePruner;

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Fri Jul 29 18:51:42 2011
@@ -3858,8 +3858,8 @@ public class SemanticAnalyzer extends Ba
+ dest_path, e);
}
}
- String cols = new String();
- String colTypes = new String();
+ String cols = "";
+ String colTypes = "";
ArrayList<ColumnInfo> colInfos = inputRR.getColumnInfos();

// CTAS case: the file output format and serde are defined by the create
@@ -4277,7 +4277,6 @@ public class SemanticAnalyzer extends Ba
private ArrayList<ExprNodeDesc> getParitionColsFromBucketCols(String dest, QB qb, Table tab,
TableDesc table_desc, Operator input, boolean convert)
throws SemanticException {
- RowResolver inputRR = opParseCtx.get(input).getRowResolver();
List<String> tabBucketCols = tab.getBucketCols();
List<FieldSchema> tabCols = tab.getCols();


Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeField.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeField.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeField.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeField.java Fri Jul 29 18:51:42 2011
@@ -28,8 +28,8 @@ public class DynamicSerDeField extends D
// [this.fieldid :] Requiredness() FieldType() this.name FieldValue()
// [CommaOrSemicolon()]

- private final int FD_REQUIREDNESS = 0;
- private final int FD_FIELD_TYPE = 1;
+ private static final int FD_REQUIREDNESS = 0;
+ private static final int FD_FIELD_TYPE = 1;

public boolean isSkippable() {
return ((DynamicSerDeFieldRequiredness) jjtGetChild(FD_REQUIREDNESS))

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFieldType.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFieldType.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFieldType.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFieldType.java Fri Jul 29 18:51:42 2011
@@ -27,7 +27,7 @@ public class DynamicSerDeFieldType exten

// production: this.name | BaseType() | MapType() | SetType() | ListType()

- private final int FD_FIELD_TYPE = 0;
+ private static final int FD_FIELD_TYPE = 0;

public DynamicSerDeFieldType(int i) {
super(i);

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFunction.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFunction.java?rev=1152338&r1=1152337&r2=1152338&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFunction.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/dynamic_type/DynamicSerDeFunction.java Fri Jul 29 18:51:42 2011
@@ -29,7 +29,7 @@ public class DynamicSerDeFunction extend
// production is: Async() FunctionType() NAME FieldList() Throws()
// [CommaOrSemicolon]

- private final int FD_FIELD_LIST = 2;
+ private static final int FD_FIELD_LIST = 2;

public DynamicSerDeFunction(int i) {
super(i);

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedJul 29, '11 at 6:52p
activeJul 29, '11 at 6:52p
posts1
users1
websitehive.apache.org

1 user in discussion

Cws: 1 post

People

Translate

site design / logo © 2021 Grokbase