tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject tajo git commit: TAJO-1598: TableMeta should change equals mechanism.
Date Tue, 12 May 2015 15:08:07 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.10.1 facbf4323 -> 74d8d8024


TAJO-1598: TableMeta should change equals mechanism.

Signed-off-by: Jihoon Son <jihoonson@apache.org>


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

Branch: refs/heads/branch-0.10.1
Commit: 74d8d80242bf5e57e8f25605e5a0e91ba5a78915
Parents: facbf43
Author: DaeMyung Kang <charsyam@naver.com>
Authored: Wed May 13 00:07:45 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Wed May 13 00:07:45 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  3 +++
 .../java/org/apache/tajo/catalog/TableMeta.java |  6 +++--
 .../org/apache/tajo/catalog/TestTableMeta.java  | 27 ++++++++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/74d8d802/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 05ea1f2..c64309a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -39,6 +39,9 @@ Release 0.10.1 - unreleased
 
   BUG FIXES
 
+    TAJO-1598: TableMeta should change equals mechanism.
+    (Contributed by DaeMyung Kang, Committed by jihoon)
+
     TAJO-1556: "insert into select" with reordered column list does not work.
     (Contributed by Yongjin Choi, Committed by jihoon)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/74d8d802/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableMeta.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableMeta.java
b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableMeta.java
index 2d95e6b..e14c1f5 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableMeta.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableMeta.java
@@ -136,8 +136,10 @@ public class TableMeta implements ProtoObject<CatalogProtos.TableProto>,
GsonObj
 	public boolean equals(Object object) {
 		if(object instanceof TableMeta) {
 			TableMeta other = (TableMeta) object;
-			
-			return this.getProto().equals(other.getProto());
+
+			boolean eq = this.getStoreType().equals(other.getStoreType());
+			eq = eq && this.getOptions().equals(other.getOptions());
+			return eq;
 		}
 		
 		return false;		

http://git-wip-us.apache.org/repos/asf/tajo/blob/74d8d802/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
index 904b4bc..3d6b390 100644
--- a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
@@ -22,6 +22,7 @@ import org.apache.tajo.catalog.json.CatalogGsonHelper;
 import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
 import org.apache.tajo.catalog.proto.CatalogProtos.TableProto;
 import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -86,6 +87,32 @@ public class TestTableMeta {
     assertTrue(meta.equals(meta2));
     assertNotSame(meta, meta2);
   }
+
+	@Test
+	public void testEqualsObject2() {
+		//This testcases should insert more 2 items into one slot.
+		//HashMap's default slot count is 16
+		//so max_count is 17
+
+		int MAX_COUNT = 17;
+
+		TableMeta meta1 = CatalogUtil.newTableMeta(StoreType.CSV.toString());
+		for (int i = 0; i < MAX_COUNT; i++) {
+			meta1.putOption("key"+i, "value"+i);
+		}
+
+		PrimitiveProtos.KeyValueSetProto.Builder optionBuilder = PrimitiveProtos.KeyValueSetProto.newBuilder();
+		for (int i = 1; i <= MAX_COUNT; i++) {
+			PrimitiveProtos.KeyValueProto.Builder keyValueBuilder = PrimitiveProtos.KeyValueProto.newBuilder();
+			keyValueBuilder.setKey("key"+(MAX_COUNT-i)).setValue("value"+(MAX_COUNT-i));
+			optionBuilder.addKeyval(keyValueBuilder);
+		}
+		TableProto.Builder builder = TableProto.newBuilder();
+		builder.setStoreType(StoreType.CSV.toString());
+		builder.setParams(optionBuilder);
+		TableMeta meta2 = new TableMeta(builder.build());
+		assertTrue(meta1.equals(meta2));
+	}
   
   @Test
   public void testGetProto() {


Mime
View raw message