5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-03 04:11:44 +08:00

sqoop merge tool composite merge-key

This commit is contained in:
KaimingChen 2016-08-22 22:34:45 +08:00
parent b9794f98e3
commit cd1e840c8d

View File

@ -74,7 +74,17 @@ protected void processRecord(SqoopRecord r, Context c)
if (null == fieldMap) {
throw new IOException("No field map in record " + r);
}
Object keyObj = fieldMap.get(keyColName);
Object keyObj = null;
if (keyColName.contains(",")) {
StringBuilder keyFieldsSb = new StringBuilder();
for (String str : keyColName.split(",")) {
keyFieldsSb.append("+").append(fieldMap.get(str).toString());
}
keyObj = keyFieldsSb;
} else {
keyObj = fieldMap.get(keyColName);
}
if (null == keyObj) {
throw new IOException("Cannot join values on null key. "
+ "Did you specify a key column that exists?");