Jackie-Jiang commented on code in PR #15515: URL: https://github.com/apache/pinot/pull/15515#discussion_r2072247997
########## pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java: ########## @@ -216,15 +273,32 @@ public boolean registerTableConfigChangeListener(TableConfigChangeListener table } /** - * Returns the schema for the given table, or {@code null} if it does not exist. + * Returns the schema for the given logical or physical table, or {@code null} if it does not exist. */ @Nullable @Override public Schema getSchema(String rawTableName) { + if (isLogicalTable(rawTableName)) { Review Comment: To save overhead for more common case, can we first lookup `_schemaInfoMap` with `rawTableName`, then fallback to logical table indirect schema name ########## pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java: ########## @@ -204,6 +253,14 @@ public TableConfig getTableConfig(String tableNameWithType) { return tableConfigInfo != null ? tableConfigInfo._tableConfig : null; } + @Nullable + @Override + public LogicalTableConfig getLogicalTable(String logicalTableName) { Review Comment: (minor) ```suggestion public LogicalTableConfig getLogicalTableConfig(String logicalTableName) { ``` ########## pinot-spi/src/main/java/org/apache/pinot/spi/config/provider/LogicalTableChangeListener.java: ########## @@ -0,0 +1,31 @@ +/** + * 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.pinot.spi.config.provider; + +import java.util.List; +import org.apache.pinot.spi.data.LogicalTableConfig; + + +public interface LogicalTableChangeListener { Review Comment: (minor) ```suggestion public interface LogicalTableConfigChangeListener { ``` ########## pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java: ########## @@ -216,15 +273,32 @@ public boolean registerTableConfigChangeListener(TableConfigChangeListener table } /** - * Returns the schema for the given table, or {@code null} if it does not exist. + * Returns the schema for the given logical or physical table, or {@code null} if it does not exist. */ @Nullable @Override public Schema getSchema(String rawTableName) { + if (isLogicalTable(rawTableName)) { + return getLogicalTableSchema(rawTableName); + } else { + return getPhysicalTableSchema(rawTableName); + } + } + + private Schema getPhysicalTableSchema(String rawTableName) { SchemaInfo schemaInfo = _schemaInfoMap.get(rawTableName); return schemaInfo != null ? schemaInfo._schema : null; } + private Schema getLogicalTableSchema(String logicalTableName) { Review Comment: (minor) Annotate with `@Nullable` ########## pinot-spi/src/main/java/org/apache/pinot/spi/config/provider/PinotConfigProvider.java: ########## @@ -57,4 +58,19 @@ public interface PinotConfigProvider { * registered. */ boolean registerSchemaChangeListener(SchemaChangeListener schemaChangeListener); + + /** + * Returns the logical table for the given logical table name. + * @param logicalTableName the name of the logical table + * @return the logical table + */ + LogicalTableConfig getLogicalTable(String logicalTableName); Review Comment: (minor) Same for other places where config is returned ```suggestion LogicalTableConfig getLogicalTableConfig(String logicalTableName); ``` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org