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.
17 package org
.apache
.hadoop
.hbase
.spark
22 * This object is a clean way to store and sort all cells that will be bulk
23 * loaded into a single row
25 class FamiliesQualifiersValues
extends Serializable
{
26 //Tree maps are used because we need the results to
27 // be sorted when we read them
28 val familyMap
= new util
.TreeMap
[ByteArrayWrapper
,
29 util
.TreeMap
[ByteArrayWrapper
, Array
[Byte
]]]()
31 //normally in a row there are more columns then
32 //column families this wrapper is reused for column
34 val reusableWrapper
= new ByteArrayWrapper(null)
37 * Adds a new cell to an existing row
38 * @param family HBase column family
39 * @param qualifier HBase column qualifier
40 * @param value HBase cell value
42 def += (family
: Array
[Byte
], qualifier
: Array
[Byte
], value
: Array
[Byte
]): Unit
= {
44 reusableWrapper
.value
= family
46 var qualifierValues
= familyMap
.get(reusableWrapper
)
48 if (qualifierValues
== null) {
49 qualifierValues
= new util
.TreeMap
[ByteArrayWrapper
, Array
[Byte
]]()
50 familyMap
.put(new ByteArrayWrapper(family
), qualifierValues
)
53 qualifierValues
.put(new ByteArrayWrapper(qualifier
), value
)