LadyForest commented on code in PR #337: URL: https://github.com/apache/flink-table-store/pull/337#discussion_r1006498869
########## flink-table-store-core/src/main/java/org/apache/flink/table/store/table/metadata/OptionsTable.java: ########## @@ -0,0 +1,182 @@ +/* + * 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.store.table.metadata; + +import org.apache.flink.core.fs.Path; +import org.apache.flink.table.data.GenericRowData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.store.file.predicate.Predicate; +import org.apache.flink.table.store.file.schema.SchemaManager; +import org.apache.flink.table.store.file.schema.TableSchema; +import org.apache.flink.table.store.file.utils.IteratorRecordReader; +import org.apache.flink.table.store.file.utils.RecordReader; +import org.apache.flink.table.store.file.utils.SnapshotManager; +import org.apache.flink.table.store.table.Table; +import org.apache.flink.table.store.table.source.Split; +import org.apache.flink.table.store.table.source.TableRead; +import org.apache.flink.table.store.table.source.TableScan; +import org.apache.flink.table.store.utils.ProjectedRowData; +import org.apache.flink.table.types.logical.RowType; + +import org.apache.flink.shaded.guava30.com.google.common.collect.Iterators; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.Map; +import java.util.Objects; + +import static org.apache.flink.table.store.file.catalog.Catalog.METADATA_TABLE_SPLITTER; +import static org.apache.flink.table.store.file.utils.SerializationUtils.newStringType; + +/** A {@link Table} for showing options of table. */ +public class OptionsTable implements Table { + + private static final long serialVersionUID = 1L; + + public static final String OPTIONS = "options"; + + public static final RowType TABLE_TYPE = + new RowType( + Arrays.asList( + new RowType.RowField("key", newStringType(false)), + new RowType.RowField("value", newStringType(false)))); + + private final Path location; + + public OptionsTable(Path location) { + this.location = location; + } + + @Override + public String name() { + return location.getName() + METADATA_TABLE_SPLITTER + OPTIONS; + } + + @Override + public RowType rowType() { + return TABLE_TYPE; + } + + @Override + public TableScan newScan() { + return new OptionsScan(); + } + + @Override + public TableRead newRead() { + return new OptionsRead(); + } + + private class OptionsScan implements TableScan { + + @Override + public TableScan withFilter(Predicate predicate) { Review Comment: add a TODO? -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
