Revert "HBASE-15572 Adding optional timestamp semantics to HBase-Spark (Weiqing Yang)"
[hbase.git] / hbase-spark / src / main / scala / org / apache / hadoop / hbase / spark / KeyFamilyQualifier.scala
blobb2eda2c9bdd7660decd869ae48452659c08fa103
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.apache.hadoop.hbase.spark
20 import java.io.Serializable
22 import org.apache.hadoop.hbase.util.Bytes
24 /**
25 * This is the key to be used for sorting and shuffling.
27 * We will only partition on the rowKey but we will sort on all three
29 * @param rowKey Record RowKey
30 * @param family Record ColumnFamily
31 * @param qualifier Cell Qualifier
33 class KeyFamilyQualifier(val rowKey:Array[Byte], val family:Array[Byte], val qualifier:Array[Byte])
34 extends Comparable[KeyFamilyQualifier] with Serializable {
35 override def compareTo(o: KeyFamilyQualifier): Int = {
36 var result = Bytes.compareTo(rowKey, o.rowKey)
37 if (result == 0) {
38 result = Bytes.compareTo(family, o.family)
39 if (result == 0) result = Bytes.compareTo(qualifier, o.qualifier)
41 result
43 override def toString: String = {
44 Bytes.toString(rowKey) + ":" + Bytes.toString(family) + ":" + Bytes.toString(qualifier)