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

# aggregateUnique

<div className="kinetica-javadoc">
  <ul className="member-list">
    <li>
      <div className="section detail" id="aggregateUnique(com.gpudb.protocol.AggregateUniqueRequest)">
        <h3>aggregateUnique</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueResponse" title="class in com.gpudb.protocol">AggregateUniqueResponse</a></span> <span className="element-name">aggregateUnique</span><wbr /><span className="parameters">(<a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest" title="class in com.gpudb.protocol">AggregateUniqueRequest</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">
          Returns all the unique values from a particular column (specified by <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getColumnName()"><code>columnName</code></a>) of a particular table or view (specified by <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getTableName()"><code>tableName</code></a>). If <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getColumnName()"><code>columnName</code></a> is a numeric column, the values will be in <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueResponse#getData()"><code>data</code></a>. Otherwise if <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getColumnName()"><code>columnName</code></a> is a string column, the values will be in <code> jsonEncodedResponse</code>. The results can be paged via <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getOffset()"><code>offset</code></a> and <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getLimit()"><code>limit</code></a> parameters.

          <p />

          <p> {"{"}"limit":"10","sort\_order":"descending"{"}"} </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>
          <p> If a <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> name is specified in the <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getOptions()"><code>options</code></a>, the results are stored in a new table with that name--no results are returned in the response. Both the table name and resulting column name must adhere to <a href="/content/concepts/tables/#table" target="_top">standard naming conventions</a>; any column expression will need to be aliased. If the source table's <a href="/content/concepts/tables/#shard-keys" target="_top">shard key</a> is used as the <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getColumnName()"><code>columnName</code></a>, the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available if the value of <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest#getColumnName()"><code>columnName</code></a> is an unrestricted-length string.</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/AggregateUniqueRequest" 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/AggregateUniqueResponse" 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="aggregateUnique(java.lang.String,java.lang.String,long,long,java.util.Map)">
        <h3>aggregateUnique</h3>
        <div className="member-signature"><span className="modifiers">public</span> <span className="return-type"><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueResponse" title="class in com.gpudb.protocol">AggregateUniqueResponse</a></span> <span className="element-name">aggregateUnique</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/lang/String.html" title="class or interface in java.lang" className="external-link">String</a> columnName, long offset, long limit, <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">
          Returns all the unique values from a particular column (specified by <code>columnName</code>) of a particular table or view (specified by <code> tableName</code>). If <code>columnName</code> is a numeric column, the values will be in <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueResponse#getData()"><code>data</code></a>. Otherwise if <code>columnName</code> is a string column, the values will be in <code>jsonEncodedResponse</code>. The results can be paged via <code> offset</code> and <code>limit</code> parameters.

          <p />

          <p> {"{"}"limit":"10","sort\_order":"descending"{"}"} </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>
          <p> If a <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> name is specified in the <code>options</code>, the results are stored in a new table with that name--no results are returned in the response. Both the table name and resulting column name must adhere to <a href="/content/concepts/tables/#table" target="_top">standard naming conventions</a>; any column expression will need to be aliased. If the source table's <a href="/content/concepts/tables/#shard-keys" target="_top">shard key</a> is used as the <code>columnName</code>, the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available if the value of <code>columnName</code> is an unrestricted-length string.</p>
        </div>

        <div className="dl notes">
          <div className="dt">Parameters:</div>
          <div className="dd"><code>tableName</code> - Name of an existing table or view on which the operation will be performed, 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>columnName</code> - Name of the column or an expression containing one or more column names on which the unique function would be applied.</div>
          <div className="dd"><code>offset</code> - A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX\_INT.</div>
          <div className="dd"><code>limit</code> - A positive integer indicating the maximum number of results to be returned, or END\_OF\_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server's own limit, defined by the <a href="/content/config/#config-main-general" target="_top">max\_get\_records\_size</a> parameter in the server configuration. Use <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueResponse#getHasMoreRecords()"><code>hasMoreRecords</code></a> to see if more records exist in the result to be fetched, and <code>offset</code> and <code>limit</code> to request subsequent pages of results. The default value is -9999.</div>

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

            <ul>
              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#CREATE_TEMP_TABLE"><code>CREATE\_TEMP\_TABLE</code></a>: If <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. If <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE_PERSIST"><code>RESULT\_TABLE\_PERSIST</code></a> is <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueResponse.Info#QUALIFIED_RESULT_TABLE_NAME"><code>QUALIFIED\_RESULT\_TABLE\_NAME</code></a>. Supported values:

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

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

              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. If the schema provided is non-existent, it will be automatically created. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#EXPRESSION"><code>EXPRESSION</code></a>: Filter expression to apply to the table. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#SORT_ORDER"><code>SORT\_ORDER</code></a>: String indicating how the returned values should be sorted. Supported values:

                <ul>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#ASCENDING"><code>ASCENDING</code></a> </li>
                  <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#DESCENDING"><code>DESCENDING</code></a> </li>
                </ul>

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

              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#ORDER_BY"><code>ORDER\_BY</code></a>: Comma-separated list of the columns to be sorted by as well as the sort direction, e.g., 'timestamp asc, x desc'. The default value is ''. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>: The name of the 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. Not available if <code>columnName</code> is an unrestricted-length string. </li>

              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE_PERSIST"><code>RESULT\_TABLE\_PERSIST</code></a>: If <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#TRUE"><code>TRUE</code></a>, then the result table specified in <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#TTL"><code>TTL</code></a> is specified. If <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#TTL"><code>TTL</code></a> is specified otherwise. Supported values:

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

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

              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. Supported values:

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

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

              <li>
                <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE_GENERATE_PK"><code>RESULT\_TABLE\_GENERATE\_PK</code></a>: If <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#TRUE"><code>TRUE</code></a> then set a primary key for the result table. Must be used in combination with the <a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. Supported values:

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

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

              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a>. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#RESULT_TABLE"><code>RESULT\_TABLE</code></a> option. </li>
              <li><a href="/content/api/java/com/gpudb/protocol/AggregateUniqueRequest.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/AggregateUniqueRequest.Options#VIEW_ID"><code>VIEW\_ID</code></a>: ID of view of which the result table will be a member. The default value is ''. </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/AggregateUniqueResponse" 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>
