@Override
    public Operation decodeEvent(String[] csvRow) {
      long scheduledStartTimeAsMilli = Long.parseLong(csvRow[0]);
      long dependencyTimeAsMilli = Long.parseLong(csvRow[1]);

      long forumId = Long.parseLong(csvRow[3]);

      String forumTitle = csvRow[4];

      String creationDateString = csvRow[5];
      Date creationDate = new Date(Long.parseLong(creationDateString));

      long moderatorPersonId = Long.parseLong(csvRow[6]);

      String tagIdsAsString = csvRow[7];
      List<Long> tagIds = new ArrayList<>();
      if (false == tagIdsAsString.isEmpty()) {
        String[] tagIdsAsStrings = collectionSeparatorPattern.split(tagIdsAsString, -1);
        for (String tagId : tagIdsAsStrings) {
          tagIds.add(Long.parseLong(tagId));
        }
      }

      Operation operation =
          new LdbcUpdate4AddForum(forumId, forumTitle, creationDate, moderatorPersonId, tagIds);
      operation.setScheduledStartTimeAsMilli(scheduledStartTimeAsMilli);
      operation.setTimeStamp(scheduledStartTimeAsMilli);
      operation.setDependencyTimeStamp(dependencyTimeAsMilli);
      return operation;
    }
    @Override
    public Operation decodeEvent(String[] csvRow) {
      long scheduledStartTimeAsMilli = Long.parseLong(csvRow[0]);
      long dependencyTimeAsMilli = Long.parseLong(csvRow[1]);

      long postId = Long.parseLong(csvRow[3]);

      String imageFile = csvRow[4];

      String creationDateString = csvRow[5];
      Date creationDate = new Date(Long.parseLong(creationDateString));

      String locationIp = csvRow[6];

      String browserUsed = csvRow[7];

      String language = csvRow[8];

      String content = csvRow[9];

      int length = Integer.parseInt(csvRow[10]);

      long authorPersonId = Long.parseLong(csvRow[11]);

      long forumId = Long.parseLong(csvRow[12]);

      long countryId = Long.parseLong(csvRow[13]);

      String tagIdsAsString = csvRow[14];
      List<Long> tagIds = new ArrayList<>();
      if (false == tagIdsAsString.isEmpty()) {
        String[] tagIdsAsStrings = collectionSeparatorPattern.split(tagIdsAsString, -1);
        for (String tagId : tagIdsAsStrings) {
          tagIds.add(Long.parseLong(tagId));
        }
      }

      Operation operation =
          new LdbcUpdate6AddPost(
              postId,
              imageFile,
              creationDate,
              locationIp,
              browserUsed,
              language,
              content,
              length,
              authorPersonId,
              forumId,
              countryId,
              tagIds);
      operation.setScheduledStartTimeAsMilli(scheduledStartTimeAsMilli);
      operation.setTimeStamp(scheduledStartTimeAsMilli);
      operation.setDependencyTimeStamp(dependencyTimeAsMilli);
      return operation;
    }
    @Override
    public Operation decodeEvent(String[] csvRow) {
      long scheduledStartTimeAsMilli = Long.parseLong(csvRow[0]);
      long dependencyTimeAsMilli = Long.parseLong(csvRow[1]);

      long person1Id = Long.parseLong(csvRow[3]);

      long person2Id = Long.parseLong(csvRow[4]);

      String creationDateString = csvRow[5];
      Date creationDate = new Date(Long.parseLong(creationDateString));

      Operation operation = new LdbcUpdate8AddFriendship(person1Id, person2Id, creationDate);
      operation.setScheduledStartTimeAsMilli(scheduledStartTimeAsMilli);
      operation.setTimeStamp(scheduledStartTimeAsMilli);
      operation.setDependencyTimeStamp(dependencyTimeAsMilli);
      return operation;
    }
