/** * Is the table name passed a fact table? * * @param tableName table name * @return true if it is cube fact, false otherwise * @throws HiveException */ public boolean isFactTable(String tableName) throws LensException { Table tbl = getTable(tableName); return isFactTable(tbl); }
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
/** * Is the table name passed a fact table? * * @param tableName table name * @return true if it is cube fact, false otherwise * @throws HiveException */ public boolean isFactTable(String tableName) throws LensException { Table tbl = getTable(tableName); return isFactTable(tbl); }
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
boolean isFactTableForCube(Table tbl, String cube) { return isFactTable(tbl) && tbl.getParameters().get(MetastoreUtil.getFactCubeNameKey(tbl.getTableName())) .equalsIgnoreCase(cube.toLowerCase()); }
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
boolean isFactTableForCube(Table tbl, String cube) { return isFactTable(tbl) && tbl.getParameters().get(MetastoreUtil.getFactCubeNameKey(tbl.getTableName())) .equalsIgnoreCase(cube.toLowerCase()); }
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME_WITH_PROPS)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
private Set<String> getAllTablesForStorage(LensSessionHandle sessionHandle, String fact, String storageName) throws LensException { Set<String> storageTableNames = new HashSet<>(); if (getClient(sessionHandle).isFactTable(fact)) { CubeFactTable cft = getClient(sessionHandle).getCubeFactTable(fact); Map<UpdatePeriod, String> storageMap = cft.getStoragePrefixUpdatePeriodMap().get(storageName); for (Map.Entry entry : storageMap.entrySet()) { storageTableNames.add(MetastoreUtil.getStorageTableName(fact, Storage.getPrefix((String) entry.getValue()))); } } else { storageTableNames.add(MetastoreUtil.getFactOrDimtableStorageTableName(fact, storageName)); } return storageTableNames; }
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
@Override public List<String> getStoragesOfFact(LensSessionHandle sessionid, String fact) throws LensException { try (SessionContext ignored = new SessionContext(sessionid)){ CubeMetastoreClient msClient = getClient(sessionid); if (!msClient.isFactTable(fact)) { throw new NotFoundException("Not a fact table " + fact); } CubeFactTable cft = msClient.getCubeFactTable(fact); if (cft != null) { return new ArrayList<>(cft.getStorages()); } else { throw new NotFoundException("Could not get fact table " + fact); } } }
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
private String getStorageTablePrefixFromStorage(String factOrDimTableName, String storage, UpdatePeriod updatePeriod) throws LensException { if (updatePeriod == null) { return storage; } if (isVirtualFactTable(factOrDimTableName)) { CubeFactTable sourceFact = (CubeFactTable) getCubeVirtualFactTable(factOrDimTableName).getSourceCubeFactTable(); return sourceFact.getTablePrefix(storage, updatePeriod); } else if (isFactTable(factOrDimTableName)) { return getCubeFactTable(factOrDimTableName).getTablePrefix(storage, updatePeriod); } else { return storage; } }
assertTrue(client.tableExists(factName)); Table cubeTbl = client.getHiveTable(factName); assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME)); assertEquals(client.getAllFacts(client.getCube(CUBE_NAME)).get(0).getName(), factName.toLowerCase());
private List<Partition> getAllLatestPartsEquivalentTo(String factOrDimtableName, String storageTableName, List<Partition> partitions) throws HiveException, LensException { if (isFactTable(factOrDimtableName)) { return Lists.newArrayList();
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME));
private List<Partition> getAllLatestPartsEquivalentTo(String factOrDimtableName, String storageTableName, List<Partition> partitions) throws HiveException, LensException { if (isFactTable(factOrDimtableName)) { return Lists.newArrayList();
assertTrue(client.isFactTable(cubeTbl)); assertTrue(client.isFactTableForCube(cubeTbl, CUBE_NAME_WITH_PROPS)); CubeFactTable cubeFact2 = new CubeFactTable(cubeTbl);
private String getStorageTablePrefixFromStorage(String factOrDimTableName, String storage, UpdatePeriod updatePeriod) throws LensException { if (updatePeriod == null) { return storage; } if (isVirtualFactTable(factOrDimTableName)) { CubeFactTable sourceFact = (CubeFactTable) getCubeVirtualFactTable(factOrDimTableName).getSourceCubeFactTable(); return sourceFact.getTablePrefix(storage, updatePeriod); } else if (isFactTable(factOrDimTableName)) { return getCubeFactTable(factOrDimTableName).getTablePrefix(storage, updatePeriod); } else { return storage; } }