MetadataManager getMetadataManager() { return MetadataManager.getInstance(config); }
private MetadataManager getMetadataManager() { return MetadataManager.getInstance(config); }
private MetadataManager getMetadataManager() { return MetadataManager.getInstance(config); }
/** * Tell MetadataManager that the instance has changed. The cube info will * be stored Reload the cube desc and source table A broadcast must be sent * out * * @return * @throws IOException */ public void reload() { clearCache(); getInstance(config); }
private ExecutableDao(KylinConfig config) { logger.info("Using metadata url: " + config); this.store = MetadataManager.getInstance(config).getStore(); }
private static MetadataManager getMetadataManager() { return MetadataManager.getInstance(KylinConfig.getInstanceFromEnv()); }
private TableDesc getTableDesc(String tableName) { return MetadataManager.getInstance(this.config).getTableDesc(tableName); }
public List<TableDesc> listTables() { MetadataManager metaMgr = MetadataManager.getInstance(config); HashSet<String> tableNames = new HashSet<String>(); List<TableDesc> result = new ArrayList<TableDesc>(); tableNames.add(factTable.toUpperCase()); for (DimensionDesc dim : dimensions) { String table = dim.getTable(); if (table != null) tableNames.add(table.toUpperCase()); } for (String tableName : tableNames) { result.add(metaMgr.getTableDesc(tableName)); } return result; }
private SnapshotTable load(String resourcePath, boolean loadData) throws IOException { logger.info("Loading snapshotTable from " + resourcePath + ", with loadData: " + loadData); ResourceStore store = MetadataManager.getInstance(this.config).getStore(); SnapshotTable table = store.getResource(resourcePath, SnapshotTable.class, loadData ? SnapshotTableSerializer.FULL_SERIALIZER : SnapshotTableSerializer.INFO_SERIALIZER); if (loadData) logger.debug("Loaded snapshot at " + resourcePath); return table; }
DictionaryInfo load(String resourcePath, boolean loadDictObj) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); logger.debug("Going to load DictionaryInfo from " + resourcePath); DictionaryInfo info = store.getResource(resourcePath, DictionaryInfo.class, loadDictObj ? DictionaryInfoSerializer.FULL_SERIALIZER : DictionaryInfoSerializer.INFO_SERIALIZER); if (loadDictObj) logger.debug("Loaded dictionary at " + resourcePath); return info; }
public void removeSnapshot(String resourcePath) throws IOException { ResourceStore store = MetadataManager.getInstance(this.config).getStore(); store.deleteResource(resourcePath); snapshotCache.remove(resourcePath); }
public void removeDictionary(String resourcePath) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); store.deleteResource(resourcePath); dictCache.remove(resourcePath); }
void save(DictionaryInfo dict) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); String path = dict.getResourcePath(); logger.info("Saving dictionary at " + path); store.putResource(path, dict, DictionaryInfoSerializer.FULL_SERIALIZER); }
private void save(SnapshotTable snapshot) throws IOException { ResourceStore store = MetadataManager.getInstance(this.config).getStore(); String path = snapshot.getResourcePath(); store.putResource(path, snapshot, SnapshotTableSerializer.FULL_SERIALIZER); }
private String checkDupByContent(SnapshotTable snapshot) throws IOException { ResourceStore store = MetadataManager.getInstance(this.config).getStore(); String resourceDir = snapshot.getResourceDir(); ArrayList<String> existings = store.listResources(resourceDir); if (existings == null) return null; for (String existing : existings) { SnapshotTable existingTable = load(existing, true); // skip cache, direct load from store if (existingTable != null && existingTable.equals(snapshot)) return existing; } return null; }
@Test public void testGetInstance() throws Exception { Assert.assertNotNull(MetadataManager.getInstance(getTestConfig())); Assert.assertNotNull(MetadataManager.getInstance(getTestConfig()).listAllTables()); Assert.assertTrue(MetadataManager.getInstance(getTestConfig()).listAllTables().size() > 0); }
public void removeDictionaries(String srcTable, String srcCol) throws IOException { DictionaryInfo info = new DictionaryInfo(); info.setSourceTable(srcTable); info.setSourceColumn(srcCol); ResourceStore store = MetadataManager.getInstance(config).getStore(); ArrayList<String> existings = store.listResources(info.getResourceDir()); if (existings == null) return; for (String existing : existings) removeDictionary(existing); }
public LookupTable initLookupTable() throws Exception { MetadataManager metaMgr = MetadataManager.getInstance(config); String tableName = "EDW.TEST_CAL_DT"; String[] pkCols = new String[]{"CAL_DT"}; String snapshotResPath = "/table_snapshot/TEST_CAL_DT.csv/4af48c94-86de-4e22-a4fd-c49b06cbaa4f.snapshot"; SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = metaMgr.getTableDesc(tableName); LookupTable lt = new LookupStringTable(tableDesc, pkCols, snapshot); System.out.println(lt); return lt; }
@Test public void testListAllTables() throws Exception { List<TableDesc> tables = MetadataManager.getInstance(getTestConfig()).listAllTables(); Assert.assertNotNull(tables); Assert.assertTrue(tables.size() > 0); }
@Test public void testFindTableByName() throws Exception { TableDesc table = MetadataManager.getInstance(getTestConfig()).getTableDesc("EDW.TEST_CAL_DT"); Assert.assertNotNull(table); Assert.assertEquals("EDW.TEST_CAL_DT", table.getIdentity()); }