public void aggregateGroupByMV()

in pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/IdSetAggregationFunction.java [325:454]


  public void aggregateGroupByMV(int length, int[][] groupKeysArray, GroupByResultHolder groupByResultHolder,
      Map<ExpressionContext, BlockValSet> blockValSetMap) {
    BlockValSet blockValSet = blockValSetMap.get(_expression);
    DataType storedType = blockValSet.getValueType().getStoredType();
    if (blockValSet.isSingleValue()) {
      switch (storedType) {
        case INT:
          int[] intValuesSV = blockValSet.getIntValuesSV();
          for (int i = 0; i < length; i++) {
            int intValue = intValuesSV[i];
            for (int groupKey : groupKeysArray[i]) {
              getIdSet(groupByResultHolder, groupKey, DataType.INT).add(intValue);
            }
          }
          break;
        case LONG:
          long[] longValuesSV = blockValSet.getLongValuesSV();
          for (int i = 0; i < length; i++) {
            long longValue = longValuesSV[i];
            for (int groupKey : groupKeysArray[i]) {
              getIdSet(groupByResultHolder, groupKey, DataType.LONG).add(longValue);
            }
          }
          break;
        case FLOAT:
          float[] floatValuesSV = blockValSet.getFloatValuesSV();
          for (int i = 0; i < length; i++) {
            float floatValue = floatValuesSV[i];
            for (int groupKey : groupKeysArray[i]) {
              getIdSet(groupByResultHolder, groupKey, DataType.FLOAT).add(floatValue);
            }
          }
          break;
        case DOUBLE:
          double[] doubleValuesSV = blockValSet.getDoubleValuesSV();
          for (int i = 0; i < length; i++) {
            double doubleValue = doubleValuesSV[i];
            for (int groupKey : groupKeysArray[i]) {
              getIdSet(groupByResultHolder, groupKey, DataType.DOUBLE).add(doubleValue);
            }
          }
          break;
        case STRING:
          String[] stringValuesSV = blockValSet.getStringValuesSV();
          for (int i = 0; i < length; i++) {
            String stringValue = stringValuesSV[i];
            for (int groupKey : groupKeysArray[i]) {
              getIdSet(groupByResultHolder, groupKey, DataType.STRING).add(stringValue);
            }
          }
          break;
        case BYTES:
          byte[][] bytesValuesSV = blockValSet.getBytesValuesSV();
          for (int i = 0; i < length; i++) {
            byte[] bytesValue = bytesValuesSV[i];
            for (int groupKey : groupKeysArray[i]) {
              getIdSet(groupByResultHolder, groupKey, DataType.BYTES).add(bytesValue);
            }
          }
          break;
        default:
          throw new IllegalStateException("Illegal SV data type for ID_SET aggregation function: " + storedType);
      }
    } else {
      switch (storedType) {
        case INT:
          int[][] intValuesMV = blockValSet.getIntValuesMV();
          for (int i = 0; i < length; i++) {
            int[] intValues = intValuesMV[i];
            for (int groupKey : groupKeysArray[i]) {
              IdSet idSet = getIdSet(groupByResultHolder, groupKey, DataType.INT);
              for (int intValue : intValues) {
                idSet.add(intValue);
              }
            }
          }
          break;
        case LONG:
          long[][] longValuesMV = blockValSet.getLongValuesMV();
          for (int i = 0; i < length; i++) {
            long[] longValues = longValuesMV[i];
            for (int groupKey : groupKeysArray[i]) {
              IdSet idSet = getIdSet(groupByResultHolder, groupKey, DataType.LONG);
              for (long longValue : longValues) {
                idSet.add(longValue);
              }
            }
          }
          break;
        case FLOAT:
          float[][] floatValuesMV = blockValSet.getFloatValuesMV();
          for (int i = 0; i < length; i++) {
            float[] floatValues = floatValuesMV[i];
            for (int groupKey : groupKeysArray[i]) {
              IdSet idSet = getIdSet(groupByResultHolder, groupKey, DataType.FLOAT);
              for (float floatValue : floatValues) {
                idSet.add(floatValue);
              }
            }
          }
          break;
        case DOUBLE:
          double[][] doubleValuesMV = blockValSet.getDoubleValuesMV();
          for (int i = 0; i < length; i++) {
            double[] doubleValues = doubleValuesMV[i];
            for (int groupKey : groupKeysArray[i]) {
              IdSet idSet = getIdSet(groupByResultHolder, groupKey, DataType.DOUBLE);
              for (double doubleValue : doubleValues) {
                idSet.add(doubleValue);
              }
            }
          }
          break;
        case STRING:
          String[][] stringValuesMV = blockValSet.getStringValuesMV();
          for (int i = 0; i < length; i++) {
            String[] stringValues = stringValuesMV[i];
            for (int groupKey : groupKeysArray[i]) {
              IdSet idSet = getIdSet(groupByResultHolder, groupKey, DataType.STRING);
              for (String stringValue : stringValues) {
                idSet.add(stringValue);
              }
            }
          }
          break;
        default:
          throw new IllegalStateException("Illegal MV data type for ID_SET aggregation function: " + storedType);
      }
    }
  }