xtern commented on code in PR #6191: URL: https://github.com/apache/ignite-3/pull/6191#discussion_r2191576486
########## modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientSql.java: ########## @@ -295,12 +312,39 @@ public <T> CompletableFuture<AsyncResultSet<T>> executeAsync( }; PayloadReader<AsyncResultSet<T>> payloadReader = r -> { - ClientAsyncResultSet<T> rs = new ClientAsyncResultSet<>(r.clientChannel(), marshallers, r.in(), mapper); + boolean tryUnpackPaMeta = partitionAwarenessEnabled + && r.clientChannel().protocolContext().isFeatureSupported(SQL_PARTITION_AWARENESS); + + ClientAsyncResultSet<T> rs = new ClientAsyncResultSet<>( + r.clientChannel(), marshallers, r.in(), mapper, tryUnpackPaMeta + ); ClientPartitionAwarenessMetadata partitionAwarenessMetadata = rs.partitionAwarenessMetadata(); - if (partitionAwarenessMetadata != null) { - cache.put(new PaCacheKey(statement.defaultSchema(), statement.query()), partitionAwarenessMetadata); + if (partitionAwarenessEnabled && partitionAwarenessMetadata != null) { + int tableId = partitionAwarenessMetadata.tableId(); + + // The table being created is fake and used only to reuse code to derive table's schema and partition assignment. + // Yet the name of the table may appear in error messages and/or logs, therefore let's put some meaning + // in the fake name. + QualifiedName tableName = QualifiedNameHelper.fromNormalized("DUMMY", String.valueOf(tableId)); + + ClientTable table = tableCache.get(tableId, id -> new ClientTable( Review Comment: why do we need a separate cache? -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org