tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject git commit: TAJO-759: Fix findbug errors added recently.
Date Mon, 14 Apr 2014 10:38:36 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 898268409 -> 06a14960e


TAJO-759: Fix findbug errors added recently.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/06a14960
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/06a14960
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/06a14960

Branch: refs/heads/master
Commit: 06a14960ee74d1bdd4dddf78955928b61563ff6f
Parents: 8982684
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Mon Apr 14 17:58:35 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Mon Apr 14 19:32:17 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../org/apache/tajo/catalog/AlterTableDesc.java | 19 ++++++++---
 .../java/org/apache/tajo/catalog/Column.java    |  5 ---
 .../java/org/apache/tajo/catalog/IndexDesc.java |  2 +-
 .../java/org/apache/tajo/catalog/SortSpec.java  |  2 +-
 .../exception/NoSuchColumnException.java        | 34 ++++++++++++++++++++
 .../tajo/catalog/statistics/ColumnStats.java    |  2 +-
 .../tajo/catalog/statistics/TableStats.java     | 24 ++++++++++----
 .../tajo/catalog/store/AbstractDBStore.java     | 16 ++++++---
 .../org/apache/tajo/catalog/store/MemStore.java |  2 +-
 .../java/org/apache/tajo/client/TajoDump.java   |  2 +-
 .../java/org/apache/tajo/common/type/IPv4.java  |  6 ++--
 .../java/org/apache/tajo/datum/CharDatum.java   |  4 +--
 .../java/org/apache/tajo/datum/DateDatum.java   |  7 ++--
 .../org/apache/tajo/datum/DatumFactory.java     |  4 +--
 .../java/org/apache/tajo/datum/Inet4Datum.java  |  8 ++---
 .../java/org/apache/tajo/datum/TextDatum.java   |  4 +--
 .../java/org/apache/tajo/datum/TimeDatum.java   |  7 ++--
 .../org/apache/tajo/datum/TimestampDatum.java   |  7 ++--
 .../org/apache/tajo/engine/eval/FieldEval.java  |  2 +-
 .../org/apache/tajo/engine/planner/Target.java  |  2 +-
 .../engine/planner/logical/GroupbyNode.java     |  2 +-
 .../apache/tajo/jdbc/TajoPreparedStatement.java |  4 +--
 tajo-project/pom.xml                            |  2 +-
 .../org/apache/tajo/rpc/ServerCallable.java     |  1 -
 .../org/apache/tajo/storage/MemoryUtil.java     |  2 ++
 .../org/apache/tajo/storage/TupleRange.java     |  2 +-
 .../apache/tajo/storage/index/bst/BSTIndex.java |  9 +++---
 .../tajo/storage/trevni/TrevniAppender.java     |  1 +
 29 files changed, 118 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8d7127f..47af4ec 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -923,6 +923,8 @@ Release 0.2.0 - released
 
   BUG FIXES
 
+    TAJO-759: Fix findbug errors added recently. (hyunsik)
+
     TAJO-754: failure of INSERT INTO may remove the target table.
     (hyunsik)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/AlterTableDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/AlterTableDesc.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/AlterTableDesc.java
index d69330d..fcaa4c3 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/AlterTableDesc.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/AlterTableDesc.java
@@ -20,8 +20,6 @@ package org.apache.tajo.catalog;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.annotations.Expose;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.catalog.json.CatalogGsonHelper;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.common.ProtoObject;
@@ -29,11 +27,12 @@ import org.apache.tajo.json.GsonObject;
 
 
 public class AlterTableDesc implements ProtoObject<CatalogProtos.AlterTableDescProto>,
