public interface InputBlobWritable extends WritableComparable
com.aliyun.odps.mapreduce.Mapper从 com.aliyun.odps.Record
中读取blob类型的列.
用法示例:
@Override
public void map(LongWritable key, Record value,
MapContext<KEYOUT, VALUEOUT> context) throws IOException {
InputBlobWritable blob = value.get(0);
BlobDataInputStream in = blob.getInputStream();
long length = in.getLength();
// 使用in.read从blob中读取
in.close();
}
从上面的示例看出, 从com.aliyun.odps.Record获得InputBlobWritable接口,
调用InputBlobWritable的getInputStream获得BlobDataInputStream后, 即可读出数据.
| Modifier and Type | Method and Description |
|---|---|
BlobDataInputStream |
getInputStream()
getInputStream方法获取可以读取blob的
BlobDataInputStream接口 |
long |
getLength()
getLength方法获取blob的总字节数
|
readFields, writecompareToBlobDataInputStream getInputStream() throws IOException
BlobDataInputStream接口BlobDataInputStreamIOExceptionlong getLength()
throws IOException
IOExceptionCopyright © 2021 Alibaba Cloud Computing. All rights reserved.