Class StringRowSerializer
java.lang.Object
io.trino.plugin.accumulo.serializers.StringRowSerializer
- All Implemented Interfaces:
AccumuloRowSerializer
Implementation of
StringRowSerializer that encodes and decodes Trino column values as human-readable String objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TGeneric function to decode the given byte array to a Java object based on the given type.voiddeserialize(Map.Entry<org.apache.accumulo.core.data.Key, org.apache.accumulo.core.data.Value> entry) Deserialize the given Accumulo entry, retrieving data for the Trino column.byte[]Encodes a Trino Java object to a byte array based on the given type.Gets the array Block of the given Trino column.booleangetBoolean(String name) Gets the Boolean value of the given Trino column.byteGets the Byte value of the given Trino column.longGets the Date value of the given Trino column.doubleGets the Double value of the given Trino column.floatGets the Float value of the given Trino column.intGets the Integer value of the given Trino column.longGets the Long value of the given Trino column.Gets the Map value of the given Trino column and Map type.shortGets the Short value of the given Trino column.Gets the Time value of the given Trino column.getTimestamp(String name) Gets the Timestamp value of the given Trino column.byte[]getVarbinary(String name) Gets the Varbinary value of the given Trino column.getVarchar(String name) Gets the String value of the given Trino column.booleanGets a Boolean value indicating whether or not the Trino column is a null value.voidreset()Reset the state of the serializer to prepare for a new set of entries with the same row ID.voidEncode the given array Block into the given Text object.voidsetBoolean(org.apache.hadoop.io.Text text, Boolean value) Encode the given Boolean value into the given Text object.voidEncode the given Byte value into the given Text object.voidsetDate(org.apache.hadoop.io.Text text, long value) Encode the given Date value into the given Text object.voidEncode the given Double value into the given Text object.voidEncode the given Float value into the given Text object.voidEncode the given Integer value into the given Text object.voidEncode the given Long value into the given Text object.voidEncode the given map Block into the given Text object.voidsetMapping(String name, String family, String qualifier) Sets the mapping for the Trino column name to Accumulo family and qualifier.voidsetRowIdName(String name) Sets the Trino name which maps to the Accumulo row ID.voidsetRowOnly(boolean rowOnly) Sets a Boolean value indicating whether or not only the row ID is going to be retrieved from the serializer.voidEncode the given Short value into the given Text object.voidEncode the given Time value into the given Text object.voidsetTimestamp(org.apache.hadoop.io.Text text, Timestamp value) Encode the given Timestamp value into the given Text object.voidsetVarbinary(org.apache.hadoop.io.Text text, byte[] value) Encode the given byte[] value into the given Text object.voidsetVarchar(org.apache.hadoop.io.Text text, String value) Encode the given String value into the given Text object.
-
Constructor Details
-
StringRowSerializer
public StringRowSerializer()
-
-
Method Details
-
setRowIdName
Description copied from interface:AccumuloRowSerializerSets the Trino name which maps to the Accumulo row ID.- Specified by:
setRowIdNamein interfaceAccumuloRowSerializer- Parameters:
name- Trino column name
-
setRowOnly
public void setRowOnly(boolean rowOnly) Description copied from interface:AccumuloRowSerializerSets a Boolean value indicating whether or not only the row ID is going to be retrieved from the serializer.- Specified by:
setRowOnlyin interfaceAccumuloRowSerializer- Parameters:
rowOnly- True if only the row ID is set, false otherwise
-
setMapping
Description copied from interface:AccumuloRowSerializerSets the mapping for the Trino column name to Accumulo family and qualifier.- Specified by:
setMappingin interfaceAccumuloRowSerializer- Parameters:
name- Trino namefamily- Accumulo familyqualifier- Accumulo qualifier
-
reset
public void reset()Description copied from interface:AccumuloRowSerializerReset the state of the serializer to prepare for a new set of entries with the same row ID.- Specified by:
resetin interfaceAccumuloRowSerializer
-
deserialize
public void deserialize(Map.Entry<org.apache.accumulo.core.data.Key, org.apache.accumulo.core.data.Value> entry) Description copied from interface:AccumuloRowSerializerDeserialize the given Accumulo entry, retrieving data for the Trino column.- Specified by:
deserializein interfaceAccumuloRowSerializer- Parameters:
entry- Entry to deserialize
-
isNull
Description copied from interface:AccumuloRowSerializerGets a Boolean value indicating whether or not the Trino column is a null value.- Specified by:
isNullin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- True if null, false otherwise.
-
getArray
Description copied from interface:AccumuloRowSerializerGets the array Block of the given Trino column.- Specified by:
getArrayin interfaceAccumuloRowSerializer- Parameters:
name- Column nametype- Array type- Returns:
- True if null, false otherwise.
-
setArray
Description copied from interface:AccumuloRowSerializerEncode the given array Block into the given Text object.- Specified by:
setArrayin interfaceAccumuloRowSerializer- Parameters:
text- Text object to settype- Array typeblock- Array block
-
getBoolean
Description copied from interface:AccumuloRowSerializerGets the Boolean value of the given Trino column.- Specified by:
getBooleanin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Boolean value
-
setBoolean
Description copied from interface:AccumuloRowSerializerEncode the given Boolean value into the given Text object.- Specified by:
setBooleanin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getByte
Description copied from interface:AccumuloRowSerializerGets the Byte value of the given Trino column.- Specified by:
getBytein interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Byte value
-
setByte
Description copied from interface:AccumuloRowSerializerEncode the given Byte value into the given Text object.- Specified by:
setBytein interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getDate
Description copied from interface:AccumuloRowSerializerGets the Date value of the given Trino column.- Specified by:
getDatein interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Date value
-
setDate
public void setDate(org.apache.hadoop.io.Text text, long value) Description copied from interface:AccumuloRowSerializerEncode the given Date value into the given Text object.- Specified by:
setDatein interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getDouble
Description copied from interface:AccumuloRowSerializerGets the Double value of the given Trino column.- Specified by:
getDoublein interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Double value
-
setDouble
Description copied from interface:AccumuloRowSerializerEncode the given Double value into the given Text object.- Specified by:
setDoublein interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getFloat
Description copied from interface:AccumuloRowSerializerGets the Float value of the given Trino column.- Specified by:
getFloatin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Float value
-
setFloat
Description copied from interface:AccumuloRowSerializerEncode the given Float value into the given Text object.- Specified by:
setFloatin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getInt
Description copied from interface:AccumuloRowSerializerGets the Integer value of the given Trino column.- Specified by:
getIntin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Integer value
-
setInt
Description copied from interface:AccumuloRowSerializerEncode the given Integer value into the given Text object.- Specified by:
setIntin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getLong
Description copied from interface:AccumuloRowSerializerGets the Long value of the given Trino column.- Specified by:
getLongin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Long value
-
setLong
Description copied from interface:AccumuloRowSerializerEncode the given Long value into the given Text object.- Specified by:
setLongin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getMap
Description copied from interface:AccumuloRowSerializerGets the Map value of the given Trino column and Map type.- Specified by:
getMapin interfaceAccumuloRowSerializer- Parameters:
name- Column nametype- Map type- Returns:
- Map value
-
setMap
Description copied from interface:AccumuloRowSerializerEncode the given map Block into the given Text object.- Specified by:
setMapin interfaceAccumuloRowSerializer- Parameters:
text- Text object to settype- Map typeblock- Map block
-
getShort
Description copied from interface:AccumuloRowSerializerGets the Short value of the given Trino column.- Specified by:
getShortin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Short value
-
setShort
Description copied from interface:AccumuloRowSerializerEncode the given Short value into the given Text object.- Specified by:
setShortin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getTime
Description copied from interface:AccumuloRowSerializerGets the Time value of the given Trino column.- Specified by:
getTimein interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Time value
-
setTime
Description copied from interface:AccumuloRowSerializerEncode the given Time value into the given Text object.- Specified by:
setTimein interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getTimestamp
Description copied from interface:AccumuloRowSerializerGets the Timestamp value of the given Trino column.- Specified by:
getTimestampin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Timestamp value
-
setTimestamp
Description copied from interface:AccumuloRowSerializerEncode the given Timestamp value into the given Text object.- Specified by:
setTimestampin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getVarbinary
Description copied from interface:AccumuloRowSerializerGets the Varbinary value of the given Trino column.- Specified by:
getVarbinaryin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- Varbinary value
-
setVarbinary
public void setVarbinary(org.apache.hadoop.io.Text text, byte[] value) Description copied from interface:AccumuloRowSerializerEncode the given byte[] value into the given Text object.- Specified by:
setVarbinaryin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
getVarchar
Description copied from interface:AccumuloRowSerializerGets the String value of the given Trino column.- Specified by:
getVarcharin interfaceAccumuloRowSerializer- Parameters:
name- Column name- Returns:
- String value
-
setVarchar
Description copied from interface:AccumuloRowSerializerEncode the given String value into the given Text object.- Specified by:
setVarcharin interfaceAccumuloRowSerializer- Parameters:
text- Text object to setvalue- Value to encode
-
encode
Description copied from interface:AccumuloRowSerializerEncodes a Trino Java object to a byte array based on the given type.Java Lists and Maps can be converted to Blocks using
AccumuloRowSerializer.getBlockFromArray(Type, java.util.List)andAccumuloRowSerializer.getBlockFromMap(Type, Map)Type to Encode Expected Java Object ARRAY io.trino.spi.block.Block BIGINT Integer or Long BOOLEAN Boolean DATE long DOUBLE Double INTEGER Integer Map io.trino.spi.block.Block REAL Float SMALLINT Short TIME java.sql.Time, Long TIMESTAMP java.sql.Timestamp, Long TINYINT Byte VARBINARY io.airlift.slice.Slice or byte[] VARCHAR io.airlift.slice.Slice or String - Specified by:
encodein interfaceAccumuloRowSerializer- Parameters:
type- The TrinoTypevalue- The Java object per the table in the method description- Returns:
- Encoded bytes
-
decode
Description copied from interface:AccumuloRowSerializerGeneric function to decode the given byte array to a Java object based on the given type.Blocks from ARRAY and MAP types can be converted to Java Lists and Maps using
AccumuloRowSerializer.getArrayFromBlock(Type, Block)andAccumuloRowSerializer.getMapFromBlock(Type, Block)Encoded Type Returned Java Object ARRAY List<?> BIGINT Long BOOLEAN Boolean DATE Long DOUBLE Double Map Map<?,?> REAL Double SMALLINT Long TIME Long TIMESTAMP Long TINYINT Long VARBINARY byte[] VARCHAR String - Specified by:
decodein interfaceAccumuloRowSerializer- Type Parameters:
T- The Java type of the object that has been encoded to the given byte array- Parameters:
type- The TrinoTypevalue- Encoded bytes to decode- Returns:
- The Java object per the table in the method description
-