Non-table segment should return null for getId#17960
Conversation
kfaraz
left a comment
There was a problem hiding this comment.
The new approach is certainly much cleaner than passing around a bunch of SegmentId.dummy() objects.
I just wonder if there was any advantage to keeping a segment ID for these cases.
But from the patch, it looks like the dummy segment ID didn't serve any purpose anyway. So I think we should be good.
Left some suggestions on the changes.
| ((ExternalSegment) segment).externalInputSource().toString() | ||
| ); | ||
| } else if (segment instanceof LookupSegment) { | ||
| return StringUtils.format("lookup input source: %s", segment.getId().getDataSource()); |
There was a problem hiding this comment.
Should we still return this string without the segment id?
| .build(); | ||
|
|
||
| public LookupSegment(final String lookupName, final LookupExtractorFactory lookupExtractorFactory) | ||
| public LookupSegment(final LookupExtractorFactory lookupExtractorFactory) |
There was a problem hiding this comment.
We should probably keep the lookup name argument and use it in asString method of this class.
There was a problem hiding this comment.
updated to keep lookupName and return it in asString
| /** | ||
| * A test segment that is backed by a {@link RowBasedSegment}. This is used to test the {@link QueryableIndexSegment}. | ||
| */ | ||
| public static class InMemoryFakeSegment extends QueryableIndexSegment |
There was a problem hiding this comment.
| public static class InMemoryFakeSegment extends QueryableIndexSegment | |
| public static class InMemoryTestSegment extends QueryableIndexSegment |
@cecemei , another more obvious way to achieve this would be to simply add a new boolean method |
Co-authored-by: Kashif Faraz <kashif.faraz@gmail.com>
…ntingSegment.java Co-authored-by: Kashif Faraz <kashif.faraz@gmail.com>
We discussed that briefly, it would work but felt a bit unnecessary to just add a method for that. We've also considered using |
…egment.java Co-authored-by: Kashif Faraz <kashif.faraz@gmail.com>
Update
Segment.getId()with@Nullableannotation.RowBasedSegment(used by external/lookup/inline segment) andFrameSegmentreturns null forgetId(). Only segment backed by a table should have aSegmentId.Besides that,
InMemoryFakeSegmentclass inTestSegmentUtilsfor easier testing.This PR is a follow-up to #17774 (review).
Key changed/added classes in this PR
SegmentArrayListSegmentFrameSegmentThis PR has: