org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType Java Examples

The following examples show how to use org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HBaseMutationCoder.java    From beam with Apache License 2.0 5 votes vote down vote up
private static MutationType getType(Mutation mutation) {
  if (mutation instanceof Put) {
    return MutationType.PUT;
  } else if (mutation instanceof Delete) {
    return MutationType.DELETE;
  } else {
    // Increment and Append are not idempotent.  They should not be used in distributed jobs.
    throw new IllegalArgumentException("Only Put and Delete are supported");
  }
}
 
Example #2
Source File: ProtobufUtil.java    From phoenix with Apache License 2.0 5 votes vote down vote up
public static MutationProto toProto(Mutation mutation) throws IOException {
    MutationType type;
    if (mutation instanceof Put) {
        type = MutationType.PUT;
    } else if (mutation instanceof Delete) {
        type = MutationType.DELETE;
    } else {
        throw new IllegalArgumentException("Only Put and Delete are supported");
    }
    return org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(type, mutation);
}
 
Example #3
Source File: IndexedKeyValue.java    From phoenix with Apache License 2.0 5 votes vote down vote up
protected MutationProto toMutationProto(Mutation mutation)  throws IOException {
    MutationProto m = null;
    if(mutation instanceof Put){
        m = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(MutationType.PUT, 
            mutation);
    } else if(mutation instanceof Delete) {
        m = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(MutationType.DELETE, 
            mutation);
    } else {
        throw new IOException("Put/Delete mutations only supported");
    }
    return m;
}
 
Example #4
Source File: StatisticsWriter.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private static MutationType getMutationType(Mutation m) throws IOException {
    if (m instanceof Put) {
        return MutationType.PUT;
    } else if (m instanceof Delete) {
        return MutationType.DELETE;
    } else {
        throw new DoNotRetryIOException("Unsupported mutation type in stats commit"
                + m.getClass().getName());
    }
}
 
Example #5
Source File: ProtobufUtil.java    From phoenix with Apache License 2.0 5 votes vote down vote up
public static MutationProto toProto(Mutation mutation) throws IOException {
    MutationType type;
    if (mutation instanceof Put) {
        type = MutationType.PUT;
    } else if (mutation instanceof Delete) {
        type = MutationType.DELETE;
    } else {
        throw new IllegalArgumentException("Only Put and Delete are supported");
    }
    return org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(type, mutation);
}
 
Example #6
Source File: IndexedKeyValue.java    From phoenix with Apache License 2.0 5 votes vote down vote up
protected MutationProto toMutationProto(Mutation mutation)  throws IOException {
    MutationProto m = null;
    if(mutation instanceof Put){
        m = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(MutationType.PUT, 
            mutation);
    } else if(mutation instanceof Delete) {
        m = org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(MutationType.DELETE, 
            mutation);
    } else {
        throw new IOException("Put/Delete mutations only supported");
    }
    return m;
}
 
Example #7
Source File: StatisticsWriter.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private static MutationType getMutationType(Mutation m) throws IOException {
    if (m instanceof Put) {
        return MutationType.PUT;
    } else if (m instanceof Delete) {
        return MutationType.DELETE;
    } else {
        throw new DoNotRetryIOException("Unsupported mutation type in stats commit" + m.getClass().getName());
    }
}
 
Example #8
Source File: HBaseMutationCoder.java    From beam with Apache License 2.0 4 votes vote down vote up
@Override
public void encode(Mutation mutation, OutputStream outStream) throws IOException {
  MutationType type = getType(mutation);
  MutationProto proto = ProtobufUtil.toMutation(type, mutation);
  proto.writeDelimitedTo(outStream);
}