Kùzu C++ API
Loading...
Searching...
No Matches
kuzu::main::QueryResult Class Reference

QueryResult stores the result of a query execution. More...

#include <query_result.h>

Public Member Functions

KUZU_API QueryResult ()
 Used to create a QueryResult object for the failing query.
 
 QueryResult (const PreparedSummary &preparedSummary)
 
KUZU_API ~QueryResult ()
 Deconstructs the QueryResult object.
 
KUZU_API bool isSuccess () const
 
KUZU_API std::string getErrorMessage () const
 
KUZU_API size_t getNumColumns () const
 
KUZU_API std::vector< std::string > getColumnNames () const
 
KUZU_API std::vector< common::LogicalTypegetColumnDataTypes () const
 
KUZU_API uint64_t getNumTuples () const
 
KUZU_API QuerySummarygetQuerySummary () const
 
KUZU_API bool hasNext () const
 
KUZU_API bool hasNextQueryResult () const
 
KUZU_API QueryResultgetNextQueryResult ()
 
KUZU_API std::shared_ptr< processor::FlatTuplegetNext ()
 
KUZU_API std::string toString ()
 
KUZU_API void resetIterator ()
 Resets the result tuple iterator.
 
processor::FactorizedTable * getTable ()
 
KUZU_API std::unique_ptr< ArrowSchemagetArrowSchema () const
 Returns the arrow schema of the query result.
 
KUZU_API std::unique_ptr< ArrowArraygetNextArrowChunk (int64_t chunkSize)
 Returns the next chunk of the query result as an arrow array.
 

Public Attributes

std::unique_ptr< QueryResultnextQueryResult
 

Friends

class Connection
 
class ClientContext
 

Detailed Description

QueryResult stores the result of a query execution.

Constructor & Destructor Documentation

◆ QueryResult() [1/2]

KUZU_API kuzu::main::QueryResult::QueryResult ( )

Used to create a QueryResult object for the failing query.

◆ QueryResult() [2/2]

kuzu::main::QueryResult::QueryResult ( const PreparedSummary & preparedSummary)
explicit

◆ ~QueryResult()

KUZU_API kuzu::main::QueryResult::~QueryResult ( )

Deconstructs the QueryResult object.

Member Function Documentation

◆ getArrowSchema()

KUZU_API std::unique_ptr< ArrowSchema > kuzu::main::QueryResult::getArrowSchema ( ) const

Returns the arrow schema of the query result.

Returns
datatypes of the columns as an arrow schema

It is the caller's responsibility to call the release function to release the underlying data If converting to another arrow type, this this is usually handled automatically.

◆ getColumnDataTypes()

KUZU_API std::vector< common::LogicalType > kuzu::main::QueryResult::getColumnDataTypes ( ) const
Returns
dataType of each column in query result.

◆ getColumnNames()

KUZU_API std::vector< std::string > kuzu::main::QueryResult::getColumnNames ( ) const
Returns
name of each column in query result.

◆ getErrorMessage()

KUZU_API std::string kuzu::main::QueryResult::getErrorMessage ( ) const
Returns
error message of the query execution if the query fails.

◆ getNext()

KUZU_API std::shared_ptr< processor::FlatTuple > kuzu::main::QueryResult::getNext ( )
Returns
next flat tuple in the query result.

◆ getNextArrowChunk()

KUZU_API std::unique_ptr< ArrowArray > kuzu::main::QueryResult::getNextArrowChunk ( int64_t chunkSize)

Returns the next chunk of the query result as an arrow array.

Parameters
chunkSizenumber of tuples to return in the chunk.
Returns
An arrow array representation of the next chunkSize tuples of the query result.

The ArrowArray internally stores an arrow struct with fields for each of the columns. This can be converted to a RecordBatch with arrow's ImportRecordBatch function

It is the caller's responsibility to call the release function to release the underlying data If converting to another arrow type, this this is usually handled automatically.

◆ getNextQueryResult()

KUZU_API QueryResult * kuzu::main::QueryResult::getNextQueryResult ( )
Returns
get next query result to read (for multiple query statements).

◆ getNumColumns()

KUZU_API size_t kuzu::main::QueryResult::getNumColumns ( ) const
Returns
number of columns in query result.

◆ getNumTuples()

KUZU_API uint64_t kuzu::main::QueryResult::getNumTuples ( ) const
Returns
num of tuples in query result.

◆ getQuerySummary()

KUZU_API QuerySummary * kuzu::main::QueryResult::getQuerySummary ( ) const
Returns
query summary which stores the execution time, compiling time, plan and query options.

◆ getTable()

processor::FactorizedTable * kuzu::main::QueryResult::getTable ( )
inline

◆ hasNext()

KUZU_API bool kuzu::main::QueryResult::hasNext ( ) const
Returns
whether there are more tuples to read.

◆ hasNextQueryResult()

KUZU_API bool kuzu::main::QueryResult::hasNextQueryResult ( ) const
Returns
whether there are more query results to read.

◆ isSuccess()

KUZU_API bool kuzu::main::QueryResult::isSuccess ( ) const
Returns
query is executed successfully or not.

◆ resetIterator()

KUZU_API void kuzu::main::QueryResult::resetIterator ( )

Resets the result tuple iterator.

◆ toString()

KUZU_API std::string kuzu::main::QueryResult::toString ( )
Returns
string of first query result.

Friends And Related Symbol Documentation

◆ ClientContext

friend class ClientContext
friend

◆ Connection

friend class Connection
friend

Member Data Documentation

◆ nextQueryResult

std::unique_ptr<QueryResult> kuzu::main::QueryResult::nextQueryResult

The documentation for this class was generated from the following file: