sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject [1/2] SQOOP-1035: Add MS Sqoop Connecter tests
Date Tue, 18 Jun 2013 22:31:09 GMT
Updated Branches:
  refs/heads/trunk 7a2079e74 -> 64878c643


http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerHiveImportManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerHiveImportManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerHiveImportManualTest.java
new file mode 100644
index 0000000..077613f
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerHiveImportManualTest.java
@@ -0,0 +1,162 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.hive.TestHiveImport;
+import com.cloudera.sqoop.testutil.CommonArgs;
+import com.cloudera.sqoop.tool.SqoopTool;
+
+/**
+ * Test import to Hive from SQL Server.
+ */
+public class SQLServerHiveImportManualTest extends TestHiveImport {
+
+  public void setUp() {
+    super.setUp();
+
+  }
+
+  protected boolean useHsqldbTestServer() {
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  //SQL Server pads out
+  protected String[] getTypesNewLineTest() {
+    String[] types = { "VARCHAR(32)", "INTEGER", "VARCHAR(64)" };
+    return types;
+  }
+
+  /**
+   * Drop a table if it already exists in the database.
+   * @param table
+   *            the name of the table to drop.
+   * @throws SQLException
+   *             if something goes wrong.
+   */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+        + "') IS NOT NULL  DROP TABLE " + table;
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+      statement.executeUpdate();
+      conn.commit();
+    } finally {
+      statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    SqoopOptions opts = new SqoopOptions(conf);
+    opts.setUsername(username);
+    opts.setPassword(password);
+
+    return opts;
+
+  }
+
+  SqoopOptions getSqoopOptions(String[] args, SqoopTool tool) {
+    SqoopOptions opts = null;
+    try {
+      opts = tool.parseArguments(args, null, null, true);
+      String username = MSSQLTestUtils.getDBUserName();
+      String password = MSSQLTestUtils.getDBPassWord();
+      opts.setUsername(username);
+      opts.setPassword(password);
+
+    } catch (Exception e) {
+      LOG.error(StringUtils.stringifyException(e));
+      fail("Invalid options: " + e.toString());
+    }
+
+    return opts;
+  }
+
+  protected String[] getArgv(boolean includeHadoopFlags, String[] moreArgs) {
+    ArrayList<String> args = new ArrayList<String>();
+    System.out.println("Ovverdien getArgv is called..");
+    if (includeHadoopFlags) {
+      CommonArgs.addHadoopFlags(args);
+    }
+
+    if (null != moreArgs) {
+      for (String arg : moreArgs) {
+        args.add(arg);
+      }
+    }
+
+    args.add("--table");
+    args.add(getTableName());
+    args.add("--warehouse-dir");
+    args.add(getWarehouseDir());
+    args.add("--connect");
+    args.add(getConnectString());
+    args.add("--hive-import");
+    String[] colNames = getColNames();
+    if (null != colNames) {
+      args.add("--split-by");
+      args.add(colNames[0]);
+    } else {
+      fail("Could not determine column names.");
+    }
+
+    args.add("--num-mappers");
+    args.add("1");
+
+    for (String a : args) {
+      LOG.debug("ARG : " + a);
+    }
+
+    return args.toArray(new String[0]);
+  }
+
+  protected String[] getCodeGenArgs() {
+    ArrayList<String> args = new ArrayList<String>();
+
+    args.add("--table");
+    args.add(getTableName());
+    args.add("--connect");
+    args.add(getConnectString());
+    args.add("--hive-import");
+
+    return args.toArray(new String[0]);
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerManualTest.java
new file mode 100644
index 0000000..ee576c9
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerManualTest.java
@@ -0,0 +1,348 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Map;
+import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import com.cloudera.sqoop.ConnFactory;
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.manager.ConnManager;
+import com.cloudera.sqoop.metastore.JobData;
+import com.cloudera.sqoop.testutil.HsqldbTestServer;
+import com.cloudera.sqoop.tool.ImportTool;
+import com.cloudera.sqoop.tool.SqoopTool;
+
+/**
+ * Test methods of the generic SqlManager implementation.
+ */
+public class SQLServerManagerManualTest extends TestCase {
+
+  public static final Log LOG = LogFactory.getLog(
+    SQLServerManagerManualTest.class.getName());
+
+  /** the name of a table that doesn't exist. */
+  static final String MISSING_TABLE = "MISSING_TABLE";
+
+  // instance variables populated during setUp, used during tests
+  private HsqldbTestServer testServer;
+  private ConnManager manager;
+
+  @Before
+  public void setUp() {
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.createTableFromSQL(MSSQLTestUtils.CREATE_TALBE_LINEITEM);
+      utils.populateLineItem();
+    } catch (SQLException e) {
+      LOG.error("Setup fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("Setup fail with SQLException: " + e.toString());
+    }
+    Configuration conf = getConf();
+    SqoopOptions opts = getSqoopOptions(conf);
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    opts.setUsername(username);
+    opts.setPassword(password);
+    opts.setConnectString(getConnectString());
+    ConnFactory f = new ConnFactory(conf);
+    try {
+      this.manager = f.getManager(new JobData(opts, new ImportTool()));
+      System.out.println("Manger : " + this.manager);
+    } catch (IOException ioe) {
+      LOG.error("Setup fail with IOException: " + StringUtils.stringifyException(ioe));
+      fail("IOException instantiating manager: "
+          + StringUtils.stringifyException(ioe));
+    }
+  }
+
+  @After
+  public void tearDown() {
+    try {
+
+      MSSQLTestUtils utils = new MSSQLTestUtils();
+      utils.dropTableIfExists("TPCH1M_LINEITEM");
+      manager.close();
+    } catch (SQLException sqlE) {
+      LOG.error("Got SQLException: " + sqlE.toString());
+      fail("Got SQLException: " + sqlE.toString());
+    }
+  }
+
+  @Test
+  public void testListColNames() {
+    String[] colNames = manager.getColumnNames(getTableName());
+    assertNotNull("manager returned no colname list", colNames);
+    assertEquals("Table list should be length 2", 16, colNames.length);
+    String[] knownFields = MSSQLTestUtils.getColumns();
+    for (int i = 0; i < colNames.length; i++) {
+      assertEquals(knownFields[i], colNames[i]);
+    }
+  }
+
+  @Test
+  public void testListColTypes() {
+    Map<String, Integer> types = manager.getColumnTypes(getTableName());
+
+    assertNotNull("manager returned no types map", types);
+    assertEquals("Map should be size=16", 16, types.size());
+    assertEquals(types.get("L_ORDERKEY").intValue(), Types.INTEGER);
+    assertEquals(types.get("L_COMMENT").intValue(), Types.VARCHAR);
+  }
+
+  @Test
+  public void testMissingTableColNames() {
+    // SQL Server returns an empty column list which gets translated as a
+    // zero length array
+    // how ever also check in case it returns null, which is also correct
+    String[] colNames = manager.getColumnNames(MISSING_TABLE);
+    if (colNames == null) {
+      assertNull("No column names should be returned for missing table",
+          colNames);
+    }
+    int numItems = colNames.length;
+    assertEquals(0, numItems);
+  }
+
+  @Test
+  public void testMissingTableColTypes() {
+    Map<String, Integer> colTypes = manager.getColumnTypes(MISSING_TABLE);
+    assertNull("No column types should be returned for missing table",
+        colTypes);
+  }
+
+  // constants related to testReadTable()
+  static final int EXPECTED_NUM_ROWS = 4;
+  static final int EXPECTED_COL1_SUM = 10;
+  static final int EXPECTED_COL2_SUM = 14;
+
+  @Test
+  public void testReadTable() {
+    ResultSet results = null;
+    try {
+      results = manager.readTable(getTableName(), MSSQLTestUtils
+          .getColumns());
+
+      assertNotNull("ResultSet from readTable() is null!", results);
+
+      ResultSetMetaData metaData = results.getMetaData();
+      assertNotNull("ResultSetMetadata is null in readTable()", metaData);
+
+      // ensure that we get the correct number of columns back
+      assertEquals("Number of returned columns was unexpected!", metaData
+          .getColumnCount(), 16);
+
+      // should get back 4 rows. They are:
+      // 1 2
+      // 3 4
+      // 5 6
+      // 7 8
+      // .. so while order isn't guaranteed, we should get back 16 on the
+      // left
+      // and 20 on the right.
+      int sumCol1 = 0, sumCol2 = 0, rowCount = 0;
+      while (results.next()) {
+        rowCount++;
+        sumCol1 += results.getInt(1);
+        sumCol2 += results.getInt(2);
+      }
+
+      assertEquals("Expected 4 rows back", EXPECTED_NUM_ROWS, rowCount);
+      assertEquals("Expected left sum of 10", EXPECTED_COL1_SUM, sumCol1);
+      assertEquals("Expected right sum of 14", EXPECTED_COL2_SUM, sumCol2);
+    } catch (SQLException sqlException) {
+      LOG.error(StringUtils.stringifyException(sqlException));
+      fail("SQL Exception: " + sqlException.toString());
+    } finally {
+      if (null != results) {
+        try {
+          results.close();
+        } catch (SQLException sqlE) {
+          LOG.error(StringUtils.stringifyException(sqlE));
+          fail("SQL Exception in ResultSet.close(): "
+              + sqlE.toString());
+        }
+      }
+
+      manager.release();
+    }
+  }
+
+  @Test
+  public void testReadMissingTable() {
+    ResultSet results = null;
+    try {
+      String[] colNames = { "*" };
+      results = manager.readTable(MISSING_TABLE, colNames);
+      assertNull("Expected null resultset from readTable(MISSING_TABLE)",
+          results);
+    } catch (SQLException sqlException) {
+      // we actually expect this pass.
+    } finally {
+      if (null != results) {
+        try {
+          results.close();
+        } catch (SQLException sqlE) {
+          fail("SQL Exception in ResultSet.close(): "
+              + sqlE.toString());
+        }
+      }
+
+      manager.release();
+    }
+  }
+
+  @Test
+  public void testgetPrimaryKeyFromMissingTable() {
+    String primaryKey = manager.getPrimaryKey(MISSING_TABLE);
+    assertNull("Expected null pkey for missing table", primaryKey);
+  }
+
+  @Test
+  public void testgetPrimaryKeyFromTableWithoutKey() {
+    String primaryKey = manager.getPrimaryKey(getTableName());
+    assertNull("Expected null pkey for table without key", primaryKey);
+  }
+
+  // constants for getPrimaryKeyFromTable()
+  static final String TABLE_WITH_KEY = "TABLE_WITH_KEY";
+  static final String KEY_FIELD_NAME = "KEYFIELD";
+
+  @Test
+  public void testgetPrimaryKeyFromTable() {
+    // first, create a table with a primary key
+    Connection conn = null;
+    try {
+      conn = getManager().getConnection();
+      dropTableIfExists(TABLE_WITH_KEY);
+      PreparedStatement statement = conn.prepareStatement("CREATE TABLE "
+          + TABLE_WITH_KEY + "(" + KEY_FIELD_NAME
+          + " INT NOT NULL PRIMARY KEY, foo INT)",
+          ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+      statement.executeUpdate();
+      statement.close();
+
+      String primaryKey = getManager().getPrimaryKey(TABLE_WITH_KEY);
+      assertEquals("Expected null pkey for table without key",
+          primaryKey, KEY_FIELD_NAME);
+
+    } catch (SQLException sqlException) {
+      LOG.error(StringUtils.stringifyException(sqlException));
+      fail("Could not create table with primary key: "
+          + sqlException.toString());
+    } finally {
+      if (null != conn) {
+        try {
+          conn.close();
+        } catch (SQLException sqlE) {
+          LOG.warn("Got SQLException during close: "
+              + sqlE.toString());
+        }
+      }
+    }
+
+  }
+
+  protected boolean useHsqldbTestServer() {
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  /**
+   * Drop a table if it already exists in the database.
+   *
+   * @param table
+   *            the name of the table to drop.
+   * @throws SQLException
+   *             if something goes wrong.
+   */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+        + "') IS NOT NULL  DROP TABLE " + table;
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+      statement.executeUpdate();
+      conn.commit();
+    } finally {
+      statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+    SqoopOptions opt = new SqoopOptions(conf);
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    SqoopOptions opts = new SqoopOptions(conf);
+    opts.setUsername(username);
+    opts.setPassword(password);
+
+    return opt;
+  }
+
+  SqoopOptions getSqoopOptions(String[] args, SqoopTool tool) {
+    SqoopOptions opts = null;
+    try {
+      opts = tool.parseArguments(args, null, null, true);
+      String username = MSSQLTestUtils.getDBUserName();
+      String password = MSSQLTestUtils.getDBPassWord();
+      opts.setUsername(username);
+      opts.setPassword(password);
+
+    } catch (Exception e) {
+      LOG.error(StringUtils.stringifyException(e));
+      fail("Invalid options: " + e.toString());
+    }
+
+    return opts;
+  }
+
+  protected String getTableName() {
+    return "tpch1m_lineitem";
+  }
+
+  protected ConnManager getManager() {
+    return manager;
+  }
+
+  protected Configuration getConf() {
+    return new Configuration();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiColsManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiColsManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiColsManualTest.java
new file mode 100644
index 0000000..66b4a51
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiColsManualTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.TestMultiCols;
+
+/**
+ * Test multiple columns SQL Server.
+ */
+public class SQLServerMultiColsManualTest extends TestMultiCols {
+
+  protected boolean useHsqldbTestServer() {
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  /**
+  * Drop a table if it already exists in the database.
+  *
+  * @param table
+  *            the name of the table to drop.
+  * @throws SQLException
+  *             if something goes wrong.
+  */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+      + "') IS NOT NULL  DROP TABLE " + table;
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+      ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+     statement.executeUpdate();
+     conn.commit();
+    } finally {
+     statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    SqoopOptions opts = new SqoopOptions(conf);
+    opts.setUsername(username);
+    opts.setPassword(password);
+
+    return opts;
+
+  }
+
+  public void testMixed4() {
+    // Overridden to bypass test case invalid for MSSQL server
+  }
+
+  public void testMixed5() {
+    // Overridden to bypass test case invalid for MSSQL server
+  }
+
+  public void testMixed6() {
+    // Overridden to bypass test case invalid for MSSQL server
+  }
+
+  public void testSkipFirstCol() {
+    // Overridden to bypass test case invalid for MSSQL server
+  }
+
+  public void testSkipSecondCol() {
+    // Overridden to bypass test case invalid for MSSQL server
+  }
+
+  public void testSkipThirdCol() {
+    // Overridden to bypass test case invalid for MSSQL server
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiMapsManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiMapsManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiMapsManualTest.java
new file mode 100644
index 0000000..58ef4b4
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerMultiMapsManualTest.java
@@ -0,0 +1,299 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.io.SequenceFile;
+import org.apache.hadoop.mapred.Utils;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.SqoopOptions.InvalidOptionsException;
+import com.cloudera.sqoop.orm.CompilationManager;
+import com.cloudera.sqoop.testutil.CommonArgs;
+import com.cloudera.sqoop.testutil.ImportJobTestCase;
+import com.cloudera.sqoop.testutil.SeqFileReader;
+import com.cloudera.sqoop.tool.ImportTool;
+import com.cloudera.sqoop.tool.SqoopTool;
+import com.cloudera.sqoop.util.ClassLoaderStack;
+
+/**
+ * Test that using multiple mapper splits works.
+ */
+public class SQLServerMultiMapsManualTest extends ImportJobTestCase {
+
+  public void setUp() {
+    super.setUp();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.createTableFromSQL(MSSQLTestUtils.CREATE_TALBE_LINEITEM);
+      utils.populateLineItem();
+    } catch (SQLException e) {
+      LOG.error("Setup fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("Setup fail with SQLException: " + e.toString());
+    }
+
+  }
+
+  public void tearDown() {
+    super.tearDown();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.dropTableIfExists("TPCH1M_LINEITEM");
+    } catch (SQLException e) {
+      LOG.error("TeatDown fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("TearDown fail with SQLException: " + e.toString());
+    }
+  }
+
+  /**
+   * Create the argv to pass to Sqoop.
+   *
+   * @return the argv as an array of strings.
+   */
+  protected String[] getArgv(boolean includeHadoopFlags, String[] colNames,
+      String splitByCol) {
+    String columnsString = "";
+    for (String col : colNames) {
+      columnsString += col + ",";
+    }
+
+    ArrayList<String> args = new ArrayList<String>();
+
+    if (includeHadoopFlags) {
+      CommonArgs.addHadoopFlags(args);
+    }
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+
+    args.add("--table");
+    args.add(getTableName());
+    args.add("--columns");
+    args.add(columnsString);
+    args.add("--split-by");
+    args.add(splitByCol);
+    args.add("--warehouse-dir");
+    args.add(getWarehouseDir());
+    args.add("--connect");
+    args.add(getConnectString());
+    args.add("--username");
+    args.add(username);
+    args.add("--password");
+    args.add(password);
+    args.add("--as-sequencefile");
+    args.add("--num-mappers");
+    args.add("2");
+
+    return args.toArray(new String[0]);
+  }
+
+  // this test just uses the two int table.
+
+  /** @return a list of Path objects for each data file */
+  protected List<Path> getDataFilePaths() throws IOException {
+    List<Path> paths = new ArrayList<Path>();
+    Configuration conf = new Configuration();
+    conf.set("fs.default.name", "file:///");
+    FileSystem fs = FileSystem.get(conf);
+
+    FileStatus[] stats = fs.listStatus(getTablePath(),
+        new Utils.OutputFileUtils.OutputFilesFilter());
+
+    for (FileStatus stat : stats) {
+      paths.add(stat.getPath());
+    }
+
+    return paths;
+  }
+
+  /**
+   * Given a comma-delimited list of integers, grab and parse the first int.
+   *
+   * @param str
+   *            a comma-delimited list of values, the first of which is an
+   *            int.
+   * @return the first field in the string, cast to int
+   */
+  private int getFirstInt(String str) {
+    String[] parts = str.split(",");
+    return Integer.parseInt(parts[0]);
+  }
+
+  public void runMultiMapTest(String splitByCol, int expectedSum)
+      throws IOException {
+
+    String[] columns = MSSQLTestUtils.getColumns();
+    ClassLoader prevClassLoader = null;
+    SequenceFile.Reader reader = null;
+
+    String[] argv = getArgv(true, columns, splitByCol);
+    runImport(argv);
+    try {
+      ImportTool importTool = new ImportTool();
+      SqoopOptions opts = importTool.parseArguments(getArgv(false,
+          columns, splitByCol), null, null, true);
+      String username = MSSQLTestUtils.getDBUserName();
+      String password = MSSQLTestUtils.getDBPassWord();
+      opts.setUsername(username);
+      opts.setPassword(password);
+
+      CompilationManager compileMgr = new CompilationManager(opts);
+      String jarFileName = compileMgr.getJarFilename();
+
+      prevClassLoader = ClassLoaderStack.addJarFile(jarFileName,
+          getTableName());
+
+      List<Path> paths = getDataFilePaths();
+      Configuration conf = new Configuration();
+      int curSum = 0;
+
+      // We expect multiple files. We need to open all the files and sum
+      // up the
+      // first column across all of them.
+      for (Path p : paths) {
+        reader = SeqFileReader.getSeqFileReader(p.toString());
+
+        // here we can actually instantiate (k, v) pairs.
+        Object key = ReflectionUtils.newInstance(reader.getKeyClass(),
+            conf);
+        Object val = ReflectionUtils.newInstance(
+            reader.getValueClass(), conf);
+
+        // We know that these values are two ints separated by a ','
+        // character. Since this is all dynamic, though, we don't want
+        // to
+        // actually link against the class and use its methods. So we
+        // just
+        // parse this back into int fields manually. Sum them up and
+        // ensure
+        // that we get the expected total for the first column, to
+        // verify that
+        // we got all the results from the db into the file.
+
+        // now sum up everything in the file.
+        while (reader.next(key) != null) {
+          reader.getCurrentValue(val);
+          curSum += getFirstInt(val.toString());
+        }
+
+        IOUtils.closeStream(reader);
+        reader = null;
+      }
+
+      assertEquals("Total sum of first db column mismatch", expectedSum,
+          curSum);
+    } catch (InvalidOptionsException ioe) {
+      LOG.error(StringUtils.stringifyException(ioe));
+      fail(ioe.toString());
+    } catch (ParseException pe) {
+      LOG.error(StringUtils.stringifyException(pe));
+      fail(pe.toString());
+    } finally {
+      IOUtils.closeStream(reader);
+
+      if (null != prevClassLoader) {
+        ClassLoaderStack.setCurrentClassLoader(prevClassLoader);
+      }
+    }
+  }
+
+  public void testSplitByFirstCol() throws IOException {
+    runMultiMapTest("L_ORDERKEY", 10);
+  }
+
+  protected boolean useHsqldbTestServer() {
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  /**
+   * Drop a table if it already exists in the database.
+   *
+   * @param table
+   *            the name of the table to drop.
+   * @throws SQLException
+   *             if something goes wrong.
+   */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+        + "') IS NOT NULL  DROP TABLE " + table;
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+      statement.executeUpdate();
+      conn.commit();
+    } finally {
+      statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+    SqoopOptions opt = new SqoopOptions(conf);
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    SqoopOptions opts = new SqoopOptions(conf);
+    opts.setUsername(username);
+    opts.setPassword(password);
+
+    return opt;
+  }
+
+  SqoopOptions getSqoopOptions(String[] args, SqoopTool tool) {
+    SqoopOptions opts = null;
+    try {
+      opts = tool.parseArguments(args, null, null, true);
+      String username = MSSQLTestUtils.getDBUserName();
+      String password = MSSQLTestUtils.getDBPassWord();
+      opts.setUsername(username);
+      opts.setPassword(password);
+
+    } catch (Exception e) {
+      LOG.error(StringUtils.stringifyException(e));
+      fail("Invalid options: " + e.toString());
+    }
+
+    return opts;
+  }
+
+  protected String getTableName() {
+    return "tpch1m_lineitem";
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerParseMethodsManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerParseMethodsManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerParseMethodsManualTest.java
new file mode 100644
index 0000000..21c950a
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerParseMethodsManualTest.java
@@ -0,0 +1,252 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapred.FileInputFormat;
+import org.apache.hadoop.mapred.FileOutputFormat;
+import org.apache.hadoop.mapred.JobClient;
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.SqoopOptions.InvalidOptionsException;
+import com.cloudera.sqoop.config.ConfigurationHelper;
+import com.cloudera.sqoop.orm.CompilationManager;
+import com.cloudera.sqoop.testutil.CommonArgs;
+import com.cloudera.sqoop.testutil.ImportJobTestCase;
+import com.cloudera.sqoop.testutil.ReparseMapper;
+import com.cloudera.sqoop.tool.ImportTool;
+import com.cloudera.sqoop.util.ClassLoaderStack;
+
+/**
+ * Test that the parse() methods generated in user SqoopRecord implementations
+ * work.
+ */
+public class SQLServerParseMethodsManualTest extends ImportJobTestCase {
+
+  public void setUp() {
+    super.setUp();
+    Path p = new Path(getWarehouseDir());
+    try {
+      FileSystem fs = FileSystem.get(new Configuration());
+      fs.delete(p);
+    } catch (IOException e) {
+      LOG.error("Setup fail with IOException: " + StringUtils.stringifyException(e));
+      fail("Setup fail with IOException: " + StringUtils.stringifyException(e));
+    }
+  }
+
+  /**
+   * Create the argv to pass to Sqoop.
+   *
+   * @return the argv as an array of strings.
+   */
+  private String[] getArgv(boolean includeHadoopFlags,
+      String fieldTerminator, String lineTerminator, String encloser,
+      String escape, boolean encloserRequired) {
+
+    ArrayList<String> args = new ArrayList<String>();
+
+    if (includeHadoopFlags) {
+      CommonArgs.addHadoopFlags(args);
+    }
+
+    args.add("--table");
+    args.add(getTableName());
+    args.add("--warehouse-dir");
+    args.add(getWarehouseDir());
+    args.add("--connect");
+    args.add(getConnectString());
+    args.add("--as-textfile");
+    args.add("--split-by");
+    args.add("DATA_COL0"); // always split by first column.
+    args.add("--fields-terminated-by");
+    args.add(fieldTerminator);
+    args.add("--lines-terminated-by");
+    args.add(lineTerminator);
+    args.add("--escaped-by");
+    args.add(escape);
+    if (encloserRequired) {
+      args.add("--enclosed-by");
+    } else {
+      args.add("--optionally-enclosed-by");
+    }
+    args.add(encloser);
+    args.add("--num-mappers");
+    args.add("1");
+
+    return args.toArray(new String[0]);
+  }
+
+  public void runParseTest(String fieldTerminator, String lineTerminator,
+      String encloser, String escape, boolean encloseRequired)
+      throws IOException {
+
+    ClassLoader prevClassLoader = null;
+
+    String[] argv = getArgv(true, fieldTerminator, lineTerminator,
+        encloser, escape, encloseRequired);
+    runImport(argv);
+    try {
+      String tableClassName = getTableName();
+
+      argv = getArgv(false, fieldTerminator, lineTerminator, encloser,
+          escape, encloseRequired);
+      SqoopOptions opts = new ImportTool().parseArguments(argv, null,
+          null, true);
+
+      CompilationManager compileMgr = new CompilationManager(opts);
+      String jarFileName = compileMgr.getJarFilename();
+
+      // Make sure the user's class is loaded into our address space.
+      prevClassLoader = ClassLoaderStack.addJarFile(jarFileName,
+          tableClassName);
+
+      JobConf job = new JobConf();
+      job.setJar(jarFileName);
+
+      // Tell the job what class we're testing.
+      job.set(ReparseMapper.USER_TYPE_NAME_KEY, tableClassName);
+
+      // use local mode in the same JVM.
+      ConfigurationHelper.setJobtrackerAddr(job, "local");
+      job.set("fs.default.name", "file:///");
+
+      String warehouseDir = getWarehouseDir();
+      Path warehousePath = new Path(warehouseDir);
+      Path inputPath = new Path(warehousePath, getTableName());
+      Path outputPath = new Path(warehousePath, getTableName() + "-out");
+
+      job.setMapperClass(ReparseMapper.class);
+      job.setNumReduceTasks(0);
+      FileInputFormat.addInputPath(job, inputPath);
+      FileOutputFormat.setOutputPath(job, outputPath);
+
+      job.setOutputKeyClass(Text.class);
+      job.setOutputValueClass(NullWritable.class);
+
+      JobClient.runJob(job);
+    } catch (InvalidOptionsException ioe) {
+      LOG.error(StringUtils.stringifyException(ioe));
+      fail(ioe.toString());
+    } catch (ParseException pe) {
+      LOG.error(StringUtils.stringifyException(pe));
+      fail(pe.toString());
+    } finally {
+      if (null != prevClassLoader) {
+        ClassLoaderStack.setCurrentClassLoader(prevClassLoader);
+      }
+    }
+  }
+
+  public void testDefaults() throws IOException {
+    String[] types = { "INTEGER", "VARCHAR(32)", "INTEGER" };
+    String[] vals = { "64", "'foo'", "128" };
+
+    createTableWithColTypes(types, vals);
+    runParseTest(",", "\\n", "\\\"", "\\", false);
+  }
+
+  public void testRequiredEnclose() throws IOException {
+    String[] types = { "INTEGER", "VARCHAR(32)", "INTEGER" };
+    String[] vals = { "64", "'foo'", "128" };
+
+    createTableWithColTypes(types, vals);
+    runParseTest(",", "\\n", "\\\"", "\\", true);
+  }
+
+  public void testStringEscapes() throws IOException {
+    String[] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)",
+        "VARCHAR(32)", "VARCHAR(32)", };
+    String[] vals = { "'foo'", "'foo,bar'", "'foo''bar'", "'foo\\bar'",
+        "'foo,bar''baz'", };
+
+    createTableWithColTypes(types, vals);
+    runParseTest(",", "\\n", "\\\'", "\\", false);
+  }
+
+  public void testNumericTypes() throws IOException {
+    String[] types = { "INTEGER", "REAL", "FLOAT", "DATE", "TIME", "BIT", };
+    String[] vals = { "42", "36.0", "127.1", "'2009-07-02'", "'11:24:00'",
+
+    "1", };
+
+    createTableWithColTypes(types, vals);
+    runParseTest(",", "\\n", "\\\'", "\\", false);
+  }
+
+  protected boolean useHsqldbTestServer() {
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  /**
+   * Drop a table if it already exists in the database.
+   *
+   * @param table
+   *            the name of the table to drop.
+   * @throws SQLException
+   *             if something goes wrong.
+   */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+        + "') IS NOT NULL  DROP TABLE " + table;
+
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+      statement.executeUpdate();
+      conn.commit();
+    } finally {
+      statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    SqoopOptions opts = new SqoopOptions(conf);
+    opts.setUsername(username);
+    opts.setPassword(password);
+    return opts;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerQueryManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerQueryManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerQueryManualTest.java
new file mode 100644
index 0000000..613bbce
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerQueryManualTest.java
@@ -0,0 +1,278 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.io.SequenceFile;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.SqoopOptions.InvalidOptionsException;
+import com.cloudera.sqoop.orm.CompilationManager;
+import com.cloudera.sqoop.testutil.CommonArgs;
+import com.cloudera.sqoop.testutil.ImportJobTestCase;
+import com.cloudera.sqoop.testutil.SeqFileReader;
+import com.cloudera.sqoop.tool.ImportTool;
+import com.cloudera.sqoop.util.ClassLoaderStack;
+
+/**
+ * Test that --query works in Sqoop.
+ */
+public class SQLServerQueryManualTest extends ImportJobTestCase {
+
+  public void setUp() {
+    super.setUp();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.createTableFromSQL(MSSQLTestUtils.CREATE_TALBE_LINEITEM);
+      utils.populateLineItem();
+    } catch (SQLException e) {
+      LOG.error("Setup fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("Setup fail with SQLException: " + e.toString());
+    }
+
+  }
+
+  public void tearDown() {
+    super.tearDown();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.dropTableIfExists("TPCH1M_LINEITEM");
+    } catch (SQLException e) {
+      LOG.error("TearDown fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("TearDown fail with SQLException: " + e.toString());
+    }
+  }
+
+  /**
+   * Create the argv to pass to Sqoop.
+   *
+   * @return the argv as an array of strings.
+   */
+  protected String[] getArgv(boolean includeHadoopFlags, String query,
+      String targetDir, boolean allowParallel) {
+
+    ArrayList<String> args = new ArrayList<String>();
+
+    if (includeHadoopFlags) {
+      CommonArgs.addHadoopFlags(args);
+    }
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+
+    args.add("--query");
+    args.add(query);
+    args.add("--split-by");
+    args.add("L_ORDERKEY");
+    args.add("--connect");
+    args.add(getConnectString());
+    args.add("--username");
+    args.add(username);
+    args.add("--password");
+    args.add(password);
+    args.add("--as-sequencefile");
+    args.add("--target-dir");
+    args.add(targetDir);
+    args.add("--class-name");
+    args.add(getTableName());
+    if (allowParallel) {
+      args.add("--num-mappers");
+      args.add("2");
+    } else {
+      args.add("--num-mappers");
+      args.add("1");
+    }
+
+    return args.toArray(new String[0]);
+  }
+
+  /**
+   * Given a comma-delimited list of integers, grab and parse the first int.
+   *
+   * @param str
+   *            a comma-delimited list of values, the first of which is an
+   *            int.
+   * @return the first field in the string, cast to int
+   */
+  private int getFirstInt(String str) {
+    String[] parts = str.split(",");
+    return Integer.parseInt(parts[0]);
+  }
+
+  public void runQueryTest(String query, String firstValStr,
+      int numExpectedResults, int expectedSum, String targetDir)
+      throws IOException {
+
+    ClassLoader prevClassLoader = null;
+    SequenceFile.Reader reader = null;
+
+    String[] argv = getArgv(true, query, targetDir, false);
+    runImport(argv);
+    try {
+      SqoopOptions opts = new ImportTool().parseArguments(getArgv(false,
+          query, targetDir, false), null, null, true);
+
+      CompilationManager compileMgr = new CompilationManager(opts);
+      String jarFileName = compileMgr.getJarFilename();
+
+      prevClassLoader = ClassLoaderStack.addJarFile(jarFileName,
+          getTableName());
+
+      reader = SeqFileReader.getSeqFileReader(getDataFilePath()
+          .toString());
+
+      // here we can actually instantiate (k, v) pairs.
+      Configuration conf = new Configuration();
+      Object key = ReflectionUtils
+          .newInstance(reader.getKeyClass(), conf);
+      Object val = ReflectionUtils.newInstance(reader.getValueClass(),
+          conf);
+
+      if (reader.next(key) == null) {
+        fail("Empty SequenceFile during import");
+      }
+
+      // make sure that the value we think should be at the top, is.
+      reader.getCurrentValue(val);
+      assertEquals("Invalid ordering within sorted SeqFile", firstValStr,
+          val.toString());
+
+      // We know that these values are two ints separated by a ','
+      // character.
+      // Since this is all dynamic, though, we don't want to actually link
+      // against the class and use its methods. So we just parse this back
+      // into int fields manually. Sum them up and ensure that we get the
+      // expected total for the first column, to verify that we got all
+      // the
+      // results from the db into the file.
+      int curSum = getFirstInt(val.toString());
+      int totalResults = 1;
+
+      // now sum up everything else in the file.
+      while (reader.next(key) != null) {
+        reader.getCurrentValue(val);
+        curSum += getFirstInt(val.toString());
+        totalResults++;
+      }
+
+      assertEquals("Total sum of first db column mismatch", expectedSum,
+          curSum);
+      assertEquals("Incorrect number of results for query",
+          numExpectedResults, totalResults);
+    } catch (InvalidOptionsException ioe) {
+      LOG.error(StringUtils.stringifyException(ioe));
+      fail(ioe.toString());
+    } catch (ParseException pe) {
+      LOG.error(StringUtils.stringifyException(pe));
+      fail(pe.toString());
+    } finally {
+      IOUtils.closeStream(reader);
+
+      if (null != prevClassLoader) {
+        ClassLoaderStack.setCurrentClassLoader(prevClassLoader);
+      }
+    }
+  }
+
+  public void testSelectStar() throws IOException {
+    runQueryTest("SELECT * FROM " + getTableName()
+        + " WHERE L_ORDERKEY > 0 AND $CONDITIONS",
+        "1,2,3,4,5,6.00,7.00,8.00,AB,CD,abcd,efgh,hijk,dothis,likethis,"
+            + "nocomments\n", 4, 10, getTablePath().toString());
+  }
+
+  public void testCompoundWhere() throws IOException {
+    runQueryTest("SELECT * FROM " + getTableName()
+        + " WHERE L_ORDERKEY > 1 AND L_PARTKEY < 4 AND $CONDITIONS",
+        "2,3,4,5,6,7.00,8.00,9.00,AB,CD,abcd,efgh,hijk,dothis,likethis,"
+            + "nocomments\n", 1, 2, getTablePath().toString());
+  }
+
+  public void testFailNoConditions() throws IOException {
+    String[] argv = getArgv(true, "SELECT * FROM " + getTableName(),
+        getTablePath().toString() + "where $CONDITIONS", true);
+    try {
+      runImport(argv);
+      fail("Expected exception running import without $CONDITIONS");
+    } catch (Exception e) {
+      LOG.info("Got exception " + e + " running job (expected; ok)");
+    }
+  }
+
+  protected boolean useHsqldbTestServer() {
+
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  /**
+   * Drop a table if it already exists in the database.
+   *
+   * @param table
+   *            the name of the table to drop.
+   * @throws SQLException
+   *             if something goes wrong.
+   */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+        + "') IS NOT NULL  DROP TABLE " + table;
+
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+      statement.executeUpdate();
+      conn.commit();
+    } finally {
+      statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+    SqoopOptions opt = new SqoopOptions(conf);
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    SqoopOptions opts = new SqoopOptions(conf);
+    opts.setUsername(username);
+    opts.setPassword(password);
+
+    return opt;
+  }
+
+  protected String getTableName() {
+    return "tpch1m_lineitem";
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerSplitByManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerSplitByManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerSplitByManualTest.java
new file mode 100644
index 0000000..4729aac
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerSplitByManualTest.java
@@ -0,0 +1,247 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.io.SequenceFile;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.SqoopOptions.InvalidOptionsException;
+import com.cloudera.sqoop.orm.CompilationManager;
+import com.cloudera.sqoop.testutil.CommonArgs;
+import com.cloudera.sqoop.testutil.ImportJobTestCase;
+import com.cloudera.sqoop.testutil.SeqFileReader;
+import com.cloudera.sqoop.tool.ImportTool;
+import com.cloudera.sqoop.util.ClassLoaderStack;
+
+/**
+ * Test that --split-by works.
+ */
+public class SQLServerSplitByManualTest extends ImportJobTestCase {
+
+  public void setUp() {
+    super.setUp();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.createTableFromSQL(MSSQLTestUtils.CREATE_TALBE_LINEITEM);
+      utils.populateLineItem();
+    } catch (SQLException e) {
+      LOG.error("Setup fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("Setup fail with SQLException: " + e.toString());
+    }
+
+  }
+
+  public void tearDown() {
+    super.tearDown();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.dropTableIfExists("TPCH1M_LINEITEM");
+    } catch (SQLException e) {
+      LOG.error("TearDown fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("TearDown fail with SQLException: " + e.toString());
+    }
+  }
+
+  /**
+   * Create the argv to pass to Sqoop.
+   *
+   * @return the argv as an array of strings.
+   */
+  protected String[] getArgv(boolean includeHadoopFlags, String[] colNames,
+      String splitByCol) {
+    String columnsString = "";
+    for (String col : colNames) {
+      columnsString += col + ",";
+    }
+
+    ArrayList<String> args = new ArrayList<String>();
+
+    if (includeHadoopFlags) {
+      CommonArgs.addHadoopFlags(args);
+    }
+
+    args.add("--table");
+    args.add("tpch1m_lineitem");
+    args.add("--columns");
+    args.add(columnsString);
+    args.add("--split-by");
+    args.add("L_ORDERKEY");
+    args.add("--warehouse-dir");
+    args.add(getWarehouseDir());
+    args.add("--connect");
+    args.add(getConnectString());
+    args.add("--as-sequencefile");
+    args.add("--num-mappers");
+    args.add("1");
+
+    return args.toArray(new String[0]);
+  }
+
+  /**
+   * Given a comma-delimited list of integers, grab and parse the first int.
+   *
+   * @param str
+   *            a comma-delimited list of values, the first of which is an
+   *            int.
+   * @return the first field in the string, cast to int
+   */
+  private int getFirstInt(String str) {
+    String[] parts = str.split(",");
+    return Integer.parseInt(parts[0]);
+  }
+
+  public void runSplitByTest(String splitByCol, int expectedSum)
+      throws IOException {
+
+    String[] columns = new String[] { "L_ORDERKEY", "L_PARTKEY",
+        "L_SUPPKEY", "L_LINENUMBER", "L_QUANTITY", "L_EXTENDEDPRICE",
+        "L_DISCOUNT", "L_TAX", "L_RETURNFLAG", "L_LINESTATUS",
+        "L_SHIPDATE", "L_COMMITDATE", "L_RECEIPTDATE",
+        "L_SHIPINSTRUCT", "L_SHIPMODE", "L_COMMENT", };
+    ClassLoader prevClassLoader = null;
+    SequenceFile.Reader reader = null;
+
+    String[] argv = getArgv(true, columns, splitByCol);
+    runImport(argv);
+    try {
+      SqoopOptions opts = new ImportTool().parseArguments(getArgv(false,
+          columns, splitByCol), null, null, true);
+
+      CompilationManager compileMgr = new CompilationManager(opts);
+      String jarFileName = compileMgr.getJarFilename();
+      LOG.debug("Got jar from import job: " + jarFileName);
+
+      prevClassLoader = ClassLoaderStack.addJarFile(jarFileName,
+          getTableName());
+
+      reader = SeqFileReader.getSeqFileReader(getDataFilePath()
+          .toString());
+
+      // here we can actually instantiate (k, v) pairs.
+      Configuration conf = new Configuration();
+      Object key = ReflectionUtils
+          .newInstance(reader.getKeyClass(), conf);
+      Object val = ReflectionUtils.newInstance(reader.getValueClass(),
+          conf);
+
+      // We know that these values are two ints separated by a ','
+      // character.
+      // Since this is all dynamic, though, we don't want to actually link
+      // against the class and use its methods. So we just parse this back
+      // into int fields manually. Sum them up and ensure that we get the
+      // expected total for the first column, to verify that we got all
+      // the
+      // results from the db into the file.
+
+      // Sum up everything in the file.
+      int curSum = 0;
+      while (reader.next(key) != null) {
+        reader.getCurrentValue(val);
+        curSum += getFirstInt(val.toString());
+      }
+      System.out.println("Sum : e,c" + expectedSum + " : " + curSum);
+      assertEquals("Total sum of first db column mismatch", expectedSum,
+          curSum);
+    } catch (InvalidOptionsException ioe) {
+      LOG.error(StringUtils.stringifyException(ioe));
+      fail(ioe.toString());
+    } catch (ParseException pe) {
+      LOG.error(StringUtils.stringifyException(pe));
+      fail(pe.toString());
+    } finally {
+      IOUtils.closeStream(reader);
+
+      if (null != prevClassLoader) {
+        ClassLoaderStack.setCurrentClassLoader(prevClassLoader);
+      }
+    }
+  }
+
+  public void testSplitByFirstCol() throws IOException {
+    String splitByCol = "L_ORDERKEY";
+    runSplitByTest(splitByCol, 10);
+  }
+
+  public void testSplitBySecondCol() throws IOException {
+    String splitByCol = "L_PARTKEY";
+    runSplitByTest(splitByCol, 10);
+  }
+
+  protected boolean useHsqldbTestServer() {
+
+    return false;
+  }
+
+  protected String getConnectString() {
+    return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+  }
+
+  protected String getTableName() {
+    return "tpch1m_lineitem";
+  }
+
+  /**
+   * Drop a table if it already exists in the database.
+   *
+   * @param table
+   *            the name of the table to drop.
+   * @throws SQLException
+   *             if something goes wrong.
+   */
+  protected void dropTableIfExists(String table) throws SQLException {
+    Connection conn = getManager().getConnection();
+    String sqlStmt = "IF OBJECT_ID('" + table
+        + "') IS NOT NULL  DROP TABLE " + table;
+    System.out.println("@abhi SQL for drop :" + sqlStmt);
+    PreparedStatement statement = conn.prepareStatement(sqlStmt,
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+    try {
+      statement.executeUpdate();
+      conn.commit();
+    } finally {
+      statement.close();
+    }
+  }
+
+  protected SqoopOptions getSqoopOptions(Configuration conf) {
+    SqoopOptions opts = new SqoopOptions(conf);
+    String username = MSSQLTestUtils.getDBUserName();
+    String password = MSSQLTestUtils.getDBPassWord();
+    opts.setUsername(username);
+    opts.setPassword(password);
+    return opts;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/src/test/org/apache/sqoop/manager/sqlserver/SQLServerWhereManualTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerWhereManualTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerWhereManualTest.java
new file mode 100644
index 0000000..9fad144
--- /dev/null
+++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerWhereManualTest.java
@@ -0,0 +1,270 @@
+/**
+ * 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.manager.sqlserver;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.io.SequenceFile;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.*;
+
+import com.cloudera.sqoop.SqoopOptions;
+import com.cloudera.sqoop.SqoopOptions.InvalidOptionsException;
+import com.cloudera.sqoop.manager.JdbcMySQLExportTest;
+import com.cloudera.sqoop.orm.CompilationManager;
+import com.cloudera.sqoop.testutil.CommonArgs;
+import com.cloudera.sqoop.testutil.ImportJobTestCase;
+import com.cloudera.sqoop.testutil.SeqFileReader;
+import com.cloudera.sqoop.tool.ImportTool;
+import com.cloudera.sqoop.util.ClassLoaderStack;
+
+/**
+ * Test that --where works in Sqoop. Methods essentially copied out of the other
+ * Test* classes.
+ */
+public class SQLServerWhereManualTest extends ImportJobTestCase {
+
+  public void setUp(){
+    super.setUp();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.createTableFromSQL(MSSQLTestUtils.CREATE_TALBE_LINEITEM);
+      utils.populateLineItem();
+    } catch (SQLException e) {
+      LOG.error("Setup fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("Setup fail with SQLException: " + e.toString());
+    }
+
+  }
+
+  public void tearDown(){
+    super.tearDown();
+    MSSQLTestUtils utils = new MSSQLTestUtils();
+    try {
+      utils.dropTableIfExists("TPCH1M_LINEITEM");
+    } catch (SQLException e) {
+      LOG.error("TearDown fail with SQLException: " + StringUtils.stringifyException(e));
+      fail("TearDown fail with SQLException: " + e.toString());
+    }
+  }
+ /**
+  * Create the argv to pass to Sqoop.
+  *
+  * @return the argv as an array of strings.
+  */
+ protected String[] getArgv(boolean includeHadoopFlags, String[] colNames,
+   String whereClause) {
+  String columnsString = "";
+  for (String col : colNames) {
+   columnsString += col + ",";
+  }
+
+  ArrayList<String> args = new ArrayList<String>();
+
+  if (includeHadoopFlags) {
+   CommonArgs.addHadoopFlags(args);
+  }
+  String username = MSSQLTestUtils.getDBUserName();
+  String password = MSSQLTestUtils.getDBPassWord();
+  args.add("--table");
+  args.add(getTableName());
+  args.add("--columns");
+  args.add(columnsString);
+  args.add("--where");
+  args.add(whereClause);
+  args.add("--split-by");
+  args.add("L_ORDERKEY");
+  args.add("--warehouse-dir");
+  args.add(getWarehouseDir());
+  args.add("--connect");
+  args.add(getConnectString());
+  args.add("--username");
+  args.add(username);
+  args.add("--password");
+  args.add(password);
+  args.add("--as-sequencefile");
+  args.add("--num-mappers");
+  args.add("1");
+
+  return args.toArray(new String[0]);
+ }
+
+ /**
+  * Given a comma-delimited list of integers, grab and parse the first int.
+  *
+  * @param str
+  *            a comma-delimited list of values, the first of which is an
+  *            int.
+  * @return the first field in the string, cast to int
+  */
+ private int getFirstInt(String str) {
+  String[] parts = str.split(",");
+  return Integer.parseInt(parts[0]);
+ }
+
+ public void runWhereTest(String whereClause, String firstValStr,
+   int numExpectedResults, int expectedSum) throws IOException {
+
+  String[] columns = MSSQLTestUtils.getColumns();
+  ClassLoader prevClassLoader = null;
+  SequenceFile.Reader reader = null;
+
+  String[] argv = getArgv(true, columns, whereClause);
+  runImport(argv);
+  try {
+   String username = MSSQLTestUtils.getDBUserName();
+   String password = MSSQLTestUtils.getDBPassWord();
+
+   SqoopOptions opts = new ImportTool().parseArguments(getArgv(false,
+     columns, whereClause), null, null, true);
+   opts.setUsername(username);
+   opts.setPassword(password);
+   CompilationManager compileMgr = new CompilationManager(opts);
+   String jarFileName = compileMgr.getJarFilename();
+
+   prevClassLoader = ClassLoaderStack.addJarFile(jarFileName,
+     getTableName());
+
+   reader = SeqFileReader.getSeqFileReader(getDataFilePath()
+     .toString());
+
+   // here we can actually instantiate (k, v) pairs.
+   Configuration conf = new Configuration();
+   Object key = ReflectionUtils
+     .newInstance(reader.getKeyClass(), conf);
+   Object val = ReflectionUtils.newInstance(reader.getValueClass(),
+     conf);
+
+   if (reader.next(key) == null) {
+    fail("Empty SequenceFile during import");
+   }
+
+   // make sure that the value we think should be at the top, is.
+   reader.getCurrentValue(val);
+   assertEquals("Invalid ordering within sorted SeqFile", firstValStr,
+     val.toString());
+
+   // We know that these values are two ints separated by a ','
+   // character.
+   // Since this is all dynamic, though, we don't want to actually link
+   // against the class and use its methods. So we just parse this back
+   // into int fields manually. Sum them up and ensure that we get the
+   // expected total for the first column, to verify that we got all
+   // the
+   // results from the db into the file.
+   int curSum = getFirstInt(val.toString());
+   int totalResults = 1;
+
+   // now sum up everything else in the file.
+   while (reader.next(key) != null) {
+    reader.getCurrentValue(val);
+    curSum += getFirstInt(val.toString());
+    totalResults++;
+   }
+
+   assertEquals("Total sum of first db column mismatch", expectedSum,
+     curSum);
+   assertEquals("Incorrect number of results for query",
+     numExpectedResults, totalResults);
+  } catch (InvalidOptionsException ioe) {
+   fail(ioe.toString());
+  } catch (ParseException pe) {
+   fail(pe.toString());
+  } finally {
+   IOUtils.closeStream(reader);
+
+   if (null != prevClassLoader) {
+    ClassLoaderStack.setCurrentClassLoader(prevClassLoader);
+   }
+  }
+ }
+
+ public void testSingleClauseWhere() throws IOException {
+  String whereClause = "L_ORDERKEY > 0 ";
+  runWhereTest(whereClause,
+    "1,2,3,4,5,6.00,7.00,8.00,AB,CD,abcd,efgh,hijk,dothis,likethis,nocomments"
+      + "\n", 4, 10);
+ }
+
+ public void testMultiClauseWhere() throws IOException {
+  String whereClause = "L_ORDERKEY > 1 AND L_PARTKEY < 4";
+  runWhereTest(whereClause,
+    "2,3,4,5,6,7.00,8.00,9.00,AB,CD,abcd,efgh,hijk,dothis,likethis,nocomments"
+      + "\n", 1, 2);
+ }
+
+ protected boolean useHsqldbTestServer() {
+
+  return false;
+ }
+
+ protected String getConnectString() {
+  return System.getProperty(
+          "sqoop.test.sqlserver.connectstring.host_url",
+          "jdbc:sqlserver://sqlserverhost:1433");
+ }
+
+ /**
+  * Drop a table if it already exists in the database.
+  *
+  * @param table
+  *            the name of the table to drop.
+  * @throws SQLException
+  *             if something goes wrong.
+  */
+ protected void dropTableIfExists(String table) throws SQLException {
+  Connection conn = getManager().getConnection();
+  String sqlStmt = "IF OBJECT_ID('" + table
+    + "') IS NOT NULL  DROP TABLE " + table;
+
+  PreparedStatement statement = conn.prepareStatement(sqlStmt,
+    ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+  try {
+   statement.executeUpdate();
+   conn.commit();
+  } finally {
+   statement.close();
+  }
+ }
+
+ protected SqoopOptions getSqoopOptions(Configuration conf) {
+  SqoopOptions opt = new SqoopOptions(conf);
+  String username = MSSQLTestUtils.getDBUserName();
+  String password = MSSQLTestUtils.getDBPassWord();
+  SqoopOptions opts = new SqoopOptions(conf);
+  opts.setUsername(username);
+  opts.setPassword(password);
+
+  return opt;
+ }
+
+ protected String getTableName() {
+  return "tpch1m_lineitem";
+ }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/testdata/DatatypeTestData-export-lite.txt
----------------------------------------------------------------------
diff --git a/testdata/DatatypeTestData-export-lite.txt b/testdata/DatatypeTestData-export-lite.txt
new file mode 100644
index 0000000..0933430
--- /dev/null
+++ b/testdata/DatatypeTestData-export-lite.txt
@@ -0,0 +1,17 @@
+BIGINT,9223372036854775807,9223372036854775807,9223372036854775807,POS
+DECIMAL,999999999999999999,999999999999999999,999999999999999999,18,0,POS
+INT,2147483647,2147483647,2147483647,POS
+MONEY,9223372036,9223372036.0000,9223372036.0000,POS
+SMALLINT,-32768,-32768,-32768,POS
+TINYINT,0,0,0,POS
+FLOAT,-2.23E-308,-2.23E-308,-2.23E-308,POS
+REAL,1000.0001,1000.0001,1000.0001,POS
+DATE,0001-01-01,0001-01-01,0001-01-01,POS
+TIME,00:00:00.0000000,00:00:00.0000000,00:00:00,POS
+CHAR,P,P,P,1,POS
+VARCHAR,P,P,P,1,POS
+NCHAR,L,L,L,1,POS
+NVARCHAR,P,P,P,1,POS
+SMALLDATETIME, 1900-01-01 23:58:58,1900-01-01 23:59:00.0,1900-01-01 23:59:00.0,POS
+DATETIME2,9999-12-31 23:59:59.90,9999-12-31 23:59:59.9000000,9999-12-31 23:59:59.9,POS
+DATETIME,9999-12-31 23:59:59.997,9999-12-31 23:59:59.997,9999-12-31 23:59:59.997,POS

http://git-wip-us.apache.org/repos/asf/sqoop/blob/64878c64/testdata/DatatypeTestData-import-lite.txt
----------------------------------------------------------------------
diff --git a/testdata/DatatypeTestData-import-lite.txt b/testdata/DatatypeTestData-import-lite.txt
new file mode 100644
index 0000000..a4b5c75
--- /dev/null
+++ b/testdata/DatatypeTestData-import-lite.txt
@@ -0,0 +1,20 @@
+BIGINT,-9223372036854775808,-9223372036854775808,-9223372036854775808,POS
+DECIMAL,1000.0001,1000.00010,1000.00010,10,5,POS
+INT,-2147483648,-2147483648,-2147483648,POS
+MONEY,92233720,92233720.0000,92233720.0000,POS
+SMALLINT,-32768,-32768,-32768,POS
+SMALLMONEY,-214748.3648,-214748.3648,-214748.3648,POS
+TINYINT,0,0,0,POS
+FLOAT,1.7976931348623157,1.7976931348623155,1.7976931348623155,POS
+REAL,3.4028234663852886,3.4028234,3.4028234,POS
+DATE,0001-01-01,0001-01-01,0001-01-01,POS
+DATETIME2,0001-01-01 00:00:00,0001-01-01 00:00:00.0000000,0001-01-01 00:00:00.0,POS
+SMALLDATETIME,1900-01-01,1900-01-01 00:00:00.0,1900-01-01 00:00:00.0,POS
+DATETIME,1753-01-01 00:00:00,1753-01-01 00:00:00.0,1753-01-01 00:00:00.0,POS
+TIME,00:00:00.0000000,00:00:00.0000000,00:00:00,POS
+CHAR,P,P,P,1,POS
+VARCHAR,P,P,P,1,POS
+NCHAR,L,L,L,1,POS
+NVARCHAR,P,P,P,1,POS
+BINARY,1,31,31,1,POS
+VARBINARY,1,31,31,100,POS
\ No newline at end of file


Mime
View raw message