Class ClickHouseSimpleRecord

java.lang.Object
com.clickhouse.data.ClickHouseSimpleRecord
All Implemented Interfaces:
ClickHouseRecord, Serializable, Iterable<ClickHouseValue>

public class ClickHouseSimpleRecord extends Object implements ClickHouseRecord
Default implementation of ClickHouseRecord, which is simply a combination of list of columns and array of values.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • of

      public static ClickHouseRecord of(List<ClickHouseColumn> columns, ClickHouseValue[] values)
      Creates a record object to wrap given values.
      Parameters:
      columns - non-null list of columns
      values - 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)
    • copy

      public ClickHouseRecord copy()
      Description copied from interface: ClickHouseRecord
      Creates a new record by copying values from current one.
      Specified by:
      copy in interface ClickHouseRecord
      Returns:
      a new 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 when ClickHouseDataConfig.isReuseValueWrapper() returns true, which is the default value. So instead of map.put("my_value", record.getValue(0)), try something like map.put("my_value", record.getValue(0).asString()).
      Specified by:
      getValue in interface ClickHouseRecord
      Parameters:
      index - zero-based 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 than ClickHouseRecord.getValue(int). Please avoid to cache the wrapper object, as it's reused among records for memory efficiency when ClickHouseDataConfig.isReuseValueWrapper() returns true, which is the default value. So instead of map.put("my_value", record.getValue("my_column")), try something like map.put("my_value", record.getValue("my_column").asString()).
      Specified by:
      getValue in interface ClickHouseRecord
      Parameters:
      name - case-insensitive name of the column
      Returns:
      non-null wrapped value
    • size

      public int size()
      Description copied from interface: ClickHouseRecord
      Gets size of the record.
      Specified by:
      size in interface ClickHouseRecord
      Returns:
      size of the record