Class 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
    • 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)
      • getResultSetType

        public int getResultSetType()
      • getResultSetConcurrency

        public int getResultSetConcurrency()
      • getResultSetHoldability

        public int getResultSetHoldability()
      • getOCSPMode

        public OCSPMode getOCSPMode()
      • getQrmk

        public String getQrmk()
      • getNetworkTimeoutInMilli

        public int getNetworkTimeoutInMilli()
      • getAuthTimeout

        public int getAuthTimeout()
      • getSocketTimeout

        public int getSocketTimeout()
      • getResultPrefetchThreads

        public int getResultPrefetchThreads()
      • getMemoryLimit

        public long getMemoryLimit()
      • getRootAllocator

        public org.apache.arrow.memory.RootAllocator getRootAllocator()
      • 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()
      • isTotalRowCountTruncated

        public boolean isTotalRowCountTruncated()
      • getColumnCount

        public int getColumnCount()
      • getAndClearFirstChunkRowset

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

        public int getFirstChunkRowCount()
      • getResultVersion

        public long getResultVersion()
      • getNumberOfBinds

        public int getNumberOfBinds()
      • 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()
      • getFirstChunkStringData

        public String getFirstChunkStringData()
      • getFirstChunkByteData

        public byte[] getFirstChunkByteData()
      • getTreatNTZAsUTC

        public boolean getTreatNTZAsUTC()
      • getFormatDateWithTimeZone

        public boolean getFormatDateWithTimeZone()
      • getUseSessionTimezone

        public boolean getUseSessionTimezone()
      • 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

        @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