use of org.apache.flink.runtime.operators.testutils.Match in project flink by apache.
the class ReusingSortMergeInnerJoinIteratorITCase method matchValues.
// --------------------------------------------------------------------------------------------
// Utilities
// --------------------------------------------------------------------------------------------
private Map<Integer, Collection<Match>> matchValues(Map<Integer, Collection<String>> leftMap, Map<Integer, Collection<String>> rightMap) {
Map<Integer, Collection<Match>> map = new HashMap<Integer, Collection<Match>>();
for (Integer key : leftMap.keySet()) {
Collection<String> leftValues = leftMap.get(key);
Collection<String> rightValues = rightMap.get(key);
if (rightValues == null) {
continue;
}
if (!map.containsKey(key)) {
map.put(key, new ArrayList<Match>());
}
Collection<Match> matchedValues = map.get(key);
for (String leftValue : leftValues) {
for (String rightValue : rightValues) {
matchedValues.add(new Match(leftValue, rightValue));
}
}
}
return map;
}
use of org.apache.flink.runtime.operators.testutils.Match in project flink by apache.
the class NonReusingSortMergeInnerJoinIteratorITCase method matchValues.
// --------------------------------------------------------------------------------------------
// Utilities
// --------------------------------------------------------------------------------------------
private Map<Integer, Collection<Match>> matchValues(Map<Integer, Collection<String>> leftMap, Map<Integer, Collection<String>> rightMap) {
Map<Integer, Collection<Match>> map = new HashMap<Integer, Collection<Match>>();
for (Integer key : leftMap.keySet()) {
Collection<String> leftValues = leftMap.get(key);
Collection<String> rightValues = rightMap.get(key);
if (rightValues == null) {
continue;
}
if (!map.containsKey(key)) {
map.put(key, new ArrayList<Match>());
}
Collection<Match> matchedValues = map.get(key);
for (String leftValue : leftValues) {
for (String rightValue : rightValues) {
matchedValues.add(new Match(leftValue, rightValue));
}
}
}
return map;
}
use of org.apache.flink.runtime.operators.testutils.Match in project flink by apache.
the class AbstractSortMergeOuterJoinIteratorITCase method joinValues.
// --------------------------------------------------------------------------------------------
// Utilities
// --------------------------------------------------------------------------------------------
private Map<Integer, Collection<Match>> joinValues(Map<Integer, Collection<String>> leftMap, Map<Integer, Collection<String>> rightMap, OuterJoinType outerJoinType) {
Map<Integer, Collection<Match>> map = new HashMap<>();
for (Integer key : leftMap.keySet()) {
Collection<String> leftValues = leftMap.get(key);
Collection<String> rightValues = rightMap.get(key);
if (outerJoinType == OuterJoinType.RIGHT && rightValues == null) {
continue;
}
if (!map.containsKey(key)) {
map.put(key, new ArrayList<Match>());
}
Collection<Match> joinedValues = map.get(key);
for (String leftValue : leftValues) {
if (rightValues != null) {
for (String rightValue : rightValues) {
joinedValues.add(new Match(leftValue, rightValue));
}
} else {
joinedValues.add(new Match(leftValue, null));
}
}
}
if (outerJoinType == OuterJoinType.RIGHT || outerJoinType == OuterJoinType.FULL) {
for (Integer key : rightMap.keySet()) {
Collection<String> leftValues = leftMap.get(key);
Collection<String> rightValues = rightMap.get(key);
if (leftValues != null) {
continue;
}
if (!map.containsKey(key)) {
map.put(key, new ArrayList<Match>());
}
Collection<Match> joinedValues = map.get(key);
for (String rightValue : rightValues) {
joinedValues.add(new Match(null, rightValue));
}
}
}
return map;
}
Aggregations