private void buildPartialCubeFullMask(RowKeyDesc rowKeyDesc) { Preconditions.checkState(this.includes != null); Preconditions.checkState(this.includes.length != 0); partialCubeFullMask = 0L; for (String dim : this.includes) { TblColRef hColumn = cubeDesc.getModel().findColumn(dim); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); long bit = 1L << index; partialCubeFullMask |= bit; } }
private void buildMandatoryColumnMask(RowKeyDesc rowKeyDesc) { mandatoryColumnMask = 0L; String[] mandatory_dims = this.selectRule.mandatoryDims; if (mandatory_dims == null || mandatory_dims.length == 0) { return; } for (String dim : mandatory_dims) { TblColRef hColumn = cubeDesc.getModel().findColumn(dim); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); mandatoryColumnMask |= (1L << index); } }
for (int i = 0; i < hierarchy_dims.length; i++) { TblColRef hColumn = cubeDesc.getModel().findColumn(hierarchy_dims[i]); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); long bit = 1L << index;
private void buildJointColumnMask(RowKeyDesc rowKeyDesc) { joints = Lists.newArrayList(); dim2JointMap = Maps.newHashMap(); if (this.selectRule.jointDims == null || this.selectRule.jointDims.length == 0) { return; } for (String[] jointDims : this.selectRule.jointDims) { if (jointDims == null || jointDims.length == 0) { continue; } long joint = 0L; for (int i = 0; i < jointDims.length; i++) { TblColRef hColumn = cubeDesc.getModel().findColumn(jointDims[i]); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); long bit = 1L << index; joint |= bit; } Preconditions.checkState(joint != 0); joints.add(joint); } for (long jt : joints) { for (int i = 0; i < 64; i++) { if (((1L << i) & jt) != 0) { dim2JointMap.put((1L << i), jt); } } } }
public static long toCuboidId(CubeDesc cubeDesc, Set<TblColRef> dimensions, Collection<FunctionDesc> metrics) { for (FunctionDesc metric : metrics) { if (metric.getMeasureType().onlyAggrInBaseCuboid()) return Cuboid.getBaseCuboidId(cubeDesc); } long cuboidID = 0; for (TblColRef column : dimensions) { int index = cubeDesc.getRowkey().getColumnBitIndex(column); cuboidID |= 1L << index; } return cuboidID; }
private long calculateCuboidID(CubeDesc cube, Collection<TblColRef> dimensions) { long cuboidID = 0; for (TblColRef column : dimensions) { int index = cube.getRowkey().getColumnBitIndex(column); cuboidID |= 1L << index; } return cuboidID; }
private Cuboid identifyCuboid(Set<TblColRef> dimensions) { long cuboidID = 0; for (TblColRef column : dimensions) { int index = cubeDesc.getRowkey().getColumnBitIndex(column); cuboidID |= 1L << index; } return Cuboid.findById(cubeDesc, cuboidID); }
private void buildHierarchyMasks() { this.hierarchyMasks = new ArrayList<HierarchyMask>(); for (DimensionDesc dimension : this.cubeDesc.getDimensions()) { HierarchyDesc[] hierarchies = dimension.getHierarchy(); if (hierarchies == null || hierarchies.length == 0) continue; HierarchyMask mask = new HierarchyMask(); ArrayList<Long> allMaskList = new ArrayList<Long>(); for (int i = 0; i < hierarchies.length; i++) { TblColRef hColumn = hierarchies[i].getColumnRef(); Integer index = getColumnBitIndex(hColumn); long bit = 1L << index; if ((tailMask & bit) > 0) continue; // ignore levels in tail, they don't participate // aggregation group combination anyway mask.fullMask |= bit; allMaskList.add(mask.fullMask); } mask.allMasks = new long[allMaskList.size()]; for (int i = 0; i < allMaskList.size(); i++) mask.allMasks[i] = allMaskList.get(i); this.hierarchyMasks.add(mask); } }
private static RowKeyColInfo extractRowKeyInfo(CubeDesc cubeDesc) { RowKeyDesc rowKeyDesc = cubeDesc.getRowkey(); RowKeyColInfo info = new RowKeyColInfo(); info.hierachyColBitIndice = new ArrayList<List<Integer>>(); info.nonHierachyColBitIndice = new ArrayList<Integer>(); HashSet<Integer> heirachyIndexSet = new HashSet<Integer>(); for (DimensionDesc dim : cubeDesc.getDimensions()) { if (dim.getHierarchy() != null) { LinkedList<Integer> hlist = new LinkedList<Integer>(); for (HierarchyDesc hierarchyDesc : dim.getHierarchy()) { int index = rowKeyDesc.getColumnBitIndex(hierarchyDesc.getColumnRef()); hlist.add(index); heirachyIndexSet.add(index); } info.hierachyColBitIndice.add(hlist); } } for (int i = 0; i < rowKeyDesc.getRowKeyColumns().length; ++i) { if (!heirachyIndexSet.contains(i)) { info.nonHierachyColBitIndice.add(i); } } return info; }
throw new IllegalArgumentException("Can't find aggregation column " + aggGrp[j] + " in cube " + this.cubeDesc.getName()); Integer index = getColumnBitIndex(aggCol); mask.groupMask |= 1L << index; mask.groupOneBitMasks[j] = 1L << index;
private void buildPartialCubeFullMask(RowKeyDesc rowKeyDesc) { Preconditions.checkState(this.includes != null); Preconditions.checkState(this.includes.length != 0); partialCubeFullMask = 0L; for (String dim : this.includes) { TblColRef hColumn = cubeDesc.getModel().findColumn(dim); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); long bit = 1L << index; partialCubeFullMask |= bit; } }
private void buildMandatoryColumnMask(RowKeyDesc rowKeyDesc) { mandatoryColumnMask = 0L; String[] mandatory_dims = this.selectRule.mandatoryDims; if (mandatory_dims == null || mandatory_dims.length == 0) { return; } for (String dim : mandatory_dims) { TblColRef hColumn = cubeDesc.getModel().findColumn(dim); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); mandatoryColumnMask |= (1L << index); } }
for (int i = 0; i < hierarchy_dims.length; i++) { TblColRef hColumn = cubeDesc.getModel().findColumn(hierarchy_dims[i]); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); long bit = 1L << index;
private void buildJointColumnMask(RowKeyDesc rowKeyDesc) { joints = Lists.newArrayList(); dim2JointMap = Maps.newHashMap(); if (this.selectRule.jointDims == null || this.selectRule.jointDims.length == 0) { return; } for (String[] jointDims : this.selectRule.jointDims) { if (jointDims == null || jointDims.length == 0) { continue; } long joint = 0L; for (int i = 0; i < jointDims.length; i++) { TblColRef hColumn = cubeDesc.getModel().findColumn(jointDims[i]); Integer index = rowKeyDesc.getColumnBitIndex(hColumn); long bit = 1L << index; joint |= bit; } Preconditions.checkState(joint != 0); joints.add(joint); } for (long jt : joints) { for (int i = 0; i < 64; i++) { if (((1L << i) & jt) != 0) { dim2JointMap.put((1L << i), jt); } } } }
private void buildHierarchyMasks() { this.hierarchyMasks = new ArrayList<HierarchyMask>(); for (DimensionDesc dimension : this.cubeDesc.getDimensions()) { HierarchyDesc[] hierarchies = dimension.getHierarchy(); if (hierarchies == null || hierarchies.length == 0) continue; HierarchyMask mask = new HierarchyMask(); ArrayList<Long> allMaskList = new ArrayList<Long>(); for (int i = 0; i < hierarchies.length; i++) { TblColRef hColumn = hierarchies[i].getColumnRef(); Integer index = getColumnBitIndex(hColumn); long bit = 1L << index; if ((tailMask & bit) > 0) continue; // ignore levels in tail, they don't participate // aggregation group combination anyway mask.fullMask |= bit; allMaskList.add(mask.fullMask); } mask.allMasks = new long[allMaskList.size()]; for (int i = 0; i < allMaskList.size(); i++) mask.allMasks[i] = allMaskList.get(i); this.hierarchyMasks.add(mask); } }
private static RowKeyColInfo extractRowKeyInfo(CubeDesc cubeDesc) { RowKeyDesc rowKeyDesc = cubeDesc.getRowkey(); RowKeyColInfo info = new RowKeyColInfo(); info.hierachyColBitIndice = new ArrayList<List<Integer>>(); info.nonHierachyColBitIndice = new ArrayList<Integer>(); HashSet<Integer> heirachyIndexSet = new HashSet<Integer>(); for (DimensionDesc dim : cubeDesc.getDimensions()) { if (dim.getHierarchy() != null) { LinkedList<Integer> hlist = new LinkedList<Integer>(); for (HierarchyDesc hierarchyDesc : dim.getHierarchy()) { int index = rowKeyDesc.getColumnBitIndex(hierarchyDesc.getColumnRef()); hlist.add(index); heirachyIndexSet.add(index); } info.hierachyColBitIndice.add(hlist); } } for (int i = 0; i < rowKeyDesc.getRowKeyColumns().length; ++i) { if (!heirachyIndexSet.contains(i)) { info.nonHierachyColBitIndice.add(i); } } return info; }
public static long toCuboidId(CubeDesc cubeDesc, Set<TblColRef> dimensions, Collection<FunctionDesc> metrics) { for (FunctionDesc metric : metrics) { if (metric.getMeasureType().onlyAggrInBaseCuboid()) return Cuboid.getBaseCuboidId(cubeDesc); } long cuboidID = 0; for (TblColRef column : dimensions) { int index = cubeDesc.getRowkey().getColumnBitIndex(column); cuboidID |= 1L << index; } return cuboidID; }
throw new IllegalArgumentException("Can't find aggregation column " + aggGrp[j] + " in cube " + this.cubeDesc.getName()); Integer index = getColumnBitIndex(aggCol); mask.groupMask |= 1L << index; mask.groupOneBitMasks[j] = 1L << index;
for (int i = hierarchies.length - 1; i >= 0; i--) { TblColRef hColumn = hierarchies[i].getColumnRef(); Integer index = rowkey.getColumnBitIndex(hColumn); long bit = 1L << index;