-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2019 from kuzudb/arrow-schema-fix
Arrow schema fixes
- Loading branch information
Showing
4 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
add_kuzu_test(main_test | ||
arrow_test.cpp | ||
config_test.cpp | ||
connection_test.cpp | ||
csv_output_test.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "main_test_helper/main_test_helper.h" | ||
|
||
using namespace kuzu::common; | ||
using namespace kuzu::testing; | ||
|
||
class ArrowTest : public ApiTest {}; | ||
|
||
TEST_F(ArrowTest, getArrowResult) { | ||
auto query = "MATCH (a:person) WHERE a.fName = 'Bob' RETURN a.fName"; | ||
auto result = conn->query(query); | ||
auto arrowArray = result->getNextArrowChunk(1); | ||
ASSERT_EQ(arrowArray->length, 1); | ||
ASSERT_EQ(arrowArray->null_count, 0); | ||
ASSERT_EQ(arrowArray->n_children, 1); | ||
// FIXME: Not sure where the length of the string is stored | ||
ASSERT_EQ(std::string((const char*)arrowArray->children[0]->buffers[2], 3), "Bob"); | ||
arrowArray->release(arrowArray.get()); | ||
} | ||
|
||
TEST_F(ArrowTest, getArrowSchema) { | ||
auto query = "MATCH (a:person) RETURN a.fName as NAME"; | ||
auto result = conn->query(query); | ||
auto schema = result->getArrowSchema(); | ||
ASSERT_EQ(schema->n_children, 1); | ||
ASSERT_EQ(std::string(schema->children[0]->name), "NAME"); | ||
schema->release(schema.get()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters