virajjasani opened a new pull request, #2706:
URL: https://github.com/apache/phoenix/pull/2706

   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](https://docs.google.com/document/d/1rXdRhJMmQPJWGKdMyoA-kW15QHEGoO_Z4B_VJJ64e1Y/edit?usp=sharing)


-- 
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]

Reply via email to