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 Converters
converters
protected SFBaseStatement
statement
statement generate current result set-
Fields inherited from class net.snowflake.client.core.SFBaseResultSet
isClosed, metaDataOfBinds, numberOfBinds, parameters, resultSetMetaData, resultSetSerializable, resultVersion, row, session, sessionTimeZone
-
-
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 void
close()
static void
closeRootAllocator(org.apache.arrow.memory.RootAllocator rootAllocator)
Date
convertToDate(Object object, TimeZone tz)
Time
convertToTime(Object object, int scale)
Timestamp
convertToTimestamp(Object object, int columnType, int columnSubType, TimeZone tz, int scale)
SQLInput
createSqlInputForColumn(Object input, Class<?> parentObjectClass, int columnIndex, SFBaseSession session, List<FieldMetadata> fields)
Array
getArray(int columnIndex)
BigDecimal
getBigDecimal(int columnIndex)
BigDecimal
getBigDecimal(int columnIndex, int scale)
net.snowflake.common.core.SFBinaryFormat
getBinaryFormatter()
boolean
getBoolean(int columnIndex)
byte
getByte(int columnIndex)
byte[]
getBytes(int columnIndex)
Converters
getConverters()
Date
getDate(int columnIndex, TimeZone tz)
net.snowflake.common.core.SnowflakeDateTimeFormat
getDateFormatter()
double
getDouble(int columnIndex)
float
getFloat(int columnIndex)
boolean
getHonorClientTZForTimestampNTZ()
int
getInt(int columnIndex)
long
getLong(int columnIndex)
Object
getObject(int columnIndex)
Object
getObjectWithoutString(int columnIndex)
String
getQueryId()
long
getResultVersion()
int
getScale(int columnIndex)
get scale from Snowflake metadatashort
getShort(int columnIndex)
SFStatementType
getStatementType()
String
getString(int columnIndex)
Time
getTime(int columnIndex)
net.snowflake.common.core.SnowflakeDateTimeFormat
getTimeFormatter()
Timestamp
getTimestamp(int columnIndex, TimeZone tz)
net.snowflake.common.core.SnowflakeDateTimeFormat
getTimestampLTZFormatter()
net.snowflake.common.core.SnowflakeDateTimeFormat
getTimestampNTZFormatter()
net.snowflake.common.core.SnowflakeDateTimeFormat
getTimestampTZFormatter()
TimeZone
getTimeZone()
boolean
isAfterLast()
boolean
isArrayBindSupported()
boolean
isLast()
boolean
next()
Advance to next rowvoid
setStatementType(SFStatementType statementType)
-
Methods inherited from class net.snowflake.client.core.SFBaseResultSet
absolute, convertStringToDate, convertStringToTime, convertStringToTimestamp, createJsonSqlInputForColumn, getJsonArray, getMetaData, getMetaDataOfBinds, getNumberOfBinds, getResultSetSerializables, getRow, getSession, getSessionTimezone, getSessionTimeZone, 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
-
converters
@SnowflakeJdbcInternalApi protected Converters converters
-
-
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
- telemetryClientsortResult
- set if results should be sorted- Throws:
SQLException
- if exception encountered
-
-
Method Detail
-
getConverters
@SnowflakeJdbcInternalApi public Converters getConverters()
- Overrides:
getConverters
in classSFBaseResultSet
-
createSqlInputForColumn
@SnowflakeJdbcInternalApi public SQLInput createSqlInputForColumn(Object input, Class<?> parentObjectClass, int columnIndex, SFBaseSession session, List<FieldMetadata> fields)
- Overrides:
createSqlInputForColumn
in classSFBaseResultSet
-
convertToDate
@SnowflakeJdbcInternalApi public Date convertToDate(Object object, TimeZone tz) throws SFException
- Overrides:
convertToDate
in classSFBaseResultSet
- Throws:
SFException
-
convertToTime
@SnowflakeJdbcInternalApi public Time convertToTime(Object object, int scale) throws SFException
- Overrides:
convertToTime
in classSFBaseResultSet
- Throws:
SFException
-
convertToTimestamp
@SnowflakeJdbcInternalApi public Timestamp convertToTimestamp(Object object, int columnType, int columnSubType, TimeZone tz, int scale) throws SFException
- Overrides:
convertToTimestamp
in classSFBaseResultSet
- Throws:
SFException
-
next
public boolean next() throws SFException, SnowflakeSQLException
Advance to next row- Overrides:
next
in classSFBaseResultSet
- Returns:
- true if next row exists, false otherwise
- Throws:
SFException
SnowflakeSQLException
-
getByte
public byte getByte(int columnIndex) throws SFException
- Specified by:
getByte
in classSFBaseResultSet
- Throws:
SFException
-
getString
public String getString(int columnIndex) throws SFException
- Specified by:
getString
in classSFBaseResultSet
- Throws:
SFException
-
getBoolean
public boolean getBoolean(int columnIndex) throws SFException
- Specified by:
getBoolean
in classSFBaseResultSet
- Throws:
SFException
-
getShort
public short getShort(int columnIndex) throws SFException
- Specified by:
getShort
in classSFBaseResultSet
- Throws:
SFException
-
getInt
public int getInt(int columnIndex) throws SFException
- Specified by:
getInt
in classSFBaseResultSet
- Throws:
SFException
-
getLong
public long getLong(int columnIndex) throws SFException
- Specified by:
getLong
in classSFBaseResultSet
- Throws:
SFException
-
getFloat
public float getFloat(int columnIndex) throws SFException
- Specified by:
getFloat
in classSFBaseResultSet
- Throws:
SFException
-
getDouble
public double getDouble(int columnIndex) throws SFException
- Specified by:
getDouble
in classSFBaseResultSet
- Throws:
SFException
-
getBytes
public byte[] getBytes(int columnIndex) throws SFException
- Specified by:
getBytes
in classSFBaseResultSet
- Throws:
SFException
-
getDate
public Date getDate(int columnIndex, TimeZone tz) throws SFException
- Specified by:
getDate
in classSFBaseResultSet
- Throws:
SFException
-
getTime
public Time getTime(int columnIndex) throws SFException
- Specified by:
getTime
in classSFBaseResultSet
- Throws:
SFException
-
getTimestamp
public Timestamp getTimestamp(int columnIndex, TimeZone tz) throws SFException
- Specified by:
getTimestamp
in classSFBaseResultSet
- Throws:
SFException
-
getObject
public Object getObject(int columnIndex) throws SFException
- Specified by:
getObject
in classSFBaseResultSet
- Throws:
SFException
-
getObjectWithoutString
@SnowflakeJdbcInternalApi public Object getObjectWithoutString(int columnIndex) throws SFException
- Specified by:
getObjectWithoutString
in classSFBaseResultSet
- Throws:
SFException
-
getArray
public Array getArray(int columnIndex) throws SFException
- Overrides:
getArray
in classSFBaseResultSet
- Throws:
SFException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex) throws SFException
- Specified by:
getBigDecimal
in classSFBaseResultSet
- Throws:
SFException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SFException
- Specified by:
getBigDecimal
in classSFBaseResultSet
- Throws:
SFException
-
isLast
public boolean isLast()
- Specified by:
isLast
in classSFBaseResultSet
-
isAfterLast
public boolean isAfterLast()
- Specified by:
isAfterLast
in classSFBaseResultSet
-
close
public void close() throws SnowflakeSQLException
- Overrides:
close
in classSFBaseResultSet
- Throws:
SnowflakeSQLException
-
closeRootAllocator
public static void closeRootAllocator(org.apache.arrow.memory.RootAllocator rootAllocator)
-
getStatementType
public SFStatementType getStatementType()
- Specified by:
getStatementType
in classSFBaseResultSet
-
setStatementType
public void setStatementType(SFStatementType statementType)
- Specified by:
setStatementType
in classSFBaseResultSet
-
isArrayBindSupported
public boolean isArrayBindSupported()
- Overrides:
isArrayBindSupported
in classSFBaseResultSet
-
getQueryId
public String getQueryId()
- Specified by:
getQueryId
in classSFBaseResultSet
-
getTimestampLTZFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampLTZFormatter()
- Specified by:
getTimestampLTZFormatter
in interfaceDataConversionContext
- Returns:
- timestamp_ltz formatter
-
getTimestampNTZFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampNTZFormatter()
- Specified by:
getTimestampNTZFormatter
in interfaceDataConversionContext
- Returns:
- timestamp_ntz formatter
-
getTimestampTZFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimestampTZFormatter()
- Specified by:
getTimestampTZFormatter
in interfaceDataConversionContext
- Returns:
- timestamp_ntz formatter
-
getDateFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getDateFormatter()
- Specified by:
getDateFormatter
in interfaceDataConversionContext
- Returns:
- date formatter
-
getTimeFormatter
public net.snowflake.common.core.SnowflakeDateTimeFormat getTimeFormatter()
- Specified by:
getTimeFormatter
in interfaceDataConversionContext
- Returns:
- time formatter
-
getBinaryFormatter
public net.snowflake.common.core.SFBinaryFormat getBinaryFormatter()
- Specified by:
getBinaryFormatter
in interfaceDataConversionContext
- Returns:
- binary formatter
-
getScale
public int getScale(int columnIndex)
Description copied from interface:DataConversionContext
get scale from Snowflake metadata- Specified by:
getScale
in interfaceDataConversionContext
- Parameters:
columnIndex
- column index- Returns:
- scale value
-
getTimeZone
public TimeZone getTimeZone()
- Specified by:
getTimeZone
in interfaceDataConversionContext
- Returns:
- session time zone
-
getHonorClientTZForTimestampNTZ
public boolean getHonorClientTZForTimestampNTZ()
- Specified by:
getHonorClientTZForTimestampNTZ
in interfaceDataConversionContext
- Returns:
- whether to honor client time zone for timestamp_ntz
-
getResultVersion
public long getResultVersion()
- Specified by:
getResultVersion
in interfaceDataConversionContext
- Returns:
- result version
-
-