code: @Override
      public void isValid() throws Exception {
          if (numStmnts() >= 2) {
              if (primaryJoinableHooks.size() > 0) {
                  for (String joinField:primaryJoinableHooks) {
                      if (joinField.equals("timestamp")) {// timestamp is implicitly present in the result.
                          continue;
                      }
                      for (QueryMeta query: getAllStmnts()) {
                          boolean isPresent = false;
                          if (query instanceof BaseAggQueryMeta) {// Since BaseAggQueryMeta is also a PlainDimQueryMeta we go with former first.
                              for (AggItem item:((BaseAggQueryMeta)query).aggregations) {
                                  if (joinField.equals(item.fieldName) || (item.asName != null && joinField.equals(item.asName))) {
                                      isPresent = true;
                                  }
                              }
                          }
                          if (query instanceof PlainDimQueryMeta) {
                              Map<String, String> dims = ((PlainDimQueryMeta)query).fetchDimensions;
                              for (Map.Entry<String, String> entry :dims.entrySet()) {
                                  if (joinField.equals(entry.getKey()) || (entry.getValue() != null && joinField.equals(entry.getValue()))) {
                                      isPresent = true;
                                  }
                              }
                          }
                          if (!isPresent) {
                              String error = joinField + " mentioned in the composite key should appear in all the data sources being queried and joined.";
                              throw new Exception(error);
                          }
                      }
                  }
              } else {
                  String error = "Need atleast one field to join on";
                  throw new Exception(error);
              }
          }
      }
docs: TODO: This method should be a full blown functional but right now address
  only partial semantics.
  Do all semantic checks here.
  @throws java.lang.Exception