sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject [1/2] SQOOP-1322: Enhance Sqoop HCatalog Integration to cover features introduced in newer Hive versions
Date Sun, 13 Jul 2014 22:46:23 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk 1bc8b6bfd -> c65b56f6f


http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/java/org/apache/sqoop/tool/ImportTool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/tool/ImportTool.java b/src/java/org/apache/sqoop/tool/ImportTool.java
index 6cbb873..81904ac 100644
--- a/src/java/org/apache/sqoop/tool/ImportTool.java
+++ b/src/java/org/apache/sqoop/tool/ImportTool.java
@@ -19,7 +19,6 @@
 package org.apache.sqoop.tool;
 
 import java.io.IOException;
-
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
@@ -33,7 +32,8 @@ import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.util.StringUtils;
 
 import com.cloudera.sqoop.Sqoop;
@@ -43,14 +43,11 @@ import com.cloudera.sqoop.cli.RelatedOptions;
 import com.cloudera.sqoop.cli.ToolOptions;
 import com.cloudera.sqoop.hive.HiveImport;
 import com.cloudera.sqoop.manager.ImportJobContext;
-
 import com.cloudera.sqoop.metastore.JobData;
 import com.cloudera.sqoop.metastore.JobStorage;
 import com.cloudera.sqoop.metastore.JobStorageFactory;
 import com.cloudera.sqoop.util.AppendUtils;
 import com.cloudera.sqoop.util.ImportException;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.FileSystem;
 
 /**
  * Tool that performs database imports to HDFS.
@@ -860,7 +857,7 @@ public class ImportTool extends com.cloudera.sqoop.tool.BaseSqoopTool {
       applyInputFormatOptions(in, out);
       applyCodeGenOptions(in, out, allTables);
       applyHBaseOptions(in, out);
-      applyHCatOptions(in, out);
+      applyHCatalogOptions(in, out);
       applyAccumuloOptions(in, out);
 
     } catch (NumberFormatException nfe) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/com/cloudera/sqoop/TestConnFactory.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/TestConnFactory.java b/src/test/com/cloudera/sqoop/TestConnFactory.java
index c0b295e..59c3455 100644
--- a/src/test/com/cloudera/sqoop/TestConnFactory.java
+++ b/src/test/com/cloudera/sqoop/TestConnFactory.java
@@ -18,20 +18,22 @@
 
 package com.cloudera.sqoop;
 
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
 import org.apache.hadoop.conf.Configuration;
+
 import com.cloudera.sqoop.manager.ConnManager;
 import com.cloudera.sqoop.manager.ImportJobContext;
 import com.cloudera.sqoop.manager.ManagerFactory;
 import com.cloudera.sqoop.metastore.JobData;
 import com.cloudera.sqoop.tool.ImportTool;
 
-import junit.framework.TestCase;
-
-import java.io.IOException;
-import java.util.Map;
-import java.sql.Connection;
-import java.sql.ResultSet;
-
 /**
  * Test the ConnFactory implementation and its ability to delegate to multiple
  * different ManagerFactory implementations using reflection.
@@ -130,6 +132,10 @@ public class TestConnFactory extends TestCase {
       return null;
     }
 
+    public Map<String,List<Integer>> getColumnInfo(String tableName) {
+      return null;
+    }
+
     /**
     * Default implementation.
     * @param sqlType     sql data type

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/org/apache/sqoop/hcat/HCatalogExportTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/hcat/HCatalogExportTest.java b/src/test/org/apache/sqoop/hcat/HCatalogExportTest.java
index 4031973..8aa0725 100644
--- a/src/test/org/apache/sqoop/hcat/HCatalogExportTest.java
+++ b/src/test/org/apache/sqoop/hcat/HCatalogExportTest.java
@@ -34,7 +34,10 @@ import java.util.TimeZone;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hcatalog.data.schema.HCatFieldSchema;
+import org.apache.hadoop.hive.common.type.HiveChar;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hive.hcatalog.data.schema.HCatFieldSchema;
 import org.apache.sqoop.hcat.HCatalogTestUtils.ColumnGenerator;
 import org.apache.sqoop.hcat.HCatalogTestUtils.CreateMode;
 import org.apache.sqoop.hcat.HCatalogTestUtils.KeyType;
@@ -143,19 +146,19 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN,
+        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN, 0, 0,
         Boolean.TRUE, Boolean.TRUE, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "tinyint", Types.INTEGER, HCatFieldSchema.Type.INT, 10,
+        "tinyint", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 10,
         10, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "smallint", Types.INTEGER, HCatFieldSchema.Type.INT, 100,
+        "smallint", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 100,
         100, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
-        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 1000,
+        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 1000,
         1000, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(4),
-        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 10000L,
+        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 0, 0, 10000L,
         10000L, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -167,13 +170,13 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "float", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 10.0F,
+        "float", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 0, 0, 10.0F,
         10.F, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "real", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 20.0F,
+        "real", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 0, 0, 20.0F,
         20.0F, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "double", Types.DOUBLE, HCatFieldSchema.Type.DOUBLE, 30.0D,
+        "double", Types.DOUBLE, HCatFieldSchema.Type.DOUBLE, 0, 0, 30.0D,
         30.0D, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -185,11 +188,15 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, "1000",
-        new BigDecimal("1000"), KeyType.NOT_A_KEY),
+        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, 0, 0,
+        "1000", new BigDecimal("1000"), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, "2000",
-        new BigDecimal("2000"), KeyType.NOT_A_KEY),
+        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, 0, 0,
+        "2000", new BigDecimal("2000"), KeyType.NOT_A_KEY),
+        HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
+          "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.DECIMAL, 18, 2,
+          HiveDecimal.create(new BigDecimal("2000")),
+          new BigDecimal("2000"), KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
@@ -200,15 +207,24 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "date", Types.DATE, HCatFieldSchema.Type.STRING, "2013-12-31",
-        new Date(113, 11, 31), KeyType.NOT_A_KEY),
-      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "time", Types.TIME, HCatFieldSchema.Type.STRING, "10:11:12",
-        new Time(10, 11, 12), KeyType.NOT_A_KEY),
+        "date", Types.DATE, HCatFieldSchema.Type.STRING, 0, 0,
+        "2013-12-31", new Date(113, 11, 31), KeyType.NOT_A_KEY),
+        HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
+          "date", Types.DATE, HCatFieldSchema.Type.DATE, 0, 0,
+          new Date(113, 11, 31),
+          new Date(113, 11, 31), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.STRING,
+        "time", Types.TIME, HCatFieldSchema.Type.STRING, 0, 0,
+        "10:11:12", new Time(10, 11, 12), KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
+        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.STRING, 0, 0,
         "2013-12-31 10:11:12", new Timestamp(113, 11, 31, 10, 11, 12, 0),
         KeyType.NOT_A_KEY),
+        HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(4),
+          "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.TIMESTAMP, 0, 0,
+          new Timestamp(113, 11, 31, 10, 11, 12, 0),
+          new Timestamp(113, 11, 31, 10, 11, 12, 0),
+          KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
@@ -220,13 +236,13 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "date", Types.DATE, HCatFieldSchema.Type.BIGINT, 0 - offset,
+        "date", Types.DATE, HCatFieldSchema.Type.BIGINT, 0, 0, 0 - offset,
         new Date(70, 0, 1), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "time", Types.TIME, HCatFieldSchema.Type.BIGINT, 36672000L - offset,
-        new Time(10, 11, 12), KeyType.NOT_A_KEY),
+        "time", Types.TIME, HCatFieldSchema.Type.BIGINT, 0, 0,
+        36672000L - offset, new Time(10, 11, 12), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.BIGINT,
+        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.BIGINT, 0, 0,
         36672000L - offset, new Timestamp(70, 0, 1, 10, 11, 12, 0),
         KeyType.NOT_A_KEY),
     };
@@ -241,10 +257,18 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, "string to test",
-        "string to test", KeyType.NOT_A_KEY),
+        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "string to test", "string to test", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "longvarchar", Types.LONGVARCHAR, HCatFieldSchema.Type.STRING,
+          "char(14)", Types.CHAR, HCatFieldSchema.Type.CHAR, 14, 0,
+          new HiveChar("string to test", 14), "string to test",
+          KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
+          "char(14)", Types.CHAR, HCatFieldSchema.Type.VARCHAR, 14, 0,
+          new HiveVarchar("string to test", 14), "string to test",
+          KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
+        "longvarchar", Types.LONGVARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "string to test", "string to test", KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -258,10 +282,10 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "binary(10)", Types.BINARY, HCatFieldSchema.Type.BINARY,
+        "binary(10)", Types.BINARY, HCatFieldSchema.Type.BINARY, 0, 0,
         bb.array(), bb.array(), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varbinary(10)", Types.BINARY, HCatFieldSchema.Type.BINARY,
+        "varbinary(10)", Types.BINARY, HCatFieldSchema.Type.BINARY, 0, 0,
         bb.array(), bb.array(), KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -273,7 +297,7 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", null, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -287,7 +311,7 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.STATIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -299,12 +323,32 @@ public class HCatalogExportTest extends ExportJobTestCase {
     runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
   }
 
+  public void testStaticPartitioningWithMultipleKeys() throws Exception {
+    final int TOTAL_RECORDS = 1 * 10;
+    String table = getTableName().toUpperCase();
+    ColumnGenerator[] cols = new ColumnGenerator[] {
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "1", "1", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "2", "2", KeyType.STATIC_KEY),
+    };
+    List<String> addlArgsArray = new ArrayList<String>();
+    addlArgsArray.add("--hcatalog-partition-keys");
+    addlArgsArray.add("col0,col1");
+    addlArgsArray.add("--hcatalog-partition-values");
+    addlArgsArray.add("1,2");
+
+    runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
+  }
+
   public void testDynamicPartitioning() throws Exception {
     final int TOTAL_RECORDS = 1 * 10;
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.DYNAMIC_KEY),
     };
 
@@ -312,15 +356,15 @@ public class HCatalogExportTest extends ExportJobTestCase {
     runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
   }
 
-  public void testStaicAndDynamicPartitioning() throws Exception {
+  public void testStaticAndDynamicPartitioning() throws Exception {
     final int TOTAL_RECORDS = 1 * 10;
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.STATIC_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "2", "2", KeyType.DYNAMIC_KEY),
     };
 
@@ -332,6 +376,29 @@ public class HCatalogExportTest extends ExportJobTestCase {
     runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
   }
 
+  public void testMultipleStaticKeysAndDynamicPartitioning() throws Exception {
+    final int TOTAL_RECORDS = 1 * 10;
+    String table = getTableName().toUpperCase();
+    ColumnGenerator[] cols = new ColumnGenerator[] {
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "1", "1", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "2", "2", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "3", "3", KeyType.DYNAMIC_KEY),
+    };
+
+    List<String> addlArgsArray = new ArrayList<String>();
+    addlArgsArray.add("--hcatalog-partition-keys");
+    addlArgsArray.add("col0,col1");
+    addlArgsArray.add("--hcatalog-partition-values");
+    addlArgsArray.add("1,2");
+    runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);
+  }
+
   /**
    * Test other file formats.
    */
