| 64 | }; |
| 65 | |
| 66 | arrow::Future<std::shared_ptr<arrow::Buffer>> GetSubstraitFromServer( |
| 67 | const std::string& filename) { |
| 68 | // Emulate server interaction by parsing hard coded JSON |
| 69 | std::string substrait_json = R"({ |
| 70 | "relations": [ |
| 71 | {"rel": { |
| 72 | "read": { |
| 73 | "base_schema": { |
| 74 | "struct": { |
| 75 | "types": [ {"i64": {}}, {"bool": {}} ] |
| 76 | }, |
| 77 | "names": ["i", "b"] |
| 78 | }, |
| 79 | "local_files": { |
| 80 | "items": [ |
| 81 | { |
| 82 | "uri_file": "file://FILENAME_PLACEHOLDER", |
| 83 | "parquet": {} |
| 84 | } |
| 85 | ] |
| 86 | } |
| 87 | } |
| 88 | }} |
| 89 | ], |
| 90 | "extension_uris": [ |
| 91 | { |
| 92 | "extension_uri_anchor": 7, |
| 93 | "uri": "https://github.com/apache/arrow/blob/main/format/substrait/extension_types.yaml" |
| 94 | } |
| 95 | ], |
| 96 | "extensions": [ |
| 97 | {"extension_type": { |
| 98 | "extension_uri_reference": 7, |
| 99 | "type_anchor": 42, |
| 100 | "name": "null" |
| 101 | }}, |
| 102 | {"extension_function": { |
| 103 | "extension_uri_reference": 7, |
| 104 | "function_anchor": 42, |
| 105 | "name": "add" |
| 106 | }} |
| 107 | ] |
| 108 | })"; |
| 109 | std::string filename_placeholder = "FILENAME_PLACEHOLDER"; |
| 110 | substrait_json.replace(substrait_json.find(filename_placeholder), |
| 111 | filename_placeholder.size(), filename); |
| 112 | return eng::internal::SubstraitFromJSON("Plan", substrait_json); |
| 113 | } |
| 114 | |
| 115 | arrow::Status RunSubstraitConsumer(int argc, char** argv) { |
| 116 | // Plans arrive at the consumer serialized in a Buffer, using the binary protobuf |
no test coverage detected