use of com.thinkbiganalytics.util.PartitionBatch in project kylo by Teradata.
the class TableMergeSyncSupport method toPartitionBatches.
/*
Generates batches of partitions in the source table
*/
protected List<PartitionBatch> toPartitionBatches(PartitionSpec spec, ResultSet rs) throws SQLException {
Vector<PartitionBatch> v = new Vector<>();
int count = rs.getMetaData().getColumnCount();
while (rs.next()) {
String[] values = new String[count];
for (int i = 1; i <= count; i++) {
Object oVal = rs.getObject(i);
String sVal = (oVal == null ? "" : oVal.toString());
values[i - 1] = StringUtils.defaultString(sVal, "");
}
Long numRecords = rs.getLong(count);
v.add(new PartitionBatch(numRecords, spec, values));
}
logger.info("Number of partitions [" + v.size() + "]");
return v;
}
Aggregations