forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-8866] [table] Create unified interfaces to configure and insta…
…tiate TableSinks This closes apache#6201.
- Loading branch information
Showing
70 changed files
with
1,560 additions
and
457 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
53 changes: 53 additions & 0 deletions
53
...k-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/config/Sink.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,53 @@ | ||
/* | ||
* 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.table.client.config; | ||
|
||
import org.apache.flink.table.descriptors.DescriptorProperties; | ||
import org.apache.flink.table.descriptors.TableSinkDescriptor; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Configuration of a table sink. | ||
*/ | ||
public class Sink extends TableSinkDescriptor { | ||
|
||
private String name; | ||
private Map<String, String> properties; | ||
|
||
protected Sink(String name, Map<String, String> properties) { | ||
this.name = name; | ||
this.properties = properties; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Map<String, String> getProperties() { | ||
return properties; | ||
} | ||
|
||
// -------------------------------------------------------------------------------------------- | ||
|
||
@Override | ||
public void addProperties(DescriptorProperties properties) { | ||
this.properties.forEach(properties::putString); | ||
} | ||
} |
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
65 changes: 65 additions & 0 deletions
65
...aries/flink-sql-client/src/main/java/org/apache/flink/table/client/config/SourceSink.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,65 @@ | ||
/* | ||
* 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.table.client.config; | ||
|
||
import org.apache.flink.table.descriptors.DescriptorProperties; | ||
import org.apache.flink.table.descriptors.TableDescriptor; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Common class for all descriptors describing a table source and sink together. | ||
*/ | ||
public class SourceSink extends TableDescriptor { | ||
|
||
private String name; | ||
private Map<String, String> properties; | ||
|
||
protected SourceSink(String name, Map<String, String> properties) { | ||
this.name = name; | ||
this.properties = properties; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Map<String, String> getProperties() { | ||
return properties; | ||
} | ||
|
||
@Override | ||
public void addProperties(DescriptorProperties properties) { | ||
this.properties.forEach(properties::putString); | ||
} | ||
|
||
public Source toSource() { | ||
final Map<String, String> newProperties = new HashMap<>(properties); | ||
newProperties.replace(TableDescriptorValidator.TABLE_TYPE(), | ||
TableDescriptorValidator.TABLE_TYPE_VALUE_SOURCE()); | ||
return new Source(name, newProperties); | ||
} | ||
|
||
public Sink toSink() { | ||
final Map<String, String> newProperties = new HashMap<>(properties); | ||
newProperties.replace(TableDescriptorValidator.TABLE_TYPE(), | ||
TableDescriptorValidator.TABLE_TYPE_VALUE_SINK()); | ||
return new Sink(name, newProperties); | ||
} | ||
} |
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
Oops, something went wrong.