Пример #1
0
  private static void processSegment(
      KylinConfig config, CubeSegment cubeSeg, DistinctColumnValuesProvider factTableValueProvider)
      throws IOException {
    CubeManager cubeMgr = CubeManager.getInstance(config);

    // dictionary
    for (TblColRef col : cubeSeg.getCubeDesc().getAllColumnsNeedDictionary()) {
      logger.info("Building dictionary for " + col);
      cubeMgr.buildDictionary(cubeSeg, col, factTableValueProvider);
    }

    for (DimensionDesc dim : cubeSeg.getCubeDesc().getDimensions()) {
      // build snapshot
      if (dim.getTable() != null
          && !dim.getTable().equalsIgnoreCase(cubeSeg.getCubeDesc().getFactTable())) {
        // CubeSegment seg = cube.getTheOnlySegment();
        logger.info("Building snapshot of " + dim.getTable());
        cubeMgr.buildSnapshotTable(cubeSeg, dim.getTable());
        logger.info("Checking snapshot of " + dim.getTable());
        cubeMgr.getLookupTable(cubeSeg, dim); // load the table for sanity check
      }
    }
  }