GsonObject, Cloneable {
-  private final Log LOG = LogFactory.getLog(AlterTableDesc.class);
 
   protected CatalogProtos.AlterTableDescProto.Builder builder = null;
 
   @Expose
+  protected AlterTableType alterTableType; //required
+  @Expose
   protected String tableName;  // required
   @Expose
   protected String newTableName;  // optional
@@ -43,8 +42,6 @@ public class AlterTableDesc implements ProtoObject<CatalogProtos.AlterTableDescP
   protected String newColumnName; //optional
   @Expose
   protected Column addColumn = null; //optiona
-  @Expose
-  protected AlterTableType alterTableType; //required
 
   public AlterTableDesc() {
     builder = CatalogProtos.AlterTableDescProto.newBuilder();
@@ -107,6 +104,18 @@ public class AlterTableDesc implements ProtoObject<CatalogProtos.AlterTableDescP
   }
 
   @Override
+  public AlterTableDesc clone() throws CloneNotSupportedException {
+    AlterTableDesc newAlter = (AlterTableDesc) super.clone();
+    newAlter.builder = CatalogProtos.AlterTableDescProto.newBuilder();
+    newAlter.alterTableType = alterTableType;
+    newAlter.tableName = tableName;
+    newAlter.newTableName = newTableName;
+    newAlter.columnName = newColumnName;
+    newAlter.addColumn = addColumn;
+    return newAlter;
+  }
+
+  @Override
   public String toJson() {
     return CatalogGsonHelper.toJson(this, AlterTableDesc.class);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
index aab20c7..aceb6f1 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Column.java
@@ -121,11 +121,6 @@ public class Column implements ProtoObject<ColumnProto>, GsonObject
{
     return Objects.hashCode(name, dataType);
 
   }
-  
-  @Override
-  public Object clone() {
-    return this;
-  }
 
   /**
    *

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
index d77408a..cff2059 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/IndexDesc.java
@@ -140,7 +140,7 @@ public class IndexDesc implements ProtoObject<IndexDescProto>, Cloneable
{
     IndexDesc desc = (IndexDesc) super.clone();
     desc.indexName = indexName;
     desc.tableName = tableName;
-    desc.column = (Column) column.clone();
+    desc.column = column;
     desc.indexMethod = indexMethod;
     desc.isUnique = isUnique;
     desc.isClustered = isClustered;

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SortSpec.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SortSpec.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SortSpec.java
index a2c76ba..5b10dfd 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SortSpec.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SortSpec.java
@@ -78,7 +78,7 @@ public class SortSpec implements Cloneable, GsonObject, ProtoObject<SortSpecProt
   @Override
   public Object clone() throws CloneNotSupportedException {
     SortSpec key = (SortSpec) super.clone();
-    key.sortKey = (Column) sortKey.clone();
+    key.sortKey = sortKey;
     key.ascending = ascending;
     key.nullFirst = nullFirst;
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchColumnException.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchColumnException.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchColumnException.java
new file mode 100644
index 0000000..4af3f70
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchColumnException.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.catalog.exception;
+
+
+public class NoSuchColumnException extends CatalogException {
+	private static final long serialVersionUID = 277182608283894937L;
+
+	public NoSuchColumnException() {}
+
+  public NoSuchColumnException(String databaseName, String relName, String columnName) {
+    super(String.format("ERROR: column \" %s.%s \" in %s does not exist", relName, columnName,
databaseName));
+  }
+
+	public NoSuchColumnException(String columnName) {
+		super("ERROR: column \"" + columnName + "\" does not exist");
+	}
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/ColumnStats.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/ColumnStats.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/ColumnStats.java
index f9f6aab..4d65d9a 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/ColumnStats.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/ColumnStats.java
@@ -129,7 +129,7 @@ public class ColumnStats implements ProtoObject<CatalogProtos.ColumnStatsProto>,
   public Object clone() throws CloneNotSupportedException {
     ColumnStats stat = (ColumnStats) super.clone();
     stat.builder = CatalogProtos.ColumnStatsProto.newBuilder();
-    stat.column = (Column) this.column.clone();
+    stat.column = this.column;
     stat.numDistVals = numDistVals;
     stat.numNulls = numNulls;
     stat.minValue = minValue;

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/TableStats.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/TableStats.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/TableStats.java
index de2922e..dda8cd3 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/TableStats.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/TableStats.java
@@ -192,12 +192,24 @@ public class TableStats implements ProtoObject<TableStatsProto>,
Cloneable, Gson
       return;
     }
 
-    numRows = stat.numRows != null ? stat.numRows + numRows : numRows;
-    numBytes = stat.numBytes != null ? stat.numBytes + numBytes : numBytes;
-    numBlocks = stat.numBlocks != null ? stat.numBlocks + numBlocks : numBlocks;
-    numShuffleOutputs = stat.numShuffleOutputs != null ? stat.numShuffleOutputs + numShuffleOutputs
: numShuffleOutputs;
-    avgRows = stat.avgRows != null ? stat.avgRows + avgRows : avgRows;
-    readBytes = stat.readBytes != null ? stat.readBytes + readBytes : readBytes;
+    if (stat.numRows != null) {
+      numRows += stat.numRows;
+    }
+    if (stat.numBytes != null) {
+      numBytes += stat.numBytes;
+    }
+    if (stat.numBlocks != null) {
+      numBlocks += stat.numBlocks;
+    }
+    if (stat.numShuffleOutputs != null) {
+      numShuffleOutputs += stat.numShuffleOutputs;
+    }
+    if (stat.avgRows != null) {
+      avgRows += stat.avgRows;
+    }
+    if (stat.readBytes != null) {
+      readBytes += stat.readBytes;
+    }
   }
 
   public void setValues(TableStats stat) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
index 5b26e14..234af19 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
@@ -841,11 +841,17 @@ public abstract class AbstractDBStore extends CatalogConstants implements
Catalo
     }
   }
 
-  private void renameColumn(final int tableId, final CatalogProtos.AlterColumnProto alterColumnProto)
throws CatalogException {
+  private void renameColumn(final int tableId, final CatalogProtos.AlterColumnProto alterColumnProto)
+      throws CatalogException {
 
-    final String selectColumnSql = "SELECT COLUMN_NAME, DATA_TYPE, TYPE_LENGTH, ORDINAL_POSITION
from " + TB_COLUMNS +" WHERE " + COL_TABLES_PK + " = ?" + " AND COLUMN_NAME = ?" ;
-    final String deleteColumnNameSql = "DELETE FROM " + TB_COLUMNS + " WHERE TID = ? AND
COLUMN_NAME = ?";
-    final String insertNewColumnSql = "INSERT INTO " + TB_COLUMNS + " (TID, COLUMN_NAME,
ORDINAL_POSITION, DATA_TYPE, TYPE_LENGTH) VALUES(?, ?, ?, ?, ?) ";
+    final String selectColumnSql =
+        "SELECT COLUMN_NAME, DATA_TYPE, TYPE_LENGTH, ORDINAL_POSITION from " + TB_COLUMNS
+
+            " WHERE " + COL_TABLES_PK + " = ?" + " AND COLUMN_NAME = ?" ;
+    final String deleteColumnNameSql =
+        "DELETE FROM " + TB_COLUMNS + " WHERE TID = ? AND COLUMN_NAME = ?";
+    final String insertNewColumnSql =
+        "INSERT INTO " + TB_COLUMNS +
+            " (TID, COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE, TYPE_LENGTH) VALUES(?, ?, ?,
?, ?) ";
 
     if (LOG.isDebugEnabled()) {
       LOG.debug(selectColumnSql);
@@ -876,6 +882,8 @@ public abstract class AbstractDBStore extends CatalogConstants implements
Catalo
         //NOTE ==> Setting new column Name
         columnProto = columnProto.toBuilder().setName(alterColumnProto.getNewColumnName()).build();
         ordinalPostion = resultSet.getInt("ORDINAL_POSITION");
+      } else {
+        throw new NoSuchColumnException(alterColumnProto.getOldColumnName());
       }
 
       resultSet.close();

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
index 8940093..ca99160 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MemStore.java
@@ -431,7 +431,7 @@ public class MemStore implements CatalogStore {
     List<IndexDescProto> protos = new ArrayList<IndexDescProto>();
     Map<String, IndexDescProto> indexByColumn = checkAndGetDatabaseNS(indexesByColumn,
databaseName);
     for (IndexDescProto proto : indexByColumn.values()) {
-      if (proto.equals(tableName)) {
+      if (proto.getTableIdentifier().getTableName().equals(tableName)) {
         protos.add(proto);
       }
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java b/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
index 924a65d..63dd35a 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
@@ -104,7 +104,7 @@ public class TajoDump {
     } else if (hostName != null && port != null) {
       conf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, hostName+":"+port);
       client = new TajoClient(conf);
-    } else if (hostName == null && port == null) {
+    } else {
       client = new TajoClient(conf);
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/common/type/IPv4.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/common/type/IPv4.java b/tajo-common/src/main/java/org/apache/tajo/common/type/IPv4.java
index 957cd89..ba1575f 100644
--- a/tajo-common/src/main/java/org/apache/tajo/common/type/IPv4.java
+++ b/tajo-common/src/main/java/org/apache/tajo/common/type/IPv4.java
@@ -62,11 +62,11 @@ public class IPv4 implements Writable, Comparable<IPv4> {
 			token = tokenizer.nextToken(".");
 			if (token == null) {
 				throw new InvalidAddressException();
-			} else if (Integer.valueOf(token) < 0 || Integer.valueOf(token) > 255) {
+			} else if (Integer.parseInt(token) < 0 || Integer.parseInt(token) > 255) {
 				throw new InvalidAddressException();
 			}
 			//			ipBytes[i] = Short.valueOf(token).byteValue();
-			this.ipBytes[i] = (byte)(((Integer.valueOf(token) << 24) >> 24) & 0xFF);
+			this.ipBytes[i] = (byte)(((Integer.parseInt(token) << 24) >> 24) & 0xFF);
 		}
 	}
 	
@@ -91,7 +91,7 @@ public class IPv4 implements Writable, Comparable<IPv4> {
 		int maskIndex;
 		if ((maskIndex=addr.indexOf('/')) != -1) {
 			IPv4 other = new IPv4(addr.substring(0, maskIndex));
-			int maskLen = Integer.valueOf(addr.substring(maskIndex+1));
+			int maskLen = Integer.parseInt(addr.substring(maskIndex+1));
 			IPv4 subnetMask = IPv4.getSubnetMask(maskLen);
 			if (this.and(subnetMask).equals(other.and(subnetMask))) {
 				return true;

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/CharDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/CharDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/CharDatum.java
index ba66320..e31f59e 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/CharDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/CharDatum.java
@@ -71,12 +71,12 @@ public class CharDatum extends Datum {
 
   @Override
 	public int asInt4() {
-		return Integer.valueOf(getString());
+		return Integer.parseInt(getString());
 	}
 
   @Override
 	public long asInt8() {
-		return Long.valueOf(getString());
+		return Long.parseLong(getString());
 	}
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
index e489a09..c327931 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
@@ -157,7 +157,7 @@ public class DateDatum extends Datum {
   public Datum equalsTo(Datum datum) {
     if (datum.type() == TajoDataTypes.Type.TIME) {
       return DatumFactory.createBool(date.equals(((DateDatum) datum).date));
-    } else if (datum instanceof NullDatum  || datum.isNull()) {
+    } else if (datum.isNull()) {
       return datum;
     } else {
       throw new InvalidOperationException();
@@ -176,14 +176,11 @@ public class DateDatum extends Datum {
   }
 
   public boolean equals(Object obj) {
-    if (obj instanceof NullDatum) {
-        return false;
-    }
     if (obj instanceof DateDatum) {
       DateDatum another = (DateDatum) obj;
       return date.isEqual(another.date);
     } else {
-      throw new InvalidOperationException();
+      return false;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java b/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
index c4f2b6c..2ddea9e 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
@@ -219,7 +219,7 @@ public class DatumFactory {
   }
 
   public static Int4Datum createInt4(String val) {
-    return new Int4Datum(Integer.valueOf(val));
+    return new Int4Datum(Integer.parseInt(val));
   }
 
   public static Int8Datum createInt8(long val) {
@@ -227,7 +227,7 @@ public class DatumFactory {
   }
 
   public static Int8Datum createInt8(String val) {
-    return new Int8Datum(Long.valueOf(val));
+    return new Int8Datum(Long.parseLong(val));
   }
 
   public static Float4Datum createFloat4(float val) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java b/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java
index 0663f0a..991fa70 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java
@@ -32,10 +32,10 @@ public class Inet4Datum extends Datum {
 	public Inet4Datum(String addr) {
     super(Type.INET4);
 		String [] elems = addr.split("\\.");
-    address = Integer.valueOf(elems[3]) & 0xFF
-        | ((Integer.valueOf(elems[2]) << 8) & 0xFF00)
-        | ((Integer.valueOf(elems[1]) << 16) & 0xFF0000)
-        | ((Integer.valueOf(elems[0]) << 24) & 0xFF000000);
+    address = Integer.parseInt(elems[3]) & 0xFF
+        | ((Integer.parseInt(elems[2]) << 8) & 0xFF00)
+        | ((Integer.parseInt(elems[1]) << 16) & 0xFF0000)
+        | ((Integer.parseInt(elems[0]) << 24) & 0xFF000000);
   }
 
 	public Inet4Datum(byte[] addr) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
index 6eb056f..669933f 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
@@ -61,12 +61,12 @@ public class TextDatum extends Datum {
 
   @Override
   public int asInt4() {
-    return Integer.valueOf(new String(bytes));
+    return Integer.parseInt(new String(bytes));
   }
 
   @Override
   public long asInt8() {
-    return Long.valueOf(new String(bytes));
+    return Long.parseLong(new String(bytes));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
index 8b18f08..21ae881 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
@@ -129,7 +129,7 @@ public class TimeDatum extends Datum {
   public Datum equalsTo(Datum datum) {
     if (datum.type() == TajoDataTypes.Type.TIME) {
       return DatumFactory.createBool(time.equals(((TimeDatum) datum).time));
-    } else if (datum instanceof NullDatum  || datum.isNull()) {
+    } else if (datum.isNull()) {
       return datum;
     } else {
       throw new InvalidOperationException();
@@ -148,14 +148,11 @@ public class TimeDatum extends Datum {
   }
 
   public boolean equals(Object obj) {
-    if (obj instanceof NullDatum) {
-        return false;
-    }
     if (obj instanceof TimeDatum) {
       TimeDatum another = (TimeDatum) obj;
       return time.isEqual(another.time);
     } else {
-      throw new InvalidOperationException();
+      return false;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
index e7a9861..6411bec 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
@@ -160,7 +160,7 @@ public class TimestampDatum extends Datum {
   public Datum equalsTo(Datum datum) {
     if (datum.type() == TajoDataTypes.Type.TIME) {
       return DatumFactory.createBool(dateTime.equals(((TimestampDatum) datum).dateTime));
-    } else if (datum instanceof NullDatum || datum.isNull()) {
+    } else if (datum.isNull()) {
       return datum;
     } else {
       throw new InvalidOperationException();
@@ -180,14 +180,11 @@ public class TimestampDatum extends Datum {
 
   @Override
   public boolean equals(Object obj) {
-    if (obj instanceof NullDatum) {
-       return false;
-    }
     if (obj instanceof TimestampDatum) {
       TimestampDatum another = (TimestampDatum) obj;
       return dateTime.isEqual(another.dateTime);
     } else {
-      throw new InvalidOperationException();
+      return false;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/FieldEval.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/FieldEval.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/FieldEval.java
index 504023a..ea2b031 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/FieldEval.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/FieldEval.java
@@ -97,7 +97,7 @@ public class FieldEval extends EvalNode implements Cloneable {
   @Override
   public Object clone() throws CloneNotSupportedException {
     FieldEval eval = (FieldEval) super.clone();
-    eval.column = (Column) this.column.clone();
+    eval.column = this.column;
     eval.fieldId = fieldId;
     
     return eval;

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
index 6e4580d..6a16d3c 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
@@ -117,7 +117,7 @@ public class Target implements Cloneable, GsonObject {
   public Object clone() throws CloneNotSupportedException {
     Target target = (Target) super.clone();
     target.expr = (EvalNode) expr.clone();
-    target.column = (Column) column.clone();
+    target.column = column;
     target.alias = alias != null ? alias : null;
 
     return target;

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
index 76b51c2..bafe0c6 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
@@ -127,7 +127,7 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable
{
     if (groupingColumns != null) {
       grp.groupingColumns = new Column[groupingColumns.length];
       for (int i = 0; i < groupingColumns.length; i++) {
-        grp.groupingColumns[i] = (Column) groupingColumns[i].clone();
+        grp.groupingColumns[i] = groupingColumns[i];
       }
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
----------------------------------------------------------------------
diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
index e2b47c1..c1d0ad2 100644
--- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
+++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
@@ -100,7 +100,7 @@ public class TajoPreparedStatement implements PreparedStatement {
 
   protected ResultSet executeImmediate(String sql) throws SQLException {
     if (isClosed) {
-      throw new SQLFeatureNotSupportedException("Can't execute after statement has been closed");
+      throw new SQLException("Can't execute after statement has been closed");
     }
 
     try {
@@ -109,7 +109,7 @@ public class TajoPreparedStatement implements PreparedStatement {
       }
       resultSet = tajoClient.executeQueryAndGetResult(sql);
     } catch (Exception e) {
-      throw new SQLFeatureNotSupportedException(e.getMessage(), e);
+      throw new SQLException(e.getMessage(), e);
     }
     return resultSet;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-project/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-project/pom.xml b/tajo-project/pom.xml
index 7f78724..6a2ff26 100644
--- a/tajo-project/pom.xml
+++ b/tajo-project/pom.xml
@@ -437,7 +437,7 @@
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>findbugs-maven-plugin</artifactId>
-          <version>2.3.2</version>
+          <version>2.5.3</version>
           <configuration>
             <findbugsXmlOutput>true</findbugsXmlOutput>
             <xmlOutput>true</xmlOutput>

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java b/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
index f2efa4b..214a4ba 100644
--- a/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
+++ b/tajo-rpc/src/main/java/org/apache/tajo/rpc/ServerCallable.java
@@ -30,7 +30,6 @@ import org.apache.tajo.conf.TajoConf;
 
 public abstract class ServerCallable<T> {
   protected InetSocketAddress addr;
-  protected TajoConf tajoConf;
   protected long startTime;
   protected long endTime;
   protected Class protocol;

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-storage/src/main/java/org/apache/tajo/storage/MemoryUtil.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/MemoryUtil.java b/tajo-storage/src/main/java/org/apache/tajo/storage/MemoryUtil.java
index 3218f4d..f19b61f 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/MemoryUtil.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/MemoryUtil.java
@@ -153,6 +153,8 @@ public class MemoryUtil {
         total += TIMESTAMP_DATUM;
         break;
 
+      default:
+        break;
       }
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-storage/src/main/java/org/apache/tajo/storage/TupleRange.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/TupleRange.java b/tajo-storage/src/main/java/org/apache/tajo/storage/TupleRange.java
index 1309116..3232056 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/TupleRange.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/TupleRange.java
@@ -91,7 +91,7 @@ public class TupleRange implements Comparable<TupleRange> {
 
     @Override
     public int compare(TupleRange left, TupleRange right) {
-      return -(left.compareTo(right));
+      return right.compareTo(left);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java b/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
index 2ae04d5..a7a144b 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
@@ -415,13 +415,12 @@ public class BSTIndex implements IndexMethod {
     public long find(Tuple key, boolean nextKey) throws IOException {
       synchronized (mutex) {
         int pos = -1;
-        switch (this.level) {
-          case ONE_LEVEL_INDEX:
+        if (this.level == ONE_LEVEL_INDEX) {
             pos = oneLevBS(key);
-            break;
-          case TWO_LEVEL_INDEX:
+        } else if (this.level == TWO_LEVEL_INDEX) {
             pos = twoLevBS(key, this.loadNum + 1);
-            break;
+        } else {
+          throw new IOException("More than TWL_LEVEL_INDEX is not supported.");
         }
 
         if (nextKey) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/06a14960/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
index 2c35148..a17fbf3 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
@@ -161,6 +161,7 @@ public class TrevniAppender extends FileAppender {
           case INET4:
           case INET6:
             writer.writeValue(t.get(i).asByteArray(), i);
+            break;
 
           default:
             break;


Mime
View raw message