public static ILookupMaterializer getExtLookupMaterializer(String lookupStorageType) { return LookupProviderFactory.createEngineAdapter(lookupStorageType, ILookupMaterializer.class); }
public String getSnapshotLocalCacheState(String tableName, String snapshotID) { ExtTableSnapshotInfoManager snapshotInfoManager = ExtTableSnapshotInfoManager.getInstance(getConfig()); ExtTableSnapshotInfo extTableSnapshotInfo = snapshotInfoManager.getSnapshot(tableName, snapshotID); if (extTableSnapshotInfo == null) { throw new IllegalArgumentException( "cannot find ext snapshot info for table:" + tableName + " snapshot:" + snapshotID); } CacheState cacheState = LookupProviderFactory.getCacheState(extTableSnapshotInfo); return cacheState.name(); }
public static void rebuildLocalCache(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshotInfo) { IExtLookupTableCache tablesCache = getExtLookupProvider(extTableSnapshotInfo.getStorageType()).getLocalCache(); if (tablesCache != null) { tablesCache.buildSnapshotCache(tableDesc, extTableSnapshotInfo, getExtLookupTableWithoutCache(tableDesc, extTableSnapshotInfo)); } }
public static <T> T createEngineAdapter(String lookupStorageType, Class<T> engineInterface) { IExtLookupProvider provider = getExtLookupProvider(lookupStorageType); return provider.adaptToBuildEngine(engineInterface); }
private ILookupTable getInMemLookupTable(CubeSegment cubeSegment, JoinDesc join, SnapshotTableDesc snapshotTableDesc) { String tableName = join.getPKSide().getTableIdentity(); String snapshotResPath = getSnapshotResPath(cubeSegment, tableName, snapshotTableDesc); String[] pkCols = join.getPrimaryKey(); try { SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName, cubeSegment.getProject()); return LookupProviderFactory.getInMemLookupTable(tableDesc, pkCols, snapshot); } catch (IOException e) { throw new IllegalStateException( "Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e); } }
private ILookupTable getExtLookupTable(CubeSegment cubeSegment, String tableName, SnapshotTableDesc snapshotTableDesc) { String snapshotResPath = getSnapshotResPath(cubeSegment, tableName, snapshotTableDesc); ExtTableSnapshotInfo extTableSnapshot = ExtTableSnapshotInfoManager.getInstance(config).getSnapshot( snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName, cubeSegment.getProject()); return LookupProviderFactory.getExtLookupTable(tableDesc, extTableSnapshot); }
private ILookupTable getSourceLookupTable(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshotInfo) { return LookupProviderFactory.getExtLookupTableWithoutCache(tableDesc, extTableSnapshotInfo); }
public void removeSnapshotLocalCache(String tableName, String snapshotID) { ExtTableSnapshotInfoManager snapshotInfoManager = ExtTableSnapshotInfoManager.getInstance(getConfig()); ExtTableSnapshotInfo extTableSnapshotInfo = snapshotInfoManager.getSnapshot(tableName, snapshotID); if (extTableSnapshotInfo == null) { throw new IllegalArgumentException( "cannot find ext snapshot info for table:" + tableName + " snapshot:" + snapshotID); } LookupProviderFactory.removeLocalCache(extTableSnapshotInfo); }
public void updateSnapshotLocalCache(String project, String tableName, String snapshotID) { ExtTableSnapshotInfoManager snapshotInfoManager = ExtTableSnapshotInfoManager.getInstance(getConfig()); ExtTableSnapshotInfo extTableSnapshotInfo = snapshotInfoManager.getSnapshot(tableName, snapshotID); TableDesc tableDesc = getTableManager().getTableDesc(tableName, project); if (extTableSnapshotInfo == null) { throw new IllegalArgumentException( "cannot find ext snapshot info for table:" + tableName + " snapshot:" + snapshotID); } LookupProviderFactory.rebuildLocalCache(tableDesc, extTableSnapshotInfo); }
@Before public void setup() throws Exception { createTestMetadata(); TableMetadataManager metadataManager = TableMetadataManager.getInstance(KylinConfig.getInstanceFromEnv()); kylinConfig = getTestConfig(); tableDesc = metadataManager.getTableDesc(TABLE_COUNTRY, "default"); cleanCache(); LookupProviderFactory.registerLookupProvider(MOCK_EXT_LOOKUP, MockedLookupProvider.class.getName()); }
public static ILookupTable getExtLookupTableWithoutCache(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshot) { IExtLookupProvider provider = getExtLookupProvider(extTableSnapshot.getStorageType()); return provider.getLookupTable(tableDesc, extTableSnapshot); }
private ILookupTable getInMemLookupTable(CubeSegment cubeSegment, JoinDesc join, SnapshotTableDesc snapshotTableDesc) { String tableName = join.getPKSide().getTableIdentity(); String snapshotResPath = getSnapshotResPath(cubeSegment, tableName, snapshotTableDesc); String[] pkCols = join.getPrimaryKey(); try { SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName, cubeSegment.getProject()); return LookupProviderFactory.getInMemLookupTable(tableDesc, pkCols, snapshot); } catch (IOException e) { throw new IllegalStateException( "Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e); } }
private ILookupTable getExtLookupTable(CubeSegment cubeSegment, String tableName, SnapshotTableDesc snapshotTableDesc) { String snapshotResPath = getSnapshotResPath(cubeSegment, tableName, snapshotTableDesc); ExtTableSnapshotInfo extTableSnapshot = ExtTableSnapshotInfoManager.getInstance(config).getSnapshot( snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName, cubeSegment.getProject()); return LookupProviderFactory.getExtLookupTable(tableDesc, extTableSnapshot); }
private ILookupTable getSourceLookupTable(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshotInfo) { return LookupProviderFactory.getExtLookupTableWithoutCache(tableDesc, extTableSnapshotInfo); }
public static ILookupTable getExtLookupTable(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshot) { IExtLookupTableCache extLookupTableCache = getExtLookupProvider(extTableSnapshot.getStorageType()).getLocalCache(); if (extLookupTableCache == null) { return getExtLookupTableWithoutCache(tableDesc, extTableSnapshot); } ILookupTable cachedLookupTable = extLookupTableCache.getCachedLookupTable(tableDesc, extTableSnapshot, true); if (cachedLookupTable != null) { logger.info("try to use cached lookup table:{}", extTableSnapshot.getResourcePath()); return cachedLookupTable; } logger.info("use ext lookup table:{}", extTableSnapshot.getResourcePath()); return getExtLookupTableWithoutCache(tableDesc, extTableSnapshot); }
public static CacheState getCacheState(ExtTableSnapshotInfo extTableSnapshotInfo) { IExtLookupTableCache tablesCache = getExtLookupProvider(extTableSnapshotInfo.getStorageType()).getLocalCache(); if (tablesCache != null) { return tablesCache.getCacheState(extTableSnapshotInfo); } return CacheState.NONE; }
public static ILookupMaterializer getExtLookupMaterializer(String lookupStorageType) { return LookupProviderFactory.createEngineAdapter(lookupStorageType, ILookupMaterializer.class); }
public static void rebuildLocalCache(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshotInfo) { IExtLookupTableCache tablesCache = getExtLookupProvider(extTableSnapshotInfo.getStorageType()).getLocalCache(); if (tablesCache != null) { tablesCache.buildSnapshotCache(tableDesc, extTableSnapshotInfo, getExtLookupTableWithoutCache(tableDesc, extTableSnapshotInfo)); } }
public static void removeLocalCache(ExtTableSnapshotInfo extTableSnapshotInfo) { IExtLookupTableCache tablesCache = getExtLookupProvider(extTableSnapshotInfo.getStorageType()).getLocalCache(); if (tablesCache != null) { tablesCache.removeSnapshotCache(extTableSnapshotInfo); } }
public static ILookupTable getExtLookupTable(TableDesc tableDesc, ExtTableSnapshotInfo extTableSnapshot) { IExtLookupTableCache extLookupTableCache = getExtLookupProvider(extTableSnapshot.getStorageType()).getLocalCache(); if (extLookupTableCache == null) { return getExtLookupTableWithoutCache(tableDesc, extTableSnapshot); } ILookupTable cachedLookupTable = extLookupTableCache.getCachedLookupTable(tableDesc, extTableSnapshot, true); if (cachedLookupTable != null) { logger.info("try to use cached lookup table:{}", extTableSnapshot.getResourcePath()); return cachedLookupTable; } logger.info("use ext lookup table:{}", extTableSnapshot.getResourcePath()); return getExtLookupTableWithoutCache(tableDesc, extTableSnapshot); }