net.snowflake.client.jdbc

## Class SnowflakeResultSetSerializableV1

- java.lang.Object
- - net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1

All Implemented Interfaces:
  Serializable, SnowflakeResultSetSerializable

    public class SnowflakeResultSetSerializableV1
    extends Object
    implements SnowflakeResultSetSerializable, Serializable

This object is an intermediate object between result JSON from GS and ResultSet. Originally, it is created from result JSON. And it can also be serializable. Logically, it stands for a part of ResultSet.

A typical result JSON data section consists of the content of the first chunk file and file metadata for the rest of chunk files e.g. URL, chunk size, etc. So this object consists of one chunk data and a list of chunk file entries. In actual cases, it may only include chunk data or chunk files entries.

This object is serializable, so it can be distributed to other threads or worker nodes for distributed processing.

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `SnowflakeResultSetSerializableV1.ChunkFileMetadata` An Entity class to represent a chunk file metadata.

### Nested classes/interfaces inherited from interface net.snowflake.client.jdbc.SnowflakeResultSetSerializable

`SnowflakeResultSetSerializable.ResultSetRetrieveConfig`

### Constructor Summary

Constructors
Constructor and Description
`SnowflakeResultSetSerializableV1()` Default constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`static SnowflakeResultSetSerializableV1` `create(com.fasterxml.jackson.databind.JsonNode rootNode, SFBaseSession sfSession, SFBaseStatement sfStatement)` A factory function to create SnowflakeResultSetSerializable object from result JSON node, using the DefaultResultStreamProvider.
`static SnowflakeResultSetSerializableV1` `create(com.fasterxml.jackson.databind.JsonNode rootNode, SFBaseSession sfSession, SFBaseStatement sfStatement, ResultStreamProvider resultStreamProvider)` A factory function to create SnowflakeResultSetSerializable object from result JSON node, with an overridable ResultStreamProvider.
`com.fasterxml.jackson.databind.JsonNode` `getAndClearFirstChunkRowset()`
`int` `getAuthTimeout()`
`net.snowflake.common.core.SFBinaryFormat` `getBinaryFormatter()`
`ChunkDownloader` `getChunkDownloader()`
`int` `getChunkFileCount()`
`List<SnowflakeResultSetSerializableV1.ChunkFileMetadata>` `getChunkFileMetadatas()`
`Map<String,String>` `getChunkHeadersMap()`
`int` `getColumnCount()`
`long` `getCompressedDataSizeInBytes()` Retrieve compressed data size in the ResultSet Serializable object.
`net.snowflake.common.core.SnowflakeDateTimeFormat` `getDateFormatter()`
`String` `getFinalDatabaseName()`
`String` `getFinalRoleName()`
`String` `getFinalSchemaName()`
`String` `getFinalWarehouseName()`
`byte[]` `getFirstChunkByteData()`
`int` `getFirstChunkRowCount()`
`String` `getFirstChunkStringData()`
`boolean` `getFormatDateWithTimeZone()`
`HttpClientSettingsKey` `getHttpClientKey()`
`long` `getMemoryLimit()`
`List<MetaDataOfBinds>` `getMetaDataOfBinds()`
`int` `getNetworkTimeoutInMilli()`
`int` `getNumberOfBinds()`
`OCSPMode` `getOCSPMode()`
`Map<String,Object>` `getParameters()`
`String` `getQrmk()`
`String` `getQueryId()`
`QueryResultFormat` `getQueryResultFormat()`
`List<SnowflakeColumnMetadata>` `getResultColumnMetadata()`
`int` `getResultPrefetchThreads()`
`ResultSet` `getResultSet()` Deprecated. Please use new interface function getResultSet(ResultSetRetrieveConfig)
`ResultSet` `getResultSet(Properties info)` Deprecated. Please use new interface function getResultSet(ResultSetRetrieveConfig)
`ResultSet` `getResultSet(SnowflakeResultSetSerializable.ResultSetRetrieveConfig resultSetRetrieveConfig)` Get ResultSet from the ResultSet Serializable object so that the user can access the data.
`int` `getResultSetConcurrency()`
`int` `getResultSetHoldability()`
`int` `getResultSetType()`
`ResultStreamProvider` `getResultStreamProvider()`
`long` `getResultVersion()`
`org.apache.arrow.memory.RootAllocator` `getRootAllocator()`
`long` `getRowCount()` Retrieve total row count included in the ResultSet Serializable object.
`long` `getSendResultTime()`
`Optional<SFBaseSession>` `getSession()`
`SFResultSetMetaData` `getSFResultSetMetaData()`
`SnowflakeConnectString` `getSnowflakeConnectString()`
`int` `getSocketTimeout()`
`SFStatementType` `getStatementType()`
`net.snowflake.common.core.SnowflakeDateTimeFormat` `getTimeFormatter()`
`net.snowflake.common.core.SnowflakeDateTimeFormat` `getTimestampLTZFormatter()`
`net.snowflake.common.core.SnowflakeDateTimeFormat` `getTimestampNTZFormatter()`
`net.snowflake.common.core.SnowflakeDateTimeFormat` `getTimestampTZFormatter()`
`TimeZone` `getTimeZone()`
`boolean` `getTreatNTZAsUTC()`
`long` `getUncompressedDataSizeInBytes()` Retrieve Uncompressed data size in the ResultSet Serializable object.
`boolean` `getUseSessionTimezone()`
`boolean` `isArrayBindSupported()`
`boolean` `isHonorClientTZForTimestampNTZ()`
`boolean` `isTotalRowCountTruncated()`
`void` `setChunkDownloader(ChunkDownloader chunkDownloader)`
`void` `setChunkFileCount(int chunkFileCount)`
`void` `setFirstChunkByteData(byte[] firstChunkByteData)`
`void` `setFirstChunkStringData(String firstChunkStringData)`
`void` `setQueryResultFormat(QueryResultFormat queryResultFormat)`
`void` `setResultStreamProvider(ResultStreamProvider resultStreamProvider)`
`void` `setRootAllocator(org.apache.arrow.memory.RootAllocator rootAllocator)`
`List<SnowflakeResultSetSerializable>` `splitBySize(long maxSizeInBytes)` Split this object into small pieces based on the user specified data size.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SnowflakeResultSetSerializableV1

    public SnowflakeResultSetSerializableV1()