Ejemplo n.º 4
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ValidationParam that = (ValidationParam) o;

    if (operation != null ? !operation.equals(that.operation) : that.operation != null)
      return false;
    if (operationResult != null
        ? !operationResult.equals(that.operationResult)
        : that.operationResult != null) return false;

    return true;
  }
    @Override
    public Operation decodeEvent(String[] csvRow) {
      long scheduledStartTimeAsMilli = Long.parseLong(csvRow[0]);
      long dependencyTimeAsMilli = Long.parseLong(csvRow[1]);

      long personId = Long.parseLong(csvRow[3]);

      String firstName = csvRow[4];

      String lastName = csvRow[5];

      String gender = csvRow[6];

      String birthdayString = csvRow[7];
      Date birthday = new Date(Long.parseLong(birthdayString));

      String creationDateString = csvRow[8];
      Date creationDate = new Date(Long.parseLong(creationDateString));

      String locationIp = csvRow[9];

      String browserUsed = csvRow[10];

      long cityId = Long.parseLong(csvRow[11]);

      String languagesString = csvRow[12];
      List<String> languages =
          (languagesString.isEmpty())
              ? EMPTY_LIST
              : Lists.newArrayList(collectionSeparatorPattern.split(languagesString, -1));

      String emailsString = csvRow[13];
      List<String> emails =
          (emailsString.isEmpty())
              ? EMPTY_LIST
              : Lists.newArrayList(collectionSeparatorPattern.split(emailsString, -1));

      String tagIdsAsString = csvRow[14];
      List<Long> tagIds = new ArrayList<>();
      if (false == tagIdsAsString.isEmpty()) {
        String[] tagIdsAsStrings = collectionSeparatorPattern.split(tagIdsAsString, -1);
        for (String tagId : tagIdsAsStrings) {
          tagIds.add(Long.parseLong(tagId));
        }
      }

      String studyAtsAsString = csvRow[15];
      List<LdbcUpdate1AddPerson.Organization> studyAts = new ArrayList<>();
      if (false == studyAtsAsString.isEmpty()) {
        String[] studyAtsAsStrings = collectionSeparatorPattern.split(studyAtsAsString, -1);
        for (String studyAtAsString : studyAtsAsStrings) {
          String[] studyAtAsStringArray = tupleSeparatorPattern.split(studyAtAsString, -1);
          studyAts.add(
              new LdbcUpdate1AddPerson.Organization(
                  Long.parseLong(studyAtAsStringArray[0]),
                  Integer.parseInt(studyAtAsStringArray[1])));
        }
      }

      String worksAtAsString = csvRow[16];
      List<LdbcUpdate1AddPerson.Organization> workAts = new ArrayList<>();
      if (false == worksAtAsString.isEmpty()) {
        String[] workAtsAsStrings = collectionSeparatorPattern.split(worksAtAsString, -1);
        for (String workAtAsString : workAtsAsStrings) {
          String[] workAtAsStringArray = tupleSeparatorPattern.split(workAtAsString, -1);
          workAts.add(
              new LdbcUpdate1AddPerson.Organization(
                  Long.parseLong(workAtAsStringArray[0]),
                  Integer.parseInt(workAtAsStringArray[1])));
        }
      }

      Operation operation =
          new LdbcUpdate1AddPerson(
              personId,
              firstName,
              lastName,
              gender,
              birthday,
              creationDate,
              locationIp,
              browserUsed,
              cityId,
              languages,
              emails,
              tagIds,
              studyAts,
              workAts);
      operation.setScheduledStartTimeAsMilli(scheduledStartTimeAsMilli);
      operation.setTimeStamp(scheduledStartTimeAsMilli);
      operation.setDependencyTimeStamp(dependencyTimeAsMilli);
      return operation;
    }
Ejemplo n.º 6
0
 @Override
 public String serializeOperation(Operation operation) throws SerializingMarshallingException {
   try {
     switch (operation.type()) {
       case InsertOperation.TYPE:
         {
           InsertOperation simpleOperation = (InsertOperation) operation;
           List<Object> operationAsList = new ArrayList<>();
           operationAsList.add(simpleOperation.getClass().getName());
           operationAsList.add(simpleOperation.table());
           operationAsList.add(simpleOperation.key());
           // TODO
           //                operationAsList.add( simpleOperation.fields() );
           return OBJECT_MAPPER.writeValueAsString(operationAsList);
         }
       case ReadOperation.TYPE:
         {
           ReadOperation simpleOperation = (ReadOperation) operation;
           List<Object> operationAsList = new ArrayList<>();
           operationAsList.add(simpleOperation.getClass().getName());
           operationAsList.add(simpleOperation.table());
           operationAsList.add(simpleOperation.key());
           operationAsList.add(simpleOperation.fields());
           return OBJECT_MAPPER.writeValueAsString(operationAsList);
         }
       case UpdateOperation.TYPE:
         {
           UpdateOperation simpleOperation = (UpdateOperation) operation;
           List<Object> operationAsList = new ArrayList<>();
           operationAsList.add(simpleOperation.getClass().getName());
           operationAsList.add(simpleOperation.table());
           operationAsList.add(simpleOperation.key());
           // TODO
           //                operationAsList.add( simpleOperation.fields() );
           return OBJECT_MAPPER.writeValueAsString(operationAsList);
         }
       case ScanOperation.TYPE:
         {
           ScanOperation simpleOperation = (ScanOperation) operation;
           List<Object> operationAsList = new ArrayList<>();
           operationAsList.add(simpleOperation.getClass().getName());
           operationAsList.add(simpleOperation.table());
           operationAsList.add(simpleOperation.startkey());
           operationAsList.add(simpleOperation.recordCount());
           operationAsList.add(simpleOperation.fields());
           return OBJECT_MAPPER.writeValueAsString(operationAsList);
         }
       case ReadModifyWriteOperation.TYPE:
         {
           ReadModifyWriteOperation simpleOperation = (ReadModifyWriteOperation) operation;
           List<Object> operationAsList = new ArrayList<>();
           operationAsList.add(simpleOperation.getClass().getName());
           operationAsList.add(simpleOperation.table());
           operationAsList.add(simpleOperation.key());
           operationAsList.add(simpleOperation.fields());
           // TODO
           //                operationAsList.add( simpleOperation.values() );
           return OBJECT_MAPPER.writeValueAsString(operationAsList);
         }
       default:
         {
           throw new SerializingMarshallingException(
               format(
                   "Workload does not know how to serialize operation\nWorkload: %s\nOperation Type: "
                       + "%s\nOperation: %s",
                   getClass().getName(), operation.getClass().getName(), operation));
         }
     }
   } catch (IOException e) {
     throw new SerializingMarshallingException(
         format("Error serializing operation\n%s", operation), e);
   }
 }
Ejemplo n.º 7
0
 @Override
 public int hashCode() {
   int result = operation != null ? operation.hashCode() : 0;
   result = 31 * result + (operationResult != null ? operationResult.hashCode() : 0);
   return result;
 }