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-1708: Rename Unsupported Column type to Unknown and add java doc
Date Tue, 11 Nov 2014 06:13:24 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 816aa0389 -> 4fd8dec14


SQOOP-1708: Rename Unsupported Column type to Unknown and add java doc

(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/4fd8dec1
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/4fd8dec1
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/4fd8dec1

Branch: refs/heads/sqoop2
Commit: 4fd8dec1452897cc7a6badf96d722af26ca5de3c
Parents: 816aa03
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon Nov 10 22:13:05 2014 -0800
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Mon Nov 10 22:13:05 2014 -0800

----------------------------------------------------------------------
 .../sqoop/json/util/SchemaSerialization.java    | 10 +--
 .../apache/sqoop/schema/type/ColumnType.java    |  2 +-
 .../org/apache/sqoop/schema/type/Unknown.java   | 70 ++++++++++++++++++++
 .../apache/sqoop/schema/type/Unsupported.java   | 69 -------------------
 .../json/util/TestSchemaSerialization.java      |  6 +-
 .../connector/jdbc/util/SqlTypesUtils.java      |  4 +-
 .../idf/CSVIntermediateDataFormat.java          |  2 +
 7 files changed, 83 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/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 e006761..ecb5aa3 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
@@ -35,7 +35,7 @@ import org.apache.sqoop.schema.type.Set;
 import org.apache.sqoop.schema.type.Text;
 import org.apache.sqoop.schema.type.Time;
 import org.apache.sqoop.schema.type.ColumnType;
-import org.apache.sqoop.schema.type.Unsupported;
+import org.apache.sqoop.schema.type.Unknown;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 
@@ -131,8 +131,8 @@ public class SchemaSerialization {
       case TIME:
         ret.put(FRACTION, ((Time)column).getFraction());
         break;
-      case UNSUPPORTED:
-        ret.put(JDBC_TYPE, ((Unsupported) column).getJdbcType());
+      case UNKNOWN:
+        ret.put(JDBC_TYPE, ((Unknown) column).getJdbcType());
         break;
       case DATE:
       case BIT:
@@ -208,8 +208,8 @@ public class SchemaSerialization {
       case TIME:
         output = new Time().setFraction(fraction);
         break;
-      case UNSUPPORTED:
-        output = new Unsupported().setJdbcType(jdbcType);
+      case UNKNOWN:
+        output = new Unknown().setJdbcType(jdbcType);
         break;
       default:
         // TODO(Jarcec): Throw an exception of unsupported type?

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/common/src/main/java/org/apache/sqoop/schema/type/ColumnType.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/schema/type/ColumnType.java b/common/src/main/java/org/apache/sqoop/schema/type/ColumnType.java
index d98d705..d04015e 100644
--- a/common/src/main/java/org/apache/sqoop/schema/type/ColumnType.java
+++ b/common/src/main/java/org/apache/sqoop/schema/type/ColumnType.java
@@ -34,6 +34,6 @@ public enum ColumnType {
   SET,
   TEXT,
   TIME,
-  UNSUPPORTED,
+  UNKNOWN,
   ;
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/common/src/main/java/org/apache/sqoop/schema/type/Unknown.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/schema/type/Unknown.java b/common/src/main/java/org/apache/sqoop/schema/type/Unknown.java
new file mode 100644
index 0000000..97f72c0
--- /dev/null
+++ b/common/src/main/java/org/apache/sqoop/schema/type/Unknown.java
@@ -0,0 +1,70 @@
+/**
+ * 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.sqoop.schema.type;
+
+/**
+ * Unknown column type (internally encoded as binary)
+ *
+ */
+public class Unknown extends Binary {
+
+  /**
+   * Optional JDBC type that is unknown.
+   */
+  Long jdbcType;
+
+  @Override
+  public ColumnType getType() {
+    return ColumnType.UNKNOWN;
+  }
+
+  public Long getJdbcType() {
+    return jdbcType;
+  }
+
+  public Unknown setJdbcType(Long jdbcType) {
+    this.jdbcType = jdbcType;
+    return this;
+  }
+
+  public Unknown() {
+  }
+
+  public Unknown(Long jdbcType) {
+    setJdbcType(jdbcType);
+  }
+
+  public Unknown(String name) {
+    super(name);
+  }
+
+  public Unknown(String name, Long jdbcType) {
+    super(name);
+    setJdbcType(jdbcType);
+  }
+
+  public Unknown(String name, Boolean nullable) {
+    super(name, nullable);
+  }
+
+  public Unknown(String name, Boolean nullable, Long jdbcType) {
+    super(name, nullable);
+    setJdbcType(jdbcType);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/common/src/main/java/org/apache/sqoop/schema/type/Unsupported.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/schema/type/Unsupported.java b/common/src/main/java/org/apache/sqoop/schema/type/Unsupported.java
deleted file mode 100644
index e7260ec..0000000
--- a/common/src/main/java/org/apache/sqoop/schema/type/Unsupported.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.sqoop.schema.type;
-
-/**
- * Unsupported data type (internally encoded as binary).
- */
-public class Unsupported extends Binary {
-
-  /**
-   * Optional JDBC type that is unknown.
-   */
-  Long jdbcType;
-
-  @Override
-  public ColumnType getType() {
-    return ColumnType.UNSUPPORTED;
-  }
-
-  public Long getJdbcType() {
-    return jdbcType;
-  }
-
-  public Unsupported setJdbcType(Long jdbcType) {
-    this.jdbcType = jdbcType;
-    return this;
-  }
-
-  public Unsupported() {
-  }
-
-  public Unsupported(Long jdbcType) {
-    setJdbcType(jdbcType);
-  }
-
-  public Unsupported(String name) {
-    super(name);
-  }
-
-  public Unsupported(String name, Long jdbcType) {
-    super(name);
-    setJdbcType(jdbcType);
-  }
-
-  public Unsupported(String name, Boolean nullable) {
-    super(name, nullable);
-  }
-
-  public Unsupported(String name, Boolean nullable, Long jdbcType) {
-    super(name, nullable);
-    setJdbcType(jdbcType);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/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 b652b32..1640ead 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
@@ -31,7 +31,7 @@ import org.apache.sqoop.schema.type.Map;
 import org.apache.sqoop.schema.type.Set;
 import org.apache.sqoop.schema.type.Text;
 import org.apache.sqoop.schema.type.Time;
-import org.apache.sqoop.schema.type.Unsupported;
+import org.apache.sqoop.schema.type.Unknown;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.junit.Test;
@@ -123,7 +123,7 @@ public class TestSchemaSerialization {
 
   @Test
   public void testUnsupported() {
-    Schema t = new Schema("t").addColumn(new Unsupported("u", 4L));
+    Schema t = new Schema("t").addColumn(new Unknown("u", 4L));
     transferAndAssert(t);
   }
   @Test
@@ -148,7 +148,7 @@ public class TestSchemaSerialization {
       .addColumn(new Set("k", new Text()))
       .addColumn(new Text("l"))
       .addColumn(new Time("m"))
-      .addColumn(new Unsupported("u"))
+      .addColumn(new Unknown("u"))
     ;
     transferAndAssert(allTypes);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/util/SqlTypesUtils.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/util/SqlTypesUtils.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/util/SqlTypesUtils.java
index 0850b0e..572f0ec 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/util/SqlTypesUtils.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/util/SqlTypesUtils.java
@@ -27,7 +27,7 @@ import org.apache.sqoop.schema.type.FixedPoint;
 import org.apache.sqoop.schema.type.FloatingPoint;
 import org.apache.sqoop.schema.type.Text;
 import org.apache.sqoop.schema.type.Time;
-import org.apache.sqoop.schema.type.Unsupported;
+import org.apache.sqoop.schema.type.Unknown;
 
 import java.sql.Types;
 
@@ -88,7 +88,7 @@ public class SqlTypesUtils {
         return new Binary();
 
       default:
-        return new Unsupported((long)sqlType);
+        return new Unknown((long)sqlType);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/4fd8dec1/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
index 1edbf4d..39a01c1 100644
--- a/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
+++ b/connector/connector-sdk/src/main/java/org/apache/sqoop/connector/idf/CSVIntermediateDataFormat.java
@@ -202,6 +202,8 @@ public class CSVIntermediateDataFormat extends IntermediateDataFormat<String>
{
           out[i] = unescapeStrings(fields[i]);
           break;
         case BINARY:
+        // Unknown is treated as a binary type
+        case UNKNOWN:
           out[i] = unescapeByteArray(fields[i]);
           break;
         case FIXED_POINT:


Mime
View raw message