Default constructor.

### Method Detail

#### setRootAllocator

    public void setRootAllocator(org.apache.arrow.memory.RootAllocator rootAllocator)

#### setQueryResultFormat

    public void setQueryResultFormat(QueryResultFormat queryResultFormat)

#### setChunkFileCount

    public void setChunkFileCount(int chunkFileCount)

#### setFirstChunkStringData

    public void setFirstChunkStringData(String firstChunkStringData)

#### setFirstChunkByteData

    public void setFirstChunkByteData(byte[] firstChunkByteData)

#### setChunkDownloader

    public void setChunkDownloader(ChunkDownloader chunkDownloader)

#### setResultStreamProvider

    public void setResultStreamProvider(ResultStreamProvider resultStreamProvider)

#### getResultStreamProvider

    public ResultStreamProvider getResultStreamProvider()

#### getSFResultSetMetaData

    public SFResultSetMetaData getSFResultSetMetaData()

#### getResultSetType

    public int getResultSetType()

#### getResultSetConcurrency

    public int getResultSetConcurrency()

#### getResultSetHoldability

    public int getResultSetHoldability()

#### getSnowflakeConnectString

    public SnowflakeConnectString getSnowflakeConnectString()

#### getOCSPMode

    public OCSPMode getOCSPMode()

#### getHttpClientKey

    public HttpClientSettingsKey getHttpClientKey()

#### getQrmk

    public String getQrmk()

#### getNetworkTimeoutInMilli

    public int getNetworkTimeoutInMilli()

#### getAuthTimeout

    public int getAuthTimeout()

#### getSocketTimeout

    public int getSocketTimeout()

#### getResultPrefetchThreads

    public int getResultPrefetchThreads()

#### getMemoryLimit

    public long getMemoryLimit()

#### getChunkHeadersMap

    public Map<String,String> getChunkHeadersMap()

