Java Code Examples for org.apache.kylin.common.util.StringUtil#splitByComma()
The following examples show how to use
org.apache.kylin.common.util.StringUtil#splitByComma() .
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: CubeMigrationCheckCLI.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public void check(List<String> segFullNameList) { issueExistHTables = Lists.newArrayList(); inconsistentHTables = Lists.newArrayList(); for (String segFullName : segFullNameList) { String[] sepNameList = StringUtil.splitByComma(segFullName); try { HTableDescriptor hTableDescriptor = hbaseAdmin.getTableDescriptor(TableName.valueOf(sepNameList[0])); String host = hTableDescriptor.getValue(IRealizationConstants.HTableTag); if (!dstCfg.getMetadataUrlPrefix().equalsIgnoreCase(host)) { inconsistentHTables.add(segFullName); } } catch (IOException e) { issueExistHTables.add(segFullName); continue; } } }
Example 2
Source File: TableController.java From kylin with Apache License 2.0 | 6 votes |
/** * Regenerate table cardinality * * @return Table metadata array * @throws IOException */ @RequestMapping(value = "/{project}/{tableNames}/cardinality", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody public CardinalityRequest generateCardinality(@PathVariable String tableNames, @RequestBody CardinalityRequest request, @PathVariable String project) throws Exception { String submitter = SecurityContextHolder.getContext().getAuthentication().getName(); String[] tables = StringUtil.splitByComma(tableNames); try { for (String table : tables) { tableService.calculateCardinality(table.trim().toUpperCase(Locale.ROOT), submitter, project); } } catch (IOException e) { logger.error("Failed to calculate cardinality", e); throw new InternalErrorException(e.getLocalizedMessage(), e); } return request; }
Example 3
Source File: TableController.java From kylin with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/{tables}/{project}", method = { RequestMethod.DELETE }, produces = { "application/json" }) @ResponseBody public Map<String, String[]> unLoadHiveTables(@PathVariable String tables, @PathVariable String project) { Set<String> unLoadSuccess = Sets.newHashSet(); Set<String> unLoadFail = Sets.newHashSet(); Map<String, String[]> result = new HashMap<String, String[]>(); try { for (String tableName : StringUtil.splitByComma(tables)) { tableACLService.deleteFromTableACLByTbl(project, tableName); if (tableService.unloadHiveTable(tableName, project)) { unLoadSuccess.add(tableName); } else { unLoadFail.add(tableName); } } } catch (Throwable e) { logger.error("Failed to unload Hive Table", e); throw new InternalErrorException(e.getLocalizedMessage(), e); } result.put("result.unload.success", (String[]) unLoadSuccess.toArray(new String[unLoadSuccess.size()])); result.put("result.unload.fail", (String[]) unLoadFail.toArray(new String[unLoadFail.size()])); return result; }
Example 4
Source File: InitialTaskManager.java From kylin with Apache License 2.0 | 6 votes |
private void runInitialTasks() { // init metrics system for kylin QueryMetricsFacade.init(); QueryMetrics2Facade.init(); KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv(); String initTasks = kylinConfig.getInitTasks(); if (!StringUtils.isEmpty(initTasks)) { String[] taskClasses = StringUtil.splitByComma(initTasks); for (String taskClass : taskClasses) { try { InitialTask task = (InitialTask) Class.forName(taskClass).newInstance(); logger.info("Running initial task: " + taskClass); task.execute(); } catch (Throwable e) { logger.error("Initial task failed: " + taskClass, e); } } logger.info("All initial tasks finished."); } }
Example 5
Source File: CubeSignatureRefresher.java From kylin with Apache License 2.0 | 6 votes |
public void update() { logger.info("Reloading Cube Metadata from store: " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); CubeDescManager cubeDescManager = CubeDescManager.getInstance(config); List<CubeDesc> cubeDescs; if (ArrayUtils.isEmpty(cubeNames)) { cubeDescs = cubeDescManager.listAllDesc(); } else { String[] names = StringUtil.splitByComma(cubeNames[0]); if (ArrayUtils.isEmpty(names)) return; cubeDescs = Lists.newArrayListWithCapacity(names.length); for (String name : names) { cubeDescs.add(cubeDescManager.getCubeDesc(name)); } } for (CubeDesc cubeDesc : cubeDescs) { updateCubeDesc(cubeDesc); } verify(); }
Example 6
Source File: CubeMigrationCheckCLI.java From kylin with Apache License 2.0 | 6 votes |
public void check(List<String> segFullNameList) { issueExistHTables = Lists.newArrayList(); inconsistentHTables = Lists.newArrayList(); for (String segFullName : segFullNameList) { String[] sepNameList = StringUtil.splitByComma(segFullName); try { HTableDescriptor hTableDescriptor = hbaseAdmin.getTableDescriptor(TableName.valueOf(sepNameList[0])); String host = hTableDescriptor.getValue(IRealizationConstants.HTableTag); if (!dstCfg.getMetadataUrlPrefix().equalsIgnoreCase(host)) { inconsistentHTables.add(segFullName); } } catch (IOException e) { issueExistHTables.add(segFullName); continue; } } }
Example 7
Source File: TableController.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
/** * Regenerate table cardinality * * @return Table metadata array * @throws IOException */ @RequestMapping(value = "/{project}/{tableNames}/cardinality", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody public CardinalityRequest generateCardinality(@PathVariable String tableNames, @RequestBody CardinalityRequest request, @PathVariable String project) throws Exception { String submitter = SecurityContextHolder.getContext().getAuthentication().getName(); String[] tables = StringUtil.splitByComma(tableNames); try { for (String table : tables) { tableService.calculateCardinality(table.trim().toUpperCase(Locale.ROOT), submitter, project); } } catch (IOException e) { logger.error("Failed to calculate cardinality", e); throw new InternalErrorException(e.getLocalizedMessage(), e); } return request; }
Example 8
Source File: TableController.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/{tables}/{project}", method = { RequestMethod.DELETE }, produces = { "application/json" }) @ResponseBody public Map<String, String[]> unLoadHiveTables(@PathVariable String tables, @PathVariable String project) { Set<String> unLoadSuccess = Sets.newHashSet(); Set<String> unLoadFail = Sets.newHashSet(); Map<String, String[]> result = new HashMap<String, String[]>(); try { for (String tableName : StringUtil.splitByComma(tables)) { tableACLService.deleteFromTableACLByTbl(project, tableName); if (tableService.unloadHiveTable(tableName, project)) { unLoadSuccess.add(tableName); } else { unLoadFail.add(tableName); } } } catch (Throwable e) { logger.error("Failed to unload Hive Table", e); throw new InternalErrorException(e.getLocalizedMessage(), e); } result.put("result.unload.success", (String[]) unLoadSuccess.toArray(new String[unLoadSuccess.size()])); result.put("result.unload.fail", (String[]) unLoadFail.toArray(new String[unLoadFail.size()])); return result; }
Example 9
Source File: InitialTaskManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void runInitialTasks() { // init metrics system for kylin QueryMetricsFacade.init(); QueryMetrics2Facade.init(); KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv(); String initTasks = kylinConfig.getInitTasks(); if (!StringUtils.isEmpty(initTasks)) { String[] taskClasses = StringUtil.splitByComma(initTasks); for (String taskClass : taskClasses) { try { InitialTask task = (InitialTask) Class.forName(taskClass).newInstance(); logger.info("Running initial task: " + taskClass); task.execute(); } catch (Throwable e) { logger.error("Initial task failed: " + taskClass, e); } } logger.info("All initial tasks finished."); } }
Example 10
Source File: CubeSignatureRefresher.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public void update() { logger.info("Reloading Cube Metadata from store: " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); CubeDescManager cubeDescManager = CubeDescManager.getInstance(config); List<CubeDesc> cubeDescs; if (ArrayUtils.isEmpty(cubeNames)) { cubeDescs = cubeDescManager.listAllDesc(); } else { String[] names = StringUtil.splitByComma(cubeNames[0]); if (ArrayUtils.isEmpty(names)) return; cubeDescs = Lists.newArrayListWithCapacity(names.length); for (String name : names) { cubeDescs.add(cubeDescManager.getCubeDesc(name)); } } for (CubeDesc cubeDesc : cubeDescs) { updateCubeDesc(cubeDesc); } verify(); }
Example 11
Source File: OLAPAuthentication.java From kylin with Apache License 2.0 | 5 votes |
public void parseUserInfo(String userInfo) { String[] info = StringUtil.splitByComma(userInfo); if (info.length > 0) //first element is username this.username = info[0]; for (int i = 1; i < info.length; i++) //the remains should be roles which starts from index 1 this.roles.add(info[i]); }
Example 12
Source File: LookupMaterializeContext.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
/** * parse the lookup snapshot string to lookup snapshot path map. * @param snapshotsString * @return */ public static Map<String, String> parseLookupSnapshots(String snapshotsString) { Map<String, String> lookupSnapshotMap = Maps.newHashMap(); String[] lookupSnapshotEntries = StringUtil.splitByComma(snapshotsString); for (String lookupSnapshotEntryStr : lookupSnapshotEntries) { String[] split = StringUtil.split(lookupSnapshotEntryStr, "="); lookupSnapshotMap.put(split[0], split[1]); } return lookupSnapshotMap; }
Example 13
Source File: CubeMigrationCheckCLI.java From kylin with Apache License 2.0 | 5 votes |
public void printIssueExistingHTables() { logger.info("------ HTables exist issues in hbase : not existing, metadata broken ------"); for (String segFullName : issueExistHTables) { String[] sepNameList = StringUtil.splitByComma(segFullName); logger.error(sepNameList[0] + " belonging to cube " + sepNameList[1] + " has some issues and cannot be read successfully!!!"); } logger.info("----------------------------------------------------"); }
Example 14
Source File: HBaseUsageExtractor.java From kylin with Apache License 2.0 | 5 votes |
@Override protected void executeExtract(OptionsHelper optionsHelper, File exportDir) throws Exception { if (cachedHMasterUrl == null) { return; } kylinConfig = KylinConfig.getInstanceFromEnv(); cubeManager = CubeManager.getInstance(kylinConfig); realizationRegistry = RealizationRegistry.getInstance(kylinConfig); projectManager = ProjectManager.getInstance(kylinConfig); if (optionsHelper.hasOption(OPTION_PROJECT)) { String projectNames = optionsHelper.getOptionValue(OPTION_PROJECT); for (String projectName : StringUtil.splitByComma(projectNames)) { ProjectInstance projectInstance = projectManager.getProject(projectName); if (projectInstance == null) { throw new IllegalArgumentException("Project " + projectName + " does not exist"); } List<RealizationEntry> realizationEntries = projectInstance.getRealizationEntries(); for (RealizationEntry realizationEntry : realizationEntries) { retrieveResourcePath(getRealization(realizationEntry)); } } } else if (optionsHelper.hasOption(OPTION_CUBE)) { String cubeNames = optionsHelper.getOptionValue(OPTION_CUBE); for (String cubeName : StringUtil.splitByComma(cubeNames)) { IRealization realization = cubeManager.getRealization(cubeName); if (realization != null) { retrieveResourcePath(realization); } else { throw new IllegalArgumentException("No cube found with name of " + cubeName); } } } extractCommonInfo(exportDir, kylinConfig); extractHTables(exportDir); }
Example 15
Source File: ITInMemCubeBuilderTest.java From kylin with Apache License 2.0 | 5 votes |
private static List<String> readValueList(String flatTable, int nColumns, int c) throws IOException { List<String> result = Lists.newArrayList(); List<String> lines = FileUtils.readLines(new File(flatTable), "UTF-8"); for (String line : lines) { String[] row = StringUtil.splitByComma(line.trim()); if (row.length != nColumns) { throw new IllegalStateException(); } if (row[c] != null) { result.add(row[c]); } } return result; }
Example 16
Source File: LookupMaterializeContext.java From kylin with Apache License 2.0 | 5 votes |
/** * parse the lookup snapshot string to lookup snapshot path map. * @param snapshotsString * @return */ public static Map<String, String> parseLookupSnapshots(String snapshotsString) { Map<String, String> lookupSnapshotMap = Maps.newHashMap(); String[] lookupSnapshotEntries = StringUtil.splitByComma(snapshotsString); for (String lookupSnapshotEntryStr : lookupSnapshotEntries) { String[] split = StringUtil.split(lookupSnapshotEntryStr, "="); lookupSnapshotMap.put(split[0], split[1]); } return lookupSnapshotMap; }
Example 17
Source File: ITInMemCubeBuilderTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private static List<String> readValueList(String flatTable, int nColumns, int c) throws IOException { List<String> result = Lists.newArrayList(); List<String> lines = FileUtils.readLines(new File(flatTable), "UTF-8"); for (String line : lines) { String[] row = StringUtil.splitByComma(line.trim()); if (row.length != nColumns) { throw new IllegalStateException(); } if (row[c] != null) { result.add(row[c]); } } return result; }
Example 18
Source File: HBaseUsageExtractor.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Override protected void executeExtract(OptionsHelper optionsHelper, File exportDir) throws Exception { if (cachedHMasterUrl == null) { return; } kylinConfig = KylinConfig.getInstanceFromEnv(); cubeManager = CubeManager.getInstance(kylinConfig); realizationRegistry = RealizationRegistry.getInstance(kylinConfig); projectManager = ProjectManager.getInstance(kylinConfig); if (optionsHelper.hasOption(OPTION_PROJECT)) { String projectNames = optionsHelper.getOptionValue(OPTION_PROJECT); for (String projectName : StringUtil.splitByComma(projectNames)) { ProjectInstance projectInstance = projectManager.getProject(projectName); if (projectInstance == null) { throw new IllegalArgumentException("Project " + projectName + " does not exist"); } List<RealizationEntry> realizationEntries = projectInstance.getRealizationEntries(); for (RealizationEntry realizationEntry : realizationEntries) { retrieveResourcePath(getRealization(realizationEntry)); } } } else if (optionsHelper.hasOption(OPTION_CUBE)) { String cubeNames = optionsHelper.getOptionValue(OPTION_CUBE); for (String cubeName : StringUtil.splitByComma(cubeNames)) { IRealization realization = cubeManager.getRealization(cubeName); if (realization != null) { retrieveResourcePath(realization); } else { throw new IllegalArgumentException("No cube found with name of " + cubeName); } } } extractCommonInfo(exportDir, kylinConfig); extractHTables(exportDir); }
Example 19
Source File: CubeMigrationCheckCLI.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public void printIssueExistingHTables() { logger.info("------ HTables exist issues in hbase : not existing, metadata broken ------"); for (String segFullName : issueExistHTables) { String[] sepNameList = StringUtil.splitByComma(segFullName); logger.error(sepNameList[0] + " belonging to cube " + sepNameList[1] + " has some issues and cannot be read successfully!!!"); } logger.info("----------------------------------------------------"); }
Example 20
Source File: OLAPAuthentication.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public void parseUserInfo(String userInfo) { String[] info = StringUtil.splitByComma(userInfo); if (info.length > 0) //first element is username this.username = info[0]; for (int i = 1; i < info.length; i++) //the remains should be roles which starts from index 1 this.roles.add(info[i]); }