-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-6519: [Java] Use IPC continuation prefix as part of 8-byte EOS #5345
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| import org.apache.arrow.vector.VectorSchemaRoot; | ||
| import org.apache.arrow.vector.dictionary.DictionaryProvider; | ||
| import org.apache.arrow.vector.ipc.message.IpcOption; | ||
| import org.apache.arrow.vector.ipc.message.MessageSerializer; | ||
|
|
||
| /** | ||
| * Writer for the Arrow stream format to send ArrowRecordBatches over a WriteChannel. | ||
|
|
@@ -68,18 +69,18 @@ public ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, Wri | |
| * Write an EOS identifier to the WriteChannel. | ||
| * | ||
| * @param out Open WriteChannel with an active Arrow stream. | ||
| * @param option IPC write option | ||
| * @throws IOException on error | ||
| */ | ||
| public void writeEndOfStream(WriteChannel out) throws IOException { | ||
| if (option.write_legacy_ipc_format) { | ||
| out.writeIntLittleEndian(0); | ||
| } else { | ||
| out.writeLongLittleEndian(0); | ||
| public static void writeEndOfStream(WriteChannel out, IpcOption option) throws IOException { | ||
| if (!option.write_legacy_ipc_format) { | ||
| out.writeIntLittleEndian(MessageSerializer.IPC_CONTINUATION_TOKEN); | ||
|
||
| } | ||
| out.writeIntLittleEndian(0); | ||
| } | ||
|
|
||
| @Override | ||
| protected void endInternal(WriteChannel out) throws IOException { | ||
| writeEndOfStream(out); | ||
| writeEndOfStream(out, option); | ||
| } | ||
| } | ||
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.
I'd prefer to keep this static because it is being used here to hide the EOS identifier https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowConverters.scala#L67