@Override public void setup(Context context) throws IOException, InterruptedException { LOGGER.info("TopKRollupPhaseOneJob.TopKRollupPhaseOneReducer.setup()"); Configuration configuration = context.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path configPath = new Path(configuration.get(TOPK_ROLLUP_PHASE1_CONFIG_PATH.toString())); try { starTreeConfig = StarTreeConfig.decode(fileSystem.open(configPath)); config = TopKRollupPhaseOneConfig.fromStarTreeConfig(starTreeConfig); dimensionNames = config.getDimensionNames(); metricTypes = config.getMetricTypes(); metricSchema = new MetricSchema(config.getMetricNames(), metricTypes); metricThresholds = config.getMetricThresholds(); keyWritable = new BytesWritable(); valWritable = new BytesWritable(); MetricSums metricSumsObj = OBJECT_MAPPER.readValue( fileSystem.open( new Path(configuration.get(TOPK_ROLLUP_PHASE1_METRIC_SUMS_PATH.toString()))), MetricSums.class); metricSums = metricSumsObj.getMetricSum(); } catch (Exception e) { throw new IOException(e); } }
@Override public void setup(Context context) throws IOException, InterruptedException { LOGGER.info("TopKRollupPhaseOneJob.TopKRollupPhaseOneMapper.setup()"); Configuration configuration = context.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path configPath = new Path(configuration.get(TOPK_ROLLUP_PHASE1_CONFIG_PATH.toString())); try { starTreeConfig = StarTreeConfig.decode(fileSystem.open(configPath)); config = TopKRollupPhaseOneConfig.fromStarTreeConfig(starTreeConfig); dimensionNames = config.getDimensionNames(); keyWritable = new BytesWritable(); valWritable = new BytesWritable(); dimensionNameToIndexMapping = new HashMap<String, Integer>(); for (int i = 0; i < dimensionNames.size(); i++) { dimensionNameToIndexMapping.put(dimensionNames.get(i), i); } } catch (Exception e) { throw new IOException(e); } }