> ## 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.

# aggregate_unpivot

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unpivot.rs#L43-L60)
pub async fn [aggregate\_unpivot](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unpivot.md#method.aggregate_unpivot)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), column\_names: [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)>, variable\_column\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), value\_column\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), pivoted\_columns: [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)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AggregateUnpivotResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Rotate column values into rows values.Rotate the column values into rows values.For unpivot details and examples, see Unpivot. For limitations, see Unpivot Limitations.Unpivot is used to normalize tables that are built for cross tabular reporting purposes. The unpivot operator rotates the column values for all the pivoted columns. A variable column, value column and all columns from the source table except the unpivot columns are projected into the result table. The variable column and value columns in the result table indicate the pivoted column name and values respectively.The response is returned as a dynamic schema. For details see: dynamic schemas documentation.

##### Arguments

<ul>
  <li>`table_name` - Name of the table on which the operation will be performed. Must be an existing table/view, in \[schema\_name.]table\_name format, using standard name resolution rules.</li>
  <li>`column_names` - List of column names or expressions. A wildcard ‘\*’ can be used to include all the non-pivoted columns from the source table.</li>
  <li>`variable_column_name` - Specifies the variable/parameter column name.</li>
  <li>`value_column_name` - Specifies the value column name.</li>
  <li>`pivoted_columns` - List of one or more values typically the column names of the input table. All the columns in the source table must have the same data type.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unpivot.rs#L95-L122)
pub async fn [aggregate\_unpivot\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unpivot.md#method.aggregate_unpivot_with_opts)( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), column\_names: [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)>, variable\_column\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), value\_column\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), pivoted\_columns: [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)>, options: [AggregateUnpivotRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AggregateUnpivotResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Rotate column values into rows values.Rotate the column values into rows values.For unpivot details and examples, see Unpivot. For limitations, see Unpivot Limitations.Unpivot is used to normalize tables that are built for cross tabular reporting purposes. The unpivot operator rotates the column values for all the pivoted columns. A variable column, value column and all columns from the source table except the unpivot columns are projected into the result table. The variable column and value columns in the result table indicate the pivoted column name and values respectively.The response is returned as a dynamic schema. For details see: dynamic schemas documentation.

##### Arguments

<ul>
  <li>`table_name` - Name of the table on which the operation will be performed. Must be an existing table/view, in \[schema\_name.]table\_name format, using standard name resolution rules.</li>
  <li>`column_names` - List of column names or expressions. A wildcard ‘\*’ can be used to include all the non-pivoted columns from the source table.</li>
  <li>`variable_column_name` - Specifies the variable/parameter column name.</li>
  <li>`value_column_name` - Specifies the value column name.</li>
  <li>`pivoted_columns` - List of one or more values typically the column names of the input table. All the columns in the source table must have the same data type.</li>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unpivot.rs#L126-L144)
pub async fn [aggregate\_unpivot\_request](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unpivot.md#method.aggregate_unpivot_request)( \&self, request: &[AggregateUnpivotRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AggregateUnpivotResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AggregateUnpivotRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequest) to the `/aggregate/unpivot` endpoint and decodes the records it returns. Only binary encoding is supported.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unpivot.rs#L148-L159)
pub async fn [aggregate\_unpivot\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unpivot.md#method.aggregate_unpivot_raw)( \&self, request: &[AggregateUnpivotRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawAggregateUnpivotResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawAggregateUnpivotResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AggregateUnpivotRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequest) to the `/aggregate/unpivot` endpoint, returning the response as the server sends it.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/aggregate_unpivot.rs#L163-L175)
pub async fn [aggregate\_unpivot\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/aggregate-unpivot.md#method.aggregate_unpivot_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[AggregateUnpivotRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawAggregateUnpivotResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawAggregateUnpivotResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AggregateUnpivotRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AggregateUnpivotRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


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