Search in sources :

Example 1 with TopKPhaseMapper

use of com.linkedin.thirdeye.hadoop.topk.TopKPhaseJob.TopKPhaseMapper in project pinot by linkedin.

the class TopkPhaseTest method setUp.

@Before
public void setUp() throws Exception {
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TABLE_NAME.toString(), "collection");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_DIMENSION_NAMES.toString(), "d1,d2,d3");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_METRIC_NAMES.toString(), "m1,m2");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_METRIC_TYPES.toString(), "INT,INT");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_NAME.toString(), "hoursSinceEpoch");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TOPK_DIMENSION_NAMES.toString(), "d2,");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TOPK_METRICS.toString() + ".d2", "m1");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TOPK_KVALUES.toString() + ".d2", "1");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_WHITELIST_DIMENSION_NAMES.toString(), "d3");
    props.setProperty(ThirdEyeConfigProperties.THIRDEYE_WHITELIST_DIMENSION.toString() + ".d3", "xyz2");
    thirdeyeConfig = ThirdEyeConfig.fromProperties(props);
    // Mapper config
    TopKPhaseMapper mapper = new TopKPhaseMapper();
    mapDriver = MapDriver.newMapDriver(mapper);
    Configuration configuration = mapDriver.getConfiguration();
    configuration.set("io.serializations", "org.apache.hadoop.io.serializer.JavaSerialization," + "org.apache.hadoop.io.serializer.WritableSerialization");
    configuration.set(TopKPhaseConstants.TOPK_PHASE_THIRDEYE_CONFIG.toString(), OBJECT_MAPPER.writeValueAsString(thirdeyeConfig));
    inputSchema = new Schema.Parser().parse(ClassLoader.getSystemResourceAsStream(AVRO_SCHEMA));
    setUpAvroSerialization(mapDriver.getConfiguration(), inputSchema);
    // Reducer config
    TopKPhaseReducer reducer = new TopKPhaseReducer();
    reduceDriver = ReduceDriver.newReduceDriver(reducer);
    configuration = reduceDriver.getConfiguration();
    configuration.set("io.serializations", "org.apache.hadoop.io.serializer.JavaSerialization," + "org.apache.hadoop.io.serializer.WritableSerialization");
    configuration.set(TopKPhaseConstants.TOPK_PHASE_THIRDEYE_CONFIG.toString(), OBJECT_MAPPER.writeValueAsString(thirdeyeConfig));
    TemporaryPath tmpPath = new TemporaryPath();
    outputPath = tmpPath.toString();
    configuration.set(TopKPhaseConstants.TOPK_PHASE_OUTPUT_PATH.toString(), outputPath);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TopKPhaseMapper(com.linkedin.thirdeye.hadoop.topk.TopKPhaseJob.TopKPhaseMapper) TopKPhaseReducer(com.linkedin.thirdeye.hadoop.topk.TopKPhaseJob.TopKPhaseReducer) TemporaryPath(org.apache.hadoop.mrunit.testutil.TemporaryPath) Before(org.junit.Before)

Aggregations

TopKPhaseMapper (com.linkedin.thirdeye.hadoop.topk.TopKPhaseJob.TopKPhaseMapper)1 TopKPhaseReducer (com.linkedin.thirdeye.hadoop.topk.TopKPhaseJob.TopKPhaseReducer)1 Configuration (org.apache.hadoop.conf.Configuration)1 TemporaryPath (org.apache.hadoop.mrunit.testutil.TemporaryPath)1 Before (org.junit.Before)1