sunjincheng121 commented on a change in pull request #8007: [FLINK-11474][table] Add ReadableCatalog, ReadableWritableCatalog, and other … URL: https://github.com/apache/flink/pull/8007#discussion_r271991296
########## File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/GenericCatalogView.java ########## @@ -0,0 +1,85 @@ +/* + * 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.catalog; + +import org.apache.flink.table.api.TableSchema; + +import java.util.Map; + +/** + * A generic catalog view implementation. + */ +public class GenericCatalogView implements CatalogView { + // Original text of the view definition. + private final String originalQuery; + + // Expanded text of the original view definition + // This is needed because the context such as current DB is + // lost after the session, in which view is defined, is gone. + // Expanded query text takes care of the this, as an example. + private final String expandedQuery; + + private TableSchema schema; + private Map<String, String> properties; + private String comment; + + public GenericCatalogView(String originalQuery, String expandedQuery, TableSchema schema, + Map<String, String> properties, String comment) { + this.originalQuery = originalQuery; + this.expandedQuery = expandedQuery; + this.schema = schema; + this.properties = properties; + this.comment = comment; + } + + @Override + public String getOriginalQuery() { + return this.originalQuery; + } + + @Override + public String getExpandedQuery() { + return this.expandedQuery; + } + + @Override + public Map<String, String> getProperties() { + return properties; + } + + @Override + public TableSchema getSchema() { + return schema; + } + + @Override + public GenericCatalogView copy() { + return new GenericCatalogView(this.originalQuery, this.expandedQuery, schema, Review comment: I think we should perform a deep copy. What do you think? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to 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 With regards, Apache Git Services