public class TCTLSeparatedProtocol extends org.apache.thrift.protocol.TProtocol implements ConfigurableTProtocol, WriteNullsProtocol, SkippableTProtocol
| Modifier and Type | Class and Description |
|---|---|
static class |
TCTLSeparatedProtocol.Factory
Factory for JSON protocol objects.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferSize
The size of the internal buffer to use.
|
static String |
BufferSizeKey |
protected String[] |
columns
For a single row, the split on the primary separator.
|
protected static String |
defaultMapSeparator |
protected static String |
defaultPrimarySeparator
These are defaults, but for now leaving them like this.
|
protected static String |
defaultRowSeparator |
protected static String |
defaultSecondarySeparator |
protected long |
elemIndex
For writes, on what element are we on so we know when to use normal list
separator or for a map know when to use the k/v separator.
|
protected String[] |
fields
For a single column, a split on the secondary separator.
|
protected boolean |
firstField
Is this the first field we're writing.
|
protected boolean |
firstInnerField
Is this the first list/map/set field we're writing for the current element.
|
protected int |
index
An index into what column we're on.
|
protected boolean |
inner
Are we currently on the top-level columns or parsing a column itself.
|
protected int |
innerIndex
An index into what field within a column we're on.
|
protected org.apache.thrift.transport.TTransport |
innerTransport
The transport being wrapped.
|
protected boolean |
isMap
Are we writing a map and need to worry about k/v separator?
|
protected boolean |
lastPrimitiveWasNullFlag |
protected Pattern |
mapPattern |
protected String |
mapSeparator |
protected String |
nullString
The string representing nulls in the serialized data.
|
protected org.apache.hadoop.io.Text |
nullText
The nullString in UTF-8 bytes.
|
protected Pattern |
primaryPattern |
protected String |
primarySeparator
The separators for this instance.
|
protected String |
quote
The quote character when supporting quotes with ability to not split across
quoted entries.
|
protected boolean |
returnNulls
For places where the separators are back to back, should we return a null
or an empty string since it is ambiguous.
|
static String |
ReturnNullsKey
Strings used to lookup the various configurable paramaters of this
protocol.
|
protected String |
rowSeparator |
protected Pattern |
secondaryPattern |
protected String |
secondarySeparator |
protected Pattern |
stripQuotePostfix |
protected Pattern |
stripQuotePrefix |
protected Pattern |
stripSeparatorPrefix
For quoted fields, strip away the quotes and also need something to strip
away the control separator when using complex split method defined here.
|
protected org.apache.hadoop.hive.serde2.thrift.TCTLSeparatedProtocol.SimpleTransportTokenizer |
transportTokenizer
The transport stream is tokenized on the row separator.
|
| Constructor and Description |
|---|
TCTLSeparatedProtocol(org.apache.thrift.transport.TTransport trans)
The simple constructor which assumes ctl-a, ctl-b and '\n' separators and
to return empty strings for empty fields.
|
TCTLSeparatedProtocol(org.apache.thrift.transport.TTransport trans,
int buffer_size) |
TCTLSeparatedProtocol(org.apache.thrift.transport.TTransport trans,
String primarySeparator,
String secondarySeparator,
String mapSeparator,
String rowSeparator,
boolean returnNulls,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
protected String[] |
complexSplit(String line,
Pattern p)
Split the line based on a complex regex pattern.
|
protected String |
getByteValue(String altValue,
String defaultVal) |
String |
getMapSeparator() |
String |
getPrimarySeparator()
Inspect the separators this instance is configured with.
|
String |
getRowSeparator() |
String |
getSecondarySeparator() |
void |
initialize(org.apache.hadoop.conf.Configuration conf,
Properties tbl)
Initialize the TProtocol.
|
protected void |
internalInitialize()
Sets the internal separator patterns and creates the internal tokenizer.
|
void |
internalWriteString(String str) |
boolean |
lastPrimitiveWasNull()
Was the last primitive read really a NULL.
|
ByteBuffer |
readBinary() |
boolean |
readBool() |
byte |
readByte() |
double |
readDouble() |
org.apache.thrift.protocol.TField |
readFieldBegin() |
void |
readFieldEnd() |
short |
readI16() |
int |
readI32() |
long |
readI64() |
org.apache.thrift.protocol.TList |
readListBegin() |
void |
readListEnd() |
org.apache.thrift.protocol.TMap |
readMapBegin() |
void |
readMapEnd() |
org.apache.thrift.protocol.TMessage |
readMessageBegin() |
void |
readMessageEnd() |
org.apache.thrift.protocol.TSet |
readSetBegin() |
void |
readSetEnd() |
String |
readString() |
org.apache.thrift.protocol.TStruct |
readStructBegin() |
void |
readStructEnd() |
void |
skip(byte type)
Skip past the current field Just increments the field index counter.
|
void |
writeBinary(ByteBuffer bin) |
void |
writeBool(boolean b) |
void |
writeByte(byte b) |
void |
writeDouble(double dub) |
void |
writeFieldBegin(org.apache.thrift.protocol.TField field) |
void |
writeFieldEnd() |
void |
writeFieldStop() |
void |
writeI16(short i16) |
void |
writeI32(int i32) |
void |
writeI64(long i64) |
void |
writeListBegin(org.apache.thrift.protocol.TList list) |
void |
writeListEnd() |
void |
writeMapBegin(org.apache.thrift.protocol.TMap map) |
void |
writeMapEnd() |
void |
writeMessageBegin(org.apache.thrift.protocol.TMessage message) |
void |
writeMessageEnd() |
void |
writeNull()
Write a null.
|
void |
writeSetBegin(org.apache.thrift.protocol.TSet set) |
void |
writeSetEnd() |
void |
writeString(String str) |
void |
writeStructBegin(org.apache.thrift.protocol.TStruct struct) |
void |
writeStructEnd() |
protected static final String defaultPrimarySeparator
protected static final String defaultSecondarySeparator
protected static final String defaultRowSeparator
protected static final String defaultMapSeparator
protected String primarySeparator
protected String secondarySeparator
protected String rowSeparator
protected String mapSeparator
protected Pattern primaryPattern
protected Pattern secondaryPattern
protected Pattern mapPattern
protected String quote
protected org.apache.hadoop.hive.serde2.thrift.TCTLSeparatedProtocol.SimpleTransportTokenizer transportTokenizer
protected String[] columns
protected int index
protected String[] fields
protected int innerIndex
protected boolean firstField
protected boolean firstInnerField
protected boolean isMap
protected long elemIndex
protected boolean inner
protected boolean returnNulls
protected final org.apache.thrift.transport.TTransport innerTransport
public static final String ReturnNullsKey
public static final String BufferSizeKey
protected int bufferSize
protected String nullString
protected org.apache.hadoop.io.Text nullText
protected Pattern stripSeparatorPrefix
protected Pattern stripQuotePrefix
protected Pattern stripQuotePostfix
protected boolean lastPrimitiveWasNullFlag
public TCTLSeparatedProtocol(org.apache.thrift.transport.TTransport trans)
trans - - the ttransport to use as input or outputpublic TCTLSeparatedProtocol(org.apache.thrift.transport.TTransport trans,
int buffer_size)
public TCTLSeparatedProtocol(org.apache.thrift.transport.TTransport trans,
String primarySeparator,
String secondarySeparator,
String mapSeparator,
String rowSeparator,
boolean returnNulls,
int bufferSize)
trans - - the ttransport to use as input or outputprimarySeparator - the separator between columns (aka fields)secondarySeparator - the separator within a field for things like sets and maps and
listsmapSeparator - - the key/value separatorrowSeparator - - the record separatorreturnNulls - - whether to return a null or an empty string for fields that seem
empty (ie two primary separators back to back)public String getPrimarySeparator()
public String getSecondarySeparator()
public String getRowSeparator()
public String getMapSeparator()
protected void internalInitialize()
protected String[] complexSplit(String line, Pattern p)
line - the current rowp - the pattern for matching fields in the rowpublic void initialize(org.apache.hadoop.conf.Configuration conf,
Properties tbl)
throws org.apache.thrift.TException
initialize in interface ConfigurableTProtocolconf - System propertiestbl - table propertiesorg.apache.thrift.TExceptionpublic void writeMessageBegin(org.apache.thrift.protocol.TMessage message)
throws org.apache.thrift.TException
writeMessageBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeMessageEnd()
throws org.apache.thrift.TException
writeMessageEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeStructBegin(org.apache.thrift.protocol.TStruct struct)
throws org.apache.thrift.TException
writeStructBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeStructEnd()
throws org.apache.thrift.TException
writeStructEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeFieldBegin(org.apache.thrift.protocol.TField field)
throws org.apache.thrift.TException
writeFieldBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeFieldEnd()
throws org.apache.thrift.TException
writeFieldEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeFieldStop()
writeFieldStop in class org.apache.thrift.protocol.TProtocolpublic void writeMapBegin(org.apache.thrift.protocol.TMap map)
throws org.apache.thrift.TException
writeMapBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeMapEnd()
throws org.apache.thrift.TException
writeMapEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeListBegin(org.apache.thrift.protocol.TList list)
throws org.apache.thrift.TException
writeListBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeListEnd()
throws org.apache.thrift.TException
writeListEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeSetBegin(org.apache.thrift.protocol.TSet set)
throws org.apache.thrift.TException
writeSetBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeSetEnd()
throws org.apache.thrift.TException
writeSetEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeBool(boolean b)
throws org.apache.thrift.TException
writeBool in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeByte(byte b)
throws org.apache.thrift.TException
writeByte in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeI16(short i16)
throws org.apache.thrift.TException
writeI16 in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeI32(int i32)
throws org.apache.thrift.TException
writeI32 in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeI64(long i64)
throws org.apache.thrift.TException
writeI64 in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeDouble(double dub)
throws org.apache.thrift.TException
writeDouble in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void internalWriteString(String str) throws org.apache.thrift.TException
org.apache.thrift.TExceptionpublic void writeString(String str) throws org.apache.thrift.TException
writeString in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void writeBinary(ByteBuffer bin) throws org.apache.thrift.TException
writeBinary in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic org.apache.thrift.protocol.TMessage readMessageBegin()
throws org.apache.thrift.TException
readMessageBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void readMessageEnd()
throws org.apache.thrift.TException
readMessageEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic org.apache.thrift.protocol.TStruct readStructBegin()
throws org.apache.thrift.TException
readStructBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void readStructEnd()
throws org.apache.thrift.TException
readStructEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void skip(byte type)
skip in interface SkippableTProtocolpublic org.apache.thrift.protocol.TField readFieldBegin()
throws org.apache.thrift.TException
readFieldBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void readFieldEnd()
throws org.apache.thrift.TException
readFieldEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic org.apache.thrift.protocol.TMap readMapBegin()
throws org.apache.thrift.TException
readMapBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void readMapEnd()
throws org.apache.thrift.TException
readMapEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic org.apache.thrift.protocol.TList readListBegin()
throws org.apache.thrift.TException
readListBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic void readListEnd()
throws org.apache.thrift.TException
readListEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic org.apache.thrift.protocol.TSet readSetBegin()
throws org.apache.thrift.TException
readSetBegin in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic boolean lastPrimitiveWasNull()
throws org.apache.thrift.TException
WriteNullsProtocollastPrimitiveWasNull in interface WriteNullsProtocolorg.apache.thrift.TExceptionpublic void writeNull()
throws org.apache.thrift.TException
WriteNullsProtocolwriteNull in interface WriteNullsProtocolorg.apache.thrift.TExceptionpublic void readSetEnd()
throws org.apache.thrift.TException
readSetEnd in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic boolean readBool()
throws org.apache.thrift.TException
readBool in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic byte readByte()
throws org.apache.thrift.TException
readByte in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic short readI16()
throws org.apache.thrift.TException
readI16 in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic int readI32()
throws org.apache.thrift.TException
readI32 in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic long readI64()
throws org.apache.thrift.TException
readI64 in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic double readDouble()
throws org.apache.thrift.TException
readDouble in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic String readString() throws org.apache.thrift.TException
readString in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionpublic ByteBuffer readBinary() throws org.apache.thrift.TException
readBinary in class org.apache.thrift.protocol.TProtocolorg.apache.thrift.TExceptionCopyright © 2019 The Apache Software Foundation. All Rights Reserved.