public static List<String> getMRDependentResources(TableDesc table) { return getSource(table).getSourceMetadataExplorer().getRelatedKylinResources(table); } }
public List<Pair<TableDesc, TableExtDesc>> extractHiveTableMeta(String[] tables, String project) throws Exception { // de-dup SetMultimap<String, String> db2tables = LinkedHashMultimap.create(); for (String fullTableName : tables) { String[] parts = HadoopUtil.parseHiveTableName(fullTableName); db2tables.put(parts[0], parts[1]); } // load all tables first List<Pair<TableDesc, TableExtDesc>> allMeta = Lists.newArrayList(); ProjectInstance projectInstance = getProjectManager().getProject(project); ISourceMetadataExplorer explr = SourceManager.getSource(projectInstance).getSourceMetadataExplorer(); for (Map.Entry<String, String> entry : db2tables.entries()) { Pair<TableDesc, TableExtDesc> pair = explr.loadTableMetadata(entry.getKey(), entry.getValue(), project); TableDesc tableDesc = pair.getFirst(); Preconditions.checkState(tableDesc.getDatabase().equals(entry.getKey().toUpperCase(Locale.ROOT))); Preconditions.checkState(tableDesc.getName().equals(entry.getValue().toUpperCase(Locale.ROOT))); Preconditions.checkState(tableDesc.getIdentity() .equals(entry.getKey().toUpperCase(Locale.ROOT) + "." + entry.getValue().toUpperCase(Locale.ROOT))); TableExtDesc extDesc = pair.getSecond(); Preconditions.checkState(tableDesc.getIdentity().equals(extDesc.getIdentity())); allMeta.add(pair); } return allMeta; }
protected List<String> getHiveTables() throws Exception { ISourceMetadataExplorer explr = SourceManager.getDefaultSource().getSourceMetadataExplorer(); return explr.listTables(config.getHiveDatabaseForIntermediateTable()); }
/** * * @param project * @return * @throws Exception */ public List<String> getSourceDbNames(String project) throws Exception { ISourceMetadataExplorer explr = SourceManager.getInstance(getConfig()).getProjectSource(project) .getSourceMetadataExplorer(); return explr.listDatabases(); }
/** * * @param project * @param database * @return * @throws Exception */ public List<String> getSourceTableNames(String project, String database) throws Exception { ISourceMetadataExplorer explr = SourceManager.getInstance(getConfig()).getProjectSource(project) .getSourceMetadataExplorer(); return explr.listTables(database); }
@BeforeClass public static void setUp() throws Exception { TestBase.setUp(); explorer = SourceManager.getSource(new JdbcSourceTest.JdbcSourceAware()).getSourceMetadataExplorer(); }
@Test public void testBasics() throws IOException { ISource source = SourceManager.getSource(new JdbcSourceAware()); ISourceMetadataExplorer explorer = source.getSourceMetadataExplorer(); ISampleDataDeployer deployer = source.getSampleDataDeployer(); Assert.assertTrue(source instanceof JdbcSource); Assert.assertTrue(explorer instanceof JdbcExplorer); Assert.assertTrue(deployer instanceof JdbcExplorer); IMRInput input = source.adaptToBuildEngine(IMRInput.class); Assert.assertNotNull(input); Class adaptTo = Object.class; expectedCannotAdaptEx.expect(RuntimeException.class); expectedCannotAdaptEx.expectMessage("Cannot adapt to " + adaptTo); source.adaptToBuildEngine(adaptTo); TableMetadataManager tblManager = TableMetadataManager.getInstance(getTestConfig()); IReadableTable table = source.createReadableTable(tblManager.getTableDesc("test_kylin_fact", "default"), null); Assert.assertTrue(table instanceof JdbcTable); source.close(); } }
public static List<String> getMRDependentResources(TableDesc table) { return getSource(table).getSourceMetadataExplorer().getRelatedKylinResources(table); } }