[PR] [FLINK-33767] Implement restore tests for TemporalJoin node [flink]

2023-12-12 Thread via GitHub


jnh5y opened a new pull request, #23916:
URL: https://github.com/apache/flink/pull/23916

   ## What is the purpose of the change
   
   Implement restore tests for TemporalJoin node
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   * Added restore tests for TemporalJoin node which verifies the generated 
compiled plan with the saved compiled plan
   
   ## Does this pull request potentially affect one of the following parts:
   
 - Dependencies (does it add or upgrade a dependency): (no)
 - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (no)
 - The serializers: (no)
 - The runtime per-record code paths (performance sensitive): (no)
 - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
 - The S3 file system connector: (no)
   
   ## Documentation
   
 - Does this pull request introduce a new feature? (no)
 - If yes, how is the feature documented? (not applicable)
   


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



Re: [PR] [FLINK-33767] Implement restore tests for TemporalJoin node [flink]

2023-12-12 Thread via GitHub


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


##
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:
   @twalthr @dawidwys Any ideas on unifying temporal functions with regular 
functions? 
   
   I'm open for feedback on how to improve this class and how it integrates 
with the tests.



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



Re: [PR] [FLINK-33767] Implement restore tests for TemporalJoin node [flink]

2023-12-12 Thread via GitHub


flinkbot commented on PR #23916:
URL: https://github.com/apache/flink/pull/23916#issuecomment-1852649867

   
   ## CI report:
   
   * 8465d60ab2e0e14337016ebb1108f065b122e51f UNKNOWN
   
   
   Bot commands
 The @flinkbot bot supports the following commands:
   
- `@flinkbot run azure` re-run the last Azure build
   


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



Re: [PR] [FLINK-33767] Implement restore tests for TemporalJoin node [flink]

2023-12-13 Thread via GitHub


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

Re: [PR] [FLINK-33767] Implement restore tests for TemporalJoin node [flink]

2023-12-15 Thread via GitHub


dawidwys closed pull request #23916: [FLINK-33767] Implement restore tests for 
TemporalJoin node
URL: https://github.com/apache/flink/pull/23916


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