Package io.confluent.ksql.api.client
Interface Row
-
public interface Row
A single record, returned as part of a query result.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description KsqlObject
asObject()
Returns the data in this row represented as aKsqlObject
where keys are column names and values are column values.List<String>
columnNames()
Returns column names for the data in this row.List<ColumnType>
columnTypes()
Returns column types for the data in this row.Boolean
getBoolean(int columnIndex)
Returns the value for a particular column of theRow
as a boolean.Boolean
getBoolean(String columnName)
Returns the value for a particular column of theRow
as a boolean.byte[]
getBytes(int columnIndex)
Returns the value for a particular column of theRow
as a byte array.byte[]
getBytes(String columnName)
Returns the value for a particular column of theRow
as byte array.BigDecimal
getDecimal(int columnIndex)
Returns the value for a particular column of theRow
as aBigDecimal
.BigDecimal
getDecimal(String columnName)
Returns the value for a particular column of theRow
as aBigDecimal
.Double
getDouble(int columnIndex)
Returns the value for a particular column of theRow
as a double.Double
getDouble(String columnName)
Returns the value for a particular column of theRow
as a double.Integer
getInteger(int columnIndex)
Returns the value for a particular column of theRow
as an integer.Integer
getInteger(String columnName)
Returns the value for a particular column of theRow
as an integer.KsqlArray
getKsqlArray(int columnIndex)
Returns the value for a particular column of theRow
as aKsqlArray
.KsqlArray
getKsqlArray(String columnName)
Returns the value for a particular column of theRow
as aKsqlArray
.KsqlObject
getKsqlObject(int columnIndex)
Returns the value for a particular column of theRow
as aKsqlObject
.KsqlObject
getKsqlObject(String columnName)
Returns the value for a particular column of theRow
as aKsqlObject
.Long
getLong(int columnIndex)
Returns the value for a particular column of theRow
as a long.Long
getLong(String columnName)
Returns the value for a particular column of theRow
as a long.String
getString(int columnIndex)
Returns the value for a particular column of theRow
as a string.String
getString(String columnName)
Returns the value for a particular column of theRow
as a string.Object
getValue(int columnIndex)
Returns the value for a particular column of theRow
as anObject
.Object
getValue(String columnName)
Returns the value for a particular column of theRow
as anObject
.boolean
isNull(int columnIndex)
Returns whether the value for a particular column of theRow
is null.boolean
isNull(String columnName)
Returns whether the value for a particular column of theRow
is null.KsqlArray
values()
Returns the values (data) in this row, represented as aKsqlArray
.
-
-
-
Method Detail
-
columnNames
List<String> columnNames()
Returns column names for the data in this row.- Returns:
- the column names
-
columnTypes
List<ColumnType> columnTypes()
Returns column types for the data in this row.- Returns:
- the column types
-
values
KsqlArray values()
Returns the values (data) in this row, represented as aKsqlArray
.Returned values are JSON types which means numeric columns are not necessarily typed in accordance with
columnTypes()
. For example, aBIGINT
field will be typed as an integer rather than a long, if the numeric value fits into an integer.- Returns:
- the values
-
asObject
KsqlObject asObject()
Returns the data in this row represented as aKsqlObject
where keys are column names and values are column values.- Returns:
- the data
-
isNull
boolean isNull(int columnIndex)
Returns whether the value for a particular column of theRow
is null.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- whether the column value is null
- Throws:
IndexOutOfBoundsException
- if the index is invalid
-
isNull
boolean isNull(String columnName)
Returns whether the value for a particular column of theRow
is null.- Parameters:
columnName
- name of column- Returns:
- whether the column value is null
- Throws:
IllegalArgumentException
- if the column name is invalid
-
getValue
Object getValue(int columnIndex)
Returns the value for a particular column of theRow
as anObject
.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
IndexOutOfBoundsException
- if the index is invalid
-
getValue
Object getValue(String columnName)
Returns the value for a particular column of theRow
as anObject
.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
IllegalArgumentException
- if the column name is invalid
-
getString
String getString(int columnIndex)
Returns the value for a particular column of theRow
as a string.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not a stringIndexOutOfBoundsException
- if the index is invalid
-
getString
String getString(String columnName)
Returns the value for a particular column of theRow
as a string.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not a stringIllegalArgumentException
- if the column name is invalid
-
getInteger
Integer getInteger(int columnIndex)
Returns the value for a particular column of theRow
as an integer.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IndexOutOfBoundsException
- if the index is invalid
-
getInteger
Integer getInteger(String columnName)
Returns the value for a particular column of theRow
as an integer.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IllegalArgumentException
- if the column name is invalid
-
getLong
Long getLong(int columnIndex)
Returns the value for a particular column of theRow
as a long.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IndexOutOfBoundsException
- if the index is invalid
-
getLong
Long getLong(String columnName)
Returns the value for a particular column of theRow
as a long.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IllegalArgumentException
- if the column name is invalid
-
getDouble
Double getDouble(int columnIndex)
Returns the value for a particular column of theRow
as a double.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IndexOutOfBoundsException
- if the index is invalid
-
getDouble
Double getDouble(String columnName)
Returns the value for a particular column of theRow
as a double.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IllegalArgumentException
- if the column name is invalid
-
getBoolean
Boolean getBoolean(int columnIndex)
Returns the value for a particular column of theRow
as a boolean.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not a booleanIndexOutOfBoundsException
- if the index is invalid
-
getBoolean
Boolean getBoolean(String columnName)
Returns the value for a particular column of theRow
as a boolean.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not a booleanIllegalArgumentException
- if the column name is invalid
-
getDecimal
BigDecimal getDecimal(int columnIndex)
Returns the value for a particular column of theRow
as aBigDecimal
.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IndexOutOfBoundsException
- if the index is invalid
-
getDecimal
BigDecimal getDecimal(String columnName)
Returns the value for a particular column of theRow
as aBigDecimal
.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aNumber
IllegalArgumentException
- if the column name is invalid
-
getBytes
byte[] getBytes(int columnIndex)
Returns the value for a particular column of theRow
as a byte array.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aString
IllegalArgumentException
- if the column value is not a base64 encoded stringIndexOutOfBoundsException
- if the index is invalid
-
getBytes
byte[] getBytes(String columnName)
Returns the value for a particular column of theRow
as byte array.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value is not aString
IllegalArgumentException
- if the column name is invalid or the column value is not a base64 encoded string
-
getKsqlObject
KsqlObject getKsqlObject(int columnIndex)
Returns the value for a particular column of theRow
as aKsqlObject
. Useful forMAP
andSTRUCT
column types.- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value cannot be converted to a mapIndexOutOfBoundsException
- if the index is invalid
-
getKsqlObject
KsqlObject getKsqlObject(String columnName)
Returns the value for a particular column of theRow
as aKsqlObject
. Useful forMAP
andSTRUCT
column types.- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value cannot be converted to a mapIllegalArgumentException
- if the column name is invalid
-
getKsqlArray
KsqlArray getKsqlArray(int columnIndex)
- Parameters:
columnIndex
- index of column (1-indexed)- Returns:
- column value
- Throws:
ClassCastException
- if the column value cannot be converted to a listIndexOutOfBoundsException
- if the index is invalid
-
getKsqlArray
KsqlArray getKsqlArray(String columnName)
- Parameters:
columnName
- name of column- Returns:
- column value
- Throws:
ClassCastException
- if the column value cannot be converted to a listIllegalArgumentException
- if the column name is invalid
-
-