@Test public void validateTimeColumnValidationConfig() { TableConfig tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).build(); try { TableConfigUtils.validate(tableConfig, null); Assert.fail("Should fail for null timeColumnName and null schema in REALTIME table"); } catch (IllegalStateException e) { } tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { TableConfigUtils.validate(tableConfig, null); Assert.fail("Should fail for null schema in REALTIME table"); } catch (IllegalStateException e) { } Schema schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should fail for null timeColumnName in REALTIME table"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should fail for timeColumnName not present in schema for REALTIME table"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addSingleValueDimension(TIME_COLUMN, FieldSpec.DataType.LONG).build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should fail for invalid fieldSpec for timeColumnName in schema for REALTIME table"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, FieldSpec.DataType.LONG, "1:MILLISECONDS:EPOCH", "1:MILLISECONDS").build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); TableConfigUtils.validate(tableConfig, schema); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).build(); TableConfigUtils.validate(tableConfig, null); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); TableConfigUtils.validate(tableConfig, null); schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).build(); TableConfigUtils.validate(tableConfig, schema); schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should fail for timeColumnName not present in schema for OFFLINE table"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addSingleValueDimension(TIME_COLUMN, FieldSpec.DataType.STRING).build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { TableConfigUtils.validate(tableConfig, schema); Assert.fail("Should fail for timeColumnName not present in schema for OFFLINE table"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, FieldSpec.DataType.LONG, "1:MILLISECONDS:EPOCH", "1:MILLISECONDS").build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); TableConfigUtils.validate(tableConfig, schema); }
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);  }