This repository has been archived by the owner on Dec 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jianyun Zhao
authored
Mar 19, 2021
1 parent
5696e81
commit 9c44d53
Showing
73 changed files
with
4,816 additions
and
325 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.streamnative.connectors</groupId> | ||
<artifactId>pulsar-flink-parent</artifactId> | ||
<version>2.7.6-SNAPSHOT</version> | ||
<!-- <relativePath>..</relativePath>--> | ||
</parent> | ||
|
||
<artifactId>flink-protobuf</artifactId> | ||
<name>Flink : Formats : Protobuf</name> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<janino.version>3.0.11</janino.version> | ||
<protoc.version>3.11.1</protoc.version> | ||
<flink.version>1.12.1</flink.version> | ||
<checkstyle.skip>true</checkstyle.skip> | ||
<license.skip>true</license.skip> | ||
<spotbugs.skip>true</spotbugs.skip> | ||
<shade.skip>true</shade.skip> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- core dependencies --> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-core</artifactId> | ||
<version>${flink.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-table-common</artifactId> | ||
<version>${flink.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>${protoc.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.codehaus.janino</groupId> | ||
<artifactId>janino</artifactId> | ||
<!-- this should be the same version of flink-table module --> | ||
<version>${janino.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId> | ||
<version>${flink.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-clients_${scala.binary.version}</artifactId> | ||
<version>${flink.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.github.os72</groupId> | ||
<artifactId>protoc-jar-maven-plugin</artifactId> | ||
<version>${protoc.version}</version> | ||
<executions> | ||
<execution> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<protocVersion>${protoc.version}</protocVersion> | ||
<inputDirectories> | ||
<include>src/test/proto</include> | ||
</inputDirectories> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
57 changes: 57 additions & 0 deletions
57
flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/PbCodegenAppender.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.flink.formats.protobuf; | ||
|
||
public class PbCodegenAppender { | ||
private StringBuilder sb; | ||
|
||
public PbCodegenAppender() { | ||
sb = new StringBuilder(); | ||
} | ||
|
||
public void appendLine(String code) { | ||
sb.append(code + ";\n"); | ||
} | ||
|
||
public void appendSegment(String code) { | ||
sb.append(code + "\n"); | ||
} | ||
|
||
public String code() { | ||
return sb.toString(); | ||
} | ||
|
||
public static String printWithLineNumber(String code) { | ||
StringBuilder sb = new StringBuilder(); | ||
String[] lines = code.split("\n"); | ||
for (int i = 0; i < lines.length; i++) { | ||
sb.append("Line " + (i + 1) + ": " + lines[i] + "\n"); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
public String printWithLineNumber() { | ||
StringBuilder newSb = new StringBuilder(); | ||
String[] lines = sb.toString().split("\n"); | ||
for (int i = 0; i < lines.length; i++) { | ||
newSb.append("Line " + (i + 1) + ": " + lines[i] + "\n"); | ||
} | ||
return newSb.toString(); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/PbCodegenException.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.flink.formats.protobuf; | ||
|
||
public class PbCodegenException extends Exception { | ||
public PbCodegenException() {} | ||
|
||
public PbCodegenException(String message) { | ||
super(message); | ||
} | ||
|
||
public PbCodegenException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public PbCodegenException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public PbCodegenException( | ||
String message, | ||
Throwable cause, | ||
boolean enableSuppression, | ||
boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
} |
Oops, something went wrong.