Repository: arrow Updated Branches: refs/heads/master a5f286174 -> 077c72bc6
ARROW-256: [Format] Add a version number to the IPC/RPC metadata See "Schema evolution examples" in https://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html. In the future, if we need to add some other message types (like `RecordBatchV2`), then this should permit this without too much trouble. Author: Wes McKinney <[email protected]> Closes #125 from wesm/ARROW-256 and squashes the following commits: 60ee5c0 [Wes McKinney] Rename current version to V1_SNAPSHOT to reflect changing nature bab2749 [Wes McKinney] Add a version number / enum to the Message and File metadata Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/077c72bc Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/077c72bc Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/077c72bc Branch: refs/heads/master Commit: 077c72bc6adf07c5311785596cb03088ae11ae5e Parents: a5f2861 Author: Wes McKinney <[email protected]> Authored: Fri Sep 9 00:02:35 2016 -0400 Committer: Wes McKinney <[email protected]> Committed: Fri Sep 9 00:02:35 2016 -0400 ---------------------------------------------------------------------- cpp/src/arrow/ipc/metadata-internal.cc | 3 ++- cpp/src/arrow/ipc/metadata-internal.h | 3 +++ format/File.fbs | 1 + format/Message.fbs | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/077c72bc/cpp/src/arrow/ipc/metadata-internal.cc ---------------------------------------------------------------------- diff --git a/cpp/src/arrow/ipc/metadata-internal.cc b/cpp/src/arrow/ipc/metadata-internal.cc index 1c15218..8cc902c 100644 --- a/cpp/src/arrow/ipc/metadata-internal.cc +++ b/cpp/src/arrow/ipc/metadata-internal.cc @@ -295,7 +295,8 @@ Status WriteDataHeader(int32_t length, int64_t body_length, } Status MessageBuilder::Finish() { - auto message = flatbuf::CreateMessage(fbb_, header_type_, header_, body_length_); + auto message = flatbuf::CreateMessage(fbb_, kMetadataVersion, + header_type_, header_, body_length_); fbb_.Finish(message); return Status::OK(); } http://git-wip-us.apache.org/repos/asf/arrow/blob/077c72bc/cpp/src/arrow/ipc/metadata-internal.h ---------------------------------------------------------------------- diff --git a/cpp/src/arrow/ipc/metadata-internal.h b/cpp/src/arrow/ipc/metadata-internal.h index 5faa8c9..db9a83f 100644 --- a/cpp/src/arrow/ipc/metadata-internal.h +++ b/cpp/src/arrow/ipc/metadata-internal.h @@ -37,6 +37,9 @@ class Status; namespace ipc { +static constexpr flatbuf::MetadataVersion kMetadataVersion = + flatbuf::MetadataVersion_V1_SNAPSHOT; + Status FieldFromFlatbuffer(const flatbuf::Field* field, std::shared_ptr<Field>* out); class MessageBuilder { http://git-wip-us.apache.org/repos/asf/arrow/blob/077c72bc/format/File.fbs ---------------------------------------------------------------------- diff --git a/format/File.fbs b/format/File.fbs index f7ad1e1..a29bbc6 100644 --- a/format/File.fbs +++ b/format/File.fbs @@ -7,6 +7,7 @@ namespace org.apache.arrow.flatbuf; /// table Footer { + version: org.apache.arrow.flatbuf.MetadataVersion; schema: org.apache.arrow.flatbuf.Schema; http://git-wip-us.apache.org/repos/asf/arrow/blob/077c72bc/format/Message.fbs ---------------------------------------------------------------------- diff --git a/format/Message.fbs b/format/Message.fbs index 78bdaeb..657904a 100644 --- a/format/Message.fbs +++ b/format/Message.fbs @@ -1,5 +1,9 @@ namespace org.apache.arrow.flatbuf; +enum MetadataVersion:short { + V1_SNAPSHOT +} + /// ---------------------------------------------------------------------- /// Logical types and their metadata (if any) /// @@ -237,6 +241,7 @@ union MessageHeader { } table Message { + version: org.apache.arrow.flatbuf.MetadataVersion; header: MessageHeader; bodyLength: long; }
