/** * Get all fact tables of the cube. * * @param cube Cube object * @return List of fact tables * @throws LensException */ public List<FactTable> getAllFacts(CubeInterface cube) throws LensException { String cubeName = null; if (cube != null) { if (cube instanceof DerivedCube) { cube = ((DerivedCube) cube).getParent(); } cubeName = cube.getName(); } List<FactTable> cubeFacts = new ArrayList<>(); for (FactTable fact : getAllFacts()) { if (cubeName == null || fact.getCubeName().equalsIgnoreCase(cubeName)) { cubeFacts.add(fact); } } return cubeFacts; }
/** * Get all fact tables of the cube. * * @param cube Cube object * @return List of fact tables * @throws LensException */ public List<FactTable> getAllFacts(CubeInterface cube) throws LensException { String cubeName = null; if (cube != null) { if (cube instanceof DerivedCube) { cube = ((DerivedCube) cube).getParent(); } cubeName = cube.getName(); } List<FactTable> cubeFacts = new ArrayList<>(); for (FactTable fact : getAllFacts()) { if (cubeName == null || fact.getCubeName().equalsIgnoreCase(cubeName)) { cubeFacts.add(fact); } } return cubeFacts; }
/** * Get all facts of cube (optional virtual facts) * * @param cube Cube object * @param includeVirtualFacts set true for virtual facts * @return List of fact tables with optional virtual facts * @throws LensException */ public List<FactTable> getAllFacts(CubeInterface cube, boolean includeVirtualFacts) throws LensException { String cubeName = null; if (cube != null) { if (cube instanceof DerivedCube) { cube = ((DerivedCube) cube).getParent(); } cubeName = cube.getName(); } List<FactTable> cubeFacts = new ArrayList<>(); for (FactTable fact : getAllFacts(includeVirtualFacts)) { if (cubeName == null || fact.getCubeName().equalsIgnoreCase(cubeName)) { cubeFacts.add(fact); } } return cubeFacts; }
/** * Get all facts of cube (optional virtual facts) * * @param cube Cube object * @param includeVirtualFacts set true for virtual facts * @return List of fact tables with optional virtual facts * @throws LensException */ public List<FactTable> getAllFacts(CubeInterface cube, boolean includeVirtualFacts) throws LensException { String cubeName = null; if (cube != null) { if (cube instanceof DerivedCube) { cube = ((DerivedCube) cube).getParent(); } cubeName = cube.getName(); } List<FactTable> cubeFacts = new ArrayList<>(); for (FactTable fact : getAllFacts(includeVirtualFacts)) { if (cubeName == null || fact.getCubeName().equalsIgnoreCase(cubeName)) { cubeFacts.add(fact); } } return cubeFacts; }
@Override public List<String> getAllFactNames(LensSessionHandle sessionid, String cubeName) throws LensException { try (SessionContext ignored = new SessionContext(sessionid)){ CubeMetastoreClient client = getClient(sessionid); CubeInterface fact = client.getCube(cubeName); if (cubeName != null && fact == null) { throw new LensException("Could not get table: " + cubeName + " as a cube"); } Collection<FactTable> facts = client.getAllFacts(fact); List<String> factNames = new ArrayList<>(facts.size()); for (FactTable cft : facts) { factNames.add(cft.getName()); } return factNames; } }
Date max = new Date(Long.MIN_VALUE); boolean updated = false; for (FactTable fact : getAllFacts(cube)) { for (String storage : fact.getStorages()) { for (UpdatePeriod updatePeriod : fact.getUpdatePeriods().get(storage)) {
Date max = new Date(Long.MIN_VALUE); boolean updated = false; for (FactTable fact : getAllFacts(cube)) { for (String storage : fact.getStorages()) { for (UpdatePeriod updatePeriod : fact.getUpdatePeriods().get(storage)) {
List<String> validFactTables = StringUtils.isBlank(str) ? null : Arrays.asList(StringUtils.split(str.toLowerCase(), ",")); List<FactTable> factTables = cubeql.getMetastoreClient().getAllFacts(cubeql.getCube()); if (factTables.isEmpty()) { throw new LensException(LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo(),
for (FactTable factTable : client.getAllFacts(false)) { CubeFactTable cubeFactTable = (CubeFactTable) factTable; try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass()
List<String> validFactTables = StringUtils.isBlank(str) ? null : Arrays.asList(StringUtils.split(str.toLowerCase(), ",")); List<FactTable> factTables = cubeql.getMetastoreClient().getAllFacts(cubeql.getCube()); if (factTables.isEmpty()) { throw new LensException(LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo(),
storageTableName = getFactOrDimtableStorageTableName(factName, c2); assertFalse(client.tableExists(storageTableName)); List<FactTable> cubeFacts = client.getAllFacts(client.getCube(CUBE_NAME)); List<String> cubeFactNames = new ArrayList<>(); for (FactTable cfact : cubeFacts) { cubeFacts = client.getAllFacts(client.getCube(DERIVED_CUBE_NAME)); cubeFactNames = new ArrayList<>(); for (FactTable cfact : cubeFacts) { assertFalse(client.tableExists(getFactOrDimtableStorageTableName(factName, c3))); assertFalse(client.tableExists(factName)); cubeFacts = client.getAllFacts(cube); cubeFactNames = new ArrayList<>(); for (FactTable cfact : cubeFacts) {
assertTrue(client.getAllFacts(client.getCube(VIRTUAL_CUBE_NAME)).get(0).getName().equals(virtualFactName.trim() .toLowerCase()));
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); assertEquals(client.getAllFacts(client.getCube(CUBE_NAME)).get(0).getName(), factName.toLowerCase()); assertEquals(client.getAllFacts(client.getCube(DERIVED_CUBE_NAME)).get(0).getName(), factName.toLowerCase()); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl); assertTrue(cubeFact.equals(cubeFact2));
assertNotNull(addedMsr); assertEquals(addedMsr.getType(), "double"); assertTrue(client.getAllFacts(altered).isEmpty());