4545#include " arrow/util/logging_internal.h"
4646#include " arrow/util/macros.h"
4747#include " arrow/util/range.h"
48+ #include " arrow/util/ree_util.h"
4849#include " arrow/util/thread_pool.h"
4950
50- // TODO(GH-37221): Remove these ifdef checks when compute dependency is removed
51- #ifdef ARROW_COMPUTE
52- # include " arrow/compute/api_vector.h"
53- #endif
54-
5551namespace arrow {
5652
5753using internal::ArrayDeviceExportTraits;
@@ -472,7 +468,6 @@ TEST_F(TestSchemaExport, Union) {
472468 {ARROW_FLAG_NULLABLE});
473469}
474470
475- #ifdef ARROW_COMPUTE
476471TEST_F (TestSchemaExport, RunEndEncoded) {
477472 TestNested (run_end_encoded (int16 (), uint8 ()), {" +r" , " s" , " C" },
478473 {" " , " run_ends" , " values" }, {ARROW_FLAG_NULLABLE, 0 , ARROW_FLAG_NULLABLE});
@@ -484,7 +479,6 @@ TEST_F(TestSchemaExport, RunEndEncoded) {
484479 {" " , " run_ends" , " values" , " item" },
485480 {ARROW_FLAG_NULLABLE, 0 , ARROW_FLAG_NULLABLE, ARROW_FLAG_NULLABLE});
486481}
487- #endif
488482
489483std::string GetIndexFormat (Type::type type_id) {
490484 switch (type_id) {
@@ -1080,15 +1074,15 @@ TEST_F(TestArrayExport, Union) {
10801074 TestNested (type, data);
10811075}
10821076
1083- # ifdef ARROW_COMPUTE
1077+ // Helper to create a RunEndEncoded array from JSON for testing
10841078Result<std::shared_ptr<Array>> REEFromJSON (const std::shared_ptr<DataType>& ree_type,
10851079 const std::string& json) {
10861080 auto ree_type_ptr = checked_cast<const RunEndEncodedType*>(ree_type.get ());
10871081 auto array = ArrayFromJSON (ree_type_ptr->value_type (), json);
1088- ARROW_ASSIGN_OR_RAISE (
1089- auto datum ,
1090- RunEndEncode (array, compute::RunEndEncodeOptions{ree_type_ptr-> run_end_type ()} ));
1091- return datum. make_array ( );
1082+ ARROW_ASSIGN_OR_RAISE (auto array_data, ree_util::RunEndEncodeArray (
1083+ array-> data (), ree_type_ptr-> run_end_type () ,
1084+ default_memory_pool () ));
1085+ return MakeArray (array_data );
10921086}
10931087
10941088TEST_F (TestArrayExport, RunEndEncoded) {
@@ -1108,7 +1102,6 @@ TEST_F(TestArrayExport, RunEndEncodedSliced) {
11081102 };
11091103 TestNested (factory);
11101104}
1111- #endif
11121105
11131106TEST_F (TestArrayExport, Dictionary) {
11141107 {
@@ -1432,7 +1425,6 @@ class TestDeviceArrayExport : public ::testing::Test {
14321425 return [=]() { return ToDevice (mm, *ArrayFromJSON (type, json)->data ()); };
14331426 }
14341427
1435- #ifdef ARROW_COMPUTE
14361428 static std::function<Result<std::shared_ptr<Array>>()> JSONREEArrayFactory (
14371429 const std::shared_ptr<MemoryManager>& mm, std::shared_ptr<DataType> type,
14381430 const char * json) {
@@ -1441,7 +1433,6 @@ class TestDeviceArrayExport : public ::testing::Test {
14411433 return ToDevice (mm, *result->data ());
14421434 };
14431435 }
1444- #endif
14451436
14461437 template <typename ArrayFactory, typename ExportCheckFunc>
14471438 void TestWithArrayFactory (ArrayFactory&& factory, ExportCheckFunc&& check_func) {
@@ -1680,7 +1671,6 @@ TEST_F(TestDeviceArrayExport, Union) {
16801671 TestNested (mm, type, data);
16811672}
16821673
1683- #ifdef ARROW_COMPUTE
16841674TEST_F (TestDeviceArrayExport, RunEndEncoded) {
16851675 std::shared_ptr<Device> device = std::make_shared<MyDevice>(1 );
16861676 auto mm = device->default_memory_manager ();
@@ -1689,7 +1679,6 @@ TEST_F(TestDeviceArrayExport, RunEndEncoded) {
16891679 const char * data = " [1, null, 2, 2, 4, 5]" ;
16901680 TestNested (JSONREEArrayFactory (mm, type, data));
16911681}
1692- #endif
16931682
16941683TEST_F (TestDeviceArrayExport, Extension) {
16951684 std::shared_ptr<Device> device = std::make_shared<MyDevice>(1 );
@@ -2186,14 +2175,12 @@ TEST_F(TestSchemaImport, Map) {
21862175 CheckImport (expected);
21872176}
21882177
2189- #ifdef ARROW_COMPUTE
21902178TEST_F (TestSchemaImport, RunEndEncoded) {
21912179 FillPrimitive (AddChild (), " s" , " run_ends" );
21922180 FillPrimitive (AddChild (), " I" , " values" );
21932181 FillRunEndEncoded (" +r" );
21942182 CheckImport (run_end_encoded (int16 (), uint32 ()));
21952183}
2196- #endif
21972184
21982185TEST_F (TestSchemaImport, Dictionary) {
21992186 FillPrimitive (AddChild (), " u" );
@@ -3175,7 +3162,6 @@ TEST_F(TestArrayImport, Struct) {
31753162 CheckImport (expected);
31763163}
31773164
3178- #ifdef ARROW_COMPUTE
31793165TEST_F (TestArrayImport, RunEndEncoded) {
31803166 FillPrimitive (AddChild (), 5 , 0 , 0 , run_ends_buffers5);
31813167 FillPrimitive (AddChild (), 5 , 0 , 0 , primitive_buffers_no_nulls5);
@@ -3218,7 +3204,6 @@ TEST_F(TestArrayImport, RunEndEncodedWithOffset) {
32183204 ASSERT_OK_AND_ASSIGN (expected, REEFromJSON (ree_type, " [-2.0, -2.0, 3.0, 3.0]" ));
32193205 CheckImport (expected);
32203206}
3221- #endif
32223207
32233208TEST_F (TestArrayImport, SparseUnion) {
32243209 auto type = sparse_union ({field (" strs" , utf8 ()), field (" ints" , int8 ())}, {43 , 42 });
@@ -3749,12 +3734,10 @@ TEST_F(TestSchemaRoundtrip, Union) {
37493734 TestWithTypeFactory ([&]() { return dense_union ({f1, f2}, type_codes); });
37503735}
37513736
3752- #ifdef ARROW_COMPUTE
37533737TEST_F (TestSchemaRoundtrip, RunEndEncoded) {
37543738 TestWithTypeFactory ([]() { return run_end_encoded (int16 (), float32 ()); });
37553739 TestWithTypeFactory ([]() { return run_end_encoded (int32 (), list (float32 ())); });
37563740}
3757- #endif
37583741
37593742TEST_F (TestSchemaRoundtrip, Dictionary) {
37603743 for (auto index_ty : all_dictionary_index_types ()) {
@@ -4104,7 +4087,6 @@ TEST_F(TestArrayRoundtrip, Union) {
41044087 }
41054088}
41064089
4107- #ifdef ARROW_COMPUTE
41084090TEST_F (TestArrayRoundtrip, RunEndEncoded) {
41094091 {
41104092 auto factory = []() -> Result<std::shared_ptr<Array>> {
@@ -4130,7 +4112,6 @@ TEST_F(TestArrayRoundtrip, RunEndEncoded) {
41304112 TestWithArrayFactory (factory);
41314113 }
41324114}
4133- #endif
41344115
41354116TEST_F (TestArrayRoundtrip, Dictionary) {
41364117 {
0 commit comments