#### getChunkFileMetadatas

    public List<SnowflakeResultSetSerializableV1.ChunkFileMetadata> getChunkFileMetadatas()

#### getRootAllocator

    public org.apache.arrow.memory.RootAllocator getRootAllocator()

#### getQueryResultFormat

    public QueryResultFormat getQueryResultFormat()

#### getChunkFileCount

    public int getChunkFileCount()

#### isArrayBindSupported

    public boolean isArrayBindSupported()

#### getQueryId

    public String getQueryId()

#### getFinalDatabaseName

    public String getFinalDatabaseName()

#### getFinalSchemaName

    public String getFinalSchemaName()

#### getFinalRoleName

    public String getFinalRoleName()

#### getFinalWarehouseName

    public String getFinalWarehouseName()

#### getStatementType

    public SFStatementType getStatementType()

#### isTotalRowCountTruncated

    public boolean isTotalRowCountTruncated()

#### getParameters

    public Map<String,Object> getParameters()

#### getColumnCount

    public int getColumnCount()

#### getResultColumnMetadata

    public List<SnowflakeColumnMetadata> getResultColumnMetadata()

#### getAndClearFirstChunkRowset

    public com.fasterxml.jackson.databind.JsonNode getAndClearFirstChunkRowset()

#### getFirstChunkRowCount

    public int getFirstChunkRowCount()

#### getResultVersion

    public long getResultVersion()

#### getNumberOfBinds

    public int getNumberOfBinds()

#### getChunkDownloader

    public ChunkDownloader getChunkDownloader()

#### getTimestampNTZFormatter

    public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampNTZFormatter()

#### getTimestampLTZFormatter

    public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampLTZFormatter()

#### getTimestampTZFormatter

    public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampTZFormatter()

#### getDateFormatter

    public net.snowflake.common.core.SnowflakeDateTimeFormat getDateFormatter()

#### getTimeFormatter

    public net.snowflake.common.core.SnowflakeDateTimeFormat getTimeFormatter()

#### getTimeZone

    public TimeZone getTimeZone()

#### isHonorClientTZForTimestampNTZ

    public boolean isHonorClientTZForTimestampNTZ()

#### getBinaryFormatter

    public net.snowflake.common.core.SFBinaryFormat getBinaryFormatter()

#### getSendResultTime

    public long getSendResultTime()

#### getMetaDataOfBinds

    public List<MetaDataOfBinds> getMetaDataOfBinds()

#### getFirstChunkStringData

    public String getFirstChunkStringData()

#### getFirstChunkByteData

    public byte[] getFirstChunkByteData()

#### getTreatNTZAsUTC

    public boolean getTreatNTZAsUTC()

#### getFormatDateWithTimeZone

    public boolean getFormatDateWithTimeZone()

#### getUseSessionTimezone

    public boolean getUseSessionTimezone()

#### getSession

    public Optional<SFBaseSession> getSession()

#### create

    public static SnowflakeResultSetSerializableV1 create(com.fasterxml.jackson.databind.JsonNode rootNode,
                                                          SFBaseSession sfSession,
                                                          SFBaseStatement sfStatement)
                                                   throws SnowflakeSQLException

A factory function to create SnowflakeResultSetSerializable object from result JSON node, using the DefaultResultStreamProvider.

Parameters:
  `rootNode` - result JSON node received from GS
  `sfSession` - the Snowflake session
  `sfStatement` - the Snowflake statement
Returns:
  processed ResultSetSerializable object
Throws:
  `SnowflakeSQLException` - if failed to parse the result JSON node

#### create

    public static SnowflakeResultSetSerializableV1 create(com.fasterxml.jackson.databind.JsonNode rootNode,
                                                          SFBaseSession sfSession,
                                                          SFBaseStatement sfStatement,
                                                          ResultStreamProvider resultStreamProvider)
                                                   throws SnowflakeSQLException

A factory function to create SnowflakeResultSetSerializable object from result JSON node, with an overridable ResultStreamProvider.

Parameters:
  `rootNode` - result JSON node received from GS
  `sfSession` - the Snowflake session
  `sfStatement` - the Snowflake statement
  `resultStreamProvider` - a ResultStreamProvider for computing a custom data source for result-file streams
