Java Code Examples for org.apache.kylin.cube.model.CubeDesc#listDimensionColumnsIncludingDerived()
The following examples show how to use
org.apache.kylin.cube.model.CubeDesc#listDimensionColumnsIncludingDerived() .
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: ModelService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public Map<TblColRef, Set<CubeInstance>> getUsedDimCols(String modelName, String project) { Map<TblColRef, Set<CubeInstance>> ret = Maps.newHashMap(); List<CubeInstance> cubeInstances = cubeService.listAllCubes(null, project, modelName, true); for (CubeInstance cubeInstance : cubeInstances) { CubeDesc cubeDesc = cubeInstance.getDescriptor(); for (TblColRef tblColRef : cubeDesc.listDimensionColumnsIncludingDerived()) { if (ret.containsKey(tblColRef)) { ret.get(tblColRef).add(cubeInstance); } else { Set<CubeInstance> set = Sets.newHashSet(cubeInstance); ret.put(tblColRef, set); } } } return ret; }
Example 2
Source File: ModelService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private Map<String, List<String>> getInfluencedCubesByDims(List<String> dims, List<CubeInstance> cubes) { Map<String, List<String>> influencedCubes = new HashMap<>(); for (CubeInstance cubeInstance : cubes) { CubeDesc cubeDesc = cubeInstance.getDescriptor(); for (TblColRef tblColRef : cubeDesc.listDimensionColumnsIncludingDerived()) { if (dims.contains(tblColRef.getIdentity())) continue; if (influencedCubes.get(tblColRef.getIdentity()) == null) { List<String> candidates = new ArrayList<>(); candidates.add(cubeInstance.getName()); influencedCubes.put(tblColRef.getIdentity(), candidates); } else influencedCubes.get(tblColRef.getIdentity()).add(cubeInstance.getName()); } } return influencedCubes; }
Example 3
Source File: ModelService.java From kylin with Apache License 2.0 | 6 votes |
public Map<TblColRef, Set<CubeInstance>> getUsedDimCols(String modelName, String project) { Map<TblColRef, Set<CubeInstance>> ret = Maps.newHashMap(); List<CubeInstance> cubeInstances = cubeService.listAllCubes(null, project, modelName, true); for (CubeInstance cubeInstance : cubeInstances) { CubeDesc cubeDesc = cubeInstance.getDescriptor(); for (TblColRef tblColRef : cubeDesc.listDimensionColumnsIncludingDerived()) { if (ret.containsKey(tblColRef)) { ret.get(tblColRef).add(cubeInstance); } else { Set<CubeInstance> set = Sets.newHashSet(cubeInstance); ret.put(tblColRef, set); } } } return ret; }
Example 4
Source File: ModelService.java From kylin with Apache License 2.0 | 6 votes |
private Map<String, List<String>> getInfluencedCubesByDims(List<String> dims, List<CubeInstance> cubes) { Map<String, List<String>> influencedCubes = new HashMap<>(); for (CubeInstance cubeInstance : cubes) { CubeDesc cubeDesc = cubeInstance.getDescriptor(); for (TblColRef tblColRef : cubeDesc.listDimensionColumnsIncludingDerived()) { if (dims.contains(tblColRef.getIdentity())) continue; if (influencedCubes.get(tblColRef.getIdentity()) == null) { List<String> candidates = new ArrayList<>(); candidates.add(cubeInstance.getName()); influencedCubes.put(tblColRef.getIdentity(), candidates); } else influencedCubes.get(tblColRef.getIdentity()).add(cubeInstance.getName()); } } return influencedCubes; }
Example 5
Source File: CubeCapabilityChecker.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private static Set<FunctionDesc> unmatchedAggregations(Collection<FunctionDesc> aggregations, CubeInstance cube) { HashSet<FunctionDesc> result = Sets.newHashSet(aggregations); CubeDesc cubeDesc = cube.getDescriptor(); List<FunctionDesc> definedFuncs = cubeDesc.listAllFunctions(); // check normal aggregations result.removeAll(definedFuncs); // check dynamic aggregations Iterator<FunctionDesc> funcIterator = result.iterator(); while (funcIterator.hasNext()) { FunctionDesc entry = funcIterator.next(); if (entry instanceof DynamicFunctionDesc) { DynamicFunctionDesc dynFunc = (DynamicFunctionDesc) entry; // Filter columns cannot be derived Collection<TblColRef> definedCols = dynFunc.ifFriendlyForDerivedFilter() ? cubeDesc.listDimensionColumnsIncludingDerived() : cubeDesc.listDimensionColumnsExcludingDerived(true); Set<TblColRef> filterCols = Sets.newHashSet(dynFunc.getFilterColumnSet()); filterCols.removeAll(definedCols); if (!filterCols.isEmpty()) { continue; } // All inner funcs should be defined Set<FunctionDesc> innerFuncSet = Sets.newHashSet(dynFunc.getRuntimeFuncs()); innerFuncSet.removeAll(definedFuncs); if (!innerFuncSet.isEmpty()) { continue; } funcIterator.remove(); } } return result; }
Example 6
Source File: CubeCapabilityChecker.java From kylin with Apache License 2.0 | 5 votes |
private static Set<FunctionDesc> unmatchedAggregations(Collection<FunctionDesc> aggregations, CubeInstance cube) { HashSet<FunctionDesc> result = Sets.newHashSet(aggregations); CubeDesc cubeDesc = cube.getDescriptor(); List<FunctionDesc> definedFuncs = cubeDesc.listAllFunctions(); // check normal aggregations result.removeAll(definedFuncs); // check dynamic aggregations Iterator<FunctionDesc> funcIterator = result.iterator(); while (funcIterator.hasNext()) { FunctionDesc entry = funcIterator.next(); if (entry instanceof DynamicFunctionDesc) { DynamicFunctionDesc dynFunc = (DynamicFunctionDesc) entry; // Filter columns cannot be derived Collection<TblColRef> definedCols = dynFunc.ifFriendlyForDerivedFilter() ? cubeDesc.listDimensionColumnsIncludingDerived() : cubeDesc.listDimensionColumnsExcludingDerived(true); Set<TblColRef> filterCols = Sets.newHashSet(dynFunc.getRuntimeDimensions()); filterCols.removeAll(definedCols); if (!filterCols.isEmpty()) { continue; } // All inner funcs should be defined Set<FunctionDesc> innerFuncSet = Sets.newHashSet(dynFunc.getRuntimeFuncMap().values()); innerFuncSet.removeAll(definedFuncs); if (!innerFuncSet.isEmpty()) { continue; } funcIterator.remove(); } } return result; }