com.vertica.sdk.BlockReader Class Reference

Iterator interface for reading rows in a Vertica block. More...

Inheritance diagram for com.vertica.sdk.BlockReader:

com.vertica.sdk.VerticaBlock com.vertica.sdk.ParamReader com.vertica.sdk.PartitionReader com.vertica.sdk.ParamWriter List of all members.

Public Member Functions

void addCol (ByteBuffer arg, ByteBuffer da, int colstride, VerticaType dt, String colName)
void addCol (ByteBuffer arg, ByteBuffer da, int colstride, VerticaType dt)
void addCol (ByteBuffer arg, int colstride, VerticaType dt)
void addCol (ByteBuffer arg, int colstride, VerticaType dt, String colName)
boolean getBoolean (int idx)
 Get a BOOLEAN value from the input row.
ByteBuffer getColDataAreaRef (int idx)
ByteBuffer getColRef (int idx)
java.sql.Date getDate (int idx)
 Get a DATE value from the input row.
double getDouble (int idx)
 Get a DOUBLE value from the input row.
long getLong (int idx)
 Get a LONG INTEGER value from the input row.
int getNumCols ()
int getNumRows ()
String getString (int idx)
 Get a reference to an VARCHAR/CHAR/VARBINARY/BINARY value from the input row.
int getStringLength (int idx)
 Get length of the String from the input row.
int getStringLoc (int idx)
 Get 'location' of the String from the input row.
java.sql.Timestamp getTimestamp (int idx)
 Get a TIMESTAMP value from the input row.
SizedColumnTypes getTypeMetaData ()
VNumeric getVNumeric (int idx)
 Get a reference to a VNumeric value from the input row.
VString getVString (int idx)
 Get a reference from the input row to an VString value, which represents a SQL VARCHAR/CHAR/VARBINARY/BINARY value.
boolean isBooleanNull (int idx)
 Check whether a value from the input row is NULL in BOOLEAN type.
boolean isDateNull (int idx)
 Check whether a value from the input row is NULL in DATE type.
boolean isDoubleNull (int idx)
 Check whether a value from the input row is NULL in DOUBLE type.
boolean isLongNull (int idx)
 Check whether a value from the input row is NULL in LONG INTERGER type.
boolean isStringNull (int idx)
 Check whether a value from the input row is NULL in SQL VARCHAR/CHAR/VARBINARY/BINARY type.
boolean isTimestampInfinite (int idx)
 Check whether a TIMESTAMP value from the input row represents 'infinity'.
boolean isTimestampInfiniteNeg (int idx)
 Check whether a TIMESTAMP value from the input row represents '-infinity'.
boolean isTimestampInfinitePos (int idx)
 Check whether a TIMESTAMP value from the input row represents '+infinity'.
boolean isTimestampNull (int idx)
 Check whether a value from the input row is NULL in TIMESTAMP type.
boolean next () throws UdfException, DestroyInvocation
void resetBuffers ()

Public Attributes

int count
int index
int ncols
SizedColumnTypes typeMetaData

Protected Member Functions

 BlockReader (int _ncols, int _rowcount)
void clear ()

Protected Attributes

ArrayList< ByteBuffer > coldataareas
ArrayList< ByteBuffer > cols
ArrayList< Integer > colstrides
ArrayList< Integer > currentPos

Detailed Description

Iterator interface for reading rows in a Vertica block.

This class provides the input to the ScalarFunction.processBlock() function. You extract values from the input row using data type specific functions to extract each column value. You can also determine the number of columns and their data types, if your processBlock function does not have hard-coded input expectations.


Member Function Documentation

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.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,
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,
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

boolean com.vertica.sdk.BlockReader.getBoolean ( int  idx  ) 

Get a BOOLEAN value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The value of the idx'th argument, cast as a BOOLEAN.

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 
Returns:

ByteBuffer com.vertica.sdk.VerticaBlock.getColRef ( int  idx  )  [inherited]

Returns:
a ByteBuffer to the idx'th argument, containing data for the column
Example:

 ByteBuffer a = arg_reader.getColPtr(0);

java.sql.Date com.vertica.sdk.BlockReader.getDate ( int  idx  ) 

