Package net.snowflake.client.jdbc
Class SFAsyncResultSet
- java.lang.Object
-
- net.snowflake.client.jdbc.SnowflakeBaseResultSet
-
- net.snowflake.client.jdbc.SFAsyncResultSet
-
- All Implemented Interfaces:
AutoCloseable,ResultSet,Wrapper,SnowflakeResultSet
public class SFAsyncResultSet extends SnowflakeBaseResultSet implements SnowflakeResultSet, ResultSet
SFAsyncResultSet implementation. Note: For Snowflake internal use
-
-
Field Summary
-
Fields inherited from class net.snowflake.client.jdbc.SnowflakeBaseResultSet
parameters, resultSetMetaData, statement
-
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
-
-
Constructor Summary
Constructors Constructor Description SFAsyncResultSet(String queryID, Statement statement)SFAsyncResultSet(SFBaseResultSet sfBaseResultSet, SnowflakeResultSetSerializableV1 resultSetSerializable)Constructor takes a result set serializable object to create a sessionless result set.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()voidclose(boolean removeClosedResultSetFromStatement)BigDecimalgetBigDecimal(int columnIndex)BigDecimalgetBigDecimal(int columnIndex, int scale)Deprecated.booleangetBoolean(int columnIndex)bytegetByte(int columnIndex)byte[]getBytes(int columnIndex)DategetDate(int columnIndex, TimeZone tz)doublegetDouble(int columnIndex)floatgetFloat(int columnIndex)intgetInt(int columnIndex)longgetLong(int columnIndex)ResultSetMetaDatagetMetaData()ObjectgetObject(int columnIndex)StringgetQueryErrorMessage()This function retrieves the error message recorded from the error status of an asynchronous query.StringgetQueryID()List<SnowflakeResultSetSerializable>getResultSetSerializables(long maxSizeInBytes)Get a list of ResultSetSerializables for the ResultSet in order to parallel processingintgetRow()shortgetShort(int columnIndex)QueryStatusgetStatus()This function retrieves the status of an asynchronous query.QueryStatusV2getStatusV2()This function retrieves the status of an asynchronous query.StringgetString(int columnIndex)TimegetTime(int columnIndex)TimestampgetTimestamp(int columnIndex, TimeZone tz)booleanisAfterLast()booleanisBeforeFirst()booleanisClosed()booleanisFirst()booleanisLast()booleanisWrapperFor(Class<?> iface)booleannext()Advance to next rowprotected voidraiseSQLExceptionIfResultSetIsClosed()Raises SQLException if the result set is closedvoidsetSession(SFSession session)voidsetStatement(Statement statement)<T> Tunwrap(Class<T> iface)booleanwasNull()-
Methods inherited from class net.snowflake.client.jdbc.SnowflakeBaseResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getFetchDirection, getFetchSize, getFloat, getHoldability, getInt, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.ResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getFetchDirection, getFetchSize, getFloat, getHoldability, getInt, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
-
-
-
-
Constructor Detail
-
SFAsyncResultSet
public SFAsyncResultSet(SFBaseResultSet sfBaseResultSet, SnowflakeResultSetSerializableV1 resultSetSerializable) throws SQLException
Constructor takes a result set serializable object to create a sessionless result set.- Parameters:
sfBaseResultSet- snowflake core base result rest objectresultSetSerializable- The result set serializable object which includes all metadata to create the result set- Throws:
SQLException- if fails to create the result set object
-
SFAsyncResultSet
public SFAsyncResultSet(String queryID, Statement statement) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
raiseSQLExceptionIfResultSetIsClosed
protected void raiseSQLExceptionIfResultSetIsClosed() throws SQLExceptionDescription copied from class:SnowflakeBaseResultSetRaises SQLException if the result set is closed- Overrides:
raiseSQLExceptionIfResultSetIsClosedin classSnowflakeBaseResultSet- Throws:
SQLException- if the result set is closed.
-
getStatus
public QueryStatus getStatus() throws SQLException
Description copied from interface:SnowflakeResultSetThis function retrieves the status of an asynchronous query. An empty ResultSet object has already been returned but the query may still be running. This function can be used to poll to see if it is possible to retrieve results from the ResultSet yet. See Client/src/main/java/net/snowflake/client/core/QueryStatus.java for the list of all possible query statuses. QueryStatus = SUCCESS means results can be retrieved.- Specified by:
getStatusin interfaceSnowflakeResultSet- Returns:
- QueryStatus enum showing status of query
- Throws:
SQLException
-
getQueryErrorMessage
public String getQueryErrorMessage() throws SQLException
Description copied from interface:SnowflakeResultSetThis function retrieves the error message recorded from the error status of an asynchronous query. If there is no error or no error is returned by the server, an empty string will be returned.- Specified by:
getQueryErrorMessagein interfaceSnowflakeResultSet- Returns:
- String value of query's error message
- Throws:
SQLException
-
getStatusV2
public QueryStatusV2 getStatusV2() throws SQLException
Description copied from interface:SnowflakeResultSetThis function retrieves the status of an asynchronous query. An empty ResultSet object has already been returned, but the query may still be running. This function can be used to query whether it is possible to retrieve results from the ResultSet already.status.isSuccess()means that results can be retrieved.- Specified by:
getStatusV2in interfaceSnowflakeResultSet- Returns:
- an instance containing query metadata
- Throws:
SQLException
-
next
public boolean next() throws SQLExceptionAdvance to next row- Specified by:
nextin interfaceResultSet- Specified by:
nextin classSnowflakeBaseResultSet- Returns:
- true if next row exists, false otherwise
- Throws:
SQLException- if failed to move to the next row
-
close
public void close() throws SQLException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceResultSet- Throws:
SQLException
-
close
public void close(boolean removeClosedResultSetFromStatement) throws SQLException- Throws:
SQLException
-
getQueryID
public String getQueryID()
- Specified by:
getQueryIDin interfaceSnowflakeResultSet- Returns:
- the Snowflake query ID of the query which generated this result set
-
wasNull
public boolean wasNull() throws SQLException- Specified by:
wasNullin interfaceResultSet- Throws:
SQLException
-
getString
public String getString(int columnIndex) throws SQLException
- Specified by:
getStringin interfaceResultSet- Throws:
SQLException
-
setSession
public void setSession(SFSession session)
-
setStatement
public void setStatement(Statement statement)
-
getBoolean
public boolean getBoolean(int columnIndex) throws SQLException- Specified by:
getBooleanin interfaceResultSet- Throws:
SQLException
-
getByte
public byte getByte(int columnIndex) throws SQLException- Specified by:
getBytein interfaceResultSet- Throws:
SQLException
-
getShort
public short getShort(int columnIndex) throws SQLException- Specified by:
getShortin interfaceResultSet- Throws:
SQLException
-
getInt
public int getInt(int columnIndex) throws SQLException- Specified by:
getIntin interfaceResultSet- Throws:
SQLException
-
getLong
public long getLong(int columnIndex) throws SQLException- Specified by:
getLongin interfaceResultSet- Throws:
SQLException
-
getFloat
public float getFloat(int columnIndex) throws SQLException- Specified by:
getFloatin interfaceResultSet- Throws:
SQLException
-
getDouble
public double getDouble(int columnIndex) throws SQLException- Specified by:
getDoublein interfaceResultSet- Throws:
SQLException
-
getDate
public Date getDate(int columnIndex, TimeZone tz) throws SQLException
- Specified by:
getDatein classSnowflakeBaseResultSet- Throws:
SQLException
-
getTime
public Time getTime(int columnIndex) throws SQLException
- Specified by:
getTimein interfaceResultSet- Specified by:
getTimein classSnowflakeBaseResultSet- Throws:
SQLException
-
getTimestamp
public Timestamp getTimestamp(int columnIndex, TimeZone tz) throws SQLException
- Specified by:
getTimestampin classSnowflakeBaseResultSet- Throws:
SQLException
-
getMetaData
public ResultSetMetaData getMetaData() throws SQLException
- Specified by:
getMetaDatain interfaceResultSet- Overrides:
getMetaDatain classSnowflakeBaseResultSet- Throws:
SQLException
-
getObject
public Object getObject(int columnIndex) throws SQLException
- Specified by:
getObjectin interfaceResultSet- Throws:
SQLException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex) throws SQLException
- Specified by:
getBigDecimalin interfaceResultSet- Throws:
SQLException
-
getBigDecimal
@Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
Deprecated.- Specified by:
getBigDecimalin interfaceResultSet- Throws:
SQLException
-
getBytes
public byte[] getBytes(int columnIndex) throws SQLException- Specified by:
getBytesin interfaceResultSet- Specified by:
getBytesin classSnowflakeBaseResultSet- Throws:
SQLException
-
getRow
public int getRow() throws SQLException- Specified by:
getRowin interfaceResultSet- Throws:
SQLException
-
isFirst
public boolean isFirst() throws SQLException- Specified by:
isFirstin interfaceResultSet- Throws:
SQLException
-
isClosed
public boolean isClosed() throws SQLException- Specified by:
isClosedin interfaceResultSet- Specified by:
isClosedin classSnowflakeBaseResultSet- Throws:
SQLException
-
isLast
public boolean isLast() throws SQLException- Specified by:
isLastin interfaceResultSet- Throws:
SQLException
-
isAfterLast
public boolean isAfterLast() throws SQLException- Specified by:
isAfterLastin interfaceResultSet- Throws:
SQLException
-
isBeforeFirst
public boolean isBeforeFirst() throws SQLException- Specified by:
isBeforeFirstin interfaceResultSet- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Overrides:
isWrapperForin classSnowflakeBaseResultSet- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Overrides:
unwrapin classSnowflakeBaseResultSet- Throws:
SQLException
-
getResultSetSerializables
public List<SnowflakeResultSetSerializable> getResultSetSerializables(long maxSizeInBytes) throws SQLException
Get a list of ResultSetSerializables for the ResultSet in order to parallel processingNot currently supported for asynchronous result sets.
- Specified by:
getResultSetSerializablesin interfaceSnowflakeResultSet- Parameters:
maxSizeInBytes- The expected max data size wrapped in the ResultSetSerializables object. NOTE: this parameter is intended to make the data size in each serializable object to be less than it. But if user specifies a small value which may be smaller than the data size of one result chunk. So the definition can't be guaranteed completely. For this special case, one serializable object is used to wrap the data chunk.- Returns:
- a list of ResultSetSerializables
- Throws:
SQLException- if fails to get the ResultSetSerializable objects.
-
-