Search in sources :

Example 1 with SchemaAnnotation

use of com.linkedin.pinot.tools.data.generator.SchemaAnnotation in project pinot by linkedin.

the class GenerateDataCommand method buildCardinalityRangeMaps.

private void buildCardinalityRangeMaps(String file, HashMap<String, Integer> cardinality, HashMap<String, IntRange> range) throws JsonParseException, JsonMappingException, IOException {
    List<SchemaAnnotation> saList;
    if (file == null) {
        // Nothing to do here.
        return;
    }
    ObjectMapper objectMapper = new ObjectMapper();
    saList = objectMapper.readValue(new File(file), new TypeReference<List<SchemaAnnotation>>() {
    });
    for (SchemaAnnotation sa : saList) {
        String column = sa.getColumn();
        if (sa.isRange()) {
            range.put(column, new IntRange(sa.getRangeStart(), sa.getRangeEnd()));
        } else {
            cardinality.put(column, sa.getCardinality());
        }
    }
}
Also used : IntRange(org.apache.commons.lang.math.IntRange) TypeReference(org.codehaus.jackson.type.TypeReference) SchemaAnnotation(com.linkedin.pinot.tools.data.generator.SchemaAnnotation) File(java.io.File) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Aggregations

SchemaAnnotation (com.linkedin.pinot.tools.data.generator.SchemaAnnotation)1 File (java.io.File)1 IntRange (org.apache.commons.lang.math.IntRange)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 TypeReference (org.codehaus.jackson.type.TypeReference)1