You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "lowka (via GitHub)" <gi...@apache.org> on 2024/03/22 11:35:15 UTC

[PR] IGNITE-21797: Column's type mismatch during marshalling of pojo (embe… [ignite-3]

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

   …dded API)
   
   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-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {

Review Comment:
   do we really need this constructor?



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {
+        this.schemaIndex = -1;
+        this.name = name;
+        this.type = type;
+        this.defValSup = defValSup == null ? NULL_SUPPLIER : defValSup;
+        this.scale = scale;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param name      Column name.
+     * @param type      An instance of column data type.
+     * @param defValSup Default value supplier.

Review Comment:
   not all fields are covered by javadoc



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/Marshaller.java:
##########
@@ -267,13 +306,36 @@ public Object readObject(MarshallerReader reader, Object target) throws Marshall
             return obj;
         }
 
+        /** {@inheritDoc} */
+        @Override
+        public Object readValue(MarshallerReader reader, Object target) throws MarshallerException {

Review Comment:
   not sure I fully understand the difference between `readObject` and `readValue`... 



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerReader.java:
##########
@@ -30,6 +30,18 @@
  * Binary reader.
  */
 public interface MarshallerReader {
+    /**
+     * Set reader's position to the given value.
+     */
+    void setIndex(int index);

Review Comment:
   if we want to extend MarshallerReader with ability to read arbitrary field, it's better to extend every `read` method with field index param rather that change its internal state every time.



-- 
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-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/KvMarshallerImpl.java:
##########
@@ -118,7 +129,7 @@ public K unmarshalKey(Row row) throws MarshallerException {
     @Nullable
     @Override
     public V unmarshalValue(Row row) throws MarshallerException {
-        Object o = valMarsh.readObject(new RowReader(row, schema.keyColumns().size()), null);
+        Object o = valMarsh.readObject(new RowReader(row, valPositions), null);

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

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


Re: [PR] IGNITE-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {

Review Comment:
   Remove this CTOR, marked another constructor (which does not provide all the fields) as TestOnly.



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {

Review Comment:
   Removed this CTOR, marked another constructor (which does not provide all the fields) as TestOnly.



-- 
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-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/Marshaller.java:
##########
@@ -267,13 +306,36 @@ public Object readObject(MarshallerReader reader, Object target) throws Marshall
             return obj;
         }
 
+        /** {@inheritDoc} */
+        @Override
+        public Object readValue(MarshallerReader reader, Object target) throws MarshallerException {

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

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


Re: [PR] IGNITE-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {
+        this.schemaIndex = -1;
+        this.name = name;
+        this.type = type;
+        this.defValSup = defValSup == null ? NULL_SUPPLIER : defValSup;
+        this.scale = scale;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param name      Column name.
+     * @param type      An instance of column data type.
+     * @param defValSup Default value supplier.

Review Comment:
   Thanks 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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {
+        this.schemaIndex = -1;
+        this.name = name;
+        this.type = type;
+        this.defValSup = defValSup == null ? NULL_SUPPLIER : defValSup;
+        this.scale = scale;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param name      Column name.
+     * @param type      An instance of column data type.
+     * @param defValSup Default value supplier.

Review Comment:
   Fixed.



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerReader.java:
##########
@@ -30,6 +30,18 @@
  * Binary reader.
  */
 public interface MarshallerReader {
+    /**
+     * Set reader's position to the given value.
+     */
+    void setIndex(int index);

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-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


-- 
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-21797: Column's type mismatch during marshalling of pojo (embedded API) [ignite-3]

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


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/KvMarshallerImpl.java:
##########
@@ -118,7 +129,7 @@ public K unmarshalKey(Row row) throws MarshallerException {
     @Nullable
     @Override
     public V unmarshalValue(Row row) throws MarshallerException {
-        Object o = valMarsh.readObject(new RowReader(row, schema.keyColumns().size()), null);
+        Object o = valMarsh.readObject(new RowReader(row, valPositions), null);

Review Comment:
   i'm wondering why have not we done the same for `unmarshalKey`? I bet it lack of tests on putAll



##########
modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerColumn.java:
##########
@@ -68,12 +70,32 @@ public MarshallerColumn(String name, BinaryMode type) {
      * @param defValSup Default value supplier.
      */
     public MarshallerColumn(String name, BinaryMode type, @Nullable Supplier<Object> defValSup, int scale) {
+        this.schemaIndex = -1;
+        this.name = name;
+        this.type = type;
+        this.defValSup = defValSup == null ? NULL_SUPPLIER : defValSup;
+        this.scale = scale;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param name      Column name.
+     * @param type      An instance of column data type.
+     * @param defValSup Default value supplier.

Review Comment:
   nitpicking: and what about `scale`? :)



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