You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/06/23 08:32:25 UTC

[GitHub] [incubator-seatunnel] ashulin opened a new pull request, #2052: [api-draft][api] Improve SeaTunnel's data types & Mapping engine data types

ashulin opened a new pull request, #2052:
URL: https://github.com/apache/incubator-seatunnel/pull/2052

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   1. Improve SeaTunnel's data types;
   2. Mapping engine data types;
   3. The conversion of SeaTunnelRow & engine's Row;
   4. Add SeaTunnelRow's data type validation;
   
   discuss: https://github.com/apache/incubator-seatunnel/issues/2024
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] Hisoka-X merged pull request #2052: [api-draft][api] Improve SeaTunnel's data types & Mapping engine data types

Posted by GitBox <gi...@apache.org>.
Hisoka-X merged PR #2052:
URL: https://github.com/apache/incubator-seatunnel/pull/2052


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] Hisoka-X commented on a diff in pull request #2052: [api-draft][api] Improve SeaTunnel's data types & Mapping engine data types

Posted by GitBox <gi...@apache.org>.
Hisoka-X commented on code in PR #2052:
URL: https://github.com/apache/incubator-seatunnel/pull/2052#discussion_r905764262


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/BasicType.java:
##########
@@ -17,69 +17,63 @@
 
 package org.apache.seatunnel.api.table.type;
 
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.time.Instant;
-import java.util.Date;
 import java.util.Objects;
 
 public class BasicType<T> implements SeaTunnelDataType<T> {
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
 
-    public static final BasicType<String> STRING_TYPE = new BasicType<>(String.class);
-    public static final BasicType<Boolean> BOOLEAN_TYPE = new BasicType<>(Boolean.class);
-    public static final BasicType<Byte> BYTE_TYPE = new BasicType<>(Byte.class);
-    public static final BasicType<Short> SHORT_TYPE = new BasicType<>(Short.class);
-    public static final BasicType<Integer> INT_TYPE = new BasicType<>(Integer.class);
-    public static final BasicType<Long> LONG_TYPE = new BasicType<>(Long.class);
-    public static final BasicType<Float> FLOAT_TYPE = new BasicType<>(Float.class);
-    public static final BasicType<Double> DOUBLE_TYPE = new BasicType<>(Double.class);
-    public static final BasicType<Character> CHAR_TYPE = new BasicType<>(Character.class);
+    public static final BasicType<String> STRING_TYPE = new BasicType<>(String.class, SqlType.STRING);
+    public static final BasicType<Boolean> BOOLEAN_TYPE = new BasicType<>(Boolean.class, SqlType.BOOLEAN);
+    public static final BasicType<Byte> BYTE_TYPE = new BasicType<>(Byte.class, SqlType.TINYINT);
+    public static final BasicType<Short> SHORT_TYPE = new BasicType<>(Short.class, SqlType.SMALLINT);
+    public static final BasicType<Integer> INT_TYPE = new BasicType<>(Integer.class, SqlType.INT);
+    public static final BasicType<Long> LONG_TYPE = new BasicType<>(Long.class, SqlType.BIGINT);
+    public static final BasicType<Float> FLOAT_TYPE = new BasicType<>(Float.class, SqlType.FLOAT);
+    public static final BasicType<Double> DOUBLE_TYPE = new BasicType<>(Double.class, SqlType.DOUBLE);
+    public static final BasicType<Void> VOID_TYPE = new BasicType<>(Void.class, SqlType.NULL);
 
-    public static final BasicType<BigInteger> BIG_INT_TYPE = new BasicType<>(BigInteger.class);
-    public static final BasicType<BigDecimal> BIG_DECIMAL_TYPE = new BasicType<>(BigDecimal.class);
-    public static final BasicType<Instant> INSTANT_TYPE = new BasicType<>(Instant.class);
-    public static final BasicType<Void> VOID_TYPE = new BasicType<>(Void.class);
-    public static final BasicType<Date> DATE_TYPE = new BasicType<>(Date.class);
+    // --------------------------------------------------------------------------------------------
 
     /**
      * The physical type class.
      */
-    private final Class<T> physicalTypeClass;
+    private final Class<T> typeClass;
+    private final SqlType sqlType;
 
-    private BasicType(Class<T> physicalTypeClass) {
-        if (physicalTypeClass == null) {
-            throw new IllegalArgumentException("physicalTypeClass cannot be null");
-        }
-        this.physicalTypeClass = physicalTypeClass;
+    protected BasicType(Class<T> typeClass, SqlType sqlType) {
+        this.typeClass = typeClass;
+        this.sqlType = sqlType;
     }
 
     @Override
     public Class<T> getTypeClass() {
-        return this.physicalTypeClass;
+        return this.typeClass;
     }
 
     @Override
-    public int hashCode() {
-        return this.physicalTypeClass.hashCode();
+    public SqlType getSqlType() {
+        return this.sqlType;
     }
 
     @Override
-    public boolean equals(Object o) {
-        if (this == o) {
+    public boolean equals(Object obj) {

Review Comment:
   The sql type should be considered when equals



-- 
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: commits-unsubscribe@seatunnel.apache.org

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