code: public void join(JSONArray jsonAllRows, List<String> joinFields, ActionType action) {
          if (jsonAllRows.length() == 0) {
              return;
          }
          JSONObject sample = jsonAllRows.getJSONObject(0);
          if (sample.has("event")) {// GroupBy
              extractAndTakeAction(null, jsonAllRows, joinFields, RequestType.GROUPBY, action);
          } else if (sample.has("result")) {// Could be timeseries/topN
              if (sample.optJSONObject("result") != null) {// Timeseries
                  extractAndTakeAction(null, jsonAllRows, joinFields, RequestType.TIMESERIES, action);
              } else if (sample.optJSONArray("result") != null) {// TopN
                  // There should be only 1 item in here.
                  JSONObject jsonItem = jsonAllRows.getJSONObject(0);
                  JSONArray result = jsonItem.getJSONArray("result");
                  extractAndTakeAction(jsonItem.optString("timestamp"), result, joinFields, RequestType.TOPN, action);
              }
          }
      }
docs: If action if FIRST_CUT then the values are added directly to the result else
  rows will be filtered on key.
  @param jsonAllRows
  @param joinFields
  @param action