1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.mapred;
21
22 import java.io.DataInput;
23 import java.io.DataOutput;
24 import java.io.IOException;
25
26 import org.apache.hadoop.hbase.HConstants;
27 import org.apache.hadoop.hbase.util.Bytes;
28 import org.apache.hadoop.mapred.InputSplit;
29
30
31
32
33 @Deprecated
34 public class TableSplit implements InputSplit, Comparable<TableSplit> {
35 private byte [] m_tableName;
36 private byte [] m_startRow;
37 private byte [] m_endRow;
38 private String m_regionLocation;
39
40
41 public TableSplit() {
42 this(HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY,
43 HConstants.EMPTY_BYTE_ARRAY, "");
44 }
45
46
47
48
49
50
51
52
53 public TableSplit(byte [] tableName, byte [] startRow, byte [] endRow,
54 final String location) {
55 this.m_tableName = tableName;
56 this.m_startRow = startRow;
57 this.m_endRow = endRow;
58 this.m_regionLocation = location;
59 }
60
61
62 public byte [] getTableName() {
63 return this.m_tableName;
64 }
65
66
67 public byte [] getStartRow() {
68 return this.m_startRow;
69 }
70
71
72 public byte [] getEndRow() {
73 return this.m_endRow;
74 }
75
76
77 public String getRegionLocation() {
78 return this.m_regionLocation;
79 }
80
81 public String[] getLocations() {
82 return new String[] {this.m_regionLocation};
83 }
84
85 public long getLength() {
86
87 return 0;
88 }
89
90 public void readFields(DataInput in) throws IOException {
91 this.m_tableName = Bytes.readByteArray(in);
92 this.m_startRow = Bytes.readByteArray(in);
93 this.m_endRow = Bytes.readByteArray(in);
94 this.m_regionLocation = Bytes.toString(Bytes.readByteArray(in));
95 }
96
97 public void write(DataOutput out) throws IOException {
98 Bytes.writeByteArray(out, this.m_tableName);
99 Bytes.writeByteArray(out, this.m_startRow);
100 Bytes.writeByteArray(out, this.m_endRow);
101 Bytes.writeByteArray(out, Bytes.toBytes(this.m_regionLocation));
102 }
103
104 @Override
105 public String toString() {
106 return m_regionLocation + ":" +
107 Bytes.toStringBinary(m_startRow) + "," + Bytes.toStringBinary(m_endRow);
108 }
109
110 public int compareTo(TableSplit o) {
111 return Bytes.compareTo(getStartRow(), o.getStartRow());
112 }
113 }