Skip to content

Commit

Permalink
Merge pull request #1941 from kuzudb/api
Browse files Browse the repository at this point in the history
Add api comment for arrow export
  • Loading branch information
mewim committed Aug 16, 2023
2 parents 06cbd43 + d124aa3 commit 409a636
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/include/c_api/kuzu.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,24 @@ KUZU_C_API void kuzu_query_result_write_to_csv(kuzu_query_result* query_result,
KUZU_C_API void kuzu_query_result_reset_iterator(kuzu_query_result* query_result);

/**
* @brief Returns the query result's schema as ArrowSchema.
* @praam query_result The query result instance to return.
* @return datatypes of the columns as an arrow schema
*
* It is the caller's responsibility to call the release function to release the underlying data
*/
struct ArrowSchema kuzu_query_result_get_arrow_schema(kuzu_query_result* query_result);
KUZU_C_API struct ArrowSchema kuzu_query_result_get_arrow_schema(kuzu_query_result* query_result);

/**
* @return An arrow array representation of the query result
* @brief Returns the next chunk of the query result as ArrowArray.
* @param query_result The query result instance to return.
* @param chunk_size The number of tuples to return in the chunk.
* @return An arrow array representation of the query result. The arrow array internally stores an
* arrow struct with fields for each of the columns.
*
* It is the caller's responsibility to call the release function to release the underlying data
*/
struct ArrowArray kuzu_query_result_get_next_arrow_chunk(
KUZU_C_API struct ArrowArray kuzu_query_result_get_next_arrow_chunk(
kuzu_query_result* query_result, int64_t chunk_size);

// FlatTuple
Expand Down
7 changes: 5 additions & 2 deletions src/include/main/query_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,17 @@ class QueryResult {
processor::FactorizedTable* getTable() { return factorizedTable.get(); }

/**
* @brief Returns the arrow schema of the query result.
* @return 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.
*/
std::unique_ptr<ArrowSchema> getArrowSchema() const;
KUZU_API std::unique_ptr<ArrowSchema> getArrowSchema() const;

/**
* @brief Returns the next chunk of the query result as an arrow array.
* @param chunkSize number of tuples to return in the chunk.
* @return 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.
Expand All @@ -114,7 +117,7 @@ class QueryResult {
* 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.
*/
std::unique_ptr<ArrowArray> getNextArrowChunk(int64_t chunkSize);
KUZU_API std::unique_ptr<ArrowArray> getNextArrowChunk(int64_t chunkSize);

private:
void initResultTableAndIterator(std::shared_ptr<processor::FactorizedTable> factorizedTable_,
Expand Down

0 comments on commit 409a636

Please sign in to comment.