| 95 | |
| 96 | private: |
| 97 | void applyRemote( |
| 98 | const SelectivityVector& rows, |
| 99 | std::vector<VectorPtr>& args, |
| 100 | const TypePtr& outputType, |
| 101 | exec::EvalCtx& context, |
| 102 | VectorPtr& result) const { |
| 103 | // Create type and row vector for serialization. |
| 104 | auto remoteRowVector = std::make_shared<RowVector>( |
| 105 | context.pool(), |
| 106 | remoteInputType_, |
| 107 | BufferPtr{}, |
| 108 | rows.end(), |
| 109 | std::move(args)); |
| 110 | |
| 111 | // Send to remote server. |
| 112 | remote::RemoteFunctionResponse remoteResponse; |
| 113 | remote::RemoteFunctionRequest request; |
| 114 | request.throwOnError_ref() = context.throwOnError(); |
| 115 | |
| 116 | auto functionHandle = request.remoteFunctionHandle_ref(); |
| 117 | functionHandle->name_ref() = functionName_; |
| 118 | functionHandle->returnType_ref() = serializeType(outputType); |
| 119 | functionHandle->argumentTypes_ref() = serializedInputTypes_; |
| 120 | |
| 121 | auto requestInputs = request.inputs_ref(); |
| 122 | requestInputs->rowCount_ref() = remoteRowVector->size(); |
| 123 | requestInputs->pageFormat_ref() = serdeFormat_; |
| 124 | |
| 125 | // TODO: serialize only active rows. |
| 126 | requestInputs->payload_ref() = rowVectorToIOBuf( |
| 127 | remoteRowVector, rows.end(), *context.pool(), serde_.get()); |
| 128 | |
| 129 | try { |
| 130 | thriftClient_->sync_invokeFunction(remoteResponse, request); |
| 131 | } catch (const std::exception& e) { |
| 132 | BOLT_FAIL( |
| 133 | "Error while executing remote function '{}' at '{}': {}", |
| 134 | functionName_, |
| 135 | location_.describe(), |
| 136 | e.what()); |
| 137 | } |
| 138 | |
| 139 | auto outputRowVector = IOBufToRowVector( |
| 140 | remoteResponse.get_result().get_payload(), |
| 141 | ROW({outputType}), |
| 142 | *context.pool(), |
| 143 | serde_.get()); |
| 144 | result = outputRowVector->childAt(0); |
| 145 | } |
| 146 | |
| 147 | const std::string functionName_; |
| 148 | folly::SocketAddress location_; |
nothing calls this directly
no test coverage detected