@Test public void testTimeBoundaryManager() { ExternalView externalView = Mockito.mock(ExternalView.class); for (TimeUnit timeUnit : TimeUnit.values()) { String rawTableName = "testTable_" + timeUnit + "_DAILY"; TableConfig tableConfig = getTableConfig(rawTableName, "DAILY"); setSchemaTimeFieldSpec(rawTableName, timeUnit); testDailyPushTable(rawTableName, tableConfig, timeUnit, externalView); rawTableName = "testTable_" + timeUnit + "_HOURLY"; tableConfig = getTableConfig(rawTableName, "HOURLY"); setSchemaTimeFieldSpec(rawTableName, timeUnit); testHourlyPushTable(rawTableName, tableConfig, timeUnit, externalView); rawTableName = "testTableDateTime_" + timeUnit + "_DAILY"; tableConfig = getTableConfig(rawTableName, "DAILY"); setSchemaDateTimeFieldSpec(rawTableName, timeUnit); testDailyPushTable(rawTableName, tableConfig, timeUnit, externalView); rawTableName = "testTableDateTime_" + timeUnit + "_HOURLY"; tableConfig = getTableConfig(rawTableName, "HOURLY"); setSchemaDateTimeFieldSpec(rawTableName, timeUnit); testHourlyPushTable(rawTableName, tableConfig, timeUnit, externalView); } }
public TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { Preconditions.checkState(tableConfig.getTableType() == TableType.OFFLINE, "Cannot construct TimeBoundaryManager for real-time table: %s", tableConfig.getTableName()); _offlineTableName = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_offlineTableName) + "/"; Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _offlineTableName); Preconditions.checkState(schema != null, "Failed to find schema for table: %s", _offlineTableName); _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _offlineTableName); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _offlineTableName); DateTimeFormatSpec formatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); _timeUnit = formatSpec.getColumnUnit(); Preconditions .checkNotNull(_timeUnit, "Time unit must be configured in the field spec for time column: %s of table: %s", _timeColumn, _offlineTableName); _isHourlyTable = CommonConstants.Table.PUSH_FREQUENCY_HOURLY.equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentPushFrequency()) && _timeUnit != TimeUnit.DAYS; LOGGER.info("Constructed TimeBoundaryManager with timeColumn: {}, timeUnit: {}, isHourlyTable: {} for table: {}", _timeColumn, _timeUnit, _isHourlyTable, _offlineTableName); }
TimeBoundaryManager { public TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { Preconditions.checkState(tableConfig.getTableType() == TableType.OFFLINE, "Cannot construct TimeBoundaryManager for real-time table: %s", tableConfig.getTableName()); _offlineTableName = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_offlineTableName) + "/"; Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _offlineTableName); Preconditions.checkState(schema != null, "Failed to find schema for table: %s", _offlineTableName); _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _offlineTableName); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _offlineTableName); DateTimeFormatSpec formatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); _timeUnit = formatSpec.getColumnUnit(); Preconditions .checkNotNull(_timeUnit, "Time unit must be configured in the field spec for time column: %s of table: %s", _timeColumn, _offlineTableName); _isHourlyTable = CommonConstants.Table.PUSH_FREQUENCY_HOURLY.equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentPushFrequency()) && _timeUnit != TimeUnit.DAYS; LOGGER.info("Constructed TimeBoundaryManager with timeColumn: {}, timeUnit: {}, isHourlyTable: {} for table: {}", _timeColumn, _timeUnit, _isHourlyTable, _offlineTableName); } }
TimeBoundaryManager { public TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { Preconditions.checkState(tableConfig.getTableType() == TableType.OFFLINE, "Cannot construct TimeBoundaryManager for real-time table: %s", tableConfig.getTableName()); _offlineTableName = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_offlineTableName) + "/"; Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _offlineTableName); Preconditions.checkState(schema != null, "Failed to find schema for table: %s", _offlineTableName); _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _offlineTableName); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _offlineTableName); DateTimeFormatSpec formatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); _timeUnit = formatSpec.getColumnUnit(); Preconditions .checkNotNull(_timeUnit, "Time unit must be configured in the field spec for time column: %s of table: %s", _timeColumn, _offlineTableName); _isHourlyTable = CommonConstants.Table.PUSH_FREQUENCY_HOURLY.equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentPushFrequency()) && _timeUnit != TimeUnit.DAYS; LOGGER.info("Constructed TimeBoundaryManager with timeColumn: {}, timeUnit: {}, isHourlyTable: {} for table: {}", _timeColumn, _timeUnit, _isHourlyTable, _offlineTableName); } TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore); }
TimeBoundaryManager { public TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { Preconditions.checkState(tableConfig.getTableType() == TableType.OFFLINE, "Cannot construct TimeBoundaryManager for real-time table: %s", tableConfig.getTableName()); _offlineTableName = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_offlineTableName) + "/"; Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _offlineTableName); Preconditions.checkState(schema != null, "Failed to find schema for table: %s", _offlineTableName); _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _offlineTableName); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _offlineTableName); DateTimeFormatSpec formatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); _timeUnit = formatSpec.getColumnUnit(); Preconditions .checkNotNull(_timeUnit, "Time unit must be configured in the field spec for time column: %s of table: %s", _timeColumn, _offlineTableName); _isHourlyTable = CommonConstants.Table.PUSH_FREQUENCY_HOURLY.equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentPushFrequency()) && _timeUnit != TimeUnit.DAYS; LOGGER.info("Constructed TimeBoundaryManager with timeColumn: {}, timeUnit: {}, isHourlyTable: {} for table: {}", _timeColumn, _timeUnit, _isHourlyTable, _offlineTableName); } TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore); @SuppressWarnings("unused") void init(ExternalView externalView, Set<String> onlineSegments); @SuppressWarnings("unused") synchronized void onExternalViewChange(ExternalView externalView, Set<String> onlineSegments); synchronized void refreshSegment(String segment); @Nullable TimeBoundaryInfo getTimeBoundaryInfo(); }
TimeBoundaryManager { public TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { Preconditions.checkState(tableConfig.getTableType() == TableType.OFFLINE, "Cannot construct TimeBoundaryManager for real-time table: %s", tableConfig.getTableName()); _offlineTableName = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_offlineTableName) + "/"; Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _offlineTableName); Preconditions.checkState(schema != null, "Failed to find schema for table: %s", _offlineTableName); _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _offlineTableName); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _offlineTableName); DateTimeFormatSpec formatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); _timeUnit = formatSpec.getColumnUnit(); Preconditions .checkNotNull(_timeUnit, "Time unit must be configured in the field spec for time column: %s of table: %s", _timeColumn, _offlineTableName); _isHourlyTable = CommonConstants.Table.PUSH_FREQUENCY_HOURLY.equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentPushFrequency()) && _timeUnit != TimeUnit.DAYS; LOGGER.info("Constructed TimeBoundaryManager with timeColumn: {}, timeUnit: {}, isHourlyTable: {} for table: {}", _timeColumn, _timeUnit, _isHourlyTable, _offlineTableName); } TimeBoundaryManager(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore); @SuppressWarnings("unused") void init(ExternalView externalView, Set<String> onlineSegments); @SuppressWarnings("unused") synchronized void onExternalViewChange(ExternalView externalView, Set<String> onlineSegments); synchronized void refreshSegment(String segment); @Nullable TimeBoundaryInfo getTimeBoundaryInfo();  }