@@ -340,11 +407,11 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "1",
-            "1", KeyType.STATIC_KEY),
+            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+            "1", "1", KeyType.STATIC_KEY),
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "2",
-            "2", KeyType.DYNAMIC_KEY), };
+            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+            "2", "2", KeyType.DYNAMIC_KEY), };
 
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--hive-partition-key");
@@ -360,11 +427,11 @@ public class HCatalogExportTest extends ExportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "1",
-            "1", KeyType.STATIC_KEY),
+            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+            "1", "1", KeyType.STATIC_KEY),
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "2",
-            "2", KeyType.DYNAMIC_KEY), };
+            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+            "2", "2", KeyType.DYNAMIC_KEY), };
 
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--hive-partition-key");

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java b/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java
index ab08013..d97b870 100644
--- a/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java
+++ b/src/test/org/apache/sqoop/hcat/HCatalogImportTest.java
@@ -38,9 +38,12 @@ import java.util.TimeZone;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hcatalog.data.HCatRecord;
-import org.apache.hcatalog.data.schema.HCatFieldSchema;
-import org.apache.hcatalog.data.schema.HCatSchema;
+import org.apache.hadoop.hive.common.type.HiveChar;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hive.hcatalog.data.HCatRecord;
+import org.apache.hive.hcatalog.data.schema.HCatFieldSchema;
+import org.apache.hive.hcatalog.data.schema.HCatSchema;
 import org.apache.sqoop.hcat.HCatalogTestUtils.ColumnGenerator;
 import org.apache.sqoop.hcat.HCatalogTestUtils.CreateMode;
 import org.apache.sqoop.hcat.HCatalogTestUtils.KeyType;
