Search in sources :

Example 1 with Operation

use of org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.Operation in project hbase by apache.

the class TableOperationSpanBuilder method unpackRowOperations.

private static Set<Operation> unpackRowOperations(final CheckAndMutate cam) {
    final Set<Operation> ops = new HashSet<>();
    final Operation op = valueFrom(cam.getAction());
    switch(op) {
        case BATCH:
        case CHECK_AND_MUTATE:
            ops.addAll(unpackRowOperations(cam.getAction()));
            break;
        default:
            ops.add(op);
    }
    return ops;
}
Also used : Operation(org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.Operation) HashSet(java.util.HashSet)

Example 2 with Operation

use of org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.Operation in project hbase by apache.

the class TableOperationSpanBuilder method unpackRowOperations.

private static Set<Operation> unpackRowOperations(final Row row) {
    final Set<Operation> ops = new HashSet<>();
    if (row instanceof CheckAndMutate) {
        final CheckAndMutate cam = (CheckAndMutate) row;
        ops.addAll(unpackRowOperations(cam));
    }
    if (row instanceof RowMutations) {
        final RowMutations mutations = (RowMutations) row;
        final List<Operation> operations = mutations.getMutations().stream().map(TableOperationSpanBuilder::valueFrom).collect(Collectors.toList());
        ops.addAll(operations);
    }
    return ops;
}
Also used : CheckAndMutate(org.apache.hadoop.hbase.client.CheckAndMutate) Operation(org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.Operation) HashSet(java.util.HashSet) RowMutations(org.apache.hadoop.hbase.client.RowMutations)

Aggregations

HashSet (java.util.HashSet)2 Operation (org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.Operation)2 CheckAndMutate (org.apache.hadoop.hbase.client.CheckAndMutate)1 RowMutations (org.apache.hadoop.hbase.client.RowMutations)1