liukun4515 commented on issue #2445:
URL: https://github.com/apache/arrow-rs/issues/2445#issuecomment-1225123380
You can change your server code to
```
async fn get_schema(
&self,
_request: Request<FlightDescriptor>,
) -> Result<Response<SchemaResult>, Status> {
let tid = Field::new("tid", DataType::Int32, false);
let timestamp = Field::new("timestamp",
DataType::Timestamp(TimeUnit::Millisecond, None), false);
let value = Field::new("value", DataType::Float32, false);
let schema = Schema::new(vec![tid, timestamp, value]);
let options = IpcWriteOptions::default();
let schema_as_ipc = SchemaAsIpc::new(&schema, &options);
// convert the schema as the ipc message
let ipc_message : IpcMessage =
IpcMessage::try_from(schema_as_ipc).unwrap();
// wrap the `SchemaResult` using the ipc message bytes
let schema_result: SchemaResult = SchemaResult {
schema: ipc_message.0,
}
Ok(Response::new(schema_result))
}
```
@skejserjensen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]