libenchao commented on code in PR #20408:
URL: https://github.com/apache/flink/pull/20408#discussion_r936137558
##########
docs/data/sql_connectors.yml:
##########
@@ -62,6 +62,12 @@ parquet:
category: format
sql_url:
https://repo.maven.apache.org/maven2/org/apache/flink/flink-sql-parquet/$version/flink-sql-parquet-$version.jar
+protobuf:
+ name: Protobuf
+ maven: flink-protobuf
+ category: format
+ builtin: true
Review Comment:
```suggestion
https://repo.maven.apache.org/maven2/org/apache/flink/flink-sql-protobuf/$version/flink-sql-protobuf-$version.jar
```
##########
docs/content/docs/connectors/table/formats/protobuf.md:
##########
@@ -0,0 +1,284 @@
+---
+title: Protobuf
+weight: 4
+type: docs
+aliases:
+- /dev/table/connectors/formats/protobuf.html
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Protobuf Format
+
+{{< label "Format: Serialization Schema" >}}
+{{< label "Format: Deserialization Schema" >}}
+
+The Protocol Buffers
[Protobuf](https://developers.google.com/protocol-buffers) format allows you to
read and write Protobuf data, based on Protobuf generated classes.
+
+Dependencies
+------------
+
+{{< sql_download_table "protobuf" >}}
+
+How to create a table with Protobuf format
+----------------
+
+Here is an example to create a table using the Kafka connector and Protobuf
format.
+
+Below is the proto definition file.
+
+```
+syntax = "proto2";
+package com.example;
+option java_package = "com.example";
+option java_multiple_files = true;
+
+message SimpleTest {
+ optional int64 uid = 1;
+ optional string name = 2;
+ optional int32 category_type = 3;
+ optional bytes content = 4;
+ optional double price = 5;
+ map<int64, InnerMessageTest> value_map = 6;
+ repeated InnerMessageTest value_arr = 7;
+ optional Corpus corpus_int = 8;
+ optional Corpus corpus_str = 9;
+
+ message InnerMessageTest{
+ optional int64 v1 =1;
+ optional int32 v2 =2;
+ }
+
+ enum Corpus {
+ UNIVERSAL = 0;
+ WEB = 1;
+ IMAGES = 2;
+ LOCAL = 3;
+ NEWS = 4;
+ PRODUCTS = 5;
+ VIDEO = 7;
+ }
+}
+```
+
+Use `protoc` command to generate protobuf java sources and put the sources in
your runtime classpath.
Review Comment:
```suggestion
1. Use
[`protoc`](https://developers.google.com/protocol-buffers/docs/javatutorial#compiling-your-protocol-buffers)
command to compile the `.proto` file to java classes
2. Then compile and package the classes
3. Finally you should provide the `jar` in your classpath, e.g. pass it
using `-j` in <a href="{{< ref "docs/dev/table/sqlClient" >}}">sql-client</a>
```
--
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]