> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GenericRecord

> GenericRecord — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)::<wbr />[generic\_record](https://docs.kinetica.com/content/api/rust/generic_record/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1514-L1519)&#x20;

<pre>`pub struct GenericRecord { /* private fields */ }`</pre>

A generic record that can hold values for any Kinetica type.It stores values in an array indexed by column position, and uses the associated `Type` for schema information.

## Example

```rust theme={null}
let record_type = Type::from_table(&kinetica, "my_table").await?;
let type_arc = Arc::new(record_type);

let mut record = type_arc.new_record();

// Set values by index
record.set(0, 42)?;
record.set(1, "Alice")?;

// Set values by name; a name the type does not have is an error
record.set_by_name("score", 95.5)?;

// Get values
let id: i32 = record.get_int(0).unwrap();
let name: &str = record.get_string_by_name("name").unwrap();
```

## Dates and times

A date, time or datetime column holds text in Kinetica’s formats: `yyyy-MM-dd`, `HH:mm:ss.SSS` and `yyyy-MM-dd HH:mm:ss.SSS`. A record reads no other formats; format the value with chrono first:

```rust theme={null}
use chrono::{DateTime, FixedOffset, NaiveDate, NaiveDateTime, NaiveTime};

// Text without an offset is kept as it is
let date = NaiveDate::parse_from_str("01/15/2024", "%m/%d/%Y").unwrap();
assert_eq!(date.format("%Y-%m-%d").to_string(), "2024-01-15");
let time = NaiveTime::parse_from_str("10:30:45.123999", "%H:%M:%S%.f").unwrap();
assert_eq!(time.format("%H:%M:%S%.3f").to_string(), "10:30:45.123");
let datetime = NaiveDateTime::parse_from_str("15.01.2024 10:30", "%d.%m.%Y %H:%M").unwrap();
assert_eq!(datetime.format("%Y-%m-%d %H:%M:%S%.3f").to_string(), "2024-01-15 10:30:00.000");
// A date alone, for a datetime column, is the start of the day
let midnight = date.and_time(NaiveTime::MIN);
assert_eq!(midnight.format("%Y-%m-%d %H:%M:%S%.3f").to_string(), "2024-01-15 00:00:00.000");

// Text with an offset is converted to the offset of the time zone given
// (a fixed offset, without daylight saving)
let india = FixedOffset::east_opt(5 * 3600 + 1800).unwrap();
let zoned = DateTime::parse_from_rfc3339("2024-01-15T23:30:00Z").unwrap().with_timezone(&india);
assert_eq!(zoned.format("%Y-%m-%d %H:%M:%S%.3f").to_string(), "2024-01-16 05:00:00.000");
assert_eq!(zoned.format("%Y-%m-%d").to_string(), "2024-01-16");
```

Fractions of a second past the millisecond are dropped, not rounded. chrono refuses a day past the end of its month (`2023-02-30`) and the time `24:00`. Zone names (`America/New_York`, `EST`) need a zone database, such as the `chrono-tz` crate. A fixed offset ignores daylight saving, so give the offset in effect if that is what is meant.

## Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1521-L1997)
impl [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1523-L1526)
pub fn [decode](#method.decode)( record\_type: &[Arc](https://doc.rust-lang.org/1.98.1/alloc/sync/struct.Arc.html)\<[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)>, encoded: &\[[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)], ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Decodes a record of `record_type` from its Avro binary form.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1529-L1547)
pub fn [decode\_all](#method.decode_all)\<B: [AsRef](https://doc.rust-lang.org/1.98.1/core/convert/trait.AsRef.html)\<\[[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)]>>( record\_type: &[Arc](https://doc.rust-lang.org/1.98.1/alloc/sync/struct.Arc.html)\<[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)>, encoded: &[\[B\]](https://doc.rust-lang.org/1.98.1/std/primitive.slice.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Decodes records of `record_type` from their Avro binary forms.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1551-L1575)
pub fn [transpose](#method.transpose)( schema\_string: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), encoded\_data: &\[[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)], record\_type: &[Arc](https://doc.rust-lang.org/1.98.1/alloc/sync/struct.Arc.html)\<[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

The records of a dynamic (column-wise) response, one per row, typed by `record_type` (see [`Type::from_dynamic_schema`](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type#method.from_dynamic_schema)).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1580-L1583)
pub fn [new](#method.new)(record\_type: [Arc](https://doc.rust-lang.org/1.98.1/alloc/sync/struct.Arc.html)\<[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)>) -> Self

Create a new GenericRecord for the given type.All values are initialized to Null.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1586-L1588)
pub fn [record\_type](#method.record_type)(\&self) -> &[Arc](https://doc.rust-lang.org/1.98.1/alloc/sync/struct.Arc.html)\<[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)>

Get the type definition for this record.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1591-L1593)
pub fn [get](#method.get)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<&[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)>

Get a value by index.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1596-L1599)
pub fn [get\_by\_name](#method.get_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<&[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)>

Get a value by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1604-L1611)
pub fn [set](#method.set)\<V: [Into](https://doc.rust-lang.org/1.98.1/core/convert/trait.Into.html)\<[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)>>( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), value: V, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sets the value at `index`. The value is not checked against the column’s type here; encoding the record does that. An index past the last column fails.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1615-L1618)
pub fn [set\_by\_name](#method.set_by_name)\<V: [Into](https://doc.rust-lang.org/1.98.1/core/convert/trait.Into.html)\<[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)>>( \&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), value: V, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sets the value of the column `name`. A name the type does not have fails with “Field ‘\<name>’ does not exist.”

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1621-L1623)
pub fn [set\_null](#method.set_null)(\&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sets the value at `index` to null; see [`GenericRecord::set`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1627-L1629)
pub fn [set\_null\_by\_name](#method.set_null_by_name)(\&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sets the value of the column `name` to null; see [`GenericRecord::set_by_name`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set_by_name).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1634-L1636)
pub fn [get\_int](#method.get_int)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[i32](https://doc.rust-lang.org/1.98.1/std/primitive.i32.html)>

Get integer value by index.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1639-L1641)
pub fn [get\_long](#method.get_long)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html)>

Get long value by index. An int value is widened.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1644-L1646)
pub fn [get\_float](#method.get_float)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html)>

Get float value by index.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1649-L1651)
pub fn [get\_double](#method.get_double)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[f64](https://doc.rust-lang.org/1.98.1/std/primitive.f64.html)>

Get double value by index. A float value is widened.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1654-L1656)
pub fn [get\_string](#method.get_string)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<&[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)>

Get string value by index.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1659-L1661)
pub fn [get\_bytes](#method.get_bytes)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<&\[[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)]>

Get bytes value by index.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1664-L1666)
pub fn [get\_bool](#method.get_bool)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)>

Get boolean value by index.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1671-L1673)
pub fn [get\_int\_by\_name](#method.get_int_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[i32](https://doc.rust-lang.org/1.98.1/std/primitive.i32.html)>

Get integer value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1676-L1678)
pub fn [get\_long\_by\_name](#method.get_long_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html)>

Get long value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1681-L1683)
pub fn [get\_float\_by\_name](#method.get_float_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html)>

Get float value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1686-L1688)
pub fn [get\_double\_by\_name](#method.get_double_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[f64](https://doc.rust-lang.org/1.98.1/std/primitive.f64.html)>

Get double value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1691-L1693)
pub fn [get\_string\_by\_name](#method.get_string_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<&[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)>

Get string value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1696-L1698)
pub fn [get\_bytes\_by\_name](#method.get_bytes_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<&\[[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)]>

Get bytes value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1701-L1703)
pub fn [get\_bool\_by\_name](#method.get_bool_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)>

Get boolean value by name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1724-L1829)
pub fn [get\_array](#method.get_array)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[ArrayValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.ArrayValue.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

The elements of an array column, or the floats of a vector column. An array column’s value is JSON text, read as an array of its element type (see [`Column::array_type`](https://docs.kinetica.com/content/api/rust/generic_record/struct.Column#method.array_type)), each element `None` where it is null, with these coercions: a number from text, an integer from a fraction (truncated), a boolean from a number. Bytes elements arrive as text whose characters are the bytes, or as integers, which become their minimal big-endian bytes.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1832-L1834)
pub fn [get\_array\_by\_name](#method.get_array_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[ArrayValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.ArrayValue.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::get_array`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.get_array), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1839-L1853)
pub fn [get\_vector](#method.get_vector)(\&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html)>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

The floats of a vector column, read little-endian from its bytes. Fails with “Not a vector column” for a column without a `vector(N)` property.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1856-L1858)
pub fn [get\_vector\_by\_name](#method.get_vector_by_name)(\&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html)>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::get_vector`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.get_vector), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1861-L1869)
pub fn [get\_json](#method.get_json)( \&self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Map](https://docs.rs/serde_json/1.0.149/serde_json/map/struct.Map.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [Value](https://docs.rs/serde_json/1.0.149/serde_json/value/enum.Value.html)>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

A JSON column’s object.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1872-L1874)
pub fn [get\_json\_by\_name](#method.get_json_by_name)( \&self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Map](https://docs.rs/serde_json/1.0.149/serde_json/map/struct.Map.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [Value](https://docs.rs/serde_json/1.0.149/serde_json/value/enum.Value.html)>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::get_json`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.get_json), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1890-L1892)
pub fn [set\_array](#method.set_array)\<V: [Serialize](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html)>( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), value: [\&V](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Puts an array column’s value. Text goes as it is, `None` as null, and anything else (a `Vec<i32>`, say) as its JSON text.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1895-L1898)
pub fn [set\_array\_by\_name](#method.set_array_by_name)\<V: [Serialize](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html)>( \&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), value: [\&V](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::set_array`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set_array), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1902-L1904)
pub fn [set\_json](#method.set_json)\<V: [Serialize](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html)>( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), value: [\&V](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Puts a JSON column’s value. Text goes as it is, `None` as null, and anything else (a map, say) as its JSON text.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1907-L1910)
pub fn [set\_json\_by\_name](#method.set_json_by_name)\<V: [Serialize](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html)>( \&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), value: [\&V](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::set_json`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set_json), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1913-L1918)
pub fn [set\_bytes](#method.set_bytes)( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), value: [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)>>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Puts a bytes column’s value, or null.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1921-L1924)
pub fn [set\_bytes\_by\_name](#method.set_bytes_by_name)( \&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), value: [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)>>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::set_bytes`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set_bytes), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1930-L1942)
pub fn [set\_vector](#method.set_vector)( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), value: &\[[f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html)], ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Puts a vector column’s floats, little-endian. Fails with “Not a vector column” for a column without a `vector(N)` property, and with “Unmatched vector dimensions: found \<n> but expected \<n>” for another number of floats.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1946-L1950)
pub fn [set\_vector\_text](#method.set_vector_text)( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), text: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Puts a vector column’s floats given as a JSON array: “Error reading vector string” where it is not one.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1953-L1956)
pub fn [set\_vector\_by\_name](#method.set_vector_by_name)( \&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), value: &\[[f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html)], ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::set_vector`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set_vector), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1963-L1985)
pub fn [set\_decimal](#method.set_decimal)( \&mut self, index: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), value: impl [Into](https://doc.rust-lang.org/1.98.1/core/convert/trait.Into.html)\<[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Puts a decimal column’s value: text as it is, null as null, and a number at the column’s scale, failing where that would drop a digit, and for a NaN or infinity. Trailing zeros after the decimal point are stripped (“120.00” is “120.”). A whole number at scale 0 has no decimal point, so it keeps its value.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1988-L1991)
pub fn [set\_decimal\_by\_name](#method.set_decimal_by_name)( \&mut self, name: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), value: impl [Into](https://doc.rust-lang.org/1.98.1/core/convert/trait.Into.html)\<[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

[`Self::set_decimal`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.set_decimal), by column name.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1994-L1996)
pub fn [data\_map](#method.data_map)(\&self) -> [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<(&[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), &[RecordValue](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md))>

The record’s values by column name, in column order.

## Trait Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1513)
impl [Clone](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1513)
fn [clone](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#tymethod.clone)(\&self) -> [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

Returns a duplicate of the value. [Read more](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#tymethod.clone)

1.0.0 (const: [unstable](https://github.com/rust-lang/rust/issues/142757)) · [Source](https://doc.rust-lang.org/1.98.1/src/core/clone.rs.html#245-247)
fn [clone\_from](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#method.clone_from)(\&mut self, source: \&Self)

Performs copy-assignment from `source`. [Read more](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#method.clone_from)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1513)
impl [Debug](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1513)
fn [fmt](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html#tymethod.fmt)(\&self, f: \&mut [Formatter](https://doc.rust-lang.org/1.98.1/core/fmt/struct.Formatter.html)\<'\_>) -> [Result](https://doc.rust-lang.org/1.98.1/core/fmt/type.Result.html)

Formats the value using the given formatter. [Read more](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html#tymethod.fmt)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2084-L2094)
impl [Display](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Display.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

`{"name":value,..}`, each name quoted and escaped, and each value as its text: a number bare (NaN and the infinities quoted), text and bytes quoted, and null as `null`.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2085-L2093)
fn [fmt](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Display.html#tymethod.fmt)(\&self, f: \&mut [Formatter](https://doc.rust-lang.org/1.98.1/core/fmt/struct.Formatter.html)\<'\_>) -> [Result](https://doc.rust-lang.org/1.98.1/core/fmt/type.Result.html)

Formats the value using the given formatter. [Read more](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Display.html#tymethod.fmt)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2060)
impl [Eq](https://doc.rust-lang.org/1.98.1/core/cmp/trait.Eq.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2064-L2079)
impl [Hash](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hash.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

Consistent with [`GenericRecord`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord)’s equality: floats by their bits, every NaN alike.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2065-L2078)
fn [hash](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hash.html#tymethod.hash)\<H: [Hasher](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hasher.html)>(\&self, state: [\&mut H](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html))

Feeds this value into the given [`Hasher`](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hasher.html). [Read more](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hash.html#tymethod.hash)

1.3.0 · [Source](https://doc.rust-lang.org/1.98.1/src/core/hash/mod.rs.html#234-236)

#### fn [hash\_slice](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hash.html#method.hash_slice)\<H>(data: &\[Self], state: [\&mut H](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html))&#xA;where H: [Hasher](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hasher.html), Self: [Sized](https://doc.rust-lang.org/1.98.1/core/marker/trait.Sized.html),

Feeds a slice of this type into the given [`Hasher`](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hasher.html). [Read more](https://doc.rust-lang.org/1.98.1/core/hash/trait.Hash.html#method.hash_slice)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2324-L2336)
impl [KineticaRecord](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2325-L2331)
fn [avro\_schema](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md#tymethod.avro_schema)(\&self) -> &'static [str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)

Returns the Avro schema as a JSON string for this record type.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2333-L2335)
fn [type\_properties](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md#tymethod.type_properties)() -> [HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>>

Returns type properties including field types and attributes (e.g., primary\_key).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/lib.rs#L325-L327)
fn [use\_compression](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md#method.use_compression)() -> [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)

Whether requests of this type are Snappy-compressed when the client has [`KineticaOptions::use_snappy`](https://docs.kinetica.com/content/api/rust/gpudb/struct.KineticaOptions#structfield.use_snappy) enabled. [Read more](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md#method.use_compression)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2052-L2058)
impl [PartialEq](https://doc.rust-lang.org/1.98.1/core/cmp/trait.PartialEq.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

The same type, and every value equal, floats by their bits with every NaN alike.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2053-L2057)
fn [eq](https://doc.rust-lang.org/1.98.1/core/cmp/trait.PartialEq.html#tymethod.eq)(\&self, other: \&Self) -> [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)

Tests for `self` and `other` values to be equal, and is used by `==`.

1.0.0 (const: [unstable](https://github.com/rust-lang/rust/issues/143800)) · [Source](https://doc.rust-lang.org/1.98.1/src/core/cmp.rs.html#263)
fn [ne](https://doc.rust-lang.org/1.98.1/core/cmp/trait.PartialEq.html#method.ne)(\&self, other: [\&Rhs](https://doc.rust-lang.org/1.98.1/std/primitive.reference.html)) -> [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)

Tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_retriever.rs#L113-L117)
impl [RetrievedRecord](https://docs.kinetica.com/content/api/rust/record_retriever/trait.RetrievedRecord.md) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_retriever.rs#L114-L116)
fn [decode\_records](https://docs.kinetica.com/content/api/rust/record_retriever/trait.RetrievedRecord.md#tymethod.decode_records)( record\_type: &[Arc](https://doc.rust-lang.org/1.98.1/alloc/sync/struct.Arc.html)\<[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)>, encoded: &\[[ByteBuf](https://docs.kinetica.com/content/api/rust/struct.ByteBuf.md)], ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<Self>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Decodes records of `record_type`. A failure reads “Could not decode object: …”.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2109-L2121)
impl [Serialize](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

Encodes the record for its Avro schema, field by field in column order, each value converted for its column:

<ul>
  <li>a number goes into an `int`, `long`, `float` or `double` column whatever its own type, converted as `as` converts it (truncated, or rounded to the nearest);</li>
  <li>a string goes only into a `string` column, and bytes only into `bytes`;</li>
  <li>a nullable column is an Avro union, which takes a value only of the column’s own type, unconverted, or null.</li>
</ul>

A value the column cannot take fails the record with a message that begins with `ENCODE_FAILURE_PREFIX`.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2110-L2120)

#### fn [serialize](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html#tymethod.serialize)\<S>(\&self, serializer: S) ->[Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<S::[Ok](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serializer.html#associatedtype.Ok), S::[Error](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serializer.html#associatedtype.Error)>&#xA;where S: [Serializer](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serializer.html),

Serialize this value into the given Serde serializer. [Read more](https://docs.rs/serde_core/1.0.228/serde_core/ser/trait.Serialize.html#tymethod.serialize)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2339-L2378)
impl [ShardKeyExtractor](https://docs.kinetica.com/content/api/rust/bulk_inserter_common/trait.ShardKeyExtractor.md) for [GenericRecord](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L2342-L2377)
fn [shard\_key\_values](https://docs.kinetica.com/content/api/rust/bulk_inserter_common/trait.ShardKeyExtractor.md#tymethod.shard_key_values)(\&self) -> [ShardKeyValues](https://docs.kinetica.com/content/api/rust/bulk_inserter_common/type.ShardKeyValues.md)\<'\_>

Returns the values of the columns the table is sharded on: its shard key columns, or its primary key columns when it has no shard key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.