Package net.snowflake.client.jdbc
Class ArrowResultChunk
- java.lang.Object
-
- net.snowflake.client.jdbc.SnowflakeResultChunk
-
- net.snowflake.client.jdbc.ArrowResultChunk
-
public class ArrowResultChunk extends SnowflakeResultChunk
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArrowResultChunk.ArrowChunkIterator
Iterator class used to go through the arrow chunk row by row-
Nested classes/interfaces inherited from class net.snowflake.client.jdbc.SnowflakeResultChunk
SnowflakeResultChunk.DownloadState
-
-
Constructor Summary
Constructors Constructor Description ArrowResultChunk(String url, int rowCount, int colCount, int uncompressedSize, org.apache.arrow.memory.RootAllocator rootAllocator, SFBaseSession session)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
computeNeededChunkMemory()
void
enableSortFirstResultChunk()
void
freeData()
static ArrowResultChunk.ArrowChunkIterator
getEmptyChunkIterator()
ArrowResultChunk.ArrowChunkIterator
getIterator(DataConversionContext dataConversionContext)
void
mergeBatchesIntoOne()
merge arrow result chunk with more than one batches into one record batch (Only used for the first chunk when client side sorting is required)void
readArrowStream(InputStream is)
Read an inputStream of arrow data bytes and load them into java vectors of value.void
reset()
-
Methods inherited from class net.snowflake.client.jdbc.SnowflakeResultChunk
getColCount, getDownloadCondition, getDownloadError, getDownloadState, getDownloadTime, getLock, getParseTime, getRowCount, getScrubbedUrl, getUncompressedSize, getUrl, isReleased, setDownloadError, setDownloadState, setDownloadTime, setParseTime, setReleased
-
-
-
-
Constructor Detail
-
ArrowResultChunk
public ArrowResultChunk(String url, int rowCount, int colCount, int uncompressedSize, org.apache.arrow.memory.RootAllocator rootAllocator, SFBaseSession session)
-
-
Method Detail
-
readArrowStream
public void readArrowStream(InputStream is) throws IOException
Read an inputStream of arrow data bytes and load them into java vectors of value. Note, there is no copy of data involved once data is loaded into memory. a.k.a ArrowStreamReader originally allocates the memory to hold vectors, but those memory ownership is transfer into ArrowResultChunk class and once ArrowStreamReader is garbage collected, memory will not be cleared up- Parameters:
is
- inputStream which contains arrow data file in bytes- Throws:
IOException
- if failed to read data as arrow file
-
reset
public void reset()
-
computeNeededChunkMemory
public long computeNeededChunkMemory()
-
freeData
public void freeData()
-
getIterator
public ArrowResultChunk.ArrowChunkIterator getIterator(DataConversionContext dataConversionContext)
- Returns:
- an iterator to iterate over current chunk
-
getEmptyChunkIterator
public static ArrowResultChunk.ArrowChunkIterator getEmptyChunkIterator()
-
enableSortFirstResultChunk
public void enableSortFirstResultChunk()
-
mergeBatchesIntoOne
public void mergeBatchesIntoOne() throws SnowflakeSQLException
merge arrow result chunk with more than one batches into one record batch (Only used for the first chunk when client side sorting is required)- Throws:
SnowflakeSQLException
-
-