shounakmk219 commented on code in PR #12591: URL: https://github.com/apache/pinot/pull/12591#discussion_r1525806218
########## 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: There used to be a feature flag to allow only 1 dot in table names, and if that was not enabled pinot didn’t allow dot in table names. The feature flag was recently [removed](https://github.com/apache/pinot/pull/12402) and allowing 1 dot was made the general behaviour in favour of supporting database in pinot. That said any earlier table name with a dot will implicitly fall under the database that is prefixed by the dot. -- 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