You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "vadimkolodingg (via GitHub)" <gi...@apache.org> on 2026/02/05 13:36:02 UTC

[PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

vadimkolodingg opened a new pull request, #7536:
URL: https://github.com/apache/ignite-3/pull/7536

   https://issues.apache.org/jira/browse/IGNITE-27753
   
   ---
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "vadimkolodingg (via GitHub)" <gi...@apache.org>.
vadimkolodingg commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2803860868


##########
modules/catalog-dsl/src/main/java/org/apache/ignite/internal/catalog/sql/CreateFromAnnotationsImpl.java:
##########
@@ -230,4 +231,17 @@ private static void processColumnsInPojo(CreateTableImpl createTable, Class<?> c
         }
     }
 
+    /**

Review Comment:
   It is, but MapperBuilder is in api module, and I don't want to introduce new public util method to api. So I left it as private but duplicated.



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "Pochatkin (via GitHub)" <gi...@apache.org>.
Pochatkin commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2803767704


##########
modules/catalog-dsl/src/main/java/org/apache/ignite/internal/catalog/sql/CreateFromAnnotationsImpl.java:
##########
@@ -230,4 +231,17 @@ private static void processColumnsInPojo(CreateTableImpl createTable, Class<?> c
         }
     }
 
+    /**

Review Comment:
   Is it duplicate from MapperBuilder? Can we avoid it?



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "nva (via GitHub)" <gi...@apache.org>.
nva commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2815915492


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/FieldAccessor.java:
##########
@@ -135,6 +135,23 @@ static FieldAccessor create(
         }
     }
 
+    /**
+     * Gets an accessible field by name of the given class and its parents (if any).
+     */
+    private static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException {
+        var current = clazz;
+        while (current != null) {
+            try {
+                return current.getDeclaredField(fieldName);

Review Comment:
   It will call `getDeclaredField` on `Object.class` before throwing a 'NoSuchFieldException'.



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/FieldAccessor.java:
##########
@@ -135,6 +135,23 @@ static FieldAccessor create(
         }
     }
 
+    /**
+     * Gets an accessible field by name of the given class and its parents (if any).
+     */
+    private static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException {
+        var current = clazz;
+        while (current != null) {
+            try {
+                return current.getDeclaredField(fieldName);
+            } catch (NoSuchFieldException ignored) {
+                // ignore
+            }
+
+            current = current.getSuperclass();
+        }
+        throw new NoSuchFieldException(fieldName);

Review Comment:
   Does it make sense to add a class name to an exception?



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "nva (via GitHub)" <gi...@apache.org>.
nva commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2815722253


##########
modules/api/src/main/java/org/apache/ignite/table/mapper/MapperBuilder.java:
##########
@@ -300,4 +302,17 @@ private static SimpleEntry<String, String> getColumnToFieldMapping(Field fld) {
         var columnName = column != null && !column.value().isEmpty() ? column.value() : fldName;
         return new SimpleEntry<>(parseIdentifier(columnName), fldName);
     }
+
+    /**
+     * Gets all fields of the given class and its parents (if any).
+     */
+    private static List<Field> getAllFields(Class<?> clazz) {
+        var result = new ArrayList<Field>();
+        var current = clazz;
+        while (current != null) {
+            Collections.addAll(result, current.getDeclaredFields());
+            current = current.getSuperclass();
+        }

Review Comment:
   Every class inherits Object. It doesn't make sense to call `Object.class.getDeclaredFields()`, it returns nothing.



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "Pochatkin (via GitHub)" <gi...@apache.org>.
Pochatkin merged PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536


-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "vadimkolodingg (via GitHub)" <gi...@apache.org>.
vadimkolodingg commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2815634196


##########
modules/api/src/main/java/org/apache/ignite/table/mapper/MapperBuilder.java:
##########
@@ -300,4 +302,17 @@ private static SimpleEntry<String, String> getColumnToFieldMapping(Field fld) {
         var columnName = column != null && !column.value().isEmpty() ? column.value() : fldName;
         return new SimpleEntry<>(parseIdentifier(columnName), fldName);
     }
+
+    /**
+     * Gets all fields of the given class and its parents (if any).
+     */
+    private static List<Field> getAllFields(Class<?> clazz) {
+        var result = new ArrayList<Field>();
+        var current = clazz;
+        while (current != null) {
+            Collections.addAll(result, current.getDeclaredFields());
+            current = current.getSuperclass();
+        }

Review Comment:
   In this case while loop seems fine. What's wrong with Object and why it should be excluded?



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "vadimkolodingg (via GitHub)" <gi...@apache.org>.
vadimkolodingg commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2815995100


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/FieldAccessor.java:
##########
@@ -135,6 +135,23 @@ static FieldAccessor create(
         }
     }
 
+    /**
+     * Gets an accessible field by name of the given class and its parents (if any).
+     */
+    private static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException {
+        var current = clazz;
+        while (current != null) {
+            try {
+                return current.getDeclaredField(fieldName);

Review Comment:
   done



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/FieldAccessor.java:
##########
@@ -135,6 +135,23 @@ static FieldAccessor create(
         }
     }
 
+    /**
+     * Gets an accessible field by name of the given class and its parents (if any).
+     */
+    private static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException {
+        var current = clazz;
+        while (current != null) {
+            try {
+                return current.getDeclaredField(fieldName);
+            } catch (NoSuchFieldException ignored) {
+                // ignore
+            }
+
+            current = current.getSuperclass();
+        }
+        throw new NoSuchFieldException(fieldName);

Review Comment:
   done



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "vadimkolodingg (via GitHub)" <gi...@apache.org>.
vadimkolodingg commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2803860868


##########
modules/catalog-dsl/src/main/java/org/apache/ignite/internal/catalog/sql/CreateFromAnnotationsImpl.java:
##########
@@ -230,4 +231,17 @@ private static void processColumnsInPojo(CreateTableImpl createTable, Class<?> c
         }
     }
 
+    /**

Review Comment:
   It is, but MapperBuilder is in api module, and I don't want to introduce new public util method to api. So, I left it as private but duplicated in api and dsl modules.



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "nva (via GitHub)" <gi...@apache.org>.
nva commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2814825248


##########
modules/api/src/main/java/org/apache/ignite/table/mapper/MapperBuilder.java:
##########
@@ -300,4 +302,17 @@ private static SimpleEntry<String, String> getColumnToFieldMapping(Field fld) {
         var columnName = column != null && !column.value().isEmpty() ? column.value() : fldName;
         return new SimpleEntry<>(parseIdentifier(columnName), fldName);
     }
+
+    /**
+     * Gets all fields of the given class and its parents (if any).
+     */
+    private static List<Field> getAllFields(Class<?> clazz) {
+        var result = new ArrayList<Field>();
+        var current = clazz;
+        while (current != null) {
+            Collections.addAll(result, current.getDeclaredFields());
+            current = current.getSuperclass();
+        }

Review Comment:
   This expression can be simplified. In your loop, current can be equal to Object.
   ```suggestion
           for (Class<?> current = clazz; current != Object.class; current = c.getSuperclass()) {
               Collections.addAll(result, current.getDeclaredFields());
           }
   ```



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27753 IgniteCatalog DSL class inheritance mapping [ignite-3]

Posted by "vadimkolodingg (via GitHub)" <gi...@apache.org>.
vadimkolodingg commented on code in PR #7536:
URL: https://github.com/apache/ignite-3/pull/7536#discussion_r2815824230


##########
modules/api/src/main/java/org/apache/ignite/table/mapper/MapperBuilder.java:
##########
@@ -300,4 +302,17 @@ private static SimpleEntry<String, String> getColumnToFieldMapping(Field fld) {
         var columnName = column != null && !column.value().isEmpty() ? column.value() : fldName;
         return new SimpleEntry<>(parseIdentifier(columnName), fldName);
     }
+
+    /**
+     * Gets all fields of the given class and its parents (if any).
+     */
+    private static List<Field> getAllFields(Class<?> clazz) {
+        var result = new ArrayList<Field>();
+        var current = clazz;
+        while (current != null) {
+            Collections.addAll(result, current.getDeclaredFields());
+            current = current.getSuperclass();
+        }

Review Comment:
   done



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org