1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.mapred;
20
21 import java.io.IOException;
22
23 import org.apache.hadoop.hbase.classification.InterfaceAudience;
24 import org.apache.hadoop.hbase.classification.InterfaceStability;
25 import org.apache.hadoop.hbase.client.Result;
26 import org.apache.hadoop.hbase.client.Table;
27 import org.apache.hadoop.hbase.filter.Filter;
28 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
29 import org.apache.hadoop.mapred.RecordReader;
30
31
32
33
34
35 @InterfaceAudience.Public
36 @InterfaceStability.Stable
37 public class TableRecordReader
38 implements RecordReader<ImmutableBytesWritable, Result> {
39
40 private TableRecordReaderImpl recordReaderImpl = new TableRecordReaderImpl();
41
42
43
44
45
46
47
48 public void restart(byte[] firstRow) throws IOException {
49 this.recordReaderImpl.restart(firstRow);
50 }
51
52
53
54
55
56
57 public void init() throws IOException {
58 this.recordReaderImpl.restart(this.recordReaderImpl.getStartRow());
59 }
60
61
62
63
64 public void setHTable(Table htable) {
65 this.recordReaderImpl.setHTable(htable);
66 }
67
68
69
70
71 public void setInputColumns(final byte [][] inputColumns) {
72 this.recordReaderImpl.setInputColumns(inputColumns);
73 }
74
75
76
77
78 public void setStartRow(final byte [] startRow) {
79 this.recordReaderImpl.setStartRow(startRow);
80 }
81
82
83
84
85
86 public void setEndRow(final byte [] endRow) {
87 this.recordReaderImpl.setEndRow(endRow);
88 }
89
90
91
92
93 public void setRowFilter(Filter rowFilter) {
94 this.recordReaderImpl.setRowFilter(rowFilter);
95 }
96
97 public void close() {
98 this.recordReaderImpl.close();
99 }
100
101
102
103
104
105
106 public ImmutableBytesWritable createKey() {
107 return this.recordReaderImpl.createKey();
108 }
109
110
111
112
113
114
115 public Result createValue() {
116 return this.recordReaderImpl.createValue();
117 }
118
119 public long getPos() {
120
121
122
123 return this.recordReaderImpl.getPos();
124 }
125
126 public float getProgress() {
127
128 return this.recordReaderImpl.getPos();
129 }
130
131
132
133
134
135
136
137 public boolean next(ImmutableBytesWritable key, Result value)
138 throws IOException {
139 return this.recordReaderImpl.next(key, value);
140 }
141 }