davidradl commented on code in PR #26396:
URL: https://github.com/apache/flink/pull/26396#discussion_r2028574557
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/dataview/DataViewUtils.java:
##########
@@ -51,13 +48,40 @@
/**
* Utilities to deal with {@link DataView}s.
*
- * <p>A {@link DataView} is either represented as a regular {@link
StructuredType} or as a {@link
- * RawType} that serializes to {@code null} when backed by a state backend. In
the latter case, a
- * {@link DataViewSpec} contains all information necessary to store and
retrieve data from state.
+ * <p>For aggregating functions: A {@link DataView} is a field that is either
represented as a
+ * regular {@link StructuredType} or as a {@link RawType} that serializes to
{@code null} when
+ * backed by a state backend. In the latter case, a {@link DataViewSpec}
contains all information
+ * necessary to store and retrieve data from state.
+ *
+ * <p>For process table functions: A {@link DataView} is a top-level instance
that is always backed
+ * by a state backend.
*/
@Internal
public final class DataViewUtils {
+ /** Returns whether the given {@link LogicalType} qualifies as a {@link
DataView}. */
+ public static boolean isDataView(LogicalType viewType, Class<? extends
DataView> viewClass) {
+ final boolean isDataView =
+ viewType.is(STRUCTURED_TYPE)
+ && ((StructuredType) viewType)
+ .getImplementationClass()
+ .map(viewClass::isAssignableFrom)
+ .orElse(false);
+ if (!isDataView) {
Review Comment:
nit: how about rewriting the if and returns as
```
if (isDataView) {
viewType.getChildren().forEach(DataViewUtils::checkForInvalidDataViews);
}
return isDataView;
```
--
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]