@@ -340,19 +343,19 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN,
+        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN, 0, 0,
         Boolean.TRUE, Boolean.TRUE, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "tinyint", Types.INTEGER, HCatFieldSchema.Type.INT, 10,
+        "tinyint", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 10,
         10, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "smallint", Types.INTEGER, HCatFieldSchema.Type.INT, 100,
+        "smallint", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 100,
         100, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
-        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 1000,
+        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 1000,
         1000, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(4),
-        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 10000L,
+        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 0, 0, 10000L,
         10000L, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -365,13 +368,13 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "float", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 10.0F,
+        "float", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 0, 0, 10.0F,
         10.F, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "real", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 20.0F,
+        "real", Types.FLOAT, HCatFieldSchema.Type.FLOAT, 0, 0, 20.0F,
         20.0F, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "double", Types.DOUBLE, HCatFieldSchema.Type.DOUBLE, 30.0D,
+        "double", Types.DOUBLE, HCatFieldSchema.Type.DOUBLE, 0, 0, 30.0D,
         30.0D, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -384,11 +387,15 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, "1000",
-        new BigDecimal("1000"), KeyType.NOT_A_KEY),
+        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, 0, 0,
+        "1000", new BigDecimal("1000"), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, "2000",
-        new BigDecimal("2000"), KeyType.NOT_A_KEY),
+        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, 0, 0,
+        "2000", new BigDecimal("2000"), KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
+          "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.DECIMAL, 18, 2,
+          HiveDecimal.create(new BigDecimal("2000")),
+          new BigDecimal("2000"), KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     setExtraArgs(addlArgsArray);
@@ -400,15 +407,24 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "date", Types.DATE, HCatFieldSchema.Type.STRING, "2013-12-31",
+        "date", Types.DATE, HCatFieldSchema.Type.STRING, 0, 0, "2013-12-31",
         new Date(113, 11, 31), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "time", Types.TIME, HCatFieldSchema.Type.STRING, "10:11:12",
-        new Time(10, 11, 12), KeyType.NOT_A_KEY),
+          "date", Types.DATE, HCatFieldSchema.Type.DATE, 0, 0,
+          new Date(113, 11, 31),
+          new Date(113, 11, 31), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.STRING,
+        "time", Types.TIME, HCatFieldSchema.Type.STRING, 0, 0, "10:11:12",
+        new Time(10, 11, 12), KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
+        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.STRING, 0, 0,
         "2013-12-31 10:11:12.0", new Timestamp(113, 11, 31, 10, 11, 12, 0),
         KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(4),
+          "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.TIMESTAMP, 0, 0,
+          new Timestamp(113, 11, 31, 10, 11, 12, 0),
+          new Timestamp(113, 11, 31, 10, 11, 12, 0),
+          KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     setExtraArgs(addlArgsArray);
@@ -421,13 +437,13 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "date", Types.DATE, HCatFieldSchema.Type.BIGINT, 0 - offset,
+        "date", Types.DATE, HCatFieldSchema.Type.BIGINT, 0, 0, 0 - offset,
         new Date(70, 0, 1), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "time", Types.TIME, HCatFieldSchema.Type.BIGINT, 36672000L - offset,
-        new Time(10, 11, 12), KeyType.NOT_A_KEY),
+        "time", Types.TIME, HCatFieldSchema.Type.BIGINT, 0, 0,
+        36672000L - offset, new Time(10, 11, 12), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.BIGINT,
+        "timestamp", Types.TIMESTAMP, HCatFieldSchema.Type.BIGINT, 0, 0,
         36672000L - offset, new Timestamp(70, 0, 1, 10, 11, 12, 0),
         KeyType.NOT_A_KEY),
     };
