flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suez1224 <...@git.apache.org>
Subject [GitHub] flink pull request #5758: [FLINK-9059][Table API & SQL] add table type attri...
Date Fri, 30 Mar 2018 07:17:14 GMT
Github user suez1224 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5758#discussion_r178244473
  
    --- Diff: flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/config/Environment.java
---
    @@ -29,38 +30,47 @@
     
     /**
      * Environment configuration that represents the content of an environment file. Environment
files
    - * define sources, execution, and deployment behavior. An environment might be defined
by default or
    + * define tables, execution, and deployment behavior. An environment might be defined
by default or
      * as part of a session. Environments can be merged or enriched with properties (e.g.
from CLI command).
      *
      * <p>In future versions, we might restrict the merging or enrichment of deployment
properties to not
      * allow overwriting of a deployment by a session.
      */
     public class Environment {
     
    -	private Map<String, Source> sources;
    +	private Map<String, TableDescriptor> tables;
     
     	private Execution execution;
     
     	private Deployment deployment;
     
     	public Environment() {
    -		this.sources = Collections.emptyMap();
    +		this.tables = Collections.emptyMap();
     		this.execution = new Execution();
     		this.deployment = new Deployment();
     	}
     
    -	public Map<String, Source> getSources() {
    -		return sources;
    +	public Map<String, TableDescriptor> getTables() {
    +		return tables;
     	}
     
    -	public void setSources(List<Map<String, Object>> sources) {
    -		this.sources = new HashMap<>(sources.size());
    -		sources.forEach(config -> {
    -			final Source s = Source.create(config);
    -			if (this.sources.containsKey(s.getName())) {
    -				throw new SqlClientException("Duplicate source name '" + s + "'.");
    +	public void setTables(List<Map<String, Object>> tables) {
    +		this.tables = new HashMap<>(tables.size());
    +		tables.forEach(config -> {
    +			if (!config.containsKey(TableDescriptor.TABLE_TYPE())) {
    +				throw new SqlClientException("The 'type' attribute of a table is missing.");
    --- End diff --
    
    Yes, the values can be (source, sink and both), please see https://issues.apache.org/jira/browse/FLINK-8866.


---

Mime
View raw message