gianm commented on a change in pull request #6370: Introduce SegmentId class
URL: https://github.com/apache/incubator-druid/pull/6370#discussion_r221702248
##########
File path: api/src/main/java/org/apache/druid/timeline/DataSegment.java
##########
@@ -50,41 +50,20 @@
import java.util.stream.Collectors;
/**
+ * Metadata of Druid's data segment. An immutable object.
+ *
+ * DataSegment's equality ({@link #equals}/{@link #hashCode}) and {@link
#compareTo} methods consider only the
+ * {@link SegmentId} of the segment.
*/
@PublicApi
public class DataSegment implements Comparable<DataSegment>
{
- public static String delimiter = "_";
- private final Integer binaryVersion;
- private static final Interner<String> STRING_INTERNER =
Interners.newWeakInterner();
- private static final Interner<List<String>> DIMENSIONS_INTERNER =
Interners.newWeakInterner();
- private static final Interner<List<String>> METRICS_INTERNER =
Interners.newWeakInterner();
- private static final Map<String, Object> PRUNED_LOAD_SPEC = ImmutableMap.of(
- "load spec is pruned, because it's not needed on Brokers, but eats a lot
of heap space",
- ""
- );
-
- public static String makeDataSegmentIdentifier(
- String dataSource,
- DateTime start,
- DateTime end,
- String version,
- ShardSpec shardSpec
- )
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append(dataSource).append(delimiter)
- .append(start).append(delimiter)
- .append(end).append(delimiter)
- .append(version);
-
- if (shardSpec.getPartitionNum() != 0) {
- sb.append(delimiter).append(shardSpec.getPartitionNum());
- }
-
- return sb.toString();
- }
+ /*
+ * The difference between this class and org.apache.druid.segment.Segment is
that this class contains the segment
+ * metadata only, while org.apache.druid.segment.Segment represents the
actual body of segment data, queryable.
+ *
+ * TODO explain the difference with org.apache.druid.query.SegmentDescriptor
Review comment:
My feeling is that if it's too small for an issue, then you should just
implement it as part of the original patch. In this case I think adding the
following sentence would do it.
> SegmentDescriptor is a "light" version of this class that only contains
the interval, version, and partition number. SegmentDescriptor is used when
brokers tell data servers which segments to include for a particular query.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]