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

# aggregateUnpivot

<div className="kinetica-javadoc">
  <ul className="member-list">
    <li>
      <div className="section detail" id="aggregateUnpivot(com.gpudb.protocol.AggregateUnpivotRequest)">
        <h3>aggregateUnpivot</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotResponse" title="class in com.gpudb.protocol">AggregateUnpivotResponse</a></span> <span className="element-name">aggregateUnpivot</span><wbr /><span className="parameters">(<a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest" title="class in com.gpudb.protocol">AggregateUnpivotRequest</a> request)</span> throws <span className="exceptions"><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></span></div>

        <div className="block">
          Rotate the column values into rows values.
          <p> For unpivot details and examples, see <a href="/content/concepts/unpivot/" target="_top">Unpivot</a>. For limitations, see <a href="/content/concepts/unpivot/#limitations" target="_top">Unpivot Limitations</a>. </p>
          <p> 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. </p>
          <p> The response is returned as a dynamic schema. For details see: <a href="/content/api/concepts/#dynamic-schemas" target="_top">dynamic schemas documentation</a>.</p>
        </div>

        <div className="dl notes">
          <div className="dt">Parameters:</div>
          <div className="dd"><code>request</code> - <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest" title="class in com.gpudb.protocol"><code>Request</code></a> object containing the parameters for the operation.</div>
          <div className="dt">Returns:</div>
          <div className="dd"><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotResponse" title="class in com.gpudb.protocol"><code>Response</code></a> object containing the results of the operation.</div>
          <div className="dt">Throws:</div>
          <div className="dd"><code><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></code> - if an error occurs during the operation.</div>
        </div>
      </div>
    </li>

    <li>
      <div className="section detail" id="aggregateUnpivot(java.lang.String,java.util.List,java.lang.String,java.lang.String,java.util.List,java.util.Map)">
        <h3>aggregateUnpivot</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotResponse" title="class in com.gpudb.protocol">AggregateUnpivotResponse</a></span> <span className="element-name">aggregateUnpivot</span><wbr /><span className="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a> tableName, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html" title="class or interface in java.util" className="external-link">List</a>\<<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a>> columnNames, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a> variableColumnName, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a> valueColumnName, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html" title="class or interface in java.util" className="external-link">List</a>\<<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a>> pivotedColumns, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" className="external-link">Map</a>\<<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a>,<wbr /><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" className="external-link">String</a>> options)</span> throws <span className="exceptions"><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></span></div>

        <div className="block">
          Rotate the column values into rows values.
          <p> For unpivot details and examples, see <a href="/content/concepts/unpivot/" target="_top">Unpivot</a>. For limitations, see <a href="/content/concepts/unpivot/#limitations" target="_top">Unpivot Limitations</a>. </p>
          <p> 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. </p>
          <p> The response is returned as a dynamic schema. For details see: <a href="/content/api/concepts/#dynamic-schemas" target="_top">dynamic schemas documentation</a>.</p>
        </div>

        <div className="dl notes">
          <div className="dt">Parameters:</div>
          <div className="dd"><code>tableName</code> - 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 <a href="/content/concepts/tables/#table-name-resolution" target="_top">name resolution rules</a>.</div>
          <div className="dd"><code>columnNames</code> - List of column names or expressions. A wildcard '\*' can be used to include all the non-pivoted columns from the source table.</div>
          <div className="dd"><code>variableColumnName</code> - Specifies the variable/parameter column name. The default value is ''.</div>
          <div className="dd"><code>valueColumnName</code> - Specifies the value column name. The default value is ''.</div>
          <div className="dd"><code>pivotedColumns</code> - 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.</div>

          <div className="dd">
            <code>options</code> - Optional parameters.

            <ul>
              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#CREATE_TEMP_TABLE"><code>CREATE\_TEMP\_TABLE</code></a>: If <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TRUE"><code>TRUE</code></a>, a unique temporary table name will be generated in the sys\_temp schema and used in place of <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. If <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE_PERSIST"><code>RESULT\_TABLE\_PERSIST</code></a> is <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a> (or unspecified), then this is always allowed even if the caller does not have permission to create tables. The generated name is returned in <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotResponse.Info#QUALIFIED_RESULT_TABLE_NAME"><code>QUALIFIED\_RESULT\_TABLE\_NAME</code></a>. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#COLLECTION_NAME"><code>COLLECTION\_NAME</code></a>: \[DEPRECATED--please specify the containing schema as part of <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> and use <a href="#createSchema(java.lang.String,java.util.Map)"><code>createSchema</code></a> to create the schema if non-existent] Name of a schema which is to contain the table specified in <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. If the schema is non-existent, it will be automatically created. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>: The name of a table used to store the results, in \[schema\_name.]table\_name format, using standard <a href="/content/concepts/tables/#table-name-resolution" target="_top">name resolution rules</a> and meeting <a href="/content/concepts/tables/#table-naming-criteria" target="_top">table naming criteria</a>. If present, no results are returned in the response. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE_PERSIST"><code>RESULT\_TABLE\_PERSIST</code></a>: If <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TRUE"><code>TRUE</code></a>, then the result table specified in <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> will be persisted and will not expire unless a <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TTL"><code>TTL</code></a> is specified. If <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a>, then the result table will be an in-memory table and will expire unless a <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TTL"><code>TTL</code></a> is specified otherwise. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>

              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#EXPRESSION"><code>EXPRESSION</code></a>: Filter expression to apply to the table prior to unpivot processing. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#ORDER_BY"><code>ORDER\_BY</code></a>: Comma-separated list of the columns to be sorted by; e.g. 'timestamp asc, x desc'. The columns specified must be present in input table. If any alias is given for any column name, the alias must be used, rather than the original column name. The default value is ''. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#CHUNK_SIZE"><code>CHUNK\_SIZE</code></a>: Indicates the number of records per chunk to be used for the result table. Must be used in combination with the <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#CHUNK_COLUMN_MAX_MEMORY"><code>CHUNK\_COLUMN\_MAX\_MEMORY</code></a>: Indicates the target maximum data size for each column in a chunk to be used for the result table. Must be used in combination with the <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#CHUNK_MAX_MEMORY"><code>CHUNK\_MAX\_MEMORY</code></a>: Indicates the target maximum data size for all columns in a chunk to be used for the result table. Must be used in combination with the <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#COMPRESSION_CODEC"><code>COMPRESSION\_CODEC</code></a>: The default <a href="/content/concepts/column_compression/" target="_top">compression codec</a> for the result table's columns. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#LIMIT"><code>LIMIT</code></a>: The number of records to keep. The default value is ''. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TTL"><code>TTL</code></a>: Sets the <a href="/content/concepts/ttl/" target="_top">TTL</a> of the table specified in <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#VIEW_ID"><code>VIEW\_ID</code></a>: View this result table is part of. The default value is ''. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#CREATE_INDEXES"><code>CREATE\_INDEXES</code></a>: Comma-separated list of columns on which to create indexes on the table specified in <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. The columns specified must be present in output column names. If any alias is given for any column name, the alias must be used, rather than the original column name. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE_FORCE_REPLICATED"><code>RESULT\_TABLE\_FORCE\_REPLICATED</code></a>: Force the result table to be replicated (ignores any sharding). Must be used in combination with the <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#TRUE"><code>TRUE</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a> </li>
                </ul>

                The default value is <a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotRequest.Options#FALSE"><code>FALSE</code></a>.
              </li>
            </ul>

            The default value is an empty <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" className="external-link"><code>Map</code></a>.
          </div>

          <div className="dt">Returns:</div>
          <div className="dd"><a href="/content/api/java/com/gpudb/protocol/AggregateUnpivotResponse" title="class in com.gpudb.protocol"><code>Response</code></a> object containing the results of the operation.</div>
          <div className="dt">Throws:</div>
          <div className="dd"><code><a href="/content/api/java/com/gpudb/GPUdbException" title="class in com.gpudb">GPUdbException</a></code> - if an error occurs during the operation.</div>
        </div>
      </div>
    </li>
  </ul>
</div>