@@ -443,10 +459,18 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, "string to test",
-        "string to test", KeyType.NOT_A_KEY),
+        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "string to test", "string to test", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "longvarchar", Types.LONGVARCHAR, HCatFieldSchema.Type.STRING,
+          "char(14)", Types.CHAR, HCatFieldSchema.Type.CHAR, 14, 0,
+          new HiveChar("string to test", 14), "string to test",
+          KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
+          "char(14)", Types.CHAR, HCatFieldSchema.Type.VARCHAR, 14, 0,
+          new HiveVarchar("string to test", 14), "string to test",
+          KeyType.NOT_A_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
+        "longvarchar", Types.LONGVARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "string to test", "string to test", KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -460,10 +484,10 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "binary(10)", Types.BINARY, HCatFieldSchema.Type.BINARY,
+        "binary(10)", Types.BINARY, HCatFieldSchema.Type.BINARY, 0, 0,
         bb.array(), bb.array(), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "longvarbinary", Types.BINARY, HCatFieldSchema.Type.BINARY,
+        "longvarbinary", Types.BINARY, HCatFieldSchema.Type.BINARY, 0, 0,
         bb.array(), bb.array(), KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -476,7 +500,7 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         null, null, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -494,7 +518,7 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         null, null, KeyType.DYNAMIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -519,7 +543,7 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.STATIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -531,12 +555,32 @@ public class HCatalogImportTest extends ImportJobTestCase {
     runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null);
   }
 
+  public void testStaticPartitioningWithMultipleKeys() throws Exception {
+    final int TOTAL_RECORDS = 1 * 10;
+    String table = getTableName().toUpperCase();
+    ColumnGenerator[] cols = new ColumnGenerator[] {
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "1", "1", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "2", "2", KeyType.STATIC_KEY),
+    };
+    List<String> addlArgsArray = new ArrayList<String>();
+    addlArgsArray.add("--hcatalog-partition-keys");
+    addlArgsArray.add("col0,col1");
+    addlArgsArray.add("--hcatalog-partition-values");
+    addlArgsArray.add("1,2");
+    setExtraArgs(addlArgsArray);
+    runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null);
+  }
+
   public void testDynamicPartitioning() throws Exception {
     final int TOTAL_RECORDS = 1 * 10;
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.DYNAMIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -544,15 +588,15 @@ public class HCatalogImportTest extends ImportJobTestCase {
     runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null);
   }
 
-  public void testStaicAndDynamicPartitioning() throws Exception {
+  public void testStaticAndDynamicPartitioning() throws Exception {
     final int TOTAL_RECORDS = 1 * 10;
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.STATIC_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "2", "2", KeyType.DYNAMIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -564,6 +608,29 @@ public class HCatalogImportTest extends ImportJobTestCase {
     runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null);
   }
 
+  public void testMultipleStaticKeysAndDynamicPartitioning() throws Exception {
+    final int TOTAL_RECORDS = 1 * 10;
+    String table = getTableName().toUpperCase();
+    ColumnGenerator[] cols = new ColumnGenerator[] {
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "1", "1", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "2", "2", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "3", "3", KeyType.DYNAMIC_KEY),
+    };
+    List<String> addlArgsArray = new ArrayList<String>();
+    addlArgsArray.add("--hcatalog-partition-keys");
+    addlArgsArray.add("col0,col1");
+    addlArgsArray.add("--hcatalog-partition-values");
+    addlArgsArray.add("1,2");
+    setExtraArgs(addlArgsArray);
+    runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null);
+  }
+
   /**
    * Test other file formats.
    */
@@ -572,11 +639,11 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "1",
-            "1", KeyType.STATIC_KEY),
+            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+            "1", "1", KeyType.STATIC_KEY),
         HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "2",
-            "2", KeyType.DYNAMIC_KEY), };
+            "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+            "2", "2", KeyType.DYNAMIC_KEY), };
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--hive-partition-key");
     addlArgsArray.add("col0");
@@ -592,10 +659,10 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "1", "1", KeyType.STATIC_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "2", "2", KeyType.DYNAMIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -613,11 +680,11 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
-        "1", "1", KeyType.STATIC_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        new HiveVarchar("1", 20), "1", KeyType.STATIC_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
-        "2", "2", KeyType.DYNAMIC_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        new HiveVarchar("2", 20), "2", KeyType.DYNAMIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--create-hcatalog-table");
@@ -631,11 +698,11 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
-        "1", "1", KeyType.NOT_A_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+       new HiveVarchar("1", 20), "1", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
-        "2", "2", KeyType.STATIC_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+       new HiveVarchar("2", 20), "2", KeyType.STATIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--hive-partition-key");
@@ -647,16 +714,37 @@ public class HCatalogImportTest extends ImportJobTestCase {
     runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null, true, false);
   }
 
+  public void testTableCreationWithMultipleStaticPartKeys() throws Exception {
+    final int TOTAL_RECORDS = 1 * 10;
+    String table = getTableName().toUpperCase();
+    ColumnGenerator[] cols = new ColumnGenerator[] {
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+        new HiveVarchar("1", 20), "1", KeyType.STATIC_KEY),
+      HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+        new HiveVarchar("2", 20), "2", KeyType.STATIC_KEY),
+    };
+    List<String> addlArgsArray = new ArrayList<String>();
+    addlArgsArray.add("--hcatalog-partition-keys");
+    addlArgsArray.add("col0,col1");
+    addlArgsArray.add("--hcatalog-partition-values");
+    addlArgsArray.add("1,2");
+    addlArgsArray.add("--create-hcatalog-table");
+    setExtraArgs(addlArgsArray);
+    runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null, true, false);
+  }
+
   public void testTableCreationWithStorageStanza() throws Exception {
     final int TOTAL_RECORDS = 1 * 10;
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
-        "1", "1", KeyType.NOT_A_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+        new HiveVarchar("1", 20), "1", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
-        "2", "2", KeyType.STATIC_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+        new HiveVarchar("2", 20), "2", KeyType.STATIC_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--hive-partition-key");
@@ -675,10 +763,10 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "Test", "\u0001\n\rTest", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "Test2", "\u0001\r\nTest2", KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -692,10 +780,10 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "^^^Test", "\u0001\n\rTest", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "^^^Test2", "\u0001\r\nTest2", KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -710,10 +798,10 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "1",
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, "1",
         "1", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "2",
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, "2",
         "2", KeyType.DYNAMIC_KEY), };
     List<String> addlArgsArray = new ArrayList<String>();
     setExtraArgs(addlArgsArray);
