本文整理了Java中org.apache.pig.data.DataByteArray.get()
方法的一些代码示例,展示了DataByteArray.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataByteArray.get()
方法的具体详情如下:
包路径:org.apache.pig.data.DataByteArray
类名称:DataByteArray
方法名:get
[英]Get the underlying byte array. This is the real thing, not a copy, so don't mess with it!
[中]获取底层字节数组。这是真的,不是复制品,所以不要弄乱它!
代码示例来源:origin: apache/hive
switch (type) {
case BINARY:
return ((DataByteArray) pigObj).get();
代码示例来源:origin: elastic/elasticsearch-hadoop
to.bytes(dba.get(), dba.size());
return;
代码示例来源:origin: elastic/elasticsearch-hadoop
break;
case DataType.BYTEARRAY:
generator.writeBinary(((DataByteArray) object).get());
break;
代码示例来源:origin: forcedotcom/phoenix
byte[] bytes = ((DataByteArray)o).get();
代码示例来源:origin: apache/phoenix
byte[] bytes = ((DataByteArray)o).get();
代码示例来源:origin: org.apache.pig/pig
@Override
public BytesWritable getPrimitiveWritableObject(Object o) {
return o == null ? null : (o instanceof DataByteArray
? new BytesWritable(((DataByteArray) o).get())
: new BytesWritable((byte[]) o));
}
代码示例来源:origin: com.twitter.elephantbird/elephant-bird-pig
private static Object toStringType(Object value) {
if (value instanceof String) {
return value;
} else if (value instanceof DataByteArray) {
byte[] buf = ((DataByteArray)value).get();
// mostly there is no need to copy.
return ByteBuffer.wrap(Arrays.copyOf(buf, buf.length));
}
return null;
}
代码示例来源:origin: org.apache.pig/pig
/**
* Append given byte array to the internal byte array.
* @param b byte array who's contents to append. The contents of the byte array are
* copied.
*/
public DataByteArray append(DataByteArray b) {
byte[] ba = (b == null) ? null : b.get();
return append(ba, 0, ba == null ? 0 : ba.length);
}
代码示例来源:origin: org.apache.pig/pig
/**
* For testing only, do not use directly.
*/
public void setFilter(DataByteArray dba) throws IOException {
DataInputStream dis = new DataInputStream(new
ByteArrayInputStream(dba.get()));
filter = new BloomFilter();
filter.readFields(dis);
}
代码示例来源:origin: org.apache.pig/pig
public static BloomFilter bloomIn(DataByteArray b) throws IOException {
DataInputStream dis = new DataInputStream(new
ByteArrayInputStream(b.get()));
BloomFilter f = new BloomFilter();
f.readFields(dis);
return f;
}
代码示例来源:origin: pl.edu.icm.coansys/coansys-io-output
private DisambiguationAuthorOut readInputData(Tuple t, int dataIndex){
DisambiguationAuthorOut dco = null;
try{
dco = DisambiguationAuthorOut.parseFrom(((DataByteArray)t.get(dataIndex)).get());
}catch(Exception e){
//this exception is handled in the method updateAuthorList(...)
LOGGER.warn("this exception is handled in the method updateAuthorList(...)", e);
}
return dco;
}
}
代码示例来源:origin: com.twitter.elephantbird/elephant-bird-pig
@Override
protected Writable toWritable(DataByteArray value) throws IOException {
Preconditions.checkNotNull(writable, "Writable is null");
byte[] bytes = value.get();
ibuf.reset(bytes, bytes.length);
writable.readFields(ibuf);
return writable;
}
}
代码示例来源:origin: pl.edu.icm.coansys/commons
@Override
public Tuple exec(Tuple input) throws ExecException {
try {
DataByteArray protoMetadata = (DataByteArray) input.get(0);
Method parseFromMethod = protobufClass.getMethod("parseFrom", byte[].class);
Message metadata = (Message) parseFromMethod.invoke(null, protoMetadata.get());
return ProtoBytearrayToTuple.messageToTuple(metadata);
} catch (Exception ex) {
throw new ExecException(ex);
}
}
代码示例来源:origin: pl.edu.icm.coansys/coansys-io-output
@Override
public Builder execute(Tuple t, int dataIndex, Builder dwb) throws IOException {
DocumentSimilarityInfo dco = null;
try{
dco = DocumentSimilarityInfo.parseFrom(((DataByteArray)t.get(dataIndex)).get());
}catch(Exception e){
LOGGER.warn("No document-similarity output for the document {}", t.get(0), e);
return dwb;
}
return buildDocumentMetadata(dwb, dco);
}
代码示例来源:origin: pl.edu.icm.coansys/coansys-io-output
@Override
public Builder execute(Tuple t, int dataIndex, Builder dwb)
throws ExecException, InvalidProtocolBufferException {
KeywordsList kl = null;
try{
kl = KeywordsList.parseFrom(((DataByteArray)t.get(dataIndex)).get());
}catch(NullPointerException ex){
LOGGER.warn("No keyword output for the document {}", t.get(0), ex);
return dwb;
}
return buildDocumentMetadata(dwb, kl);
}
代码示例来源:origin: pl.edu.icm.coansys/coansys-io-output
public DocumentWrapper.Builder mainBlockParsing(Tuple t) throws ExecException, InvalidProtocolBufferException{
docId = (String) t.get(2*mainGroupIndex);
DataByteArray proto = (DataByteArray) t.get(2*mainGroupIndex+1);
return DocumentWrapper.newBuilder(DocumentWrapper.parseFrom(proto.get()));
}
}
代码示例来源:origin: com.twitter.elephantbird/elephant-bird-pig
@Override
public Tuple exec(Tuple input) throws IOException {
if (input == null || input.size() < 1) return null;
try {
DataByteArray bytes = (DataByteArray) input.get(0);
M value = thriftConverter.fromBytes(bytes.get());
return value == null ? null : thriftToPig.getPigTuple(value);
} catch (IOException e) {
return null;
}
}
代码示例来源:origin: com.twitter.elephantbird/elephant-bird-pig
@Override
public void putNext(Tuple t) throws IOException {
DataByteArray data = null;
if (t == null || t.size() < 1 || (data = (DataByteArray) t.get(0)) == null) {
// TODO(Andy Schlaikjer): Signal error
return;
}
writable.set(data.get());
writeRecord(null, writable);
}
}
代码示例来源:origin: pl.edu.icm.coansys/document-similarity-logic
@Override
public Tuple exec(Tuple input) throws IOException {
DataByteArray dba = (DataByteArray) input.get(0);
DocumentMetadata metadata = DocumentWrapper.parseFrom(dba.get())
.getDocumentMetadata();
Tuple output = TupleFactory.getInstance().newTuple(
fieldNumberMap.size());
output = addDocumentMetatdataFields(metadata, output);
return output;
}
代码示例来源:origin: pl.edu.icm.coansys/deduplication-document-impl
@Override
public Tuple exec(Tuple tuple) throws IOException {
DataByteArray dba = (DataByteArray) tuple.get(1);
DocumentProtos.DocumentWrapper docWrapper = DocumentProtos.DocumentWrapper.parseFrom(dba.get());
String id = docWrapper.getDocumentMetadata().getKey();
String title = docWrapper.getDocumentMetadata().getBasicMetadata().getTitle(0).getText();
Tuple retTuple = TupleFactory.getInstance().newTuple(Arrays.asList(id, title));
return retTuple;
}
}
内容来源于网络,如有侵权,请联系作者删除!