xtern commented on code in PR #2719:
URL: https://github.com/apache/ignite-3/pull/2719#discussion_r1368525483


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java:
##########
@@ -98,7 +99,63 @@ public CompletableFuture<Void> schemaReadyFuture(int 
version) {
         return catalogManager.catalogReadyFuture(version);
     }
 
-    private static SchemaPlus createSqlSchema(int catalogVersion, 
CatalogSchemaDescriptor schemaDescriptor) {
+    @Override
+    public IgniteTable table(int schemaVersion, int tableId) {
+        return tableCache.get(tableCacheKey(schemaVersion, tableId), key -> {
+            SchemaPlus rootSchema = schemaCache.get(schemaVersion);
+
+            if (rootSchema != null) {
+                for (String name : rootSchema.getSubSchemaNames()) {
+                    SchemaPlus subSchema = rootSchema.getSubSchema(name);
+
+                    assert subSchema != null : name;
+
+                    IgniteSchema schema = subSchema.unwrap(IgniteSchema.class);
+
+                    assert schema != null : "unknown schema " + subSchema;
+
+                    IgniteTable table = schema.getTable(tableId);
+
+                    if (table != null) {

Review Comment:
   It seems PlanningContext#schema should be fixed also to return the schema 
that is set in the session.



-- 
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]

Reply via email to