9prady9 commented on a change in pull request #11694: URL: https://github.com/apache/arrow/pull/11694#discussion_r756178272
########## File path: cpp/src/arrow/array/array_test.cc ########## @@ -3348,4 +3358,54 @@ TEST(TestSwapEndianArrayData, InvalidLength) { } } +template <typename T> +class TestPrimitiveArray : public ::testing::Test { + public: + void SetUp() { pool_ = default_memory_pool(); } + + protected: + MemoryPool* pool_; +}; + +TYPED_TEST_SUITE(TestPrimitiveArray, Primitives); + +TYPED_TEST(TestPrimitiveArray, IndexOperator) { + using ArrayBuilderPointer = std::shared_ptr<arrow::ArrayBuilder>; + using CurrentBuilderType = typename TypeParam::BuilderType; + using CurrentArrayType = typename TypeParam::ArrayType; + using T = typename TypeParam::T; + + using CType = typename std::conditional<std::is_integral<T>::value || + std::is_floating_point<T>::value, + T, typename TypeParam::ConversionType>::type; + + const std::vector<bool> valids = {true, true, true, false, true, true}; + const std::vector<CType> values( + 6); // default/garbage values, not important for this test Review comment: That is a good lead, I am still getting used to different approaches on how to create arrays in arrow. Thanks -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org