Jackie-Jiang commented on code in PR #12886:
URL: https://github.com/apache/pinot/pull/12886#discussion_r1577046142
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java:
##########
@@ -428,17 +570,25 @@ public ExecutorService getSegmentPreloadExecutor() {
@Override
public void addSegmentError(String segmentName, SegmentErrorInfo
segmentErrorInfo) {
- _errorCache.put(Pair.of(_tableNameWithType, segmentName),
segmentErrorInfo);
+ if (_errorCache != null) {
+ _errorCache.put(Pair.of(_tableNameWithType, segmentName),
segmentErrorInfo);
+ }
}
@Override
public Map<String, SegmentErrorInfo> getSegmentErrors() {
- if (_errorCache == null) {
- return Collections.emptyMap();
+ if (_errorCache != null) {
+ // Filter out entries that match the table name
+ Map<String, SegmentErrorInfo> segmentErrors = new HashMap<>();
+ for (Map.Entry<Pair<String, String>, SegmentErrorInfo> entry :
_errorCache.asMap().entrySet()) {
+ Pair<String, String> tableSegmentPair = entry.getKey();
+ if (tableSegmentPair.getLeft().equals(_tableNameWithType)) {
+ segmentErrors.put(tableSegmentPair.getRight(), entry.getValue());
+ }
+ }
+ return segmentErrors;
} else {
- // Filter out entries that match the table name.
- return _errorCache.asMap().entrySet().stream().filter(map ->
map.getKey().getLeft().equals(_tableNameWithType))
- .collect(Collectors.toMap(map -> map.getKey().getRight(),
Map.Entry::getValue));
+ return Map.of();
Review Comment:
Since `1.0` release, we have officially dropped the support for java 8, and
we can use the more concise APIs introduced since java 9, such as `List.of()`,
`Map.of()` etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]