diff --git a/tree/dataframe/test/datasource_arrow.cxx b/tree/dataframe/test/datasource_arrow.cxx index f1b8fab8ccf1b..d045f74f48f9a 100644 --- a/tree/dataframe/test/datasource_arrow.cxx +++ b/tree/dataframe/test/datasource_arrow.cxx @@ -30,6 +30,16 @@ std::shared_ptr exampleSchema() field("Married", arrow::boolean()), field("Babies", arrow::uint32())}); } +template +std::shared_ptr makeColumn(std::shared_ptr, std::shared_ptr array) { + return std::make_shared(field, array); +} + +template <> +std::shared_ptr makeColumn(std::shared_ptr, std::shared_ptr array) { + return std::make_shared(array); +} + std::shared_ptr createTestTable() { auto schema_ = exampleSchema(); @@ -49,10 +59,14 @@ std::shared_ptr
createTestTable() arrow::ArrayFromVector(marriageStatus, &arrays_[3]); arrow::ArrayFromVector(babies, &arrays_[4]); - std::vector> columns_ = { - std::make_shared(schema_->field(0), arrays_[0]), std::make_shared(schema_->field(1), arrays_[1]), - std::make_shared(schema_->field(2), arrays_[2]), std::make_shared(schema_->field(3), arrays_[3]), - std::make_shared(schema_->field(4), arrays_[4])}; + using ColumnType = typename decltype(std::declval().column(0))::element_type; + + std::vector> columns_ = { + makeColumn(schema_->field(0), arrays_[0]), + makeColumn(schema_->field(1), arrays_[1]), + makeColumn(schema_->field(2), arrays_[2]), + makeColumn(schema_->field(3), arrays_[3]), + makeColumn(schema_->field(4), arrays_[4])}; auto table_ = Table::Make(schema_, columns_); return table_;