@Test public void testCompatibilityWithTableConfig() { List<TableConfig> tableConfigs = new ArrayList<>(); Schema schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); SchemaUtils.validate(schema, tableConfigs); TableConfig tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).build(); SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); Assert.fail("Should fail schema validation, as timeColumn is absent"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).addSingleValueDimension(TIME_COLUMN, DataType.STRING) .build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); Assert.fail("Should fail schema validation, as timeColumn is not present as time spec"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, DataType.LONG, "1:MILLISECONDS:EPOCH", "1:HOURS").build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setIngestionConfig( new IngestionConfig(null, Lists.newArrayList(new TransformConfig("colA", "round(colB, 1000)")))).build(); try { SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); Assert.fail("Should fail schema validation, as colA is not present in schema"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).addSingleValueDimension("colA", DataType.STRING).build(); SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); Assert.fail("Should fail schema validation, as timeColumn is absent"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME).addSingleValueDimension(TIME_COLUMN, DataType.STRING) .build(); tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); try { SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); Assert.fail("Should fail schema validation, as timeColumn is not present as time spec"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, DataType.LONG, "1:MILLISECONDS:EPOCH", "1:HOURS").build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN).build(); SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, DataType.LONG, "1:MILLISECONDS:EPOCH", "1:HOURS").build(); tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN) .setIngestionConfig( new IngestionConfig(null, Lists.newArrayList(new TransformConfig("colA", "round(colB, 1000)")))).build(); try { SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); Assert.fail("Should fail schema validation, as colA is not present in schema"); } catch (IllegalStateException e) { } schema = new Schema.SchemaBuilder().setSchemaName(TABLE_NAME) .addDateTime(TIME_COLUMN, DataType.LONG, "1:MILLISECONDS:EPOCH", "1:HOURS") .addSingleValueDimension("colA", DataType.STRING).build(); SchemaUtils.validate(schema, Lists.newArrayList(tableConfig)); }
public static void validate(Schema schema, List<TableConfig> tableConfigs) { for (TableConfig tableConfig : tableConfigs) { validateCompatibilityWithTableConfig(schema, tableConfig); } validate(schema); }
SchemaUtils { public static void validate(Schema schema, List<TableConfig> tableConfigs) { for (TableConfig tableConfig : tableConfigs) { validateCompatibilityWithTableConfig(schema, tableConfig); } validate(schema); } }
SchemaUtils { public static void validate(Schema schema, List<TableConfig> tableConfigs) { for (TableConfig tableConfig : tableConfigs) { validateCompatibilityWithTableConfig(schema, tableConfig); } validate(schema); }  }
SchemaUtils { public static void validate(Schema schema, List<TableConfig> tableConfigs) { for (TableConfig tableConfig : tableConfigs) { validateCompatibilityWithTableConfig(schema, tableConfig); } validate(schema); }  static void validate(Schema schema, List<TableConfig> tableConfigs); static void validate(Schema schema); }
SchemaUtils { public static void validate(Schema schema, List<TableConfig> tableConfigs) { for (TableConfig tableConfig : tableConfigs) { validateCompatibilityWithTableConfig(schema, tableConfig); } validate(schema); }  static void validate(Schema schema, List<TableConfig> tableConfigs); static void validate(Schema schema); static final String MAP_KEY_COLUMN_SUFFIX; static final String MAP_VALUE_COLUMN_SUFFIX; }