-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][Engine] Add flink engine (#487)
- Loading branch information
Showing
73 changed files
with
3,729 additions
and
649 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
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
14 changes: 14 additions & 0 deletions
14
datavines-engine/datavines-engine-plugins/datavines-engine-flink/HEADER
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,14 @@ | ||
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. |
59 changes: 59 additions & 0 deletions
59
...engine/datavines-engine-plugins/datavines-engine-flink/datavines-engine-flink-api/pom.xml
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,59 @@ | ||
<?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/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>datavines-engine-flink</artifactId> | ||
<groupId>io.datavines</groupId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>datavines-engine-flink-api</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.datavines</groupId> | ||
<artifactId>datavines-engine-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.datavines</groupId> | ||
<artifactId>datavines-common</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId> | ||
<version>${flink.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId> | ||
<version>${flink.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
89 changes: 89 additions & 0 deletions
89
...engine-flink-api/src/main/java/io/datavines/engine/flink/api/FlinkRuntimeEnvironment.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,89 @@ | ||
/* | ||
* 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 io.datavines.engine.flink.api; | ||
|
||
import io.datavines.common.config.CheckResult; | ||
import io.datavines.common.config.Config; | ||
import io.datavines.common.exception.DataVinesException; | ||
import io.datavines.engine.api.env.Execution; | ||
import io.datavines.engine.api.env.RuntimeEnvironment; | ||
import io.datavines.engine.flink.api.stream.FlinkStreamExecution; | ||
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; | ||
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment; | ||
|
||
public class FlinkRuntimeEnvironment implements RuntimeEnvironment { | ||
|
||
private StreamExecutionEnvironment env; | ||
private StreamTableEnvironment tableEnv; | ||
private Config config; | ||
private FlinkStreamExecution execution; | ||
|
||
public FlinkRuntimeEnvironment() { | ||
this.config = new Config(); | ||
this.execution = new FlinkStreamExecution(this); | ||
} | ||
|
||
public void setConfig(Config config) { | ||
if (config != null) { | ||
this.config = config; | ||
} | ||
} | ||
|
||
public Config getConfig() { | ||
return config; | ||
} | ||
|
||
public CheckResult checkConfig() { | ||
return new CheckResult(true, "Configuration check passed"); | ||
} | ||
|
||
public Execution getExecution() { | ||
return execution; | ||
} | ||
|
||
public void prepare() { | ||
try { | ||
env = StreamExecutionEnvironment.getExecutionEnvironment(); | ||
tableEnv = StreamTableEnvironment.create(env); | ||
} catch (Exception e) { | ||
throw new DataVinesException("Failed to prepare Flink environment", e); | ||
} | ||
} | ||
|
||
public void stop() { | ||
try { | ||
if (env != null) { | ||
// Flink's environment doesn't have a direct cancel method, | ||
// we need to handle job cancellation through JobClient | ||
} | ||
} catch (Exception e) { | ||
throw new DataVinesException("Failed to stop Flink environment", e); | ||
} | ||
} | ||
|
||
public String getType() { | ||
return "flink"; | ||
} | ||
|
||
public StreamExecutionEnvironment getEnv() { | ||
return env; | ||
} | ||
|
||
public StreamTableEnvironment getTableEnv() { | ||
return tableEnv; | ||
} | ||
} |
Oops, something went wrong.