sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-1769: Fix Enum to no inherit from list
Date Wed, 26 Nov 2014 21:02:56 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 6822e8ba3 -> 0cd1ec954


SQOOP-1769: Fix Enum to no inherit from list

(Veena Basavaraj via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/0cd1ec95
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/0cd1ec95
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/0cd1ec95

Branch: refs/heads/sqoop2
Commit: 0cd1ec954a24f49157632beb9d4699cbdced2090
Parents: 6822e8b
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Wed Nov 26 13:02:25 2014 -0800
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Wed Nov 26 13:02:52 2014 -0800

----------------------------------------------------------------------
 .../org/apache/sqoop/json/util/SchemaSerialization.java |  3 +--
 .../main/java/org/apache/sqoop/schema/type/Enum.java    | 12 +-----------
 .../apache/sqoop/json/util/TestSchemaSerialization.java |  5 ++---
 .../java/org/apache/sqoop/schema/type/TestEnum.java     |  9 ---------
 4 files changed, 4 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/0cd1ec95/common/src/main/java/org/apache/sqoop/json/util/SchemaSerialization.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/util/SchemaSerialization.java b/common/src/main/java/org/apache/sqoop/json/util/SchemaSerialization.java
index 634c84a..2f5fadc 100644
--- a/common/src/main/java/org/apache/sqoop/json/util/SchemaSerialization.java
+++ b/common/src/main/java/org/apache/sqoop/json/util/SchemaSerialization.java
@@ -133,7 +133,6 @@ public class SchemaSerialization {
     case ENUM:
       JSONObject enumList = new JSONObject();
       ret.put(LIST, enumList);
-      enumList.put(LIST_TYPE, extractColumn(((AbstractComplexListType) column).getListType()));
       JSONArray optionsArray = new JSONArray();
       optionsArray.addAll(((Enum)column).getOptions());
       enumList.put(ENUM_OPTIONS, optionsArray);
@@ -245,7 +244,7 @@ public class SchemaSerialization {
       output = new Decimal(name).setPrecision(precision).setScale(scale);
       break;
     case ENUM:
-      output = new Enum(name, options).setListType(listType);
+      output = new Enum(name, options);
       break;
     case FIXED_POINT:
       Boolean unsigned = (Boolean) obj.get(UNSIGNED);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/0cd1ec95/common/src/main/java/org/apache/sqoop/schema/type/Enum.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/schema/type/Enum.java b/common/src/main/java/org/apache/sqoop/schema/type/Enum.java
index 33e6dec..85a015b 100644
--- a/common/src/main/java/org/apache/sqoop/schema/type/Enum.java
+++ b/common/src/main/java/org/apache/sqoop/schema/type/Enum.java
@@ -26,7 +26,7 @@ import java.util.HashSet;
  * JDBC Types: enum
  */
 
-public class Enum extends AbstractComplexListType {
+public class Enum extends Column {
 
   // The options set contains the possible values for the Enum
   private Set<String> options;
@@ -41,16 +41,6 @@ public class Enum extends AbstractComplexListType {
     setOptions(options);
   }
 
-  public Enum(String name, Set<String> options, Column listType) {
-    super(name, listType);
-    setOptions(options);
-  }
-
-  public Enum(String name, Boolean nullable, Set<String> options, Column listType)
{
-    super(name, nullable, listType);
-    setOptions(options);
-  }
-
   public Enum setOptions(Set<String> options) {
     assert options != null;
     this.options = options;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/0cd1ec95/common/src/test/java/org/apache/sqoop/json/util/TestSchemaSerialization.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/util/TestSchemaSerialization.java
b/common/src/test/java/org/apache/sqoop/json/util/TestSchemaSerialization.java
index 1779bce..3d31600 100644
--- a/common/src/test/java/org/apache/sqoop/json/util/TestSchemaSerialization.java
+++ b/common/src/test/java/org/apache/sqoop/json/util/TestSchemaSerialization.java
@@ -101,8 +101,7 @@ public class TestSchemaSerialization {
   @Test
   public void testEnum() {
     Schema e = new Schema("e").addColumn(new Enum("e", Collections
-        .unmodifiableSet(new HashSet<String>(Arrays.asList(new String[] { "A", "B"
}))), new Text(
-        "e1")));
+        .unmodifiableSet(new HashSet<String>(Arrays.asList(new String[] { "A", "B"
})))));
     transferAndAssert(e);
   }
 
@@ -162,7 +161,7 @@ public class TestSchemaSerialization {
       .addColumn(new Date("d"))
       .addColumn(new DateTime("e"))
       .addColumn(new Decimal("f"))
-      .addColumn(new Enum("g", Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(new
String[] { "X", "Y" }))), new Text("g1")))
+      .addColumn(new Enum("g", Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(new
String[] { "X", "Y" })))))
       .addColumn(new FixedPoint("h"))
       .addColumn(new FloatingPoint("i"))
       .addColumn(new Map("j", new Text("j1"), new Text("j2")))

http://git-wip-us.apache.org/repos/asf/sqoop/blob/0cd1ec95/common/src/test/java/org/apache/sqoop/schema/type/TestEnum.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/schema/type/TestEnum.java b/common/src/test/java/org/apache/sqoop/schema/type/TestEnum.java
index 4f207c8..f97ebf4 100644
--- a/common/src/test/java/org/apache/sqoop/schema/type/TestEnum.java
+++ b/common/src/test/java/org/apache/sqoop/schema/type/TestEnum.java
@@ -55,13 +55,4 @@ public class TestEnum {
     assertEquals(e1.toString(), e2.toString());
   }
 
-  @Test
-  public void testEnumWithDifferentListType() {
-    Enum e1 = new Enum("A");
-    e1.setListType(new Text("T"));
-    Enum e2 = new Enum("A");
-    e2.setListType(new Binary("B"));
-    assertFalse(e1.equals(e2));
-    assertNotEquals(e1.toString(), e2.toString());
-  }
 }


Mime
View raw message