@@ -726,10 +814,10 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "1",
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, "1",
         "1", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "2",
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, "2",
         "2", KeyType.DYNAMIC_KEY), };
     List<String> addlArgsArray = new ArrayList<String>();
     setExtraArgs(addlArgsArray);
@@ -742,11 +830,11 @@ public class HCatalogImportTest extends ImportJobTestCase {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "1",
-        "1", KeyType.NOT_A_KEY),
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+        new HiveVarchar("1", 20), "1", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, "2",
-        "2", KeyType.DYNAMIC_KEY), };
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.VARCHAR, 20, 0,
+        new HiveVarchar("2", 20), "2", KeyType.DYNAMIC_KEY), };
     List<String> addlArgsArray = new ArrayList<String>();
     addlArgsArray.add("--create-hcatalog-table");
     setExtraArgs(addlArgsArray);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/org/apache/sqoop/hcat/HCatalogTestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/hcat/HCatalogTestUtils.java b/src/test/org/apache/sqoop/hcat/HCatalogTestUtils.java
index abb809f..32c267f 100644
--- a/src/test/org/apache/sqoop/hcat/HCatalogTestUtils.java
+++ b/src/test/org/apache/sqoop/hcat/HCatalogTestUtils.java
@@ -35,7 +35,13 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.common.type.HiveChar;
+import org.apache.hadoop.hive.common.type.HiveVarchar;
 import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
@@ -46,13 +52,13 @@ import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
 import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
-import org.apache.hcatalog.data.DefaultHCatRecord;
-import org.apache.hcatalog.data.HCatRecord;
-import org.apache.hcatalog.data.schema.HCatFieldSchema;
-import org.apache.hcatalog.data.schema.HCatSchema;
-import org.apache.hcatalog.mapreduce.HCatInputFormat;
-import org.apache.hcatalog.mapreduce.HCatOutputFormat;
-import org.apache.hcatalog.mapreduce.OutputJobInfo;
+import org.apache.hive.hcatalog.data.DefaultHCatRecord;
+import org.apache.hive.hcatalog.data.HCatRecord;
+import org.apache.hive.hcatalog.data.schema.HCatFieldSchema;
+import org.apache.hive.hcatalog.data.schema.HCatSchema;
+import org.apache.hive.hcatalog.mapreduce.HCatInputFormat;
+import org.apache.hive.hcatalog.mapreduce.HCatOutputFormat;
+import org.apache.hive.hcatalog.mapreduce.OutputJobInfo;
 import org.apache.sqoop.config.ConfigurationConstants;
 import org.apache.sqoop.mapreduce.hcat.SqoopHCatUtilities;
 import org.junit.Assert;
@@ -97,6 +103,10 @@ public final class HCatalogTestUtils {
     return Holder.INSTANCE;
   }
 