Returns:
  processed ResultSetSerializable object
Throws:
  `SnowflakeSQLException` - if failed to parse the result JSON node

#### splitBySize

    public List<SnowflakeResultSetSerializable> splitBySize(long maxSizeInBytes)
                                                     throws SQLException

Split this object into small pieces based on the user specified data size.

Parameters:
  `maxSizeInBytes` - the expected max data size wrapped in the result ResultSetSerializables object. NOTE: if a result chunk size is greater than this value, the ResultSetSerializable object will include one result chunk.
Returns:
  a list of SnowflakeResultSetSerializable
Throws:
  `SQLException` - if fails to split objects.

#### getResultSet

    public ResultSet getResultSet(SnowflakeResultSetSerializable.ResultSetRetrieveConfig resultSetRetrieveConfig)
                           throws SQLException

Get ResultSet from the ResultSet Serializable object so that the user can access the data.

Specified by:
  `getResultSet` in interface `SnowflakeResultSetSerializable`
Parameters:
  `resultSetRetrieveConfig` - The extra info to retrieve the result set.
Returns:
  a ResultSet which represents for the data wrapped in the object
Throws:
  `SQLException`

#### getResultSet

    @Deprecated
    public ResultSet getResultSet()
                                       throws SQLException

Deprecated. Please use new interface function getResultSet(ResultSetRetrieveConfig)
Get ResultSet from the ResultSet Serializable object so that the user can access the data.

This API is used by spark connector from 2.6.0 to 2.8.1. It is deprecated from sc:2.8.2/jdbc:3.12.12 since Sept 2020. It is safe to remove it after Sept 2022.

Specified by:
  `getResultSet` in interface `SnowflakeResultSetSerializable`
Returns:
  a ResultSet which represents for the data wrapped in the object
Throws:
  `SQLException`

#### getResultSet

    @Deprecated
    public ResultSet getResultSet(Properties info)
                                       throws SQLException

Deprecated. Please use new interface function getResultSet(ResultSetRetrieveConfig)
Get ResultSet from the ResultSet Serializable object so that the user can access the data.

This API is used by spark connector from 2.6.0 to 2.8.1. It is deprecated from sc:2.8.2/jdbc:3.12.12 since Sept 2020. It is safe to remove it after Sept 2022.

Specified by:
  `getResultSet` in interface `SnowflakeResultSetSerializable`
Parameters:
  `info` - The proxy sever information if proxy is necessary.
Returns:
  a ResultSet which represents for the data wrapped in the object
Throws:
  `SQLException`

#### getRowCount

    public long getRowCount()
                     throws SQLException

Retrieve total row count included in the ResultSet Serializable object.

GS sends the data of first chunk and metadata of the other chunk if exist to client, so this function calculates the row count for all of them.

Specified by:
  `getRowCount` in interface `SnowflakeResultSetSerializable`
Returns:
  the total row count from metadata
Throws:
  `SQLException`

#### getCompressedDataSizeInBytes

    public long getCompressedDataSizeInBytes()
                                      throws SQLException

Retrieve compressed data size in the ResultSet Serializable object.

GS sends the data of first chunk and metadata of the other chunks if exist to client, so this function calculates the data size for all of them. NOTE: if first chunk exists, this function uses its uncompressed data size as its compressed data size in this calculation though it is not compressed.

Specified by:
  `getCompressedDataSizeInBytes` in interface `SnowflakeResultSetSerializable`
Returns:
  the total compressed data size in bytes from metadata
Throws:
  `SQLException`

#### getUncompressedDataSizeInBytes

    public long getUncompressedDataSizeInBytes()
                                        throws SQLException

Retrieve Uncompressed data size in the ResultSet Serializable object.

GS sends the data of first chunk and metadata of the other chunk if exist to client, so this function calculates the data size for all of them.

Specified by:
  `getUncompressedDataSizeInBytes` in interface `SnowflakeResultSetSerializable`
Returns:
  the total uncompressed data size in bytes from metadata
Throws:
  `SQLException`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`