MCPcopy Create free account
hub / github.com/apache/arrow / GetSubstraitFromServer

Function GetSubstraitFromServer

cpp/examples/arrow/engine_substrait_consumption.cc:66–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64};
65
66arrow::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
115arrow::Status RunSubstraitConsumer(int argc, char** argv) {
116 // Plans arrive at the consumer serialized in a Buffer, using the binary protobuf

Callers 1

RunSubstraitConsumerFunction · 0.85

Calls 3

SubstraitFromJSONFunction · 0.85
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected