dawidwys commented on code in PR #23916:
URL: https://github.com/apache/flink/pull/23916#discussion_r1425373388


##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/test/program/TemporalFunctionTestStep.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.test.program;
+
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.functions.TemporalTableFunction;
+
+/** Test step for registering a (temporary) (system or catalog) function. */
+public final class TemporalFunctionTestStep implements TestStep {
+
+    /** Whether function should be temporary or not. */
+    enum FunctionPersistence {
+        TEMPORARY,
+        PERSISTENT
+    }
+
+    /** Whether function should be persisted in a catalog or not. */
+    enum FunctionBehavior {
+        SYSTEM,
+        CATALOG
+    }
+
+    public final FunctionPersistence persistence;
+    public final FunctionBehavior behavior;
+    public final String name;
+    public final String table;
+    public final Expression timeAttribute;
+    public final Expression primaryKey;
+
+    TemporalFunctionTestStep(
+            FunctionPersistence persistence,
+            FunctionBehavior behavior,
+            String name,
+            String table,
+            Expression timeAttribute,
+            Expression primaryKey) {
+        this.persistence = persistence;
+        this.behavior = behavior;
+        this.name = name;
+        this.table = table;
+        this.timeAttribute = timeAttribute;
+        this.primaryKey = primaryKey;
+    }
+
+    @Override
+    public TestKind getKind() {
+        return TestKind.TEMPORAL_FUNCTION;
+    }
+
+    public void apply(TableEnvironment env) {
+        TemporalTableFunction function =
+                env.from(table).createTemporalTableFunction(timeAttribute, 
primaryKey);
+        if (behavior == FunctionBehavior.SYSTEM) {
+            if (persistence == FunctionPersistence.TEMPORARY) {
+                env.createTemporarySystemFunction(name, function);
+
+            } else {
+                throw new UnsupportedOperationException("System functions must 
be temporary.");

Review Comment:
   I wouldn't add options which are not possible. Temporal functions can only 
ever be temporary.  Other than that I'd say it's fine.



##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/test/program/TemporalFunctionTestStep.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.test.program;
+
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.functions.TemporalTableFunction;
+
+/** Test step for registering a (temporary) (system or catalog) function. */
+public final class TemporalFunctionTestStep implements TestStep {
+
+    /** Whether function should be temporary or not. */
+    enum FunctionPersistence {
+        TEMPORARY,
+        PERSISTENT
+    }
+
+    /** Whether function should be persisted in a catalog or not. */
+    enum FunctionBehavior {
+        SYSTEM,
+        CATALOG
+    }
+
+    public final FunctionPersistence persistence;
+    public final FunctionBehavior behavior;
+    public final String name;
+    public final String table;
+    public final Expression timeAttribute;
+    public final Expression primaryKey;
+
+    TemporalFunctionTestStep(

Review Comment:
   I think this is legacy way of performing a temporal join, so I believe it's 
fine to have a separate step.



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to