ctubbsii commented on code in PR #3342:
URL: https://github.com/apache/accumulo/pull/3342#discussion_r1179735010
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java:
##########
@@ -1490,7 +1490,7 @@ public Map<String,String> tableIdMap() {
public Text getMaxRow(String tableName, Authorizations auths, Text startRow,
boolean startInclusive, Text endRow, boolean endInclusive) throws
TableNotFoundException {
return getMaxRow(tableName, auths,
- new RowRange(startRow, startInclusive, endRow, endInclusive));
+ RowRange.create(startRow, startInclusive, endRow, endInclusive));
Review Comment:
The equivalent Guava API would call this "range" instead of "create". And
they also use "open" and "closed" instead of "inclusive" and its negation. I
think it would be good to use the "range" method name here, but keep our use of
"inclusive" that matches with the key Range API.
##########
core/src/main/java/org/apache/accumulo/core/data/RowRange.java:
##########
@@ -45,8 +45,91 @@ public RowRange() {
* @param endRow ending row; set to null for positive infinity
* @throws IllegalArgumentException if end row is before start row
*/
- public RowRange(Text startRow, Text endRow) {
- this(startRow, true, endRow, true);
+ public static RowRange open(Text startRow, Text endRow) {
+ return create(startRow, true, endRow, true);
+ }
+
+ /**
+ * Creates a range of rows from startRow exclusive to endRow exclusive.
+ *
+ * @param startRow starting row; set to null for the smallest possible row
(an empty one)
+ * @param endRow ending row; set to null for positive infinity
+ * @throws IllegalArgumentException if end row is before start row
+ */
+ public static RowRange closed(Text startRow, Text endRow) {
+ return create(startRow, false, endRow, false);
+ }
Review Comment:
This is incorrect. Closed means "inclusive", not "exclusive". Open means
"exclusive". This is backwards throughout.
##########
core/src/main/java/org/apache/accumulo/core/data/RowRange.java:
##########
@@ -45,8 +45,91 @@ public RowRange() {
* @param endRow ending row; set to null for positive infinity
* @throws IllegalArgumentException if end row is before start row
*/
- public RowRange(Text startRow, Text endRow) {
- this(startRow, true, endRow, true);
+ public static RowRange open(Text startRow, Text endRow) {
Review Comment:
It kinda sucks that we're creating a new API with Text, as it would be nice
to try to phase out that dependency on Hadoop types in our APIs. But, we don't
have an alternative right now. You may want to consider offering overloaded
methods for CharSequence, though, so users aren't forced to use Text if their
endpoints are human-readable as Strings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]