Get a DATE value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The value of the idx'th argument, cast as a DATE; null if the column is NULL.

double com.vertica.sdk.BlockReader.getDouble ( int  idx  ) 

Get a DOUBLE value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The value of the idx'th argument, cast as a DOUBLE.

long com.vertica.sdk.BlockReader.getLong ( int  idx  ) 

Get a LONG INTEGER value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The value of the idx'th argument, cast as a LONG INTEGER.
Example:

 long a = arg_reader.getLong(0);

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.

String com.vertica.sdk.BlockReader.getString ( int  idx  ) 

Get a reference to an VARCHAR/CHAR/VARBINARY/BINARY value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
a reference to the idx'th argument, cast as an String.

int com.vertica.sdk.BlockReader.getStringLength ( int  idx  ) 

Get length of the String from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The length of the String in specified column.

int com.vertica.sdk.BlockReader.getStringLoc ( int  idx  ) 

Get 'location' of the String from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The location of the String in specified column. If zero, data is inlined immediately after the header, otherwise data is at offset loc within the data area.

java.sql.Timestamp com.vertica.sdk.BlockReader.getTimestamp ( int  idx  ) 

Get a TIMESTAMP value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
The value of the idx'th argument, cast as a TIMESTAMP; null if the column is NULL or represents 'infinity'.

SizedColumnTypes com.vertica.sdk.VerticaBlock.getTypeMetaData (  )  [inherited]

Returns:
information about the types and numbers of arguments

VNumeric com.vertica.sdk.BlockReader.getVNumeric ( int  idx  ) 

Get a reference to a VNumeric value from the input row.

Parameters:
idx The column number to retrieve from the input row.
Returns:
A reference to the retrieved value cast as a Numeric.

VString com.vertica.sdk.BlockReader.getVString ( int  idx  ) 

Get a reference from the input row to an VString value, which represents a SQL VARCHAR/CHAR/VARBINARY/BINARY value.

Parameters:
idx The column number to retrieve from the input row.
Returns:
a reference to the idx'th argument, cast as an VString.

boolean com.vertica.sdk.BlockReader.isBooleanNull ( int  idx  ) 

Check whether a value from the input row is NULL in BOOLEAN type.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the value is NULL, false otherwise.

boolean com.vertica.sdk.BlockReader.isDateNull ( int  idx  ) 

Check whether a value from the input row is NULL in DATE type.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the value is NULL, false otherwise.

boolean com.vertica.sdk.BlockReader.isDoubleNull ( int  idx  ) 

Check whether a value from the input row is NULL in DOUBLE type.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the value is NULL, false otherwise.

boolean com.vertica.sdk.BlockReader.isLongNull ( int  idx  ) 

Check whether a value from the input row is NULL in LONG INTERGER type.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the value is NULL, false otherwise.

boolean com.vertica.sdk.BlockReader.isStringNull ( int  idx  ) 

Check whether a value from the input row is NULL in SQL VARCHAR/CHAR/VARBINARY/BINARY type.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the value is NULL, false otherwise.

boolean com.vertica.sdk.BlockReader.isTimestampInfinite ( int  idx  ) 

Check whether a TIMESTAMP value from the input row represents 'infinity'.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the TIMESTAMP value is '+infinity' or '-infinity', false otherwise.

boolean com.vertica.sdk.BlockReader.isTimestampInfiniteNeg ( int  idx  ) 

Check whether a TIMESTAMP value from the input row represents '-infinity'.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the TIMESTAMP value is '-infinity', false otherwise.

boolean com.vertica.sdk.BlockReader.isTimestampInfinitePos ( int  idx  ) 

Check whether a TIMESTAMP value from the input row represents '+infinity'.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the TIMESTAMP value is '+infinity', false otherwise.

boolean com.vertica.sdk.BlockReader.isTimestampNull ( int  idx  ) 

Check whether a value from the input row is NULL in TIMESTAMP type.

Parameters:
idx The column number to retrieve from the input row.
Returns:
true if the value is NULL, false otherwise.

boolean com.vertica.sdk.BlockReader.next (  )  throws UdfException, DestroyInvocation

Advance to the next record.

Returns:
true if there are more rows to read, false otherwise.

Reimplemented in com.vertica.sdk.PartitionReader.