private void buildRowKey(Map<String, TblColRef> colNameAbbr) { columnMap = new HashMap<TblColRef, RowKeyColDesc>(); mandatoryColumnMask = 0; for (int i = 0; i < rowkeyColumns.length; i++) { RowKeyColDesc rowKeyColDesc = rowkeyColumns[i]; String column = rowKeyColDesc.getColumn(); rowKeyColDesc.setColumn(column.toUpperCase()); rowKeyColDesc.setBitIndex(rowkeyColumns.length - i - 1); rowKeyColDesc.setColRef(colNameAbbr.get(column)); if (rowKeyColDesc.getColRef() == null) { throw new IllegalArgumentException("Cannot find rowkey column " + column + " in cube " + cubeDesc); } columnMap.put(rowKeyColDesc.getColRef(), rowKeyColDesc); if (rowKeyColDesc.isMandatory()) { mandatoryColumnMask |= 1L << rowKeyColDesc.getBitIndex(); } } }
@Override public void validate(CubeDesc cube, ValidateContext context) { Set<String> mands = new HashSet<String>(); RowKeyColDesc[] cols = cube.getRowkey().getRowKeyColumns(); if (cols == null || cols.length == 0) { return; } for (int i = 0; i < cols.length; i++) { RowKeyColDesc rowKeyColDesc = cols[i]; if (rowKeyColDesc.isMandatory()) { mands.add(rowKeyColDesc.getColumn()); } } if (mands.isEmpty()) { return; } String[][] groups = cube.getRowkey().getAggregationGroups(); for (int i = 0; i < groups.length; i++) { String[] group = groups[i]; for (int j = 0; j < group.length; j++) { String col = group[j]; if (mands.contains(col)) { context.addResult(ResultLevel.ERROR, "mandatory column " + col + " must not be in aggregation group [" + ArrayUtils.toString(group) + "]"); } } } }
private void buildRowKey(Map<String, TblColRef> colNameAbbr) { columnMap = new HashMap<TblColRef, RowKeyColDesc>(); mandatoryColumnMask = 0; for (int i = 0; i < rowkeyColumns.length; i++) { RowKeyColDesc rowKeyColDesc = rowkeyColumns[i]; String column = rowKeyColDesc.getColumn(); rowKeyColDesc.setColumn(column.toUpperCase()); rowKeyColDesc.setBitIndex(rowkeyColumns.length - i - 1); rowKeyColDesc.setColRef(colNameAbbr.get(column)); if (rowKeyColDesc.getColRef() == null) { throw new IllegalArgumentException("Cannot find rowkey column " + column + " in cube " + cubeDesc); } columnMap.put(rowKeyColDesc.getColRef(), rowKeyColDesc); if (rowKeyColDesc.isMandatory()) { mandatoryColumnMask |= 1L << rowKeyColDesc.getBitIndex(); } } }
@Override public void validate(CubeDesc cube, ValidateContext context) { Set<String> mands = new HashSet<String>(); RowKeyColDesc[] cols = cube.getRowkey().getRowKeyColumns(); if (cols == null || cols.length == 0) { return; } for (int i = 0; i < cols.length; i++) { RowKeyColDesc rowKeyColDesc = cols[i]; if (rowKeyColDesc.isMandatory()) { mands.add(rowKeyColDesc.getColumn()); } } if (mands.isEmpty()) { return; } String[][] groups = cube.getRowkey().getAggregationGroups(); for (int i = 0; i < groups.length; i++) { String[] group = groups[i]; for (int j = 0; j < group.length; j++) { String col = group[j]; if (mands.contains(col)) { context.addResult(ResultLevel.ERROR, "mandatory column " + col + " must not be in aggregation group [" + ArrayUtils.toString(group) + "]"); } } } }