Package net.snowflake.client.core
Class SFArrowResultSet
- java.lang.Object
-
- net.snowflake.client.core.SFBaseResultSet
-
- net.snowflake.client.core.SFArrowResultSet
-
- All Implemented Interfaces:
DataConversionContext
public class SFArrowResultSet extends SFBaseResultSet implements DataConversionContext
Arrow result set implementation
-
-
Field Summary
Fields Modifier and Type Field Description protected SFBaseStatementstatementstatement generate current result set-
Fields inherited from class net.snowflake.client.core.SFBaseResultSet
isClosed, metaDataOfBinds, numberOfBinds, parameters, resultSetMetaData, resultSetSerializable, resultVersion, row, session
-
-
Constructor Summary
Constructors Constructor Description SFArrowResultSet(SnowflakeResultSetSerializableV1 resultSetSerializable, SFBaseSession session, SFBaseStatement statement, boolean sortResult)Constructor takes a result from the API response that we get from executing a SQL statement.SFArrowResultSet(SnowflakeResultSetSerializableV1 resultSetSerializable, Telemetry telemetryClient, boolean sortResult)This is a minimum initialization for SFArrowResult.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static voidcloseRootAllocator(org.apache.arrow.memory.RootAllocator rootAllocator)BigDecimalgetBigDecimal(int columnIndex)BigDecimalgetBigDecimal(int columnIndex, int scale)net.snowflake.common.core.SFBinaryFormatgetBinaryFormatter()binary formatterbooleangetBoolean(int columnIndex)bytegetByte(int columnIndex)byte[]getBytes(int columnIndex)DategetDate(int columnIndex, TimeZone tz)net.snowflake.common.core.SnowflakeDateTimeFormatgetDateFormatter()date formatterdoublegetDouble(int columnIndex)floatgetFloat(int columnIndex)booleangetHonorClientTZForTimestampNTZ()intgetInt(int columnIndex)longgetLong(int columnIndex)ObjectgetObject(int columnIndex)StringgetQueryId()longgetResultVersion()intgetScale(int columnIndex)get scale from Snowflake metadatashortgetShort(int columnIndex)SFStatementTypegetStatementType()StringgetString(int columnIndex)TimegetTime(int columnIndex)net.snowflake.common.core.SnowflakeDateTimeFormatgetTimeFormatter()time formatterTimestampgetTimestamp(int columnIndex, TimeZone tz)net.snowflake.common.core.SnowflakeDateTimeFormatgetTimestampLTZFormatter()timestamp_ltz formatternet.snowflake.common.core.SnowflakeDateTimeFormatgetTimestampNTZFormatter()timestamp_ntz formatternet.snowflake.common.core.SnowflakeDateTimeFormatgetTimestampTZFormatter()timestamp_tz formatterTimeZonegetTimeZone()booleanisAfterLast()booleanisArrayBindSupported()booleanisLast()booleannext()Advance to next rowvoidsetStatementType(SFStatementType statementType)-
Methods inherited from class net.snowflake.client.core.SFBaseResultSet
absolute, getMetaData, getMetaDataOfBinds, getNumberOfBinds, getResultSetSerializables, getRow, getSession, isBeforeFirst, isClosed, isFirst, previous, relative, setSession, wasNull
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.snowflake.client.core.DataConversionContext
getSession
-
-
-
-
Field Detail
-
statement
protected SFBaseStatement statement
statement generate current result set
-
-
Constructor Detail
-
SFArrowResultSet
public SFArrowResultSet(SnowflakeResultSetSerializableV1 resultSetSerializable, SFBaseSession session, SFBaseStatement statement, boolean sortResult) throws SQLException
Constructor takes a result from the API response that we get from executing a SQL statement.The constructor will initialize the ResultSetMetaData.
- Parameters:
resultSetSerializable- result data after parsing jsonsession- SFBaseSession objectstatement- statement objectsortResult- true if sort results otherwise false- Throws:
SQLException- exception raised from general SQL layers
-
SFArrowResultSet
public SFArrowResultSet(SnowflakeResultSetSerializableV1 resultSetSerializable, Telemetry telemetryClient, boolean sortResult) throws SQLException
This is a minimum initialization for SFArrowResult. Mainly used for testing purpose. However, real prod constructor will call this constructor as well- Parameters:
resultSetSerializable- data returned in query responsetelemetryClient- telemetryClient- Throws:
SQLException
-
-
Method Detail
-
next
public boolean next() throws SFException, SnowflakeSQLExceptionAdvance to next row- Overrides:
nextin classSFBaseResultSet- Returns:
- true if next row exists, false otherwise
- Throws:
SFExceptionSnowflakeSQLException
-
getByte
public byte getByte(int columnIndex) throws SFException- Specified by:
getBytein classSFBaseResultSet- Throws:
SFException
-
getString
public String getString(int columnIndex) throws SFException
- Specified by:
getStringin classSFBaseResultSet- Throws:
SFException
-
getBoolean
public boolean getBoolean(int columnIndex) throws SFException- Specified by:
getBooleanin classSFBaseResultSet- Throws:
SFException
-
getShort
public short getShort(int columnIndex) throws SFException- Specified by:
getShortin classSFBaseResultSet- Throws:
SFException
-
getInt
public int getInt(int columnIndex) throws SFException- Specified by:
getIntin classSFBaseResultSet- Throws:
SFException
-
getLong
public long getLong(int columnIndex) throws SFException- Specified by:
getLongin classSFBaseResultSet- Throws:
SFException
-
getFloat
public float getFloat(int columnIndex) throws SFException- Specified by:
getFloatin classSFBaseResultSet- Throws:
SFException
-
getDouble
public double getDouble(int columnIndex) throws SFException- Specified by:
getDoublein classSFBaseResultSet- Throws:
SFException
-
getBytes
public byte[] getBytes(int columnIndex) throws SFException- Specified by:
getBytesin classSFBaseResultSet- Throws:
SFException
-
getDate
public Date getDate(int columnIndex, TimeZone tz) throws SFException
- Specified by:
getDatein classSFBaseResultSet- Throws:
SFException
-
getTime
public Time getTime(int columnIndex) throws SFException
- Specified by:
getTimein classSFBaseResultSet- Throws:
SFException
-
getTimestamp
public Timestamp getTimestamp(int columnIndex, TimeZone tz) throws SFException
- Specified by:
getTimestampin classSFBaseResultSet- Throws:
SFException
-
getObject
public Object getObject(int columnIndex) throws SFException
- Specified by:
getObjectin classSFBaseResultSet- Throws:
SFException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex) throws SFException
- Specified by:
getBigDecimalin classSFBaseResultSet- Throws:
SFException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SFException
- Specified by:
getBigDecimalin classSFBaseResultSet- Throws:
SFException
-
isLast
public boolean isLast()
- Specified by:
isLastin classSFBaseResultSet
-
isAfterLast
public boolean isAfterLast()
- Specified by:
isAfterLastin classSFBaseResultSet
-
close
public void close() throws SnowflakeSQLException- Overrides:
closein classSFBaseResultSet- Throws:
SnowflakeSQLException
-
closeRootAllocator
public static void closeRootAllocator(org.apache.arrow.memory.RootAllocator rootAllocator)
-
getStatementType
public SFStatementType getStatementType()
- Specified by:
getStatementTypein classSFBaseResultSet
-
setStatementType
public void setStatementType(SFStatementType statementType)
- Specified by:
setStatementTypein classSFBaseResultSet
-
isArrayBindSupported
public boolean isArrayBindSupported()
- Overrides:
isArrayBindSupportedin classSFBaseResultSet
-
getQueryId
public String getQueryId()
- Specified by:
getQueryIdin classSFBaseResultSet
-
getTimestampLTZFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampLTZFormatter()
Description copied from interface:DataConversionContexttimestamp_ltz formatter- Specified by:
getTimestampLTZFormatterin interfaceDataConversionContext
-
getTimestampNTZFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampNTZFormatter()
Description copied from interface:DataConversionContexttimestamp_ntz formatter- Specified by:
getTimestampNTZFormatterin interfaceDataConversionContext
-
getTimestampTZFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampTZFormatter()
Description copied from interface:DataConversionContexttimestamp_tz formatter- Specified by:
getTimestampTZFormatterin interfaceDataConversionContext
-
getDateFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getDateFormatter()
Description copied from interface:DataConversionContextdate formatter- Specified by:
getDateFormatterin interfaceDataConversionContext
-
getTimeFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimeFormatter()
Description copied from interface:DataConversionContexttime formatter- Specified by:
getTimeFormatterin interfaceDataConversionContext
-
getBinaryFormatter
public net.snowflake.common.core.SFBinaryFormat getBinaryFormatter()
Description copied from interface:DataConversionContextbinary formatter- Specified by:
getBinaryFormatterin interfaceDataConversionContext
-
getScale
public int getScale(int columnIndex)
Description copied from interface:DataConversionContextget scale from Snowflake metadata- Specified by:
getScalein interfaceDataConversionContext
-
getTimeZone
public TimeZone getTimeZone()
- Specified by:
getTimeZonein interfaceDataConversionContext- Returns:
- session time zone
-
getHonorClientTZForTimestampNTZ
public boolean getHonorClientTZForTimestampNTZ()
- Specified by:
getHonorClientTZForTimestampNTZin interfaceDataConversionContext- Returns:
- whether to honor client time zone for timestamp_ntz
-
getResultVersion
public long getResultVersion()
- Specified by:
getResultVersionin interfaceDataConversionContext- Returns:
- result version
-
-