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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -717,4 +724,59 @@ private CompletableFuture<Void> closeExecNode(boolean 
cancel) {
     interface ImplementorFactory<RowT> {
         LogicalRelImplementor<RowT> create(ExecutionContext<RowT> ctx);
     }
+
+    private static class ColocationServiceImpl<T> implements 
ColocationHashFunctionFactory<T> {
+        private final SqlSchemaManager sqlSchemaManager;
+        private final RowHandler<T> rowHandler;
+
+        private ColocationServiceImpl(SqlSchemaManager sqlSchemaManager, 
RowHandler<T> rowHandler) {
+            this.sqlSchemaManager = sqlSchemaManager;
+            this.rowHandler = rowHandler;
+        }
+
+        @Override
+        public ColocationHashFunction<T> create(UUID tableId, int[] 
colocationFields) {
+            return new ColocationHashFunctionImpl(tableId, colocationFields);
+        }
+
+        private class ColocationHashFunctionImpl implements 
ColocationHashFunction<T> {
+            private final int[] colocationFields;
+            private final NativeType[] colTypes;
+
+            private ColocationHashFunctionImpl(UUID tableId, int[] 
colocationFields) {
+                this.colTypes = colocationColumnTypes(tableId, 
colocationFields.length);
+                this.colocationFields = colocationFields;
+            }
+
+            private NativeType[] colocationColumnTypes(UUID tableId, int 
fieldCnt) {
+                NativeType[] colTypes = new NativeType[fieldCnt];
+                TableDescriptor tblDesc = sqlSchemaManager.tableById(tableId, 
-1).descriptor();
+
+                List<Integer> colocationColumns = tblDesc.colocationColumns();
+
+                assert colocationColumns.size() >= fieldCnt : "fieldsCount=" + 
fieldCnt + ", colocationColumns=" + colocationColumns;

Review Comment:
   Fixed, thanks



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