Commit 1b3deb5f authored by Jeff Daily's avatar Jeff Daily
Browse files

Revert "Fix error in cpp_tests/test_arrow.cpp."

This reverts commit e461e868.
parent e601565d
...@@ -148,66 +148,65 @@ class ArrowChunkedArrayTest : public testing::Test { ...@@ -148,66 +148,65 @@ class ArrowChunkedArrayTest : public testing::Test {
arr.private_data = nullptr; arr.private_data = nullptr;
return arr; return arr;
} }
};
/* ------------------------------------- SCHEMA CREATION ------------------------------------- */
/* ------------------------------------- SCHEMA CREATION ------------------------------------- */ template <typename T>
ArrowSchema create_primitive_schema() {
std::logic_error("not implemented");
}
template <typename T> template <>
ArrowSchema create_primitive_schema() { ArrowSchema create_primitive_schema<float>() {
std::logic_error("not implemented"); ArrowSchema schema;
} schema.format = "f";
schema.name = nullptr;
schema.metadata = nullptr;
schema.flags = 0;
schema.n_children = 0;
schema.children = nullptr;
schema.dictionary = nullptr;
schema.release = nullptr;
schema.private_data = nullptr;
return schema;
}
template <> template <>
ArrowSchema create_primitive_schema<float>() { ArrowSchema create_primitive_schema<bool>() {
ArrowSchema schema; ArrowSchema schema;
schema.format = "f"; schema.format = "b";
schema.name = nullptr; schema.name = nullptr;
schema.metadata = nullptr; schema.metadata = nullptr;
schema.flags = 0; schema.flags = 0;
schema.n_children = 0; schema.n_children = 0;
schema.children = nullptr; schema.children = nullptr;
schema.dictionary = nullptr; schema.dictionary = nullptr;
schema.release = nullptr; schema.release = nullptr;
schema.private_data = nullptr; schema.private_data = nullptr;
return schema; return schema;
} }
template <> ArrowSchema create_nested_schema(const std::vector<ArrowSchema*>& arrays) {
ArrowSchema create_primitive_schema<bool>() { auto children = static_cast<ArrowSchema**>(malloc(sizeof(ArrowSchema*) * arrays.size()));
ArrowSchema schema; for (size_t i = 0; i < arrays.size(); ++i) {
schema.format = "b"; auto child = static_cast<ArrowSchema*>(malloc(sizeof(ArrowSchema)));
schema.name = nullptr; *child = *arrays[i];
schema.metadata = nullptr; children[i] = child;
schema.flags = 0; }
schema.n_children = 0;
schema.children = nullptr;
schema.dictionary = nullptr;
schema.release = nullptr;
schema.private_data = nullptr;
return schema;
}
ArrowSchema create_nested_schema(const std::vector<ArrowSchema*>& arrays) { ArrowSchema schema;
auto children = static_cast<ArrowSchema**>(malloc(sizeof(ArrowSchema*) * arrays.size())); schema.format = "+s";
for (size_t i = 0; i < arrays.size(); ++i) { schema.name = nullptr;
auto child = static_cast<ArrowSchema*>(malloc(sizeof(ArrowSchema))); schema.metadata = nullptr;
*child = *arrays[i]; schema.flags = 0;
children[i] = child; schema.n_children = static_cast<int64_t>(arrays.size());
schema.children = children;
schema.dictionary = nullptr;
schema.release = &release_schema;
schema.private_data = nullptr;
return schema;
} }
};
ArrowSchema schema;
schema.format = "+s";
schema.name = nullptr;
schema.metadata = nullptr;
schema.flags = 0;
schema.n_children = static_cast<int64_t>(arrays.size());
schema.children = children;
schema.dictionary = nullptr;
schema.release = &release_schema;
schema.private_data = nullptr;
return schema;
}
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/* TESTS */ /* TESTS */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment