code: private static Tuple2<Object, List<Object>> mapPkToRow(String timestamp, JSONObject jsonRow, List<String> joinFields) {
          Object joinValue = null;
          List<Object> rowValues = new ArrayList<>();
          rowValues.add(timestamp);
          for (Object key : jsonRow.keySet()) {
              String colName = key.toString();
              rowValues.add(jsonRow.get(colName));
              if (joinFields.contains(colName)) {
                  joinValue = (joinValue == null)?jsonRow.get(colName):(joinValue + "\u0001" + jsonRow.get(colName));
              } 
          }
          if (joinFields.contains("timestamp")) {// Join field could contain timestamp(timestamp can be out of the actual data JSON, so we try this way)
              joinValue = (joinValue == null)?timestamp:(joinValue + "\u0001" + timestamp);
          }
          //Though join field could be specified like (a,timestamp,b) the value of the join,
          //field will be (a.value^Ab.value^Atimestamp.value) if b appears after a in the json 
          //object. And timestamp value is always appended to last.
          return new Tuple2<>(joinValue, rowValues);
      }
docs: Extract fields(k,v) from json
  k = primary field(s) could be a composite key.
  v = all fields . The first field is always timestamp.
  Presumption is jsonRow object passed to this method should not have timestamp field.
  @param timestamp
  @param jsonRow (This is a jsonObject without timestamp(even for select query response though timestamp is present it is stripped off before passing it to this method)
  @param joinFields
  @return