Java Code Examples for org.apache.kylin.metadata.project.RealizationEntry#getType()
The following examples show how to use
org.apache.kylin.metadata.project.RealizationEntry#getType() .
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: HybridManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public List<HybridInstance> getHybridInstancesByChild(RealizationType type, String realizationName) { try (AutoLock l = lock.lockForRead()) { List<HybridInstance> result = Lists.newArrayList(); for (HybridInstance hybridInstance : hybridMap.values()) { for (RealizationEntry realizationEntry : hybridInstance.getRealizationEntries()) { if (realizationEntry.getType() == type && realizationEntry.getRealization().equalsIgnoreCase(realizationName)) { result.add(hybridInstance); } } } return result; } }
Example 2
Source File: HybridCubeCLI.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void checkSegmentOffset(List<RealizationEntry> realizationEntries) { List<SegmentRange> segmentRanges = Lists.newArrayList(); for (RealizationEntry entry : realizationEntries) { if (entry.getType() != RealizationType.CUBE) { throw new IllegalArgumentException("Wrong realization type: " + entry.getType() + ", only cube supported. "); } CubeInstance cubeInstance = cubeManager.getCube(entry.getRealization()); Segments<CubeSegment> segments = cubeInstance.getSegments(); for (CubeSegment segment : segments) { segmentRanges.add(segment.getSegRange()); } } if (segmentRanges.size() >= 2) { Collections.sort(segmentRanges); for (int i = 0; i < segmentRanges.size() - 1; i++) { if (segmentRanges.get(i).overlaps(segmentRanges.get(i + 1))) { throw new IllegalArgumentException("Segments has overlap, could not hybrid. First Segment Range: [" + segmentRanges.get(i).start.v + "," + segmentRanges.get(i).end.v + "], Second Segment Range: [" + segmentRanges.get(i + 1).start.v + "," + segmentRanges.get(i + 1).end.v + "]"); } } } }
Example 3
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public List<CubeInstance> listAllCubes(String projectName) { ProjectManager projectManager = getProjectManager(); ProjectInstance project = projectManager.getProject(projectName); if (project == null) { return Collections.emptyList(); } ArrayList<CubeInstance> result = new ArrayList<CubeInstance>(); for (RealizationEntry projectDataModel : project.getRealizationEntries()) { if (projectDataModel.getType() == RealizationType.CUBE) { CubeInstance cube = getCubeManager().getCube(projectDataModel.getRealization()); if (cube != null) result.add(cube); else logger.error("Cube instance " + projectDataModel.getRealization() + " is failed to load"); } } return result; }
Example 4
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
protected boolean isCubeInProject(String projectName, CubeInstance target) { ProjectManager projectManager = getProjectManager(); ProjectInstance project = projectManager.getProject(projectName); if (project == null) { return false; } for (RealizationEntry projectDataModel : project.getRealizationEntries()) { if (projectDataModel.getType() == RealizationType.CUBE) { CubeInstance cube = getCubeManager().getCube(projectDataModel.getRealization()); if (cube == null) { logger.error("Project " + projectName + " contains realization " + projectDataModel.getRealization() + " which is not found by CubeManager"); continue; } if (cube.equals(target)) { return true; } } } return false; }
Example 5
Source File: HybridManager.java From kylin with Apache License 2.0 | 6 votes |
public List<HybridInstance> getHybridInstancesByChild(RealizationType type, String realizationName) { try (AutoLock l = lock.lockForRead()) { List<HybridInstance> result = Lists.newArrayList(); for (HybridInstance hybridInstance : hybridMap.values()) { for (RealizationEntry realizationEntry : hybridInstance.getRealizationEntries()) { if (realizationEntry.getType() == type && realizationEntry.getRealization().equalsIgnoreCase(realizationName)) { result.add(hybridInstance); } } } return result; } }
Example 6
Source File: HybridCubeCLI.java From kylin with Apache License 2.0 | 6 votes |
private void checkSegmentOffset(List<RealizationEntry> realizationEntries) { List<SegmentRange> segmentRanges = Lists.newArrayList(); for (RealizationEntry entry : realizationEntries) { if (entry.getType() != RealizationType.CUBE) { throw new IllegalArgumentException("Wrong realization type: " + entry.getType() + ", only cube supported. "); } CubeInstance cubeInstance = cubeManager.getCube(entry.getRealization()); Segments<CubeSegment> segments = cubeInstance.getSegments(); for (CubeSegment segment : segments) { segmentRanges.add(segment.getSegRange()); } } if (segmentRanges.size() >= 2) { Collections.sort(segmentRanges); for (int i = 0; i < segmentRanges.size() - 1; i++) { if (segmentRanges.get(i).overlaps(segmentRanges.get(i + 1))) { throw new IllegalArgumentException("Segments has overlap, could not hybrid. First Segment Range: [" + segmentRanges.get(i).start.v + "," + segmentRanges.get(i).end.v + "], Second Segment Range: [" + segmentRanges.get(i + 1).start.v + "," + segmentRanges.get(i + 1).end.v + "]"); } } } }
Example 7
Source File: CubeService.java From kylin with Apache License 2.0 | 6 votes |
public List<CubeInstance> listAllCubes(String projectName) { ProjectManager projectManager = getProjectManager(); ProjectInstance project = projectManager.getProject(projectName); if (project == null) { return Collections.emptyList(); } ArrayList<CubeInstance> result = new ArrayList<CubeInstance>(); for (RealizationEntry projectDataModel : project.getRealizationEntries()) { if (projectDataModel.getType() == RealizationType.CUBE) { CubeInstance cube = getCubeManager().getCube(projectDataModel.getRealization()); if (cube != null) result.add(cube); else logger.error("Cube instance " + projectDataModel.getRealization() + " is failed to load"); } } return result; }
Example 8
Source File: CubeService.java From kylin with Apache License 2.0 | 6 votes |
protected boolean isCubeInProject(String projectName, CubeInstance target) { ProjectManager projectManager = getProjectManager(); ProjectInstance project = projectManager.getProject(projectName); if (project == null) { return false; } for (RealizationEntry projectDataModel : project.getRealizationEntries()) { if (projectDataModel.getType() == RealizationType.CUBE) { CubeInstance cube = getCubeManager().getCube(projectDataModel.getRealization()); if (cube == null) { logger.error("Project " + projectName + " contains realization " + projectDataModel.getRealization() + " which is not found by CubeManager"); continue; } if (cube.equals(target)) { return true; } } } return false; }
Example 9
Source File: DashboardService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private List<CubeInstance> getCubeByHybrid(HybridInstance hybridInstance) { List<CubeInstance> cubeInstances = Lists.newArrayList(); List<RealizationEntry> realizationEntries = hybridInstance.getRealizationEntries(); for (RealizationEntry realizationEntry : realizationEntries) { String reName = realizationEntry.getRealization(); if (RealizationType.CUBE == realizationEntry.getType()) { CubeInstance cubeInstance = getCubeManager().getCube(reName); cubeInstances.add(cubeInstance); } else if (RealizationType.HYBRID == realizationEntry.getType()) { HybridInstance innerHybridInstance = getHybridManager().getHybridInstance(reName); cubeInstances.addAll(getCubeByHybrid(innerHybridInstance)); } } return cubeInstances; }
Example 10
Source File: DashboardService.java From kylin with Apache License 2.0 | 5 votes |
private List<CubeInstance> getCubeByHybrid(HybridInstance hybridInstance) { List<CubeInstance> cubeInstances = Lists.newArrayList(); List<RealizationEntry> realizationEntries = hybridInstance.getRealizationEntries(); for (RealizationEntry realizationEntry : realizationEntries) { String reName = realizationEntry.getRealization(); if (RealizationType.CUBE == realizationEntry.getType()) { CubeInstance cubeInstance = getCubeManager().getCube(reName); cubeInstances.add(cubeInstance); } else if (RealizationType.HYBRID == realizationEntry.getType()) { HybridInstance innerHybridInstance = getHybridManager().getHybridInstance(reName); cubeInstances.addAll(getCubeByHybrid(innerHybridInstance)); } } return cubeInstances; }