-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update flight definitions including backwards-incompatible change to GetSchema #2586
Changes from 2 commits
bbf77ac
05b7a2f
f92b3b7
eacb730
137e2c1
ad0b77e
961c689
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,10 +254,17 @@ impl From<SchemaAsIpc<'_>> for FlightData { | |
} | ||
} | ||
|
||
impl From<SchemaAsIpc<'_>> for SchemaResult { | ||
fn from(schema_ipc: SchemaAsIpc) -> Self { | ||
let IpcMessage(vals) = flight_schema_as_flatbuffer(schema_ipc.0, schema_ipc.1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tustvold
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the original implementation for the rust is not right without the buffer size for the schema flatbuffer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would agree the original Rust implementation is different, I'm not sure I would go so far as to say it is incorrect. There is no particular need to send the length, given the protobuf is already providing the message framing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree, the layout of the |
||
SchemaResult { schema: vals } | ||
impl TryFrom<SchemaAsIpc<'_>> for SchemaResult { | ||
type Error = ArrowError; | ||
|
||
fn try_from(schema_ipc: SchemaAsIpc) -> ArrowResult<Self> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised we can change this without also needing to change the flight client? In particular I would expect changes to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The flight client just can get the bytes array from The server/client grpc can be generated automatically. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we provide logic to convert the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to make consistent with original implementation for me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My point is twofold:
As an aside I do really wonder why arrow flight is using opaque byte objects, the whole point of using an API DSL is to avoid this but hey ho, this protocol is wild There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think the tooling has issues when it is generated into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will that work when published to crates.io or used via a git revision? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand the thread, it sounds like this has been resolved:
? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it will work for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://doc.rust-lang.org/cargo/commands/cargo-publish.html
|
||
// According to the definition from `Flight.proto` | ||
// The schema of the dataset in its IPC form: | ||
// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix | ||
// 4 bytes - the byte length of the payload | ||
// a flatbuffer Message whose header is the Schema | ||
let IpcMessage(vals) = schema_to_ipc_format(schema_ipc)?; | ||
Ok(SchemaResult { schema: vals }) | ||
} | ||
} | ||
|
||
|
@@ -275,15 +282,19 @@ impl TryFrom<SchemaAsIpc<'_>> for IpcMessage { | |
type Error = ArrowError; | ||
|
||
fn try_from(schema_ipc: SchemaAsIpc) -> ArrowResult<Self> { | ||
let pair = *schema_ipc; | ||
let encoded_data = flight_schema_as_encoded_data(pair.0, pair.1); | ||
|
||
let mut schema = vec![]; | ||
arrow::ipc::writer::write_message(&mut schema, encoded_data, pair.1)?; | ||
Ok(IpcMessage(schema)) | ||
schema_to_ipc_format(schema_ipc) | ||
} | ||
} | ||
|
||
fn schema_to_ipc_format(schema_ipc: SchemaAsIpc) -> ArrowResult<IpcMessage> { | ||
let pair = *schema_ipc; | ||
let encoded_data = flight_schema_as_encoded_data(pair.0, pair.1); | ||
|
||
let mut schema = vec![]; | ||
arrow::ipc::writer::write_message(&mut schema, encoded_data, pair.1)?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've double-checked this will write the continuation token 👍 |
||
Ok(IpcMessage(schema)) | ||
} | ||
|
||
impl TryFrom<&FlightData> for Schema { | ||
type Error = ArrowError; | ||
fn try_from(data: &FlightData) -> ArrowResult<Self> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a formatting change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prost
had a bug that got fixed. I don't think this is a huge problem. tokio-rs/prost#694There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not a huge problem, but it will introduce useless changes in the git diff for each build