You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/10/25 07:04:23 UTC

[GitHub] [flink] slinkydeveloper commented on a change in pull request #17550: [FLINK-24599][table] Replace static methods with member methods

slinkydeveloper commented on a change in pull request #17550:
URL: https://github.com/apache/flink/pull/17550#discussion_r735307913



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/LogicalType.java
##########
@@ -77,6 +77,33 @@ public LogicalTypeRoot getTypeRoot() {
         return typeRoot;
     }
 
+    /**
+     * Returns whether the root of the type equals to the {@code typeRoot} or not.
+     *
+     * @param typeRoot The root type to check against for equality
+     */
+    public boolean is(LogicalTypeRoot typeRoot) {
+        return this.typeRoot == typeRoot;
+    }
+
+    /**
+     * Returns whether the root of the type equals to at least on of the {@code typeRoots} or not.
+     *
+     * @param typeRoots The root types to check against for equality
+     */
+    public boolean isAnyOf(LogicalTypeRoot... typeRoots) {
+        return Arrays.stream(typeRoots).anyMatch(tr -> this.typeRoot == tr);
+    }
+
+    /**
+     * Returns whether the family type of the type equals to the {@code family} or not.
+     *
+     * @param family The family type to check against for equality
+     */
+    public boolean is(LogicalTypeFamily family) {

Review comment:
       Naming this method `is` seems not correct to me, for two reasons: family is a set, and also `is` is already defined with `typeRoot` argument. Perhaps `isFamily` is better?




-- 
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: issues-unsubscribe@flink.apache.org

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