Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

/**
Expand Down Expand Up @@ -893,11 +892,12 @@ private void handlePendingFilesForPreviousCheckpoints(Map<Long, List<String>> pe

LOG.debug("Moving pending files to final location on restore.");

Set<Long> pastCheckpointIds = pendingFilesPerCheckpoint.keySet();
for (Long pastCheckpointId : pastCheckpointIds) {
for (Map.Entry<Long, List<String>> entry : pendingFilesPerCheckpoint.entrySet()) {
Long pastCheckpointId = entry.getKey();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kurt, thanks for reviewing. I add back the original comments as you suggested.

List<String> pendingFiles = entry.getValue();
// All the pending files are buckets that have been completed but are waiting to be renamed
// to their final name
for (String filename : pendingFilesPerCheckpoint.get(pastCheckpointId)) {
for (String filename : pendingFiles) {
Path finalPath = new Path(filename);
Path pendingPath = getPendingPathFor(finalPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,21 @@ private void convert(Map<String, Object> map, Row row, TypeInformation<?>[] fiel
private void convert(Map<String, Object> target, Map<String, Object> source, MapTypeInfo mapTypeInfo) {
TypeInformation valueTypeInfp = mapTypeInfo.getValueTypeInfo();

for (String key : source.keySet()) {
for (Map.Entry<String, Object> entry : source.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (valueTypeInfp instanceof RowTypeInfo) {
Map<String, Object> nestedRow = new HashMap<>();
convert(nestedRow, (Row) source.get(key),
convert(nestedRow, (Row) value,
((RowTypeInfo) valueTypeInfp).getFieldTypes(), ((RowTypeInfo) valueTypeInfp).getFieldNames());
target.put(key, nestedRow);
} else if (valueTypeInfp instanceof MapTypeInfo) {
Map<String, Object> nestedMap = new HashMap<>();
convert(nestedMap, (Map<String, Object>) source.get(key), (MapTypeInfo) valueTypeInfp);
convert(nestedMap, (Map<String, Object>) value, (MapTypeInfo) valueTypeInfp);
target.put(key, nestedMap);
} else if (valueTypeInfp instanceof ObjectArrayTypeInfo) {
List<Object> nestedObjectList = new ArrayList<>();
convert(nestedObjectList, (Object[]) source.get(key), (ObjectArrayTypeInfo) valueTypeInfp);
convert(nestedObjectList, (Object[]) value, (ObjectArrayTypeInfo) valueTypeInfp);
target.put(key, nestedObjectList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ public void updateVertex(Vertex<K, Tuple2<Long, Double>> vertex,
// find the label with the highest score from the ones received
double maxScore = -Double.MAX_VALUE;
long maxScoreLabel = vertex.getValue().f0;
for (long curLabel : receivedLabelsWithScores.keySet()) {
for (Map.Entry<Long, Double> entry : receivedLabelsWithScores.entrySet()) {
long curLabel = entry.getKey();
double curValue = entry.getValue();

if (receivedLabelsWithScores.get(curLabel) > maxScore) {
maxScore = receivedLabelsWithScores.get(curLabel);
if (curValue > maxScore) {
maxScore = curValue;
maxScoreLabel = curLabel;
}
}
Expand Down