public class Query
extends java.lang.Object
implements java.lang.AutoCloseable
Example:
Query query = new Query(my_dense_array, TILEDB_WRITE);
query.setLayout(TILEDB_GLOBAL_ORDER);
query.setBuffer("a1", a1_data);
NativeArray a1_data = new NativeArray(ctx, new int[] {1,2,3,4}, Integer.class);
query.setBuffer("a1", a1_data);
query.submit();
Constructor and Description |
---|
Query(Array array) |
Query(Array array,
QueryType type) |
Modifier and Type | Method and Description |
---|---|
Query |
addRange(int dimIdx,
java.lang.Object start,
java.lang.Object end)
Adds a 1D range along a subarray dimension, which is in the form (start, end).
|
Query |
addRangeVar(int dimIdx,
java.lang.String start,
java.lang.String end)
Adds a 1D variable-sized range along a subarray dimension, which is in the form (start, end).
|
void |
close()
Free's native TileDB resources associated with the Query object
|
Query |
finalizeQuery()
Flushes all internal state of a query object and finalizes the query.
|
java.lang.Object |
getBuffer(java.lang.String bufferName)
Return a Java primitive array object as a copy of the attribute buffer
|
byte[] |
getByteArray(java.lang.String bufferName)
Drains a ByteBuffer and returns its contents as a byte[] array
|
Pair<java.nio.ByteBuffer,java.nio.ByteBuffer> |
getByteBuffer(java.lang.String attr)
Retrieves the ByteBuffer of attribute attr
|
Pair<java.nio.LongBuffer,java.nio.CharBuffer> |
getCharBuffer(java.lang.String bufferName)
Retrieves the CharBuffer of an attribute bufferName of type Char
|
java.lang.Object |
getCoordinates()
Deprecated.
|
Pair<java.nio.LongBuffer,java.nio.DoubleBuffer> |
getDoubleBuffer(java.lang.String bufferName)
Retrieves the an DoubleBuffer of an attribute bufferName of type Double
|
int |
getEstResultSize(Context ctx,
java.lang.String attribute) |
Pair<java.lang.Integer,java.lang.Integer> |
getEstResultSizeVar(Context ctx,
java.lang.String attribute) |
Pair<java.nio.LongBuffer,java.nio.FloatBuffer> |
getFloatBuffer(java.lang.String bufferName)
Retrieves the an FloatBuffer of an attribute bufferName of type Float
|
long |
getFragmentNum()
Retrieves the number of written fragments.
|
Pair<java.lang.Long,java.lang.Long> |
getFragmentTimestampRange(java.math.BigInteger idx) |
java.lang.String |
getFragmentURI(java.math.BigInteger idx)
Retrieves the URI of the written fragment with the input index.
|
Pair<java.nio.LongBuffer,java.nio.IntBuffer> |
getIntBuffer(java.lang.String bufferName)
Retrieves an IntBuffer of an attribute attr of type Integer
|
Pair<java.nio.LongBuffer,java.nio.LongBuffer> |
getLongBuffer(java.lang.String bufferName)
Retrieves a LongBuffer of an attribute bufferName of type Long
|
long[] |
getOffsetArray(java.lang.String bufferName)
Drains a variable-sized buffer and returns its offsets as a byte[] Array
|
QueryStatus |
getQueryStatus() |
Pair<java.lang.Object,java.lang.Object> |
getRange(int dimIdx,
long rangeIdx)
Retrieves a specific range of the query subarray along a given dimension.
|
long |
getRangeNum(int dimIdx)
Retrieves the number of ranges of the query subarray along a given dimension.
|
Pair<java.lang.String,java.lang.String> |
getRangeVar(int dimIdx,
java.math.BigInteger rangeIdx)
Retrieves a specific range of the query subarray along a given variable-length dimension.
|
Pair<java.lang.Long,java.lang.Long> |
getRangeVarSize(int dimIdx,
java.math.BigInteger rangeIdx)
Retrieves a range's start and end size for a given variable-length dimensions at a given range
index.
|
java.util.HashMap<java.lang.String,Pair<java.lang.Integer,java.lang.Integer>> |
getResultEstimations()
Returns the result size estimate for each attribute/dimension
|
Pair<java.nio.LongBuffer,java.nio.ShortBuffer> |
getShortBuffer(java.lang.String bufferName)
Retrieves the CharBuffer of an attribute bufferName of type Char
|
long[] |
getVarBuffer(java.lang.String bufferName)
Return an array containing offsets for a variable attribute buffer
|
void |
resetBuffers()
Clears all attribute buffers.
|
Query |
resetBufferSizes()
Resets all attribute buffer sizes to zero
|
Query |
resetBufferSizes(java.lang.Long val) |
java.util.HashMap<java.lang.String,Pair<java.lang.Long,java.lang.Long>> |
resultBufferElements() |
java.util.HashMap<java.lang.String,Pair<java.lang.Long,java.lang.Long>> |
resultBufferSizes()
It is highly likely you want to use resultBufferElements.
|
Query |
setBuffer(java.lang.String attr,
java.nio.ByteBuffer buffer)
* Sets a NIO ByteBuffer
|
Query |
setBuffer(java.lang.String attr,
java.nio.ByteBuffer offsets,
java.nio.ByteBuffer buffer)
Sets a ByteBuffer buffer for a variable-sized getAttribute.
|
Query |
setBuffer(java.lang.String attr,
long bufferElements)
* Sets a NIO ByteBuffer
|
Query |
setBuffer(java.lang.String attr,
NativeArray buffer)
Sets a buffer for a fixed-sized attribute or dimension.
|
Query |
setBuffer(java.lang.String attr,
NativeArray buffer,
long bufferElements)
Sets a buffer for a fixed-sized attribute.
|
Query |
setBuffer(java.lang.String attr,
NativeArray offsets,
NativeArray buffer)
Sets a buffer for a variable-sized getAttribute.
|
Query |
setBuffer(java.lang.String attr,
NativeArray offsets,
NativeArray buffer,
long offsetElements,
long bufferElements)
Sets a buffer for a variable-sized getAttribute.
|
Query |
setBufferByteSize(java.lang.String attribute,
java.lang.Long bufferSize) |
Query |
setBufferByteSize(java.lang.String attribute,
java.lang.Long offsetSize,
java.lang.Long bufferSize) |
Query |
setBufferElements(java.lang.String attribute,
java.lang.Integer bufferElements) |
Query |
setBufferElements(java.lang.String attribute,
java.lang.Integer offsetElements,
java.lang.Integer bufferElements) |
Query |
setBufferNullable(java.lang.String attr,
NativeArray buffer,
long bufferElements,
NativeArray bytemap)
Sets a nullable buffer for a fixed-sized attribute.
|
Query |
setBufferNullable(java.lang.String attr,
NativeArray offsets,
NativeArray buffer,
NativeArray bytemap)
Sets a nullable buffer for a variable-sized getAttribute.
|
Query |
setBufferNullableNIO(java.lang.String attr,
java.nio.ByteBuffer buffer,
java.nio.ByteBuffer bytemap)
Sets a nullable buffer for a fixed-sized, nullable attribute.
|
Query |
setBufferNullableNIO(java.lang.String attr,
java.nio.ByteBuffer offsets,
java.nio.ByteBuffer buffer,
java.nio.ByteBuffer bytemap)
Sets a ByteBuffer buffer for a variable-sized, nullable attribute.
|
Query |
setCoordinates(NativeArray buffer)
Deprecated.
|
Query |
setLayout(Layout layout)
Sets the data layout of the buffers.
|
Query |
setSubarray(java.nio.ByteBuffer subarray)
Sets a subarray, defined in the order dimensions were added.
|
Query |
setSubarray(NativeArray subarray)
Sets a subarray, defined in the order dimensions were added.
|
QueryStatus |
submit()
Submits the query.
|
void |
submitAsync()
Submit an async query (non-blocking).
|
void |
submitAsync(Callback callback)
Submit an async query, with callback.
|
java.lang.String |
toString() |
public Query(Array array, QueryType type) throws TileDBError
TileDBError
public Query(Array array) throws TileDBError
TileDBError
public Query setLayout(Layout layout) throws TileDBError
layout
- The layout order to be set.TileDBError
- A TileDB exceptionpublic QueryStatus getQueryStatus() throws TileDBError
TileDBError
- A TileDB exceptionpublic QueryStatus submit() throws TileDBError
TileDBError
- A TileDB exceptionpublic void submitAsync() throws TileDBError
TileDBError
- A TileDB exceptionpublic void submitAsync(Callback callback) throws TileDBError
callback
- Callback function.TileDBError
- A TileDB exceptionpublic Query setSubarray(NativeArray subarray) throws TileDBError
subarray
- The targeted subarray.TileDBError
- A TileDB exceptionpublic Query setSubarray(java.nio.ByteBuffer subarray) throws TileDBError
subarray
- The targeted subarray.TileDBError
- A TileDB exceptionpublic Query addRange(int dimIdx, java.lang.Object start, java.lang.Object end) throws TileDBError
dimIdx
- The index of the dimension to add the range tostart
- The range startend
- The range endTileDBError
- A TileDB exceptionpublic Query addRangeVar(int dimIdx, java.lang.String start, java.lang.String end) throws TileDBError
dimIdx
- The index of the dimension to add the range tostart
- The range startend
- The range endTileDBError
- A TileDB exceptionpublic Pair<java.lang.Long,java.lang.Long> getRangeVarSize(int dimIdx, java.math.BigInteger rangeIdx) throws TileDBError
dimIdx
- The index of the dimension to add the range toTileDBError
- A TileDB exceptionpublic Pair<java.lang.String,java.lang.String> getRangeVar(int dimIdx, java.math.BigInteger rangeIdx) throws TileDBError
dimIdx
- The index of the dimension to add the range toTileDBError
- A TileDB exceptionpublic int getEstResultSize(Context ctx, java.lang.String attribute) throws TileDBError
TileDBError
public Pair<java.lang.Integer,java.lang.Integer> getEstResultSizeVar(Context ctx, java.lang.String attribute) throws TileDBError
TileDBError
public long getRangeNum(int dimIdx) throws TileDBError
dimIdx
- The index of the dimension whose range number to retrieveTileDBError
- A TileDB exceptionpublic Pair<java.lang.Object,java.lang.Object> getRange(int dimIdx, long rangeIdx) throws TileDBError
dimIdx
- The index of the dimension to retrieve the range fromrangeIdx
- The index of the range to retrieveTileDBError
- A TileDB exceptionpublic Query setBuffer(java.lang.String attr, NativeArray buffer) throws TileDBError
attr
- The attribute/dimension name.buffer
- NativeBuffer to be used for the attribute values.TileDBError
- A TileDB exceptionpublic Query setBuffer(java.lang.String attr, NativeArray buffer, long bufferElements) throws TileDBError
attr
- The attribute name.buffer
- NativeBuffer to be used for the attribute values.bufferElements
- The actual number of buffer elementsTileDBError
- A TileDB exceptionpublic Query setBufferNullable(java.lang.String attr, NativeArray buffer, long bufferElements, NativeArray bytemap) throws TileDBError
attr
- The attribute name.buffer
- NativeBuffer to be used for the attribute values.bufferElements
- The actual number of buffer elementsbytemap
- The byte-mapTileDBError
- A TileDB exceptionpublic Query setBufferNullableNIO(java.lang.String attr, java.nio.ByteBuffer buffer, java.nio.ByteBuffer bytemap) throws TileDBError
attr
- The attribute name.buffer
- NativeBuffer to be used for the attribute values.bytemap
- The byte-mapTileDBError
- A TileDB exceptionpublic Query setBufferNullable(java.lang.String attr, NativeArray offsets, NativeArray buffer, NativeArray bytemap) throws TileDBError
attr
- Attribute nameoffsets
- Offsets where a new element begins in the data buffer.buffer
- Buffer vector with elements of the attribute type.bytemap
- The byte-mapTileDBError
- A TileDB exceptionpublic Query setBufferNullableNIO(java.lang.String attr, java.nio.ByteBuffer offsets, java.nio.ByteBuffer buffer, java.nio.ByteBuffer bytemap) throws TileDBError
attr
- Attribute nameoffsets
- Offsets where a new element begins in the data buffer.buffer
- Buffer vector with elements of the attribute type.TileDBError
- A TileDB exceptionpublic Query setBuffer(java.lang.String attr, long bufferElements) throws TileDBError
attr
- The attributebufferElements
- TileDBError
public Query setBuffer(java.lang.String attr, java.nio.ByteBuffer buffer) throws TileDBError
attr
- The attributebuffer
- The input NIO ByteBufferTileDBError
public Query setBuffer(java.lang.String attr, NativeArray offsets, NativeArray buffer) throws TileDBError
attr
- Attribute nameoffsets
- Offsets where a new element begins in the data buffer.buffer
- Buffer vector with elements of the attribute type.TileDBError
- A TileDB exceptionpublic Query setBuffer(java.lang.String attr, java.nio.ByteBuffer offsets, java.nio.ByteBuffer buffer) throws TileDBError
attr
- Attribute nameoffsets
- Offsets where a new element begins in the data buffer.buffer
- Buffer vector with elements of the attribute type.TileDBError
- A TileDB exceptionpublic Query setBuffer(java.lang.String attr, NativeArray offsets, NativeArray buffer, long offsetElements, long bufferElements) throws TileDBError
attr
- Attribute nameoffsets
- Offsets where a new element begins in the data buffer.buffer
- Buffer vector with elements of the attribute type.offsetElements
- The actual number of offset elementsbufferElements
- The actual number of buffer elementsTileDBError
- A TileDB exceptionpublic Query setBufferByteSize(java.lang.String attribute, java.lang.Long offsetSize, java.lang.Long bufferSize) throws TileDBError
TileDBError
public Query setBufferByteSize(java.lang.String attribute, java.lang.Long bufferSize) throws TileDBError
TileDBError
public Query setBufferElements(java.lang.String attribute, java.lang.Integer bufferElements) throws TileDBError
TileDBError
public Query setBufferElements(java.lang.String attribute, java.lang.Integer offsetElements, java.lang.Integer bufferElements) throws TileDBError
TileDBError
@Deprecated public Query setCoordinates(NativeArray buffer) throws TileDBError
buffer
- A NativeArray to be used for the coordinates.TileDBError
- A TileDB exception@Deprecated public java.lang.Object getCoordinates() throws TileDBError
TileDBError
- A TileDB exceptionpublic java.util.HashMap<java.lang.String,Pair<java.lang.Long,java.lang.Long>> resultBufferElements() throws TileDBError
The first is number of elements for var size attributes, and the second is number of elements in the data buffer. For fixed sized attributes (and coordinates), the first is always 0.
TileDBError
- A TileDB exceptionpublic java.util.HashMap<java.lang.String,Pair<java.lang.Long,java.lang.Long>> resultBufferSizes() throws TileDBError
resultBufferSizes used mostly for metric reporting.
The first is size in bytes for offsets of var size attributes, and the second is size in bytes in the data buffer. For fixed sized attributes (and coordinates), the first is always 0.
TileDBError
- A TileDB exceptionpublic void resetBuffers()
public Query resetBufferSizes(java.lang.Long val)
public Query resetBufferSizes()
public java.lang.Object getBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.ByteBuffer,java.nio.ByteBuffer> getByteBuffer(java.lang.String attr) throws TileDBError
attr
- The attribute nameTileDBError
- A TileDB exceptionpublic long[] getVarBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.LongBuffer,java.nio.IntBuffer> getIntBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.LongBuffer,java.nio.LongBuffer> getLongBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.LongBuffer,java.nio.ShortBuffer> getShortBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.LongBuffer,java.nio.CharBuffer> getCharBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.LongBuffer,java.nio.FloatBuffer> getFloatBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic Pair<java.nio.LongBuffer,java.nio.DoubleBuffer> getDoubleBuffer(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic byte[] getByteArray(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic long[] getOffsetArray(java.lang.String bufferName) throws TileDBError
bufferName
- The attribute nameTileDBError
- A TileDB exceptionpublic java.util.HashMap<java.lang.String,Pair<java.lang.Integer,java.lang.Integer>> getResultEstimations() throws TileDBError
TileDBError
public Query finalizeQuery() throws TileDBError
TileDBError
- A TileDB excdeptionpublic long getFragmentNum() throws TileDBError
TileDBError
public java.lang.String getFragmentURI(java.math.BigInteger idx) throws TileDBError
TileDBError
public Pair<java.lang.Long,java.lang.Long> getFragmentTimestampRange(java.math.BigInteger idx) throws TileDBError
TileDBError
public java.lang.String toString()
toString
in class java.lang.Object
public void close()
close
in interface java.lang.AutoCloseable