JingsongLi commented on code in PR #423:
URL: https://github.com/apache/flink-table-store/pull/423#discussion_r1061242317
##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/DataType.java:
##########
@@ -53,6 +53,29 @@ public LogicalType logicalType() {
*/
public abstract DataType copy(boolean isNullable);
+ /**
+ * Compare two data types without nullable.
+ *
+ * @param o the target data type
+ */
+ public boolean equalsIgnoreNullable(Object o) {
Review Comment:
`DataType o`?
##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/DataType.java:
##########
@@ -53,6 +53,29 @@ public LogicalType logicalType() {
*/
public abstract DataType copy(boolean isNullable);
+ /**
+ * Compare two data types without nullable.
+ *
+ * @param o the target data type
+ */
+ public boolean equalsIgnoreNullable(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ DataType dataType = (DataType) o;
+ if (logicalType == dataType.logicalType) {
+ return true;
+ }
+ if (logicalType == null || logicalType.getClass() !=
dataType.logicalType.getClass()) {
+ return false;
+ }
+ return logicalType.getTypeRoot() == dataType.logicalType.getTypeRoot();
Review Comment:
Different precisions are also different, we can add test: varchar(5) and
varchar(10).
Here we can just use
`logicalType.copy(true).equals(dataType.logicalType.copy(true))`.
--
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]