Repository navigation
PHOENIX-8036 Introduce Protobuf Data type - #2706
Open
virajjasani wants to merge 1 commit into
Open
virajjasani wants to merge 1 commit into
virajjasani wants to merge 1 commit into
Conversation
virajjasani
force-pushed
the
PHOENIX-8036-master-2
branch
from
November 24, 2026 20:21
695a3f1 to
79a3366
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: PHOENIX-8036
Phoenix supports two document data types: JSON and BSON. Both data types help store JSON documents in encoded formats, where the document does not need to follow any schema patterns. However, storing JSON documents requires storing all the key-value pairs of the document. Some use cases do not always need flexible structure to store the document data in a single column.
Protocol buffers (or protobuf) is a binary serialization format that uses schema. Protobufs are language-neutral, platform-neutral extensible mechanisms for serializing structured data. Users can describe the protobuf messages in a .proto file. The protoc compiler generates typed classes for Java, C++, Go, Python and other languages. Those classes encode messages into compact bytes and decode them back.
On the wire, each field is written as a pair: a field number plus a type tag, followed by the value. Integers use varints (small numbers take fewer bytes). Field names are not sent on the wire, and therefore protobuf is quite compact than JSON or BSON serialized formats. Protobufs are also faster to parse and serialize than JSON/BSON formats.
Under normal circumstances, protobuf serialized bytes can be stored as VARBINARY format in Phoenix or any other SQL databases. However, it does not work when the use case requires creating a global secondary index on one or more fields of the protobuf data, or retrieving values of one or more fields rather than retrieving full binary data to the SQL client. Therefore, Phoenix is introducing a new data type PROTOBUF, with the data stored as variable length binary, and certain functions to retrieve the field values to clients and allow creating secondary indexes on the fields of the protobuf data.
Design doc