[ https://issues.apache.org/jira/browse/FLINK-9737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16659498#comment-16659498 ]
ASF GitHub Bot commented on FLINK-9737: --------------------------------------- dawidwys commented on a change in pull request #6897: [FLINK-9737] [FLINK-8880] [sql-client] Support defining temporal tables in environment files URL: https://github.com/apache/flink/pull/6897#discussion_r227005801 ########## File path: flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/config/entries/TableEntry.java ########## @@ -0,0 +1,109 @@ +/* + * 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.entries; + +import org.apache.flink.table.client.SqlClientException; +import org.apache.flink.table.client.config.ConfigUtil; +import org.apache.flink.table.descriptors.DescriptorProperties; + +import java.util.Arrays; +import java.util.Map; + +/** + * Describes a table-like configuration entry. + */ +public abstract class TableEntry extends ConfigEntry { + + public static final String TABLES_NAME = "name"; + + private static final String TABLES_TYPE = "type"; + + @Deprecated + private static final String TABLES_TYPE_VALUE_SOURCE = "source"; + + @Deprecated + private static final String TABLES_TYPE_VALUE_SINK = "sink"; + + @Deprecated + private static final String TABLES_TYPE_VALUE_BOTH = "both"; + + private static final String TABLES_TYPE_VALUE_SOURCE_TABLE = "source-table"; + + private static final String TABLES_TYPE_VALUE_SINK_TABLE = "sink-table"; + + private static final String TABLES_TYPE_VALUE_SOURCE_SINK_TABLE = "source-sink-table"; + + private static final String TABLES_TYPE_VALUE_VIEW = "view"; + + private static final String TABLES_TYPE_VALUE_TEMPORAL_TABLE = "temporal-table"; + + private final String name; + + protected TableEntry(String name, DescriptorProperties properties) { + super(properties); + this.name = name; + } + + public String getName() { + return name; + } + + public static TableEntry create(Map<String, Object> config) { + return create(ConfigUtil.normalizeYaml(config)); + } + + private static TableEntry create(DescriptorProperties properties) { + properties.validateString(TABLES_NAME, false, 1); + properties.validateEnumValues( + TABLES_TYPE, + false, + Arrays.asList( + TABLES_TYPE_VALUE_SOURCE, + TABLES_TYPE_VALUE_SOURCE_TABLE, + TABLES_TYPE_VALUE_SINK, + TABLES_TYPE_VALUE_SINK_TABLE, + TABLES_TYPE_VALUE_BOTH, + TABLES_TYPE_VALUE_SOURCE_SINK_TABLE, + TABLES_TYPE_VALUE_VIEW, + TABLES_TYPE_VALUE_TEMPORAL_TABLE)); + + final String name = properties.getString(TABLES_NAME); + + final DescriptorProperties cleanedProperties = + properties.removeKeys(Arrays.asList(TABLES_NAME, TABLES_TYPE)); Review comment: How about rename the `removeKeys` method to e.g. `withoutKeys`? This is one of few methods (the only one?) that does not mutate the internal state. I think this should be somehow more obvious from the name itself. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Allow to define Table Version Functions from SQL environment file > ----------------------------------------------------------------- > > Key: FLINK-9737 > URL: https://issues.apache.org/jira/browse/FLINK-9737 > Project: Flink > Issue Type: Sub-task > Components: Table API & SQL > Affects Versions: 1.5.0 > Reporter: Piotr Nowojski > Assignee: Timo Walther > Priority: Major > Labels: pull-request-available > > It should be possible to define TVF from SQL environment file. -- This message was sent by Atlassian JIRA (v7.6.3#76005)