Java Code Examples for org.apache.kylin.metadata.model.TableDesc#getProject()
The following examples show how to use
org.apache.kylin.metadata.model.TableDesc#getProject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
/** * table may referenced by several projects, and kylin only keep one copy of meta for each table, * that's why we have two if statement here. * @param tableName * @param project * @return */ public boolean unloadHiveTable(String tableName, String project) throws IOException { aclEvaluate.checkProjectAdminPermission(project); Message msg = MsgPicker.getMsg(); boolean rtn = false; int tableType = 0; tableName = normalizeHiveTableName(tableName); TableDesc desc = getTableManager().getTableDesc(tableName, project); // unload of legacy global table is not supported for now if (desc == null || desc.getProject() == null) { logger.warn("Unload Table {} in Project {} failed, could not find TableDesc or related Project", tableName, project); return false; } if (!modelService.isTableInModel(desc, project)) { removeTableFromProject(tableName, project); rtn = true; } else { List<String> models = modelService.getModelsUsingTable(desc, project); throw new BadRequestException(String.format(Locale.ROOT, msg.getTABLE_IN_USE_BY_MODEL(), models)); } // it is a project local table, ready to remove since no model is using it within the project TableMetadataManager metaMgr = getTableManager(); metaMgr.removeTableExt(tableName, project); metaMgr.removeSourceTable(tableName, project); // remove streaming info SourceManager sourceManager = SourceManager.getInstance(KylinConfig.getInstanceFromEnv()); ISource source = sourceManager.getCachedSource(desc); source.unloadTable(tableName, project); return rtn; }
Example 2
Source File: TableService.java From kylin with Apache License 2.0 | 5 votes |
/** * table may referenced by several projects, and kylin only keep one copy of meta for each table, * that's why we have two if statement here. * @param tableName * @param project * @return */ public boolean unloadHiveTable(String tableName, String project) throws IOException { aclEvaluate.checkProjectAdminPermission(project); Message msg = MsgPicker.getMsg(); boolean rtn = false; int tableType = 0; tableName = normalizeHiveTableName(tableName); TableDesc desc = getTableManager().getTableDesc(tableName, project); // unload of legacy global table is not supported for now if (desc == null || desc.getProject() == null) { logger.warn("Unload Table {} in Project {} failed, could not find TableDesc or related Project", tableName, project); return false; } if (!modelService.isTableInModel(desc, project)) { removeTableFromProject(tableName, project); rtn = true; } else { List<String> models = modelService.getModelsUsingTable(desc, project); throw new BadRequestException(String.format(Locale.ROOT, msg.getTABLE_IN_USE_BY_MODEL(), models)); } // it is a project local table, ready to remove since no model is using it within the project TableMetadataManager metaMgr = getTableManager(); metaMgr.removeTableExt(tableName, project); metaMgr.removeSourceTable(tableName, project); // remove streaming info SourceManager sourceManager = SourceManager.getInstance(KylinConfig.getInstanceFromEnv()); ISource source = sourceManager.getCachedSource(desc); source.unloadTable(tableName, project); return rtn; }