|
28 | 28 | #include "arrow/record_batch.h" |
29 | 29 | #include "arrow/result.h" |
30 | 30 | #include "arrow/status.h" |
| 31 | +#include "arrow/testing/extension_type.h" |
31 | 32 | #include "arrow/type.h" |
32 | 33 | #include "arrow/type_fwd.h" |
33 | 34 | #include "arrow/util/logging.h" |
34 | 35 |
|
35 | 36 | namespace arrow::internal::integration { |
36 | 37 | namespace { |
37 | 38 |
|
| 39 | +// Make sure the extension types referenced in test data are registered. |
| 40 | +[[nodiscard]] auto RequireExtensionTypes() { |
| 41 | + return ExtensionTypeGuard({uuid(), dict_extension_type()}); |
| 42 | +} |
| 43 | + |
38 | 44 | template <typename Func> |
39 | 45 | const char* StatusToErrorString(Func&& func) { |
40 | 46 | static std::string error; |
@@ -113,30 +119,39 @@ Status ImportBatchAndCompareToJson(std::string json_path, int num_batch, |
113 | 119 | const char* ArrowCpp_CDataIntegration_ExportSchemaFromJson(const char* json_path, |
114 | 120 | ArrowSchema* out) { |
115 | 121 | using namespace arrow::internal::integration; // NOLINT(build/namespaces) |
116 | | - return StatusToErrorString([=]() { return ExportSchemaFromJson(json_path, out); }); |
| 122 | + return StatusToErrorString([=]() { |
| 123 | + auto guard = RequireExtensionTypes(); |
| 124 | + return ExportSchemaFromJson(json_path, out); |
| 125 | + }); |
117 | 126 | } |
118 | 127 |
|
119 | 128 | const char* ArrowCpp_CDataIntegration_ImportSchemaAndCompareToJson(const char* json_path, |
120 | 129 | ArrowSchema* schema) { |
121 | 130 | using namespace arrow::internal::integration; // NOLINT(build/namespaces) |
122 | | - return StatusToErrorString( |
123 | | - [=]() { return ImportSchemaAndCompareToJson(json_path, schema); }); |
| 131 | + return StatusToErrorString([=]() { |
| 132 | + auto guard = RequireExtensionTypes(); |
| 133 | + return ImportSchemaAndCompareToJson(json_path, schema); |
| 134 | + }); |
124 | 135 | } |
125 | 136 |
|
126 | 137 | const char* ArrowCpp_CDataIntegration_ExportBatchFromJson(const char* json_path, |
127 | 138 | int num_batch, |
128 | 139 | ArrowArray* out) { |
129 | 140 | using namespace arrow::internal::integration; // NOLINT(build/namespaces) |
130 | | - return StatusToErrorString( |
131 | | - [=]() { return ExportBatchFromJson(json_path, num_batch, out); }); |
| 141 | + return StatusToErrorString([=]() { |
| 142 | + auto guard = RequireExtensionTypes(); |
| 143 | + return ExportBatchFromJson(json_path, num_batch, out); |
| 144 | + }); |
132 | 145 | } |
133 | 146 |
|
134 | 147 | const char* ArrowCpp_CDataIntegration_ImportBatchAndCompareToJson(const char* json_path, |
135 | 148 | int num_batch, |
136 | 149 | ArrowArray* batch) { |
137 | 150 | using namespace arrow::internal::integration; // NOLINT(build/namespaces) |
138 | | - return StatusToErrorString( |
139 | | - [=]() { return ImportBatchAndCompareToJson(json_path, num_batch, batch); }); |
| 151 | + return StatusToErrorString([=]() { |
| 152 | + auto guard = RequireExtensionTypes(); |
| 153 | + return ImportBatchAndCompareToJson(json_path, num_batch, batch); |
| 154 | + }); |
140 | 155 | } |
141 | 156 |
|
142 | 157 | int64_t ArrowCpp_BytesAllocated() { |
|
0 commit comments