Package com.clickhouse.client.data
Class ClickHouseSimpleRecord
- java.lang.Object
-
- com.clickhouse.client.data.ClickHouseSimpleRecord
-
- All Implemented Interfaces:
ClickHouseRecord
,Serializable
,Iterable<ClickHouseValue>
public class ClickHouseSimpleRecord extends Object implements ClickHouseRecord
Default implementation ofClickHouseRecord
, which is simply a combination of list of columns and array of values.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ClickHouseSimpleRecord
EMPTY
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClickHouseSimpleRecord(List<ClickHouseColumn> columns, ClickHouseValue[] values)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<ClickHouseColumn>
getColumns()
ClickHouseValue
getValue(int index)
Gets deserialized value wrapped in an object using column index.ClickHouseValue
getValue(String name)
Gets deserialized value wrapped in an object using case-insensitive column name, which usually is slower thanClickHouseRecord.getValue(int)
.protected ClickHouseValue[]
getValues()
static ClickHouseRecord
of(List<ClickHouseColumn> columns, ClickHouseValue[] values)
Creates a record object to wrap given values.int
size()
Gets size of the record.protected void
update(ClickHouseValue[] values)
protected void
update(Object[] values)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.clickhouse.client.ClickHouseRecord
iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
EMPTY
public static final ClickHouseSimpleRecord EMPTY
-
-
Constructor Detail
-
ClickHouseSimpleRecord
protected ClickHouseSimpleRecord(List<ClickHouseColumn> columns, ClickHouseValue[] values)
-
-
Method Detail
-
of
public static ClickHouseRecord of(List<ClickHouseColumn> columns, ClickHouseValue[] values)
Creates a record object to wrap given values.- Parameters:
columns
- non-null list of columnsvalues
- non-null array of values- Returns:
- record
-
getColumns
protected List<ClickHouseColumn> getColumns()
-
getValues
protected ClickHouseValue[] getValues()
-
update
protected void update(ClickHouseValue[] values)
-
update
protected void update(Object[] values)
-
size
public int size()
Description copied from interface:ClickHouseRecord
Gets size of the record.- Specified by:
size
in interfaceClickHouseRecord
- Returns:
- size of the record
-
getValue
public ClickHouseValue getValue(int index)
Description copied from interface:ClickHouseRecord
Gets deserialized value wrapped in an object using column index. Please avoid to cache the wrapper object, as it's reused among records for memory efficiency whenClickHouseConfig.isReuseValueWrapper()
returnstrue
, which is the default value. So instead ofmap.put("my_value", record.getValue(0))
, try something likemap.put("my_value", record.getValue(0).asString())
.- Specified by:
getValue
in interfaceClickHouseRecord
- Parameters:
index
- index of the column- Returns:
- non-null wrapped value
-
getValue
public ClickHouseValue getValue(String name)
Description copied from interface:ClickHouseRecord
Gets deserialized value wrapped in an object using case-insensitive column name, which usually is slower thanClickHouseRecord.getValue(int)
. Please avoid to cache the wrapper object, as it's reused among records for memory efficiency whenClickHouseConfig.isReuseValueWrapper()
returnstrue
, which is the default value. So instead ofmap.put("my_value", record.getValue("my_column"))
, try something likemap.put("my_value", record.getValue("my_column").asString())
.- Specified by:
getValue
in interfaceClickHouseRecord
- Parameters:
name
- case-insensitive name of the column- Returns:
- non-null wrapped value
-
-