swaroopak commented on a change in pull request #750: PHOENIX-5799 - Inline Index Verification Output API URL: https://github.com/apache/phoenix/pull/750#discussion_r403404730
########## File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexVerificationOutputRow.java ########## @@ -0,0 +1,221 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.mapreduce.index; + +import org.apache.hadoop.hbase.util.Bytes; + +import java.util.Arrays; +import java.util.Objects; + +public class IndexVerificationOutputRow { + private String dataTableName; + private String indexTableName; + private Long scanMaxTimestamp; + private byte[] dataTableRowKey; + private byte[] indexTableRowKey; + private Long dataTableRowTimestamp; + private Long indexTableRowTimestamp; + private String errorMessage; + private byte[] expectedValue; + private byte[] actualValue; + private byte[] phaseValue; + + private IndexVerificationOutputRow(String dataTableName, String indexTableName, + byte[] dataTableRowKey, Long scanMaxTimestamp, + byte[] indexTableRowKey, + long dataTableRowTimestamp, long indexTableRowTimestamp, + String errorMessage, byte[] expectedValue, byte[] actualValue, + byte[] phaseValue) { + this.dataTableName = dataTableName; + this.indexTableName = indexTableName; + this.scanMaxTimestamp = scanMaxTimestamp; + this.dataTableRowKey = dataTableRowKey; + this.indexTableRowKey = indexTableRowKey; + this.dataTableRowTimestamp = dataTableRowTimestamp; + this.indexTableRowTimestamp = indexTableRowTimestamp; + this.errorMessage = errorMessage; + this.expectedValue = expectedValue; + this.actualValue = actualValue; + this.phaseValue = phaseValue; + } + + public String getDataTableName() { + return dataTableName; + } + + public String getIndexTableName() { + return indexTableName; + } + + public Long getScanMaxTimestamp() { + return scanMaxTimestamp; + } + + public byte[] getIndexTableRowKey() { + return indexTableRowKey; + } + + public long getIndexTableRowTimestamp() { + return indexTableRowTimestamp; + } + + public String getErrorMessage() { + return errorMessage; + } + + public byte[] getExpectedValue() { + return expectedValue; + } + + public byte[] getActualValue() { + return actualValue; + } + + public byte[] getPhaseValue() { + return phaseValue; + } + + public byte[] getDataTableRowKey() { + return dataTableRowKey; + } + + public Long getDataTableRowTimestamp() { + return dataTableRowTimestamp; + } + + @Override + public boolean equals(Object o) { + if (o == null ) { + return false; + } + if (!(o instanceof IndexVerificationOutputRow)) { + return false; + } + IndexVerificationOutputRow otherRow = (IndexVerificationOutputRow) o; + + return Objects.equals(dataTableName, otherRow.getDataTableName()) && + Objects.equals(indexTableName, otherRow.getIndexTableName()) && + Objects.equals(scanMaxTimestamp, otherRow.getScanMaxTimestamp()) && + Arrays.equals(dataTableRowKey, otherRow.getDataTableRowKey()) && + Arrays.equals(indexTableRowKey, otherRow.getIndexTableRowKey()) && + Objects.equals(dataTableRowTimestamp, otherRow.getDataTableRowTimestamp()) && + Objects.equals(indexTableRowTimestamp, otherRow.getIndexTableRowTimestamp()) && + Objects.equals(errorMessage, otherRow.getErrorMessage()) && + Arrays.equals(expectedValue, otherRow.getExpectedValue()) && + Arrays.equals(actualValue, otherRow.getActualValue()) && + Arrays.equals(phaseValue, otherRow.getPhaseValue()); + } + + @Override + public int hashCode(){ + return Objects.hashCode(scanMaxTimestamp) ^ Objects.hashCode(indexTableName) ^ + Arrays.hashCode(dataTableRowKey); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("DataTableName: ").append(dataTableName).append(","); Review comment: Why not reuse the same strings from table values? like DTName, ITName. Would be easier to track and reuse. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
