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



##########
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:
       btw while reviewing the code: actually `is(LogicalTypeFamily.TIMESTAMP)` 
reads nicely because the enum is always prefixes with `LogicalTypeFamily` any 
way.




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


Reply via email to