public void addMaterializeLookupTablesSteps(LookupMaterializeContext context) { CubeDesc cubeDesc = cube.getDescriptor(); Set<String> allLookupTables = Sets.newHashSet(); for (DimensionDesc dim : cubeDesc.getDimensions()) { TableRef table = dim.getTableRef(); if (cubeDesc.getModel().isLookupTable(table)) { allLookupTables.add(table.getTableIdentity()); } } List<SnapshotTableDesc> snapshotTableDescs = cubeDesc.getSnapshotTableDescList(); for (SnapshotTableDesc snapshotTableDesc : snapshotTableDescs) { if (ExtTableSnapshotInfo.STORAGE_TYPE_HBASE.equals(snapshotTableDesc.getStorageType()) && allLookupTables.contains(snapshotTableDesc.getTableName())) { addMaterializeLookupTableSteps(context, snapshotTableDesc.getTableName(), snapshotTableDesc); } } }
private void saveExtSnapshotIfNeeded(CubeManager cubeManager, CubeInstance cube, CubeSegment segment) throws IOException { String extLookupSnapshotStr = this.getParam(BatchConstants.ARG_EXT_LOOKUP_SNAPSHOTS_INFO); if (extLookupSnapshotStr == null || extLookupSnapshotStr.isEmpty()) { return; } Map<String, String> extLookupSnapshotMap = LookupMaterializeContext.parseLookupSnapshots(extLookupSnapshotStr); logger.info("update ext lookup snapshots:{}", extLookupSnapshotMap); List<SnapshotTableDesc> snapshotTableDescList = cube.getDescriptor().getSnapshotTableDescList(); for (SnapshotTableDesc snapshotTableDesc : snapshotTableDescList) { String tableName = snapshotTableDesc.getTableName(); if (snapshotTableDesc.isExtSnapshotTable()) { String newSnapshotResPath = extLookupSnapshotMap.get(tableName); if (newSnapshotResPath == null || newSnapshotResPath.isEmpty()) { continue; } if (snapshotTableDesc.isGlobal()) { if (!newSnapshotResPath.equals(cube.getSnapshotResPath(tableName))) { cubeManager.updateCubeLookupSnapshot(cube, tableName, newSnapshotResPath); } } else { segment.putSnapshotResPath(tableName, newSnapshotResPath); } } } }
newCubeDesc.setVersion(cubeDesc.getVersion()); newCubeDesc.setParentForward(cubeDesc.getParentForward()); newCubeDesc.setSnapshotTableDescList(cubeDesc.getSnapshotTableDescList()); newCubeDesc.setMandatoryDimensionSetList(cubeDesc.getMandatoryDimensionSetList()); newCubeDesc.updateRandomUuid();
private void saveExtSnapshotIfNeeded(CubeManager cubeManager, CubeInstance cube, CubeSegment segment) throws IOException { String extLookupSnapshotStr = this.getParam(BatchConstants.ARG_EXT_LOOKUP_SNAPSHOTS_INFO); if (extLookupSnapshotStr == null || extLookupSnapshotStr.isEmpty()) { return; } Map<String, String> extLookupSnapshotMap = LookupMaterializeContext.parseLookupSnapshots(extLookupSnapshotStr); logger.info("update ext lookup snapshots:{}", extLookupSnapshotMap); List<SnapshotTableDesc> snapshotTableDescList = cube.getDescriptor().getSnapshotTableDescList(); for (SnapshotTableDesc snapshotTableDesc : snapshotTableDescList) { String tableName = snapshotTableDesc.getTableName(); if (snapshotTableDesc.isExtSnapshotTable()) { String newSnapshotResPath = extLookupSnapshotMap.get(tableName); if (newSnapshotResPath == null || newSnapshotResPath.isEmpty()) { continue; } if (snapshotTableDesc.isGlobal()) { if (!newSnapshotResPath.equals(cube.getSnapshotResPath(tableName))) { cubeManager.updateCubeLookupSnapshot(cube, tableName, newSnapshotResPath); } } else { segment.putSnapshotResPath(tableName, newSnapshotResPath); } } } }
public void addMaterializeLookupTablesSteps(LookupMaterializeContext context) { CubeDesc cubeDesc = cube.getDescriptor(); Set<String> allLookupTables = Sets.newHashSet(); for (DimensionDesc dim : cubeDesc.getDimensions()) { TableRef table = dim.getTableRef(); if (cubeDesc.getModel().isLookupTable(table)) { allLookupTables.add(table.getTableIdentity()); } } List<SnapshotTableDesc> snapshotTableDescs = cubeDesc.getSnapshotTableDescList(); for (SnapshotTableDesc snapshotTableDesc : snapshotTableDescs) { if (ExtTableSnapshotInfo.STORAGE_TYPE_HBASE.equals(snapshotTableDesc.getStorageType()) && allLookupTables.contains(snapshotTableDesc.getTableName())) { addMaterializeLookupTableSteps(context, snapshotTableDesc.getTableName(), snapshotTableDesc); } } }
newCubeDesc.setVersion(cubeDesc.getVersion()); newCubeDesc.setParentForward(cubeDesc.getParentForward()); newCubeDesc.setSnapshotTableDescList(cubeDesc.getSnapshotTableDescList()); newCubeDesc.setMandatoryDimensionSetList(cubeDesc.getMandatoryDimensionSetList()); newCubeDesc.updateRandomUuid();