You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2021/11/15 19:52:00 UTC

[pinot] branch master updated: Add timeColumn, timeUnit and totalDocs to the json segment metadata (#7765)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new d547920  Add timeColumn, timeUnit and totalDocs to the json segment metadata (#7765)
d547920 is described below

commit d54792046dd76e16bf8c1ffcf732efdec3f754e2
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Mon Nov 15 11:51:46 2021 -0800

    Add timeColumn, timeUnit and totalDocs to the json segment metadata (#7765)
---
 .../pinot/segment/local/segment/index/SegmentMetadataImplTest.java     | 3 +++
 .../apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/SegmentMetadataImplTest.java b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/SegmentMetadataImplTest.java
index fee0293..a925350 100644
--- a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/SegmentMetadataImplTest.java
+++ b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/SegmentMetadataImplTest.java
@@ -84,8 +84,11 @@ public class SegmentMetadataImplTest {
     Assert.assertEquals(jsonMeta.get("crc").asLong(), Long.valueOf(metadata.getCrc()).longValue());
     Assert.assertTrue(jsonMeta.get("creatorName").isNull());
     assertEquals(jsonMeta.get("creationTimeMillis").asLong(), metadata.getIndexCreationTime());
+    assertEquals(jsonMeta.get("timeColumn").asText(), metadata.getTimeColumn());
+    assertEquals(jsonMeta.get("timeUnit").asText(), metadata.getTimeUnit().name());
     assertEquals(jsonMeta.get("startTimeMillis").asLong(), metadata.getTimeInterval().getStartMillis());
     assertEquals(jsonMeta.get("endTimeMillis").asLong(), metadata.getTimeInterval().getEndMillis());
+    assertEquals(jsonMeta.get("totalDocs").asInt(), metadata.getTotalDocs());
     assertEquals(jsonMeta.get("custom").get("k1").asText(), metadata.getCustomMap().get("k1"));
     assertEquals(jsonMeta.get("custom").get("k2").asText(), metadata.getCustomMap().get("k2"));
 
diff --git a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java
index bd66a92..f0847ab 100644
--- a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java
+++ b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java
@@ -387,6 +387,8 @@ public class SegmentMetadataImpl implements SegmentMetadata {
     dateFormat.setTimeZone(timeZone);
     String creationTimeStr = _creationTime != Long.MIN_VALUE ? dateFormat.format(new Date(_creationTime)) : null;
     segmentMetadata.put("creationTimeReadable", creationTimeStr);
+    segmentMetadata.put("timeColumn", _timeColumn);
+    segmentMetadata.put("timeUnit", _timeUnit != null ? _timeUnit.name() : null);
     segmentMetadata.put("timeGranularitySec", _timeGranularity != null ? _timeGranularity.getStandardSeconds() : null);
     if (_timeInterval == null) {
       segmentMetadata.set("startTimeMillis", null);
@@ -402,6 +404,7 @@ public class SegmentMetadataImpl implements SegmentMetadata {
 
     segmentMetadata.put("segmentVersion", ((_segmentVersion != null) ? _segmentVersion.toString() : null));
     segmentMetadata.put("creatorName", _creatorName);
+    segmentMetadata.put("totalDocs", _totalDocs);
 
     ObjectNode customConfigs = JsonUtils.newObjectNode();
     for (String key : _customMap.keySet()) {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org