QueryUtil { public static byte[] getMaxKeyBasedOnDimensions(List<QueryDimension> queryDimensions, KeyGenerator generator) throws KeyGenException { long[] max = new long[generator.getDimCount()]; Arrays.fill(max, 0L); for (int i = 0; i < queryDimensions.size(); i++) { if (queryDimensions.get(i).getDimension().getKeyOrdinal() == -1) { continue; } max[queryDimensions.get(i).getDimension().getKeyOrdinal()] = Long.MAX_VALUE; } return generator.generateKey(max); }  static int[] getMaskedByteRange(List<QueryDimension> queryDimensions,
      KeyGenerator keyGenerator); static int[] getMaskedByteRangeBasedOrdinal(List<Integer> ordinals,
      KeyGenerator keyGenerator); static byte[] getMaxKeyBasedOnOrinal(List<Integer> keyOrdinalList, KeyGenerator generator); static byte[] getMaxKeyBasedOnDimensions(List<QueryDimension> queryDimensions,
      KeyGenerator generator); static int[] getMaskedByte(int keySize, int[] maskedKeyRanges); static int[] getDimensionsBlockIndexes(List<QueryDimension> queryDimensions,
      Map<Integer, Integer> dimensionOrdinalToBlockMapping,
      List<CarbonDimension> customAggregationDimension); static Map<String, Dictionary> getDimensionDictionaryDetail(
      List<QueryDimension> queryDimensions,
      Set<CarbonDimension> filterComplexDimensions,
      AbsoluteTableIdentifier absoluteTableIdentifier); static int[] getMeasureBlockIndexes(List<QueryMeasure> queryMeasures,
      List<CarbonMeasure> expressionMeasure, Map<Integer, Integer> ordinalToBlockIndexMapping); static int[][] getMaskedByteRangeForSorting(List<QueryDimension> orderByDimensions,
      KeyGenerator generator, int[] maskedRanges); static byte[][] getMaksedKeyForSorting(List<QueryDimension> orderDimensions,
      KeyGenerator generator, int[][] maskedByteRangeForSorting, int[] maskedRanges); static byte[] getSortDimensionIndexes(List<QueryDimension> sortedDimensions,
      List<QueryDimension> queryDimensions); static Map<Integer, KeyStructureInfo> getColumnGroupKeyStructureInfo(
      List<QueryDimension> queryDimensions, SegmentProperties segmentProperties); static boolean searchInArray(int[] data, int key); static byte[] getMaskedKey(byte[] data, byte[] maxKey, int[] maskByteRanges,
      int byteCount); static void fillQueryDimensionsBlockIndexes(List<QueryDimension> queryDimensions,
      Map<Integer, Integer> columnOrdinalToBlockIndexMapping,
      Set<Integer> dictionaryDimensionBlockIndex, List<Integer> noDictionaryDimensionBlockIndex); static void resolveQueryModel(QueryModel queryModel); static int[] getNumberTypeIndex(List<String> aggType); static int[] getActualTypeIndex(List<String> aggType); static KeyStructureInfo getKeyStructureInfo(SegmentProperties segmentProperties,
      DimColumnResolvedFilterInfo dimColumnEvaluatorInfo); static int getColumnGroupId(SegmentProperties segmentProperties, int ordinal); static Map<Integer, GenericQueryType> getComplexDimensionsMap(
      List<QueryDimension> queryDimensions, Map<Integer, Integer> dimensionToBlockIndexMap,
      int[] eachComplexColumnValueSize, Map<String, Dictionary> columnIdToDictionaryMap,
      Set<CarbonDimension> filterDimensions); static Set<CarbonDimension> getAllFilterDimensions(FilterResolverIntf filterResolverTree);  }
@Test public void testGetMaxKeyBasedOnDimensions() { List<QueryDimension> dimensions = new ArrayList<QueryDimension>(); for (int i = 0; i < 2; i++) { QueryDimension dimension = new QueryDimension(segmentProperties.getDimensions().get(i).getColName()); dimension.setDimension(segmentProperties.getDimensions().get(i)); dimensions.add(dimension); } byte[] maxKeyBasedOnDimensions = null; try { maxKeyBasedOnDimensions = QueryUtil .getMaxKeyBasedOnDimensions(dimensions, segmentProperties.getDimensionKeyGenerator()); } catch (KeyGenException e) { assertTrue(false); } byte[] expectedMaxKeyBasedOnDimensions = { -1, 0, 0, 0, 0, 0 }; for (int i = 0; i < expectedMaxKeyBasedOnDimensions.length; i++) { if (expectedMaxKeyBasedOnDimensions[i] != maxKeyBasedOnDimensions[i]) { assertTrue(false); } } long[] expectedKeyArray = { 255, 0, 0, 0, 0, 0 }; long[] keyArray = segmentProperties.getDimensionKeyGenerator().getKeyArray(maxKeyBasedOnDimensions); for (int i = 0; i < keyArray.length; i++) { if (expectedKeyArray[i] != keyArray[i]) { assertTrue(false); } } }