20
20
#include < cmath>
21
21
#include < cstdint>
22
22
23
+ #if defined(NANOARROW_ARROW_FOUND)
23
24
#include < arrow/array.h>
24
25
#include < arrow/array/builder_binary.h>
25
26
#include < arrow/array/builder_decimal.h>
35
36
#if defined(ARROW_VERSION_MAJOR) && ARROW_VERSION_MAJOR >= 12
36
37
#include < arrow/array/builder_run_end.h>
37
38
#endif
39
+ #endif
38
40
39
41
#include " nanoarrow/nanoarrow.hpp"
40
42
43
+ #if defined(NANOARROW_ARROW_FOUND)
41
44
using namespace arrow ;
45
+ #endif
42
46
using namespace nanoarrow ::literals;
43
47
using nanoarrow::NA;
44
48
using testing::ElementsAre;
45
49
46
50
// Lightweight versions of ArrowTesting's ARROW_EXPECT_OK. This
47
51
// version accomplishes the task of making sure the status message
48
52
// ends up in the ctests log.
53
+ #if defined(NANOARROW_ARROW_FOUND)
49
54
void ARROW_EXPECT_OK (Status status) {
50
55
if (!status.ok ()) {
51
56
throw std::runtime_error (status.message ());
@@ -57,6 +62,7 @@ void ARROW_EXPECT_OK(Result<std::shared_ptr<Array>> result) {
57
62
throw std::runtime_error (result.status ().message ());
58
63
}
59
64
}
65
+ #endif
60
66
61
67
TEST (ArrayTest, ArrayTestInit) {
62
68
struct ArrowArray array;
@@ -380,6 +386,7 @@ INSTANTIATE_TEST_SUITE_P(NanoarrowIpcTest, UnparameterizedTypeTestFixture,
380
386
::testing::Values (NANOARROW_TYPE_NA, NANOARROW_TYPE_INT32,
381
387
NANOARROW_TYPE_BINARY, NANOARROW_TYPE_STRUCT));
382
388
389
+ #if defined(NANOARROW_ARROW_FOUND)
383
390
TEST (ArrayTest, ArrayTestAppendToNullArray) {
384
391
struct ArrowArray array;
385
392
ASSERT_EQ (ArrowArrayInitFromType (&array, NANOARROW_TYPE_NA), NANOARROW_OK);
@@ -566,6 +573,7 @@ TEST(ArrayTest, ArrayTestAppendToStringArray) {
566
573
567
574
EXPECT_TRUE (arrow_array.ValueUnsafe ()->Equals (expected_array.ValueUnsafe ()));
568
575
}
576
+ #endif
569
577
570
578
TEST (ArrayTest, ArrayTestAppendEmptyToString) {
571
579
struct ArrowArray array;
@@ -577,6 +585,7 @@ TEST(ArrayTest, ArrayTestAppendEmptyToString) {
577
585
ArrowArrayRelease (&array);
578
586
}
579
587
588
+ #if defined(NANOARROW_ARROW_FOUND)
580
589
TEST (ArrayTest, ArrayTestAppendToUInt64Array) {
581
590
struct ArrowArray array;
582
591
@@ -608,6 +617,7 @@ TEST(ArrayTest, ArrayTestAppendToUInt64Array) {
608
617
609
618
EXPECT_TRUE (arrow_array.ValueUnsafe ()->Equals (expected_array.ValueUnsafe ()));
610
619
}
620
+ #endif
611
621
612
622
TEST (ArrayTest, ArrayTestAppendToUInt32Array) {
613
623
struct ArrowArray array;
@@ -629,6 +639,7 @@ TEST(ArrayTest, ArrayTestAppendToUInt32Array) {
629
639
ArrowArrayRelease (&array);
630
640
}
631
641
642
+ #if defined(NANOARROW_ARROW_FOUND)
632
643
TEST (ArrayTest, ArrayTestAppendToUInt16Array) {
633
644
struct ArrowArray array;
634
645
@@ -844,6 +855,7 @@ TEST(ArrayTest, ArrayTestAppendToHalfFloatArray) {
844
855
auto arrow_array = ImportArray (&array, float16 ());
845
856
ARROW_EXPECT_OK (arrow_array);
846
857
}
858
+ #endif
847
859
848
860
TEST (ArrayTest, ArrayTestAppendToBoolArray) {
849
861
struct ArrowArray array;
@@ -1095,6 +1107,7 @@ TEST(ArrayTest, ArrayTestAppendToIntervalArrayYearMonth) {
1095
1107
ArrowArrayRelease (&array);
1096
1108
}
1097
1109
1110
+ #if defined(NANOARROW_ARROW_FOUND)
1098
1111
TEST (ArrayTest, ArrayTestAppendToIntervalArrayDayTime) {
1099
1112
struct ArrowArray array;
1100
1113
@@ -1518,6 +1531,7 @@ TEST(ArrayTest, ArrayTestAppendToFixedSizeListArray) {
1518
1531
1519
1532
EXPECT_TRUE (arrow_array.ValueUnsafe ()->Equals (expected_array.ValueUnsafe ()));
1520
1533
}
1534
+ #endif
1521
1535
1522
1536
TEST (ArrayTest, ArrayTestAppendToListArrayErrors) {
1523
1537
struct ArrowArray array;
@@ -1535,6 +1549,7 @@ TEST(ArrayTest, ArrayTestAppendToListArrayErrors) {
1535
1549
ArrowSchemaRelease (&schema);
1536
1550
}
1537
1551
1552
+ #if defined(NANOARROW_ARROW_FOUND)
1538
1553
TEST (ArrayTest, ArrayTestAppendToStructArray) {
1539
1554
struct ArrowArray array;
1540
1555
struct ArrowSchema schema;
@@ -1744,6 +1759,7 @@ TEST(ArrayTest, ArrayTestAppendToRunEndEncodedArray) {
1744
1759
expected_array.ValueUnsafe ()->ToString ().c_str ());
1745
1760
#endif
1746
1761
}
1762
+ #endif
1747
1763
1748
1764
TEST (ArrayTest, ArrayTestUnionUtils) {
1749
1765
// Check length calculation with nullptr
@@ -1776,6 +1792,7 @@ TEST(ArrayTest, ArrayTestUnionUtils) {
1776
1792
EXPECT_FALSE (_ArrowUnionTypeIdsWillEqualChildIndices (" 0,2" , 2 ));
1777
1793
}
1778
1794
1795
+ #if defined(NANOARROW_ARROW_FOUND)
1779
1796
TEST (ArrayTest, ArrayTestAppendToDenseUnionArray) {
1780
1797
struct ArrowArray array;
1781
1798
struct ArrowSchema schema;
@@ -1871,6 +1888,7 @@ TEST(ArrayTest, ArrayTestAppendToSparseUnionArray) {
1871
1888
expected_array.ValueUnsafe ()->ToString ());
1872
1889
EXPECT_TRUE (arrow_array.ValueUnsafe ()->Equals (expected_array.ValueUnsafe ()));
1873
1890
}
1891
+ #endif
1874
1892
1875
1893
TEST (ArrayTest, ArrayTestAppendToUnionArrayErrors) {
1876
1894
struct ArrowArray array;
@@ -3250,6 +3268,7 @@ TEST(ArrayTest, ArrayViewTestSparseUnionGet) {
3250
3268
// the "value type" that would correspond to what ArrowArrayViewGetDoubleUnsafe()
3251
3269
// or ArrowArrayAppendDouble() do since they operate on the logical/represented
3252
3270
// value.
3271
+ #if defined(NANOARROW_ARROW_FOUND)
3253
3272
template <typename TypeClass, typename BuilderValueT>
3254
3273
BuilderValueT logical_value_to_builder_value (int64_t value) {
3255
3274
return static_cast <BuilderValueT>(value);
@@ -3352,6 +3371,7 @@ TEST(ArrayViewTest, ArrayViewTestGetNumeric) {
3352
3371
TestGetFromNumericArrayView<FloatType>();
3353
3372
TestGetFromNumericArrayView<HalfFloatType>();
3354
3373
}
3374
+ #endif
3355
3375
3356
3376
TEST (ArrayViewTest, ArrayViewTestGetFloat16) {
3357
3377
struct ArrowArray array;
@@ -3419,6 +3439,7 @@ TEST(ArrayViewTest, ArrayViewTestGetFloat16) {
3419
3439
ArrowSchemaRelease (&schema);
3420
3440
}
3421
3441
3442
+ #if defined(NANOARROW_ARROW_FOUND)
3422
3443
template <typename BuilderClass>
3423
3444
void TestGetFromBinary (BuilderClass& builder) {
3424
3445
struct ArrowArray array;
@@ -3595,6 +3616,7 @@ TEST(ArrayViewTest, ArrayViewTestGetBinaryView) {
3595
3616
GTEST_SKIP () << " Arrow C++ StringView compatibility test needs Arrow C++ >= 15" ;
3596
3617
#endif
3597
3618
}
3619
+ #endif
3598
3620
3599
3621
TEST (ArrayViewTest, ArrayViewTestGetIntervalYearMonth) {
3600
3622
struct ArrowArray array;
@@ -3633,6 +3655,7 @@ TEST(ArrayViewTest, ArrayViewTestGetIntervalYearMonth) {
3633
3655
ArrowArrayRelease (&array);
3634
3656
}
3635
3657
3658
+ #if defined(NANOARROW_ARROW_FOUND)
3636
3659
TEST (ArrayViewTest, ArrayViewTestGetIntervalDayTime) {
3637
3660
struct ArrowArray array;
3638
3661
struct ArrowSchema schema;
@@ -3780,3 +3803,4 @@ TEST(ArrayViewTest, ArrayViewTestGetDecimal256) {
3780
3803
ArrowSchemaRelease (&schema);
3781
3804
ArrowArrayRelease (&array);
3782
3805
}
3806
+ #endif
0 commit comments