+  public static StringBuilder escHCatObj(String objectName) {
+    return SqoopHCatUtilities.escHCatObj(objectName);
+  }
+
   public void initUtils() throws IOException, MetaException {
     if (initialized) {
       return;
@@ -123,24 +133,25 @@ public final class HCatalogTestUtils {
     storageInfo = info;
   }
 
-  private static String getDropTableCmd(final String dbName,
+  private static String getHCatDropTableCmd(final String dbName,
     final String tableName) {
-    return "DROP TABLE IF EXISTS " + dbName.toLowerCase() + "."
-      + tableName.toLowerCase();
+    return "DROP TABLE IF EXISTS " + escHCatObj(dbName.toLowerCase()) + "."
+      + escHCatObj(tableName.toLowerCase());
   }
 
   private static String getHCatCreateTableCmd(String dbName,
     String tableName, List<HCatFieldSchema> tableCols,
     List<HCatFieldSchema> partKeys) {
     StringBuilder sb = new StringBuilder();
-    sb.append("create table ").append(dbName.toLowerCase()).append('.');
-    sb.append(tableName.toLowerCase()).append(" (\n\t");
+    sb.append("create table ")
+      .append(escHCatObj(dbName.toLowerCase()).append('.'));
+    sb.append(escHCatObj(tableName.toLowerCase()).append(" (\n\t"));
     for (int i = 0; i < tableCols.size(); ++i) {
       HCatFieldSchema hfs = tableCols.get(i);
       if (i > 0) {
         sb.append(",\n\t");
       }
-      sb.append(hfs.getName().toLowerCase());
+      sb.append(escHCatObj(hfs.getName().toLowerCase()));
       sb.append(' ').append(hfs.getTypeString());
     }
     sb.append(")\n");
@@ -151,7 +162,7 @@ public final class HCatalogTestUtils {
         if (i > 0) {
           sb.append("\n\t,");
         }
-        sb.append(hfs.getName().toLowerCase());
+        sb.append(escHCatObj(hfs.getName().toLowerCase()));
         sb.append(' ').append(hfs.getTypeString());
       }
       sb.append(")\n");
@@ -174,7 +185,7 @@ public final class HCatalogTestUtils {
       ? SqoopHCatUtilities.DEFHCATDB : dbName;
     LOG.info("Dropping HCatalog table if it exists " + databaseName
       + '.' + tableName);
-    String dropCmd = getDropTableCmd(databaseName, tableName);
+    String dropCmd = getHCatDropTableCmd(databaseName, tableName);
 
     try {
       utils.launchHCatCli(dropCmd);
@@ -411,6 +422,11 @@ public final class HCatalogTestUtils {
     /** Return the HCat type for this column. */
     HCatFieldSchema.Type getHCatType();
 
+    /** Return the precision/length of the field if any. */
+    int getHCatPrecision();
+
+    /** Return the scale of the field if any. */
+    int getHCatScale();
 
     /**
      * If the field is a partition key, then whether is part of the static
@@ -437,7 +453,8 @@ public final class HCatalogTestUtils {
 
   public static ColumnGenerator colGenerator(final String name,
     final String dbType, final int sqlType,
-    final HCatFieldSchema.Type hCatType, final Object hCatValue,
+    final HCatFieldSchema.Type hCatType, final int hCatPrecision,
+    final int hCatScale, final Object hCatValue,
     final Object dbValue, final KeyType keyType) {
     return new ColumnGenerator() {
 
@@ -471,6 +488,16 @@ public final class HCatalogTestUtils {
         return hCatType;
       }
 
+      @Override
+      public int getHCatPrecision() {
+        return hCatPrecision;
+      }
+
+      @Override
+      public int getHCatScale() {
+        return hCatScale;
+      }
+
       public KeyType getKeyType() {
         return keyType;
       }
@@ -503,6 +530,28 @@ public final class HCatalogTestUtils {
             .assertEquals("Got unexpected column value", expectedVal,
               actualVal);
         }
+      } else if (expectedVal instanceof HiveVarchar) {
+        HiveVarchar vc1 = (HiveVarchar) expectedVal;
+        if (actualVal instanceof HiveVarchar) {
+          HiveVarchar vc2 = (HiveVarchar)actualVal;
+          assertEquals(vc1.getCharacterLength(), vc2.getCharacterLength());
+          assertEquals(vc1.getValue(), vc2.getValue());
+        } else {
+          String vc2 = (String)actualVal;
+          assertEquals(vc1.getCharacterLength(), vc2.length());
+          assertEquals(vc1.getValue(), vc2);
+        }
+      } else if (expectedVal instanceof HiveChar) {
+        HiveChar c1 = (HiveChar) expectedVal;
+        if (actualVal instanceof HiveChar) {
+          HiveChar c2 = (HiveChar)actualVal;
+          assertEquals(c1.getCharacterLength(), c2.getCharacterLength());
+          assertEquals(c1.getValue(), c2.getValue());
+        } else {
+          String c2 = (String) actualVal;
+          assertEquals(c1.getCharacterLength(), c2.length());
+          assertEquals(c1.getValue(), c2);
+        }
       } else {
         Assert
           .assertEquals("Got unexpected column value", expectedVal,
@@ -626,7 +675,7 @@ public final class HCatalogTestUtils {
     sb.append(tableName);
     sb.append(" (id, msg");
     int colNum = 0;
-    for (ColumnGenerator gen : extraCols) {
+    for (int i = 0; i < extraCols.length; ++i) {
       sb.append(", " + forIdx(colNum++));
     }
     sb.append(") VALUES ( ?, ?");
@@ -733,13 +782,34 @@ public final class HCatalogTestUtils {
     throws Exception {
     List<HCatFieldSchema> hCatTblCols = new ArrayList<HCatFieldSchema>();
     hCatTblCols.clear();
-    hCatTblCols.add(new HCatFieldSchema("id", HCatFieldSchema.Type.INT, ""));
+    PrimitiveTypeInfo tInfo;
+    tInfo = new PrimitiveTypeInfo();
+    tInfo.setTypeName(HCatFieldSchema.Type.INT.name().toLowerCase());
+    hCatTblCols.add(new HCatFieldSchema("id", tInfo, ""));
+    tInfo = new PrimitiveTypeInfo();
+    tInfo.setTypeName(HCatFieldSchema.Type.STRING.name().toLowerCase());
     hCatTblCols
-      .add(new HCatFieldSchema("msg", HCatFieldSchema.Type.STRING, ""));
+      .add(new HCatFieldSchema("msg", tInfo, ""));
     for (ColumnGenerator gen : extraCols) {
       if (gen.getKeyType() == KeyType.NOT_A_KEY) {
+        switch(gen.getHCatType()) {
+          case CHAR:
+            tInfo = new CharTypeInfo(gen.getHCatPrecision());
+            break;
+          case VARCHAR:
+            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
+            break;
+          case DECIMAL:
+            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
+              gen.getHCatScale());
+            break;
+          default:
+            tInfo = new PrimitiveTypeInfo();
+            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
+            break;
+        }
         hCatTblCols
-          .add(new HCatFieldSchema(gen.getName(), gen.getHCatType(), ""));
+          .add(new HCatFieldSchema(gen.getName(), tInfo, ""));
       }
     }
     HCatSchema hCatTblSchema = new HCatSchema(hCatTblCols);
@@ -749,11 +819,28 @@ public final class HCatalogTestUtils {
   private HCatSchema generateHCatPartitionSchema(ColumnGenerator... extraCols)
     throws Exception {
     List<HCatFieldSchema> hCatPartCols = new ArrayList<HCatFieldSchema>();
+    PrimitiveTypeInfo tInfo;
 
     for (ColumnGenerator gen : extraCols) {
       if (gen.getKeyType() != KeyType.NOT_A_KEY) {
+        switch(gen.getHCatType()) {
+          case CHAR:
+            tInfo = new CharTypeInfo(gen.getHCatPrecision());
+            break;
+          case VARCHAR:
+            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
+            break;
+          case DECIMAL:
+            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
+            gen.getHCatScale());
+            break;
+          default:
+            tInfo = new PrimitiveTypeInfo();
+            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
+            break;
+        }
         hCatPartCols
-          .add(new HCatFieldSchema(gen.getName(), gen.getHCatType(), ""));
+          .add(new HCatFieldSchema(gen.getName(), tInfo, ""));
       }
     }
     HCatSchema hCatPartSchema = new HCatSchema(hCatPartCols);
@@ -763,16 +850,32 @@ public final class HCatalogTestUtils {
   private HCatSchema generateHCatDynamicPartitionSchema(
     ColumnGenerator... extraCols) throws Exception {
     List<HCatFieldSchema> hCatPartCols = new ArrayList<HCatFieldSchema>();
+    PrimitiveTypeInfo tInfo;
+
     hCatPartCols.clear();
-    boolean staticFound = false;
     for (ColumnGenerator gen : extraCols) {
       if (gen.getKeyType() != KeyType.NOT_A_KEY) {
-        if (gen.getKeyType() == KeyType.STATIC_KEY && !staticFound) {
-          staticFound = true;
+        if (gen.getKeyType() == KeyType.STATIC_KEY) {
           continue;
         }
+        switch(gen.getHCatType()) {
+          case CHAR:
+            tInfo = new CharTypeInfo(gen.getHCatPrecision());
+            break;
+          case VARCHAR:
+            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
+            break;
+          case DECIMAL:
+            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
+            gen.getHCatScale());
+            break;
+          default:
+            tInfo = new PrimitiveTypeInfo();
+            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
+            break;
+        }
         hCatPartCols
-          .add(new HCatFieldSchema(gen.getName(), gen.getHCatType(), ""));
+          .add(new HCatFieldSchema(gen.getName(), tInfo, ""));
       }
     }
     HCatSchema hCatPartSchema = new HCatSchema(hCatPartCols);
@@ -783,11 +886,29 @@ public final class HCatalogTestUtils {
   private HCatSchema generateHCatStaticPartitionSchema(
     ColumnGenerator... extraCols) throws Exception {
     List<HCatFieldSchema> hCatPartCols = new ArrayList<HCatFieldSchema>();
+    PrimitiveTypeInfo tInfo;
+
     hCatPartCols.clear();
     for (ColumnGenerator gen : extraCols) {
       if (gen.getKeyType() == KeyType.STATIC_KEY) {
+        switch(gen.getHCatType()) {
+          case CHAR:
+            tInfo = new CharTypeInfo(gen.getHCatPrecision());
+            break;
+          case VARCHAR:
+            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
+            break;
+          case DECIMAL:
+            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
+            gen.getHCatScale());
+            break;
+          default:
+            tInfo = new PrimitiveTypeInfo();
+            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
+            break;
+        }
         hCatPartCols
-          .add(new HCatFieldSchema(gen.getName(), gen.getHCatType(), ""));
+          .add(new HCatFieldSchema(gen.getName(), tInfo, ""));
         break;
       }
     }
@@ -804,12 +925,9 @@ public final class HCatalogTestUtils {
       DefaultHCatRecord record = new DefaultHCatRecord(size);
       record.set(hCatTblCols.get(0).getName(), hCatTblSchema, i);
       record.set(hCatTblCols.get(1).getName(), hCatTblSchema, "textfield" + i);
-      boolean staticFound = false;
       int idx = 0;
       for (int j = 0; j < extraCols.length; ++j) {
-        if (extraCols[j].getKeyType() == KeyType.STATIC_KEY
-          && !staticFound) {
-          staticFound = true;
+        if (extraCols[j].getKeyType() == KeyType.STATIC_KEY) {
           continue;
         }
         record.set(hCatTblCols.get(idx + 2).getName(), hCatTblSchema,

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/org/apache/sqoop/hcat/TestHCatalogBasic.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/hcat/TestHCatalogBasic.java b/src/test/org/apache/sqoop/hcat/TestHCatalogBasic.java
index 45646dd..388cce5 100644
--- a/src/test/org/apache/sqoop/hcat/TestHCatalogBasic.java
+++ b/src/test/org/apache/sqoop/hcat/TestHCatalogBasic.java
@@ -230,4 +230,79 @@ public class TestHCatalogBasic extends TestCase {
     };
     SqoopOptions opts = parseImportArgs(args);
   }
+
+  public void testHCatImportWithPartKeys() throws Exception {
+    String[] args = {
+      "--hcatalog-table",
+      "table",
+      "--hcatalog-partition-keys",
+      "k1,k2",
+      "--hcatalog-partition-values",
+      "v1,v2",
+    };
+    SqoopOptions opts = parseImportArgs(args);
+  }
+
+  public void testHCatImportWithOnlyHCatKeys() throws Exception {
+    String[] args = {
+      "--connect",
+      "jdbc:db:url",
+      "--table",
+      "dbtable",
+      "--hcatalog-table",
+      "table",
+      "--hcatalog-partition-keys",
+      "k1,k2",
+    };
+    try {
+      SqoopOptions opts = parseImportArgs(args);
+      importTool.validateOptions(opts);
+      fail("Expected InvalidOptionsException");
+    } catch (SqoopOptions.InvalidOptionsException ioe) {
+      // expected.
+    }
+  }
+
+  public void testHCatImportWithMismatchedKeysAndVals() throws Exception {
+    String[] args = {
+      "--connect",
+      "jdbc:db:url",
+      "--table",
+      "dbtable",
+      "--hcatalog-table",
+      "table",
+      "--hcatalog-partition-keys",
+      "k1,k2",
+      "--hcatalog-partition-values",
+      "v1",
+    };
+    try {
+      SqoopOptions opts = parseImportArgs(args);
+      importTool.validateOptions(opts);
+      fail("Expected InvalidOptionsException");
+    } catch (SqoopOptions.InvalidOptionsException ioe) {
+      // expected.
+    }
+  }
+
+  public void testHCatImportWithBothHCatAndHivePartOptions() throws Exception {
+    String[] args = {
+      "--connect",
+      "jdbc:db:url",
+      "--table",
+      "dbtable",
+      "--hcatalog-table",
+      "table",
+      "--hcatalog-partition-keys",
+      "k1,k2",
+      "--hcatalog-partition-values",
+      "v1,v2",
+      "--hive-partition-key",
+      "k1",
+      "--hive-partition-value",
+      "v1",
+    };
+    SqoopOptions opts = parseImportArgs(args);
+    importTool.validateOptions(opts);
+  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatExportManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatExportManualTest.java b/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatExportManualTest.java
index 2183b1a..dbf9988 100644
--- a/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatExportManualTest.java
+++ b/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatExportManualTest.java
@@ -25,7 +25,7 @@ import java.sql.Types;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.hcatalog.data.schema.HCatFieldSchema;
+import org.apache.hive.hcatalog.data.schema.HCatFieldSchema;
 import org.apache.sqoop.hcat.HCatalogExportTest;
 import org.apache.sqoop.hcat.HCatalogTestUtils;
 import org.apache.sqoop.hcat.HCatalogTestUtils.ColumnGenerator;
@@ -93,17 +93,17 @@ public class DirectNetezzaHCatExportManualTest extends HCatalogExportTest {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN,
+        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN, 0, 0,
         Boolean.TRUE, Boolean.TRUE, KeyType.NOT_A_KEY),
       // Netezza does not have tinyint
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "smallint", Types.SMALLINT, HCatFieldSchema.Type.INT, 100,
+        "smallint", Types.SMALLINT, HCatFieldSchema.Type.INT, 0, 0, 100,
         (short) 100, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 1000,
+        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 1000,
         1000, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
-        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 10000L,
+        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 0, 0, 10000L,
         10000L, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -115,10 +115,10 @@ public class DirectNetezzaHCatExportManualTest extends HCatalogExportTest {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, "string to test",
-        "string to test", KeyType.NOT_A_KEY),
+        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "string to test", "string to test", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "string to test", "string to test", KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -130,11 +130,11 @@ public class DirectNetezzaHCatExportManualTest extends HCatalogExportTest {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, "1000.00",
-        new BigDecimal("1000.00"), KeyType.NOT_A_KEY),
+        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, 0, 0,
+        "1000.00", new BigDecimal("1000.00"), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, "2000.00",
-        new BigDecimal("2000.00"), KeyType.NOT_A_KEY),
+        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, 0, 0,
+        "2000.00", new BigDecimal("2000.00"), KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c65b56f6/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatImportManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatImportManualTest.java b/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatImportManualTest.java
index 36bc53c..cf56714 100644
--- a/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatImportManualTest.java
+++ b/src/test/org/apache/sqoop/manager/netezza/DirectNetezzaHCatImportManualTest.java
@@ -25,7 +25,7 @@ import java.sql.Types;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.hcatalog.data.schema.HCatFieldSchema;
+import org.apache.hive.hcatalog.data.schema.HCatFieldSchema;
 import org.apache.sqoop.hcat.HCatalogImportTest;
 import org.apache.sqoop.hcat.HCatalogTestUtils;
 import org.apache.sqoop.hcat.HCatalogTestUtils.ColumnGenerator;
@@ -93,17 +93,17 @@ public class DirectNetezzaHCatImportManualTest extends HCatalogImportTest {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN,
+        "boolean", Types.BOOLEAN, HCatFieldSchema.Type.BOOLEAN, 0, 0,
         Boolean.TRUE, Boolean.TRUE, KeyType.NOT_A_KEY),
       // Netezza does not have tinyint
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "smallint", Types.INTEGER, HCatFieldSchema.Type.INT, 100,
+        "smallint", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 100,
         100, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(2),
-        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 1000,
+        "int", Types.INTEGER, HCatFieldSchema.Type.INT, 0, 0, 1000,
         1000, KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(3),
-        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 10000L,
+        "bigint", Types.BIGINT, HCatFieldSchema.Type.BIGINT, 0, 0, 10000L,
         10000L, KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -116,10 +116,10 @@ public class DirectNetezzaHCatImportManualTest extends HCatalogImportTest {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, "string to test",
-        "string to test", KeyType.NOT_A_KEY),
+        "char(14)", Types.CHAR, HCatFieldSchema.Type.STRING, 0, 0,
+        "string to test", "string to test", KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING,
+        "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0,
         "string to test", "string to test", KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
@@ -132,11 +132,11 @@ public class DirectNetezzaHCatImportManualTest extends HCatalogImportTest {
     String table = getTableName().toUpperCase();
     ColumnGenerator[] cols = new ColumnGenerator[] {
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0),
-        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, "1000.00",
-        new BigDecimal("1000"), KeyType.NOT_A_KEY),
+        "numeric(18,2)", Types.NUMERIC, HCatFieldSchema.Type.STRING, 0, 0,
+        "1000.00", new BigDecimal("1000"), KeyType.NOT_A_KEY),
       HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1),
-        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, "2000.00",
-        new BigDecimal("2000"), KeyType.NOT_A_KEY),
+        "decimal(18,2)", Types.DECIMAL, HCatFieldSchema.Type.STRING, 0, 0,
+        "2000.00", new BigDecimal("2000"), KeyType.NOT_A_KEY),
     };
     List<String> addlArgsArray = new ArrayList<String>();
     setExtraArgs(addlArgsArray);


Mime
View raw message