lowka commented on code in PR #1623:
URL: https://github.com/apache/ignite-3/pull/1623#discussion_r1105625352


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeFactory.java:
##########
@@ -376,6 +498,49 @@ private boolean allEquals(List<RelDataType> types) {
         return true;
     }
 
+    private static final class CustomDataTypes {
+
+        /**
+         * Contains java types used registered custom data types.
+         * We need those to throw errors to reject attempts to create custom 
data types via
+         * {@link IgniteTypeFactory#createType(Type)}/{@link 
IgniteTypeFactory#createJavaType(Class)}
+         * methods of {@link IgniteTypeFactory}.
+         */
+        private final Set<Type> javaTypes;
+
+        /**
+         * Stores functions that are being used by {@link 
#createCustomType(String, int)} to create type instances.
+         */
+        private final Map<String, MakeCustomType> typeConstructors;
+
+        CustomDataTypes(Set<NewCustomType> customDataTypes) {
+            this.javaTypes = customDataTypes.stream()
+                    .map(t -> t.storageType)
+                    .collect(Collectors.toSet());
+
+            this.typeConstructors = 
customDataTypes.stream().collect(Collectors.toMap((v) -> v.typeName, (v) -> 
v.makeType));
+        }
+    }
+
+    private static final class NewCustomType {
+        final String typeName;
+
+        final Class<?> storageType;
+
+        final MakeCustomType makeType;
+
+        NewCustomType(String typeName, Class<?> storageType, MakeCustomType 
makeType) {
+            this.typeName = typeName;
+            this.storageType = storageType;
+            this.makeType = makeType;
+        }
+    }
+
+    @FunctionalInterface
+    interface MakeCustomType {

Review Comment:
   Fixed



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