@Test public void validateTierConfigs() { Schema schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, FieldSpec.DataType.LONG, "1:MILLISECONDS:EPOCH", "1:MILLISECONDS").build(); TableConfig tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(null).build(); TableConfigUtils.validate(tableConfig, schema); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Collections.emptyList()) .build(); TableConfigUtils.validate(tableConfig, schema); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"))).build(); TableConfigUtils.validate(tableConfig, schema); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE.toLowerCase(), "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE.toLowerCase(), "tier2_tag_OFFLINE"))).build(); TableConfigUtils.validate(tableConfig, schema); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN) .setTierConfigList(Lists.newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE.toLowerCase(), "tier1_tag_OFFLINE"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE.toLowerCase(), "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); TableConfigUtils.validate(tableConfig, schema); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList( new TierConfig("", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to empty tier name"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("sameTierName", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"), new TierConfig("sameTierName", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "100d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to duplicate tier name"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"), new TierConfig("tier2", "unsupportedSegmentSelector", "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to invalid segmentSelectorType"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList( new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, null, TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to missing segmentAge"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "3600", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to invalid segment age"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", "unsupportedStorageType", "tier1_tag_OFFLINE"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to invalid storage type"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE, null))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to "); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTierConfigList(Lists .newArrayList(new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag"), new TierConfig("tier2", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "40d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier2_tag_OFFLINE"))).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should have failed due to invalid server tag"); } catch (IllegalStateException e) { } }
public static void validate(TableConfig tableConfig, @Nullable Schema schema) { if (tableConfig.getTableType() == TableType.REALTIME) { Preconditions.checkState(schema != null, "Schema should not be null for REALTIME table"); } validateValidationConfig(tableConfig, schema); validateIngestionConfig(tableConfig.getIngestionConfig(), schema); validateTierConfigList(tableConfig.getTierConfigsList()); validateIndexingConfig(tableConfig.getIndexingConfig(), schema); validateFieldConfigList(tableConfig.getFieldConfigList(), schema); }
TableConfigUtils { public static void validate(TableConfig tableConfig, @Nullable Schema schema) { if (tableConfig.getTableType() == TableType.REALTIME) { Preconditions.checkState(schema != null, "Schema should not be null for REALTIME table"); } validateValidationConfig(tableConfig, schema); validateIngestionConfig(tableConfig.getIngestionConfig(), schema); validateTierConfigList(tableConfig.getTierConfigsList()); validateIndexingConfig(tableConfig.getIndexingConfig(), schema); validateFieldConfigList(tableConfig.getFieldConfigList(), schema); } }
TableConfigUtils { public static void validate(TableConfig tableConfig, @Nullable Schema schema) { if (tableConfig.getTableType() == TableType.REALTIME) { Preconditions.checkState(schema != null, "Schema should not be null for REALTIME table"); } validateValidationConfig(tableConfig, schema); validateIngestionConfig(tableConfig.getIngestionConfig(), schema); validateTierConfigList(tableConfig.getTierConfigsList()); validateIndexingConfig(tableConfig.getIndexingConfig(), schema); validateFieldConfigList(tableConfig.getFieldConfigList(), schema); } private  TableConfigUtils(); }
TableConfigUtils { public static void validate(TableConfig tableConfig, @Nullable Schema schema) { if (tableConfig.getTableType() == TableType.REALTIME) { Preconditions.checkState(schema != null, "Schema should not be null for REALTIME table"); } validateValidationConfig(tableConfig, schema); validateIngestionConfig(tableConfig.getIngestionConfig(), schema); validateTierConfigList(tableConfig.getTierConfigsList()); validateIndexingConfig(tableConfig.getIndexingConfig(), schema); validateFieldConfigList(tableConfig.getFieldConfigList(), schema); } private  TableConfigUtils(); static void validate(TableConfig tableConfig, @Nullable Schema schema); static void validateTableName(TableConfig tableConfig); static void validateRetentionConfig(TableConfig tableConfig); }
TableConfigUtils { public static void validate(TableConfig tableConfig, @Nullable Schema schema) { if (tableConfig.getTableType() == TableType.REALTIME) { Preconditions.checkState(schema != null, "Schema should not be null for REALTIME table"); } validateValidationConfig(tableConfig, schema); validateIngestionConfig(tableConfig.getIngestionConfig(), schema); validateTierConfigList(tableConfig.getTierConfigsList()); validateIndexingConfig(tableConfig.getIndexingConfig(), schema); validateFieldConfigList(tableConfig.getFieldConfigList(), schema); } private  TableConfigUtils(); static void validate(TableConfig tableConfig, @Nullable Schema schema); static void validateTableName(TableConfig tableConfig); static void validateRetentionConfig(TableConfig tableConfig);  }