You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "korlov42 (via GitHub)" <gi...@apache.org> on 2025/11/13 13:29:30 UTC

[PR] IGNITE-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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

   https://issues.apache.org/jira/browse/IGNITE-26705
   
   ------
   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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/RowHandler.java:
##########
@@ -63,7 +63,7 @@ default ByteBuffer toByteBuffer(RowT row) {
     String toString(RowT row);
 
     /** Creates a factory that produces rows with fields defined by the given schema. */
-    RowFactory<RowT> factory(RowSchema rowSchema);
+    RowFactory<RowT> factory(StructNativeType rowSchema);

Review Comment:
   Should we avoid using `schema` term? and maybe replace with `type`?
   rowSchema -> rowType ?



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeFactory.java:
##########
@@ -302,6 +320,14 @@ public static NativeType relDataTypeToNative(RelDataType relType) {
                         : NativeTypes.blobOf(relType.getPrecision());
             case UUID:
                 return NativeTypes.UUID;
+            case ROW:

Review Comment:
   actually, vast majority of the SQL tests touches this branch. It wasn't because I forgot to remove `if` branch on top of the method after moving conversion inside switch-case. Now duplicated code is removed.



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeFactory.java:
##########
@@ -302,6 +320,14 @@ public static NativeType relDataTypeToNative(RelDataType relType) {
                         : NativeTypes.blobOf(relType.getPrecision());
             case UUID:
                 return NativeTypes.UUID;
+            case ROW:

Review Comment:
   Do we have tests that use this?



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/RowHandler.java:
##########
@@ -63,7 +63,7 @@ default ByteBuffer toByteBuffer(RowT row) {
     String toString(RowT row);
 
     /** Creates a factory that produces rows with fields defined by the given schema. */
-    RowFactory<RowT> factory(RowSchema rowSchema);
+    RowFactory<RowT> factory(StructNativeType rowSchema);

Review Comment:
   Should we avoid using `schema` term? and maybe replace with `type`? e.g. rowSchema -> rowType ?
   And fix parameter/method names and javadocs?



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeFactory.java:
##########
@@ -277,7 +295,7 @@ public static NativeType relDataTypeToNative(RelDataType relType) {
             case INTERVAL_YEAR_MONTH:
             case INTERVAL_MONTH:
                 // TODO: https://issues.apache.org/jira/browse/IGNITE-17373
-                throw new IllegalArgumentException("Type is not supported yet: " + relType);

Review Comment:
   Should we remove TODO too?



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/RowHandler.java:
##########
@@ -63,7 +63,7 @@ default ByteBuffer toByteBuffer(RowT row) {
     String toString(RowT row);
 
     /** Creates a factory that produces rows with fields defined by the given schema. */
-    RowFactory<RowT> factory(RowSchema rowSchema);
+    RowFactory<RowT> factory(StructNativeType rowSchema);

Review Comment:
   we still use `schema` in the context of describing row layout (see `SchemaDescriptor`), thus I think it's ok to leave variable name as `rowSchema` (it's not an arbitrary structured type, it's descriptor (i.e. schema) of the tuple created by this factory).
   
   Moreover, rename like this will generate gazillion of changes which (in my opinion) doesn't bring anything to the project.
   
   But if you strongly believe it would be better to have matching name, I will do rename



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeFactory.java:
##########
@@ -277,7 +295,7 @@ public static NativeType relDataTypeToNative(RelDataType relType) {
             case INTERVAL_YEAR_MONTH:
             case INTERVAL_MONTH:
                 // TODO: https://issues.apache.org/jira/browse/IGNITE-17373
-                throw new IllegalArgumentException("Type is not supported yet: " + relType);

Review Comment:
   I decided to leave these TODO's because INTERVAL types in fact are not supported fully. I believe this place should be revisited 



-- 
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-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/core/src/main/java/org/apache/ignite/internal/type/NativeType.java:
##########
@@ -41,18 +41,11 @@ public class NativeType implements Comparable<NativeType> {
      * @param size     Type size in bytes.
      */
     protected NativeType(ColumnType typeSpec, int size) {
-        this.fixedSize = !((typeSpec.precisionAllowed() && typeSpec.scaleAllowed()) || typeSpec.lengthAllowed());
-
-        if (!this.fixedSize) {
-            throw new IllegalArgumentException("Size must be provided only for fixed-length types: " + typeSpec);
-        }
-
-        if (size <= 0) {
-            throw new IllegalArgumentException("Size must be positive [typeSpec=" + typeSpec + ", size=" + size + ']');
-        }
-
-        this.typeSpec = typeSpec;
-        this.size = size;
+        this(
+                typeSpec,
+                !((typeSpec.precisionAllowed() && typeSpec.scaleAllowed()) || typeSpec.lengthAllowed()),

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

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


Re: [PR] IGNITE-26705 Sql. Replace sql.engine.exec.row.RowSchema with StructNativeType [ignite-3]

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


##########
modules/core/src/main/java/org/apache/ignite/internal/type/NativeType.java:
##########
@@ -41,18 +41,11 @@ public class NativeType implements Comparable<NativeType> {
      * @param size     Type size in bytes.
      */
     protected NativeType(ColumnType typeSpec, int size) {
-        this.fixedSize = !((typeSpec.precisionAllowed() && typeSpec.scaleAllowed()) || typeSpec.lengthAllowed());
-
-        if (!this.fixedSize) {
-            throw new IllegalArgumentException("Size must be provided only for fixed-length types: " + typeSpec);
-        }
-
-        if (size <= 0) {
-            throw new IllegalArgumentException("Size must be positive [typeSpec=" + typeSpec + ", size=" + size + ']');
-        }
-
-        this.typeSpec = typeSpec;
-        this.size = size;
+        this(
+                typeSpec,
+                !((typeSpec.precisionAllowed() && typeSpec.scaleAllowed()) || typeSpec.lengthAllowed()),

Review Comment:
   ```suggestion
                   isFixedSize(typeSpec),
   ```
   
   ```
   private static boolean isFixedSize(ColumnType typeSpec) {
       return !((typeSpec.precisionAllowed() && typeSpec.scaleAllowed()) || typeSpec.lengthAllowed());
   }
   ```



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