Package com.cloudera.sqoop.tool

Examples of com.cloudera.sqoop.tool.ImportTool


    String [] extraArgs = {
      "--fields-terminated-by", ",",
      "--lines-terminated-by", "|",
    };
    runImportTest(TABLE_NAME, types, vals, "customDelimImport.q",
        getArgv(false, extraArgs), new ImportTool());
  }
View Full Code Here


    String[] vals = { "'test with \n new lines \n'", "42",
        "'oh no " + '\01' + " field delims " + '\01' + "'", };
    String[] moreArgs = { "--"+ BaseSqoopTool.HIVE_DROP_DELIMS_ARG };

    runImportTest(TABLE_NAME, types, vals, "fieldWithNewlineImport.q",
        getArgv(false, moreArgs), new ImportTool());

    LOG.info("Validating data in single row is present in: "
          + "FIELD_WITH_NL_HIVE_IMPORT table");

    // Ideally, we would actually invoke hive code to verify that record with
View Full Code Here

        "'oh no " + '\01' + " field delims " + '\01' + "'", };
    String[] moreArgs = { "--"+BaseSqoopTool.HIVE_DELIMS_REPLACEMENT_ARG, " "};

    runImportTest(TABLE_NAME, types, vals,
        "fieldWithNewlineReplacementImport.q", getArgv(false, moreArgs),
        new ImportTool());

    LOG.info("Validating data in single row is present in: "
          + "FIELD_WITH_NL_REPLACEMENT_HIVE_IMPORT table");

    // Ideally, we would actually invoke hive code to verify that record with
View Full Code Here

    setNumCols(3);
    String[] moreArgs = { "--"+BaseSqoopTool.HIVE_DELIMS_REPLACEMENT_ARG, " ",
      "--"+BaseSqoopTool.HIVE_DROP_DELIMS_ARG, };

    ImportTool tool = new ImportTool();
    try {
      tool.validateOptions(tool.parseArguments(getArgv(false, moreArgs), null,
          null, true));
      fail("Expected InvalidOptionsException");
    } catch (InvalidOptionsException ex) {
      /* success */
    }
View Full Code Here

    String[] vals = { "'whoop'", "42", "'I am a row in a partition'", };
    String[] moreArgs = { "--" + BaseSqoopTool.HIVE_PARTITION_KEY_ARG, "ds",
        "--" + BaseSqoopTool.HIVE_PARTITION_VALUE_ARG, "20110413", };

    runImportTest(TABLE_NAME, types, vals, "partitionImport.q",
        getArgv(false, moreArgs), new ImportTool());
  }
View Full Code Here

    };

    // Test hive-import with the 1st args.
    try {
      runImportTest(TABLE_NAME, types, vals, "partitionImport.q",
          getArgv(false, moreArgs1), new ImportTool());
      fail(TABLE_NAME + " test should have thrown IOException");
    } catch (IOException ioe) {
      // expected; ok.
    }

    // Test hive-import with the 2nd args.
    try {
      runImportTest(TABLE_NAME, types, vals, "partitionImport.q",
          getArgv(false, moreArgs2), new ImportTool());
      fail(TABLE_NAME + " test should have thrown IOException");
    } catch (IOException ioe) {
      // expected; ok.
    }
View Full Code Here

  private static ExportTool exportTool;

  @Before
  @Override
  public void setUp() {
    importTool = new ImportTool();
    exportTool = new ExportTool();
  }
View Full Code Here

  private File runGenerationTest(String [] argv, String classNameToCheck) {
    File codeGenDirFile = new File(CODE_GEN_DIR);
    File classGenDirFile = new File(JAR_GEN_DIR);

    try {
      options = new ImportTool().parseArguments(argv,
          null, options, true);
    } catch (Exception e) {
      LOG.error("Could not parse options: " + e.toString());
    }
View Full Code Here

    SequenceFile.Reader reader = null;

    String [] argv = getArgv(true, columns, codec, "--as-sequencefile");
    runImport(argv);
    try {
      SqoopOptions opts = new ImportTool().parseArguments(
          getArgv(false, columns, codec, "--as-sequencefile"),
          null, null, true);

      CompilationManager compileMgr = new CompilationManager(opts);
      String jarFileName = compileMgr.getJarFilename();
View Full Code Here

    SequenceFile.Reader reader = null;

    String [] argv = getArgv(true, tableImport, query, targetDir, extraArgs);
    runImport(argv);
    try {
      SqoopOptions opts = new ImportTool().parseArguments(
          getArgv(false, tableImport, query, targetDir, extraArgs),
          null, null, true);

      CompilationManager compileMgr = new CompilationManager(opts);
      String jarFileName = compileMgr.getJarFilename();
View Full Code Here

TOP

Related Classes of com.cloudera.sqoop.tool.ImportTool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.