gortiz commented on code in PR #12591: URL: https://github.com/apache/pinot/pull/12591#discussion_r1521945915
########## pinot-query-planner/src/main/java/org/apache/pinot/query/catalog/PinotCatalog.java: ########## @@ -44,14 +50,46 @@ */ public class PinotCatalog implements Schema { + public static final String DEFAULT_DB_NAME = "default"; + private final TableCache _tableCache; + private final Map<String, CalciteSchema> _subCatalog; + + private final String _databaseName; + /** * PinotCatalog needs have access to the actual {@link TableCache} object because TableCache hosts the actual * table available for query and processes table/segment metadata updates when cluster status changes. */ public PinotCatalog(TableCache tableCache) { _tableCache = tableCache; + _databaseName = null; + // create all databases + // TODO: we need to monitor table cache changes to register newly created databases + // TODO: we also need to monitor table that needs to be put into the right places + _subCatalog = constructSubCatalogs(_tableCache); + } + + private PinotCatalog(String databaseName, TableCache tableCache) { + _tableCache = tableCache; + _databaseName = databaseName; + _subCatalog = null; + } + + private Map<String, CalciteSchema> constructSubCatalogs(TableCache tableCache) { + Map<String, CalciteSchema> subCatalog = new HashMap<>(); + for (String physicalTableName : tableCache.getTableNameMap().keySet()) { + String[] nameSplit = StringUtils.split(physicalTableName, '.'); Review Comment: Are we sure this is backward compatible? Could older tables contain a `.` in their name? -- 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