Jackie-Jiang commented on a change in pull request #3821: Refactor
SegmentNameGenerators and integrate them into Hadoop
URL: https://github.com/apache/incubator-pinot/pull/3821#discussion_r256648306
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/segment/name/NormalizedDateSegmentNameGenerator.java
##########
@@ -18,147 +18,115 @@
*/
package org.apache.pinot.core.segment.name;
-import com.google.common.base.Joiner;
+import com.google.common.base.Preconditions;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.Arrays;
import java.util.Date;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
-import org.apache.pinot.common.data.TimeGranularitySpec;
-import org.apache.pinot.core.segment.creator.ColumnStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import javax.annotation.Nullable;
+import org.apache.pinot.common.data.TimeGranularitySpec.TimeFormat;
/**
* Segment name generator that normalizes the date to human readable format.
*/
public class NormalizedDateSegmentNameGenerator implements
SegmentNameGenerator {
- private static final Logger LOGGER =
LoggerFactory.getLogger(NormalizedDateSegmentNameGenerator.class);
-
- private final String _tableName;
- private final int _sequenceId;
- private final String _timeColumnType;
- private final String _tablePushFrequency;
- private final String _tablePushType;
private final String _segmentNamePrefix;
- private final String _segmentExcludeSequenceId;
- private final String _schemaTimeFormat;
+ private final boolean _appendPushType;
+ private final boolean _excludeSequenceId;
- public NormalizedDateSegmentNameGenerator(String tableName, int sequenceId,
String timeColumnType,
- String tablePushFrequency, String tablePushType, String
segmentNamePrefix, String segmentExcludeSequenceId,
- String schemaTimeFormat) {
- _tableName = tableName;
- _sequenceId = sequenceId;
- _timeColumnType = timeColumnType;
- _tablePushFrequency = tablePushFrequency;
- _tablePushType = tablePushType;
- _segmentNamePrefix = segmentNamePrefix;
- _segmentExcludeSequenceId = segmentExcludeSequenceId;
- _schemaTimeFormat = schemaTimeFormat;
- }
+ // For APPEND tables
+ private final SimpleDateFormat _outputSDF;
+ // For EPOCH time format
+ private final TimeUnit _inputTimeUnit;
+ // For SIMPLE_DATE_FORMAT time format
+ private final SimpleDateFormat _inputSDF;
- @Override
- public String generateSegmentName(ColumnStatistics statsCollector)
- throws Exception {
- long minTimeValue =
Long.parseLong(statsCollector.getMinValue().toString());
- long maxTimeValue =
Long.parseLong(statsCollector.getMaxValue().toString());
- String segmentName = generateSegmentName(minTimeValue, maxTimeValue);
- LOGGER.info("Segment name is: " + segmentName + " for table name: " +
_tableName);
- return segmentName;
- }
+ public NormalizedDateSegmentNameGenerator(String tableName, @Nullable String
segmentNamePrefix,
Review comment:
The caller will log the detailed info with `toString()` if necessary.
----------------------------------------------------------------
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]