Skip to content

Commit

Permalink
SQOOP-3194: HCatalogExportTest fails because of column escaping problems
Browse files Browse the repository at this point in the history
(Szabolcs Vasas via Anna Szonyi)
  • Loading branch information
commanderofthegrey committed Jun 20, 2017
1 parent 66ce74a commit af277ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/test/org/apache/sqoop/hcat/HCatalogExportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ protected void assertColMinAndMax(String colName, ColumnGenerator generator)
Object expectedMin = generator.getDBValue(minId);
Object expectedMax = generator.getDBValue(maxId);

utils.assertSqlColValForRowId(conn, table, minId, colName, true, expectedMin);
utils.assertSqlColValForRowId(conn, table, maxId, colName, true, expectedMax);
utils.assertSqlColValForRowId(conn, table, minId, colName, false, expectedMin);
utils.assertSqlColValForRowId(conn, table, maxId, colName, false, expectedMax);
}

protected void runHCatExport(List<String> addlArgsArray,
final int totalRecords, String table,
ColumnGenerator[] cols) throws Exception {
utils.createHCatTable(CreateMode.CREATE_AND_LOAD,
totalRecords, table, cols);
utils.createSqlTable(getConnection(), true, totalRecords, table, true, cols);
utils.createSqlTable(getConnection(), true, totalRecords, table, false, cols);
Map<String, String> addlArgsMap = utils.getAddlTestArgs();
addlArgsArray.add("--verbose");
addlArgsArray.add("-m");
Expand Down Expand Up @@ -338,7 +338,7 @@ public void testColumnProjection() throws Exception {
};
List<String> addlArgsArray = new ArrayList<String>();
addlArgsArray.add("--columns");
addlArgsArray.add("id,msg");
addlArgsArray.add("ID,MSG");
runHCatExport(addlArgsArray, TOTAL_RECORDS, table, cols);

}
Expand Down
2 changes: 1 addition & 1 deletion src/test/org/apache/sqoop/hcat/HCatalogTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ public void assertSqlColValForRowId(Connection conn,
LOG.info("Verifying column " + colName + " has value " + expectedVal);
String escapeStr = escapeId? "\"" : "";
PreparedStatement statement = conn.prepareStatement(
"SELECT "+escapeStr + colName + escapeStr+" FROM " + table + " WHERE "+escapeStr+"id"+escapeStr+" = " + id,
"SELECT \"" + colName +"\" FROM " + table + " WHERE "+escapeStr+"id"+escapeStr+" = " + id,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
Object actualVal = null;
try {
Expand Down

0 comments on commit af277ae

Please sign in to comment.