com.vertica.sdk.PartitionWriter Class Reference
Inheritance diagram for com.vertica.sdk.PartitionWriter:
Collaboration diagram for com.vertica.sdk.PartitionWriter:
| Public Member Functions | |
|---|---|
| PartitionWriter (int nargs) | |
| void | addCol (ByteBuffer arg, int colstride, VerticaType dt, String colName) |
| void | addCol (ByteBuffer arg, int colstride, VerticaType dt) |
| void | addCol (ByteBuffer arg, ByteBuffer da, int colstride, VerticaType dt) |
| void | addCol (ByteBuffer arg, ByteBuffer da, int colstride, VerticaType dt, String colName) |
| boolean | checkStringUserBlockInfo (int idx) |
| boolean | checkTimeUserBlockInfo (int idx) |
| void | copyFromInput (int dstIdx, PartitionReader input_reader, int srcIdx) throws UdfException |
| ByteBuffer | getColDataAreaRef (int idx) |
| ByteBuffer | getColRef (int idx) |
| TypeCoercion | getDefaultTypeCoercion () |
| int | getNumCols () |
| VNumeric | getNumericWriter (int idx) |
| int | getNumRows () |
| BaseDataOID | getProcessBlockUserInfoVectorAt (int i) |
| VString | getStringWriter (int idx) |
| SizedColumnTypes | getTypeMetaData () |
| abstract boolean | getWriteableBlock () throws UdfException, DestroyInvocation |
| boolean | next () throws UdfException, DestroyInvocation |
| void | resetBuffers () |
| void | setBoolean (int idx, boolean r) |
| void | setBooleanNull (int idx) |
| void | setBooleanValue (int idx, Boolean value) |
| void | setDate (int idx, java.sql.Date r) |
| void | setDateNull (int idx) |
| void | setDateValue (int idx, java.sql.Date value) |
| TypeCoercion | setDefaultTypeCoercion (TypeCoercion coerce) |
| void | setDouble (int idx, double r) |
| void | setDoubleNull (int idx) |
| void | setDoubleValue (int idx, Double value) |
| void | setLong (int idx, long r) |
| void | setLongNull (int idx) |
| void | setLongValue (int idx, Long value) |
| void | setNumeric (int idx, BigDecimal bd) |
| void | setNumericNull (int idx) |
| void | setNumericValue (int idx, BigDecimal value) |
| void | setRowFromMap (Map rowData) |
| void | setRowFromMap (Map rowData, TypeCoercion coerce) |
| void | setString (int idx, String r) |
| void | setStringBytes (int idx, ByteBuffer bytes) |
| void | setStringNull (int idx) |
| void | setStringValue (int idx, String value) |
| void | setTimestamp (int idx, java.sql.Timestamp r) |
| void | setTimestampInfiniteNeg (int idx) |
| void | setTimestampInfinitePos (int idx) |
| void | setTimestampNull (int idx) |
| void | setTimestampValue (int idx, java.sql.Timestamp value) |
| void | setValue (int idx, Object value, TypeCoercion coerce) |
| void | setVMap (int idx, Map data) |
| void | setVMap (int idx, Map data, TypeCoercion coerce) |
| void | throwInCorrectUsageError (int idx) |
| : Throwing UdfException for incorrect setter usage |
| Public Attributes | |
|---|---|
| int | count |
| int | index |
| int | ncols |
| int | nrows |
| SizedColumnTypes | typeMetaData |
| Protected Member Functions | |
|---|---|
| void | clear () |
| ByteBuffer | getInlineColBuffer (int idx) |
| long | getRowSize (SizedColumnTypes types) |
| void | setRowCount (SizedColumnTypes types) |
| Static Protected Member Functions | |
|---|---|
| static long | blockSizeGivenRowSize (long row_size) |
| Protected Attributes | |
|---|---|
| ArrayList | coldataareas |
| ArrayList | cols |
| ArrayList | colstrides |
| ArrayList | currentPos |
Detailed Description
PartitionWriter provides an iterator-based write interface over output data for a single partition. Automatically makes space a block-at-a-time, as needed.
Member Function Documentation
void com.vertica.sdk.VerticaBlock.addCol(ByteBuffer arg, int colstride, VerticaType dt, String colName)
inherited Add the location for reading a particular argument.
Parameters
arg: The base location to find data.colstride: The stride between data instances.dt: The type of input.colName: Name of the column
Referenced by com.vertica.sdk.VerticaBlock.addCol().
void com.vertica.sdk.VerticaBlock.addCol(ByteBuffer arg, int colstride, VerticaType dt)
inherited Add the location for reading a particular argument.
Parameters
arg: The base location to find data.colstride: The stride between data instances.dt: The type of input.
void com.vertica.sdk.VerticaBlock.addCol(ByteBuffer arg, ByteBuffer da, int colstride, VerticaType dt)
inherited Add the location for reading a particular argument.
Parameters
arg: The base location to find data.da: The location to find out of band string data.colstride: The stride between data instances.dt: The type of input.
void com.vertica.sdk.VerticaBlock.addCol(ByteBuffer arg, ByteBuffer da, int colstride, VerticaType dt, String colName)
inherited Add the location for reading a particular argument.
Parameters
arg: The base location to find data.da: The location to find out of band string data.colstride: The stride between data instances.dt: The type of input.colName: Name of the column
void com.vertica.sdk.PartitionWriter.copyFromInput(int dstIdx, PartitionReader input_reader, int srcIdx) throws UdfException
Copies a column from the input reader to the output writer. The data types and sizes of the source and destination columns must match exactly.
Parameters
dstIdx: The destination column index (in the output writer)input_reader: The input reader from which to copy a columnsrcIdx: The source column index (in the input reader)
ByteBuffer com.vertica.sdk.VerticaBlock.getColDataAreaRef(int idx)
inherited Get the ByteBuffer that stores out of line string data (Data Area) for the idx'th argument
Parameters
idx: The column number to retrieve from the input row.
Returns the ByteBuffer
Referenced by com.vertica.sdk.BlockReader.getVString().
ByteBuffer com.vertica.sdk.VerticaBlock.getColRef(int idx)
inherited Example
ByteBuffer a = arg_reader.getColPtr(0);
Parameters
idx: The column number to retrieve from the input row.
Returns a ByteBuffer to the idx'th argument, containing data for the column
Referenced by
- com.vertica.sdk.PartitionWriter.copyFromInput()
- com.vertica.sdk.BlockReader.getBoolean()
- com.vertica.sdk.BlockReader.getDouble()
- com.vertica.sdk.VerticaBlock.getInlineColBuffer()
- com.vertica.sdk.BlockReader.getLong()
- com.vertica.sdk.BlockReader.getStringLength()
- com.vertica.sdk.BlockReader.getStringLoc()
- com.vertica.sdk.BlockReader.getVNumeric()
- com.vertica.sdk.BlockReader.getVString()
- com.vertica.sdk.BlockWriter.getVStringWriter()
- com.vertica.sdk.BlockReader.isBooleanNull()
- com.vertica.sdk.ParamWriter.setBool()
- com.vertica.sdk.BlockWriter.setBoolean()
- com.vertica.sdk.BlockWriter.setBooleanNull()
- com.vertica.sdk.PartitionWriter.setBooleanValue()
- com.vertica.sdk.BlockWriter.setDate()
- com.vertica.sdk.BlockWriter.setDateNull()
- com.vertica.sdk.PartitionWriter.setDateValue()
- com.vertica.sdk.BlockWriter.setDouble()
- com.vertica.sdk.ParamWriter.setDouble()
- com.vertica.sdk.BlockWriter.setDoubleNull()
- com.vertica.sdk.PartitionWriter.setDoubleValue()
- com.vertica.sdk.BlockWriter.setLong()
- com.vertica.sdk.ParamWriter.setLong()
- com.vertica.sdk.BlockWriter.setLongNull()
- com.vertica.sdk.ParamWriter.setLongString()
- com.vertica.sdk.PartitionWriter.setLongValue()
- com.vertica.sdk.ParamWriter.setNumeric()
- com.vertica.sdk.BlockWriter.setNumeric()
- com.vertica.sdk.ParamWriter.setString()
- com.vertica.sdk.BlockWriter.setString()
- com.vertica.sdk.BlockWriter.setStringNull()
- com.vertica.sdk.BlockWriter.setTimestamp()
- com.vertica.sdk.BlockWriter.setTimestampInfiniteNeg()
- com.vertica.sdk.BlockWriter.setTimestampInfinitePos()
- com.vertica.sdk.BlockWriter.setTimestampNull()
- com.vertica.sdk.PartitionWriter.setTimestampValue()
TypeCoercion com.vertica.sdk.PartitionWriter.getDefaultTypeCoercion()
Give the default TypeCoercion instance, creating one if necessary. This may be useful in cases where the calling code would like to change the TypeCoercionPolicy or do TypeCoercion in the same manner as this PartitionWriter.
If a TypeCoercion is created, it is an instance of StandardTypeCoercion.
See Also
#setRowFromMap(Map)
Returns the current default TypeCoercion, creating one if necessary.
Referenced by
ByteBuffer com.vertica.sdk.VerticaBlock.getInlineColBuffer(int idx)
protected inherited Give a ByteBuffer for the given column (inline storage only). Returns a buffer with position and limit bounding the data area for a single element of that column, given the current position in the column.
Parameters
idx: The column number to retrieve from the input row.
Returns the ByteBuffer for the column
Referenced by
int com.vertica.sdk.VerticaBlock.getNumCols()
inherited Returns the number of arguments held by this reader.
int com.vertica.sdk.VerticaBlock.getNumRows()
inherited Returns the number of rows held by this block.
SizedColumnTypes com.vertica.sdk.VerticaBlock.getTypeMetaData()
inherited Returns information about the types and numbers of arguments
Referenced by
- com.vertica.sdk.ParamReader.getType()
- com.vertica.sdk.PartitionWriter.setRowFromMap()
- com.vertica.sdk.PartitionWriter.setValue()
abstract boolean com.vertica.sdk.PartitionWriter.getWriteableBlock() throws UdfException, DestroyInvocation
pure virtual Gets a writeable block of data and positions cursor at the beginning.
Returns true on success; use other methods to manipulate the block
Exceptions
UdfException: UDF problemDestroyInvocation: Invocation needed to be destroyed
Implemented in com.vertica.sdk.StreamWriter, and com.vertica.sdk.AnalyticPartitionWriter.
void com.vertica.sdk.PartitionWriter.setBooleanValue(int idx, Boolean value)
Set a Boolean value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
void com.vertica.sdk.PartitionWriter.setDateValue(int idx, java.sql.Date value)
Set a Date value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
TypeCoercion com.vertica.sdk.PartitionWriter.setDefaultTypeCoercion(TypeCoercion coerce)
Set the default type coercion instance.
See Also
#setRowFromMap(Map)
Parameters
coerce: A TypeCoercion instance.
Returns the former default, which may be null.
void com.vertica.sdk.PartitionWriter.setDoubleValue(int idx, Double value)
Set a Double value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
void com.vertica.sdk.PartitionWriter.setLongValue(int idx, Long value)
Set a Long value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
void com.vertica.sdk.PartitionWriter.setNumericValue(int idx, BigDecimal value)
Set a Numeric value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
void com.vertica.sdk.PartitionWriter.setRowFromMap(Map rowData)
Sets all columns on the current row according to the data provided, using the column names to match the data keys. See setRowFromMap(Map, TypeCoercion) for more details. This is a shortcut for using the default type coercion.
Parameters
rowData: The data. Null data is treated as empty.
See Also
#setRowFromMap(Map, TypeCoercion)
void com.vertica.sdk.PartitionWriter.setRowFromMap(Map rowData, TypeCoercion coerce)
Sets all columns on the current row according to the data provided, using the column names to match the data keys.
For each column, TypeCoercion will be used to convert a value in rowData to the appropriate type for that column. This is done via setValue and may cause a TypeCoercion exception.
To find the corresponding value, the 'first' matching key (according to case-insensitive SQL identifier matching) in the map will be used. 'first' is not well defined, but is consistent.
If no corresponding value is found, the column will be set to null. This never raises an exception, regardless of the target column type. That is, FAIL_SDK_UNSUPPORTED_TYPE is ignored in that case.
In addition, if the target row structure appears to be a flex table, the necessary internal structures will be populated with an encoded vmap via setVMap(int, Map, TypeCoercion).
Parameters
rowData: The data. Null data is treated as empty.coerce: The implementation of coercion
See Also
#setVMap(int, Map, TypeCoercion)
setValue(int, Object, TypeCoercion)
void com.vertica.sdk.PartitionWriter.setStringBytes(int idx, ByteBuffer bytes)
Set a String value for column at index idx. Accepts null values.
Parameters
idx: The column indexbytes: A ByteBuffer with bytes between position and limit that are a string encoded according to Vertica's requirements. This buffer must fit within the column's length requirements.
Exceptions
IllegalArgumentException: if bytes is too long
void com.vertica.sdk.PartitionWriter.setStringValue(int idx, String value)
Set a String value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
void com.vertica.sdk.PartitionWriter.setTimestampValue(int idx, java.sql.Timestamp value)
Set a Timestamp value for column at index idx. Accepts null values.
Parameters
idx: column numbervalue: value to set it to
void com.vertica.sdk.PartitionWriter.setValue(int idx, Object value, TypeCoercion coerce)
Set a value for a column using type coercion. Type coercion attempts to generate an appropriate value for the target column type based on the input type.
The following target column types are supported by the SDK for this method. All others will generate a TypeCoercionException due to FAIL_SDK_UNSUPPORTED_TYPE if appropriate.
-
Bools
-
Integers (excluding Numeric)
-
Floats
-
String-like types (char and binary, along with var- and long variants)
-
Timestamp and timestamptz
-
Dates
Parameters
idx: The column indexvalue: The value to store in the column. May be null.coerce: The type coercion policy.
Referenced by com.vertica.sdk.PartitionWriter.setRowFromMap().
void com.vertica.sdk.PartitionWriter.setVMap(int idx, Map data)
Encodes a VMap into the given column, which must be of binary type.
Parameters
idx: The index of the binary or varbinary column.data: The data. Null data is treated as empty.
See Also
#setVMap(int, Map, TypeCoercion)
void com.vertica.sdk.PartitionWriter.setVMap(int idx, Map data, TypeCoercion coerce)
Encodes a VMap into the given column, which must be of binary type. Uses standard type coercion to identify aggregate values and to serialize all values.
Parameters
idx: The index of the binary or varbinary column.data: The data. Null data is treated as empty.coerce: Ignored but still here for backwards compatibility.
See Also
#setVMap(int, Map)