use of org.talend.spark.utils.CompareCol in project tdi-studio-se by Talend.
the class KeyByCompareColFunction method call.
public Tuple2<List<Object>, List<Object>> call(List<Object> d) {
List<Object> key = new ArrayList<Object>(compCols.size());
for (int i = 0; i < compCols.size(); i++) {
key.add(i, d.get(compCols.get(i).getColId()));
}
List<Object> values = new ArrayList<Object>(d.size());
int valId = 0;
for (Integer i = 0; i < d.size(); i++) {
boolean contain = false;
for (CompareCol compCol : compCols) {
if (compCol.getColId().equals(i)) {
contain = true;
break;
}
}
if (!contain) {
values.add(valId, d.get(i));
valId++;
}
}
return new Tuple2<List<Object>, List<Object>>(key, values);
}
Aggregations