You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/01/01 12:44:11 UTC
[GitHub] [hbase] Apache9 commented on a change in pull request #975:
HBASE-23624 Add a tool to dump the procedure info in HFile
Apache9 commented on a change in pull request #975: HBASE-23624 Add a tool to dump the procedure info in HFile
URL: https://github.com/apache/hbase/pull/975#discussion_r362321218
##########
File path: hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
##########
@@ -598,19 +598,28 @@ public static void setTimestamp(Cell cell, byte[] ts, int tsOffset) throws IOExc
}
/**
- * @param cell
* @return The Key portion of the passed <code>cell</code> as a String.
*/
public static String getCellKeyAsString(Cell cell) {
- StringBuilder sb = new StringBuilder(Bytes.toStringBinary(
- cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
+ return getCellKeyAsString(cell,
+ c -> Bytes.toStringBinary(c.getRowArray(), c.getRowOffset(), c.getRowLength()));
+ }
+
+ /**
+ * @param cell the cell to convert
+ * @param rowConverter used to convert the row of the cell to a string
+ * @return The Key portion of the passed <code>cell</code> as a String.
+ */
+ public static String getCellKeyAsString(Cell cell, Function<Cell, String> rowConverter) {
+ StringBuilder sb = new StringBuilder(rowConverter.apply(cell));
sb.append('/');
- sb.append(cell.getFamilyLength() == 0? "":
- Bytes.toStringBinary(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()));
- // KeyValue only added ':' if family is non-null. Do same.
+ sb.append(cell.getFamilyLength() == 0 ? ""
+ : Bytes.toStringBinary(cell.getFamilyArray(), cell.getFamilyOffset(),
+ cell.getFamilyLength()));
+ // KeyValue only added ':' if family is non-null. Do same.
if (cell.getFamilyLength() > 0) sb.append(':');
- sb.append(cell.getQualifierLength() == 0? "":
- Bytes.toStringBinary(cell.getQualifierArray(), cell.getQualifierOffset(),
+ sb.append(cell.getQualifierLength() == 0 ? ""
+ : Bytes.toStringBinary(cell.getQualifierArray(), cell.getQualifierOffset(),
Review comment:
Let me check my formatter config...
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services