Skip to content

Commit 15789ec

Browse files
HBASE-29195 Get Column value with timestamp is giving wrong result as not found (#6814)
Signed-off-by: Duo Zhang <[email protected]>
1 parent ed7625e commit 15789ec

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ public RowResultGenerator(final String tableName, final RowSpec rowspec, final F
5656
}
5757
}
5858
}
59-
get.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime());
59+
if (rowspec.isPartialTimeRange()) {
60+
get.setTimestamp(rowspec.getTimestamp());
61+
} else {
62+
get.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime());
63+
}
64+
6065
get.readVersions(rowspec.getMaxVersions());
6166
if (filter != null) {
6267
get.setFilter(filter);

hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowSpec.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class RowSpec {
4646
private long endTime = DEFAULT_END_TIMESTAMP;
4747
private int maxVersions = 1;
4848
private int maxValues = Integer.MAX_VALUE;
49+
private boolean partialTimeRange;
4950

5051
public RowSpec(String path) throws IllegalArgumentException {
5152
this(path, null);
@@ -216,6 +217,7 @@ private int parseTimestamp(final String path, int i) throws IllegalArgumentExcep
216217
endTime = time1;
217218
} else {
218219
endTime = time0;
220+
partialTimeRange = true;
219221
}
220222
return i;
221223
}
@@ -426,4 +428,9 @@ public String toString() {
426428
result.append("}");
427429
return result.toString();
428430
}
431+
432+
public boolean isPartialTimeRange() {
433+
return partialTimeRange;
434+
}
435+
429436
}

hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ScannerResultGenerator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ public ScannerResultGenerator(final String tableName, final RowSpec rowspec, fin
9191
}
9292
}
9393
}
94-
scan.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime());
94+
95+
if (rowspec.isPartialTimeRange()) {
96+
scan.setTimestamp(rowspec.getTimestamp());
97+
} else {
98+
scan.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime());
99+
}
100+
95101
scan.readVersions(rowspec.getMaxVersions());
96102
if (filter != null) {
97103
scan.setFilter(filter);

0 commit comments

Comments
 (0)