Refactor: Rename UsedSegmentChecker and cleanup task actions#16644
Refactor: Rename UsedSegmentChecker and cleanup task actions#16644kfaraz merged 11 commits intoapache:masterfrom
Conversation
| theIntervals = ImmutableList.of(interval); | ||
| } else if (intervals != null && intervals.size() > 0) { | ||
| theIntervals = JodaUtils.condenseIntervals(intervals); | ||
| if (intervals == null || intervals.isEmpty()) { |
There was a problem hiding this comment.
Nit: Use CollectionUtils.isNullOrEmpty
| null | ||
| ); | ||
| final SegmentTransactionalInsertAction action = SegmentTransactionalInsertAction | ||
| .overwriteAction(null, ImmutableSet.of(SEGMENT3), null); |
There was a problem hiding this comment.
Is there a style guide for this in Druid?
If not, I think that formatting can be subjective in the sense that a few people may prefer the previous code. (Not a strong opinion)
There was a problem hiding this comment.
Fair point. I don't recall why I had made this change. Let me revert this with any other change that is required.
There was a problem hiding this comment.
By the way, in terms of style guide, this is what I try to follow:
druid/codestyle/checkstyle.xml
Lines 252 to 296 in f1043d2
Line 285 says:
2) In a variable, field or constant assignment, it's often more readable to break the
whole right hand side expression to the next line, instead of breaking the expression
I also wrote something up here
#16563 (comment)
|
Thanks for the review, @AmatyaAvadhanula ! |
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) |
There was a problem hiding this comment.
Any specific reason to clean equals and hashcode ?
There was a problem hiding this comment.
Instances of this class are never compared for equality.
There was a problem hiding this comment.
I generally feel that is okay to have this since future developers might use this object in a map or some equality and then that's a bug.
There was a problem hiding this comment.
I would agree if this was a POJO that was sent over the wire or even passed between classes. But this is meant only for the internal use of IndexerSqlMetadataStorageCoordinator and is exposed only for testing.
Better to have someone add it when they actually need it. Also, if someone is using this in a set or as the key of a map, they are doing something very wrong in the first place anyway.
The only real usage of equality for this class would be in tests but since that is not happening, the equals/hashCode methods were redundant.
| * the given interval and are marked as used. | ||
| */ | ||
| default Collection<DataSegment> retrieveUsedSegmentsForInterval( | ||
| default Set<DataSegment> retrieveUsedSegmentsForInterval( |
There was a problem hiding this comment.
We have essentially changed a long standing interface.
This might break custom extensions. Should we call this out in dev notes ?
There was a problem hiding this comment.
I don't really feel so, because this interface is not exposed as an @ExtensionPoint or @PublicApi and extensions are not expected to implement this interface.
Follow up to #16614
Changes
UsedSegmentCheckertoPublishedSegmentsRetrieverIntervalargument fromRetrieveUsedSegmentsActionas it is now unused and has been deprecated since support multiple intervals in dataSource inputSpec #1988
Setof segments instead of aCollectionfromIndexerMetadataStorageCoordinator.retrieveUsedSegments()