Package io.confluent.ksql.api.client
Interface Row
public interface Row
A single record, returned as part of a query result.
-
Method Summary
Modifier and TypeMethodDescriptionasObject()
Returns the data in this row represented as aKsqlObject
where keys are column names and values are column values.Returns column names for the data in this row.Returns column types for the data in this row.getBoolean
(int columnIndex) Returns the value for a particular column of theRow
as a 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[]
Returns the value for a particular column of theRow
as byte array.getDecimal
(int columnIndex) Returns the value for a particular column of theRow
as aBigDecimal
.getDecimal
(String columnName) Returns the value for a particular column of theRow
as aBigDecimal
.getDouble
(int columnIndex) Returns the value for a particular column of theRow
as a double.Returns the value for a particular column of theRow
as a double.getInteger
(int columnIndex) Returns the value for a particular column of theRow
as an integer.getInteger
(String columnName) Returns the value for a particular column of theRow
as an integer.getKsqlArray
(int columnIndex) Returns the value for a particular column of theRow
as aKsqlArray
.getKsqlArray
(String columnName) Returns the value for a particular column of theRow
as aKsqlArray
.getKsqlObject
(int columnIndex) Returns the value for a particular column of theRow
as aKsqlObject
.getKsqlObject
(String columnName) Returns the value for a particular column of theRow
as aKsqlObject
.getLong
(int columnIndex) Returns the value for a particular column of theRow
as a long.Returns the value for a particular column of theRow
as a long.getString
(int columnIndex) Returns the value for a particular column of theRow
as a string.Returns the value for a particular column of theRow
as a string.getValue
(int columnIndex) Returns the value for a particular column of theRow
as anObject
.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
Returns whether the value for a particular column of theRow
is null.values()
Returns the values (data) in this row, represented as aKsqlArray
.
-
Method Details
-
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
- 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
- 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
-