@Override public void createTable(ColumnGenerator... extraColumns) throws SQLException { super.createTable(extraColumns); names = new String[extraColumns.length]; types = new String[extraColumns.length]; for (int i = 0; i < extraColumns.length; ++i) { names[i] = forIdx(i); types[i] = extraColumns[i].getType(); } createProcedure(names, types); }
@Override public void publish(Data data) { hiveTable = data.getHiveTable(); storeTable = data.getStoreTable(); storeType = data.getStoreType(); operation = data.getOperation(); } }
private SqoopOptions getSqoopOptions() { SqoopOptions options = new SqoopOptions(); options.setConnectString(metaConnectString); options.setUsername(metaUser); options.setPassword(metaPass); return options; }
protected void testExportToTableWithName(String tableName) throws IOException, SQLException { final int TOTAL_RECORDS = 10; setCurTableName(tableName); createTextFile(0, TOTAL_RECORDS, false); createTable(); runExport(getArgv(true, 10, 10)); verifyExport(TOTAL_RECORDS); }
@Override public SqoopOptions injectConnectionParameters(SqoopOptions options) { options.setUsername(PostgresqlTestUtil.DATABASE_USER); options.setPassword(PostgresqlTestUtil.PASSWORD); return options; }
public static void insertFunctiontestIntCol(int id, String msg, final int testIntCol) throws SQLException { insertFunction(id, msg, new SetExtraArgs() { @Override public void set(PreparedStatement on) throws SQLException { on.setInt(3, testIntCol); } }); }
public String getExportText(int rowNum) { int day = rowNum + 1; return "2009-10-" + pad(day); } public String getVerifyText(int rowNum) {
protected void setNumCols(int numCols) { String [] cols = new String[numCols]; for (int i = 0; i < numCols; i++) { cols[i] = "DATA_COL" + i; } setColNames(cols); }
/** * @return a new SqoopOptions customized for this particular test, but one * which has not had any arguments parsed yet. */ protected SqoopOptions getSqoopOptions(Configuration conf) { return new SqoopOptions(conf); }
/** * Return a list of arguments to import the specified table. */ private List<String> getArgListForTable(String tableName, boolean commonArgs, boolean isAppend) { return getArgListForTable(tableName, commonArgs, isAppend, false); }
/** * Do a full import verification test on a table containing one row. * @param types the types of the columns to insert * @param insertVals the SQL text to use to insert each value * @param validateLine the text to expect as a toString() of the entire row, * as imported by the tool */ private void verifyTypes(String [] types , String [] insertVals, String validateLine) { verifyTypes(types, insertVals, validateLine, null); }
private void checkData(String dataDir, List<List<Integer>> records, SqoopOptions.FileLayout fileLayout) throws Exception { for (List<Integer> record : records) { assertRecordStartsWith(record, dataDir, fileLayout); } }
@Override protected String getVarBinarySeqOutput(String asInserted) { return toLowerHexString(asInserted); } }
public static void insertFunctiontestNumericTypes(int id, String msg, final BigDecimal f, final BigDecimal d) throws SQLException { insertFunction(id, msg, new SetExtraArgs() { @Override public void set(PreparedStatement on) throws SQLException { on.setBigDecimal(3, f); on.setBigDecimal(4, d); } }); }
public String getVerifyText(int rowNum) { int day = rowNum + 1; return "2009-10-" + pad(day); } public String getType() {
public static void insertFunction(int id, String msg) throws SQLException { insertFunction(id, msg, new SetExtraArgs() { @Override public void set(PreparedStatement on) throws SQLException { } }); }
public static void insertFunctiontestBigIntCol(int id, String msg, final long testBigIntCol) throws SQLException { insertFunction(id, msg, new SetExtraArgs() { @Override public void set(PreparedStatement on) throws SQLException { on.setLong(3, testBigIntCol); } }); }
public static void insertFunctiontestDatesAndTimes(int id, String msg, final Date date, final Time time) throws SQLException { insertFunction(id, msg, new SetExtraArgs() { @Override public void set(PreparedStatement on) throws SQLException { on.setDate(3, date); on.setTime(4, time); } }); }