Skip to content

Commit

Permalink
add test for fromSubstrait with a plan for "select true"
Browse files Browse the repository at this point in the history
  • Loading branch information
scgkiran committed Dec 18, 2024
1 parent 0d85c4f commit f541de0
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions test/c/test_substrait_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,65 @@ TEST_CASE("Test C VirtualTable input Expression", "[substrait-api]") {
REQUIRE(CHECK_COLUMN(result, 0, {2, 6}));
REQUIRE(CHECK_COLUMN(result, 1, {4, 8}));
}


TEST_CASE("Test C Simple select true", "[substrait-api]") {
DuckDB db(nullptr);
Connection con(db);

auto json = R"({
"version": {
"minorNumber": 29,
"producer": "substrait-go"
},
"relations": [
{
"root": {
"input": {
"read": {
"common": {
"direct": {}
},
"baseSchema": {
"names": [
"C1"
],
"struct": {
"types": [
{
"bool": {
"nullability": "NULLABILITY_NULLABLE"
}
}
],
"nullability": "NULLABILITY_REQUIRED"
}
},
"virtualTable": {
"expressions": [
{
"fields": [
{
"literal": {
"boolean": true,
"nullable": true
}
}
]
}
]
}
}
},
"names": [
"C1"
]
}
}
]
})";


auto result = con.FromSubstraitJSON(json);
REQUIRE(CHECK_COLUMN(result, 0, {true}));
}

0 comments on commit f541de0

Please sign in to comment.