Re: [PR] [FLINK-34095] Adds restore tests for StreamExecAsyncCalc [flink]

2024-02-06 Thread via GitHub


twalthr merged PR #24220:
URL: https://github.com/apache/flink/pull/24220


-- 
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-34095] Adds restore tests for StreamExecAsyncCalc [flink]

2024-02-05 Thread via GitHub


AlanConfluent commented on code in PR #24220:
URL: https://github.com/apache/flink/pull/24220#discussion_r1479328861


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/AsyncCalcTestPrograms.java:
##
@@ -0,0 +1,297 @@
+/*
+ * 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.planner.plan.nodes.exec.stream;
+
+import org.apache.flink.table.annotation.DataTypeHint;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.table.functions.AsyncScalarFunction;
+import org.apache.flink.table.functions.FunctionContext;
+import org.apache.flink.table.test.program.SinkTestStep;
+import org.apache.flink.table.test.program.SourceTestStep;
+import org.apache.flink.table.test.program.TableTestProgram;
+import org.apache.flink.types.Row;
+
+import java.sql.Timestamp;
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.util.TimeZone;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static 
org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_BUFFER_CAPACITY;
+import static 
org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_MAX_ATTEMPTS;
+import static 
org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_RETRY_DELAY;
+import static org.assertj.core.api.Assertions.fail;
+
+/** {@link TableTestProgram} definitions for testing {@link 
StreamExecAsyncCalc}. */
+public class AsyncCalcTestPrograms {
+
+static final TableTestProgram ASYNC_CALC_UDF_SIMPLE =
+TableTestProgram.of("async-calc-simple", "validates async calc 
node with simple UDF")
+.setupTemporaryCatalogFunction("udf1", 
AsyncJavaFunc0.class)
+.setupTableSource(
+SourceTestStep.newBuilder("source_t")
+.addSchema("a INT")
+.producedBeforeRestore(Row.of(5))
+.producedAfterRestore(Row.of(5))
+.build())
+.setupTableSink(
+SinkTestStep.newBuilder("sink_t")
+.addSchema("a INT", "a1 BIGINT")
+.consumedBeforeRestore(Row.of(5, 6L))
+.consumedAfterRestore(Row.of(5, 6L))
+.build())
+.runSql("INSERT INTO sink_t SELECT a, udf1(a) FROM 
source_t")
+.build();
+
+static final TableTestProgram ASYNC_CALC_UDF_COMPLEX =
+TableTestProgram.of("async-calc-complex", "validates calc node 
with complex UDFs")
+.setupTemporaryCatalogFunction("udf1", 
AsyncJavaFunc0.class)
+.setupTemporaryCatalogFunction("udf2", 
AsyncJavaFunc1.class)
+.setupTemporarySystemFunction("udf3", AsyncJavaFunc2.class)
+.setupTemporarySystemFunction("udf4", 
AsyncUdfWithOpen.class)
+.setupCatalogFunction("udf5", AsyncJavaFunc5.class)
+.setupTableSource(
+SourceTestStep.newBuilder("source_t")
+.addSchema(
+"a BIGINT, b INT NOT NULL, c 
VARCHAR, d TIMESTAMP(3)")
+.producedBeforeRestore(
+Row.of(
+5L,
+11,
+"hello world",
+LocalDateTime.of(2023, 12, 
16, 1, 1, 1, 123)))
+.producedAfterRestore(
+Row.of(
+5L,
+11,
+"hello world",
+  

Re: [PR] [FLINK-34095] Adds restore tests for StreamExecAsyncCalc [flink]

2024-02-05 Thread via GitHub


twalthr commented on code in PR #24220:
URL: https://github.com/apache/flink/pull/24220#discussion_r1478523651


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/AsyncCalcTestPrograms.java:
##
@@ -0,0 +1,297 @@
+/*
+ * 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.planner.plan.nodes.exec.stream;
+
+import org.apache.flink.table.annotation.DataTypeHint;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.table.functions.AsyncScalarFunction;
+import org.apache.flink.table.functions.FunctionContext;
+import org.apache.flink.table.test.program.SinkTestStep;
+import org.apache.flink.table.test.program.SourceTestStep;
+import org.apache.flink.table.test.program.TableTestProgram;
+import org.apache.flink.types.Row;
+
+import java.sql.Timestamp;
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.util.TimeZone;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static 
org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_BUFFER_CAPACITY;
+import static 
org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_MAX_ATTEMPTS;
+import static 
org.apache.flink.table.api.config.ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_RETRY_DELAY;
+import static org.assertj.core.api.Assertions.fail;
+
+/** {@link TableTestProgram} definitions for testing {@link 
StreamExecAsyncCalc}. */
+public class AsyncCalcTestPrograms {
+
+static final TableTestProgram ASYNC_CALC_UDF_SIMPLE =
+TableTestProgram.of("async-calc-simple", "validates async calc 
node with simple UDF")
+.setupTemporaryCatalogFunction("udf1", 
AsyncJavaFunc0.class)
+.setupTableSource(
+SourceTestStep.newBuilder("source_t")
+.addSchema("a INT")
+.producedBeforeRestore(Row.of(5))
+.producedAfterRestore(Row.of(5))
+.build())
+.setupTableSink(
+SinkTestStep.newBuilder("sink_t")
+.addSchema("a INT", "a1 BIGINT")
+.consumedBeforeRestore(Row.of(5, 6L))
+.consumedAfterRestore(Row.of(5, 6L))
+.build())
+.runSql("INSERT INTO sink_t SELECT a, udf1(a) FROM 
source_t")
+.build();
+
+static final TableTestProgram ASYNC_CALC_UDF_COMPLEX =
+TableTestProgram.of("async-calc-complex", "validates calc node 
with complex UDFs")
+.setupTemporaryCatalogFunction("udf1", 
AsyncJavaFunc0.class)
+.setupTemporaryCatalogFunction("udf2", 
AsyncJavaFunc1.class)
+.setupTemporarySystemFunction("udf3", AsyncJavaFunc2.class)
+.setupTemporarySystemFunction("udf4", 
AsyncUdfWithOpen.class)
+.setupCatalogFunction("udf5", AsyncJavaFunc5.class)
+.setupTableSource(
+SourceTestStep.newBuilder("source_t")
+.addSchema(
+"a BIGINT, b INT NOT NULL, c 
VARCHAR, d TIMESTAMP(3)")
+.producedBeforeRestore(
+Row.of(
+5L,
+11,
+"hello world",
+LocalDateTime.of(2023, 12, 
16, 1, 1, 1, 123)))
+.producedAfterRestore(
+Row.of(
+5L,
+11,
+"hello world",
+

Re: [PR] [FLINK-34095] Adds restore tests for StreamExecAsyncCalc [flink]

2024-01-30 Thread via GitHub


twalthr commented on code in PR #24220:
URL: https://github.com/apache/flink/pull/24220#discussion_r1470990008


##
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/AsyncCalcTestPrograms.java:
##
@@ -0,0 +1,158 @@
+/*
+ * 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.planner.plan.nodes.exec.stream;
+
+import 
org.apache.flink.table.planner.runtime.utils.JavaUserDefinedScalarFunctions;
+import org.apache.flink.table.test.program.SinkTestStep;
+import org.apache.flink.table.test.program.SourceTestStep;
+import org.apache.flink.table.test.program.TableTestProgram;
+import org.apache.flink.types.Row;
+
+import java.time.LocalDateTime;
+
+public class AsyncCalcTestPrograms {
+
+static final TableTestProgram ASYNC_CALC_UDF_SIMPLE =
+TableTestProgram.of("async-calc-simple", "validates async calc 
node with simple UDF")
+.setupTemporaryCatalogFunction(
+"udf1", 
JavaUserDefinedScalarFunctions.AsyncJavaFunc0.class)
+.setupTableSource(
+SourceTestStep.newBuilder("source_t")
+.addSchema("a INT")
+.producedBeforeRestore(Row.of(5))
+.producedAfterRestore(Row.of(5))
+.build())
+.setupTableSink(
+SinkTestStep.newBuilder("sink_t")
+.addSchema("a INT", "a1 BIGINT")
+.consumedBeforeRestore(Row.of(5, 6L))
+.consumedAfterRestore(Row.of(5, 6L))
+.build())
+.runSql("INSERT INTO sink_t SELECT a, udf1(a) FROM 
source_t")
+.build();
+
+static final TableTestProgram ASYNC_CALC_UDF_COMPLEX =
+TableTestProgram.of("async-calc-complex", "validates calc node 
with complex UDFs")
+.setupTemporaryCatalogFunction(
+"udf1", 
JavaUserDefinedScalarFunctions.AsyncJavaFunc0.class)
+.setupTemporaryCatalogFunction(
+"udf2", 
JavaUserDefinedScalarFunctions.AsyncJavaFunc1.class)
+.setupTemporarySystemFunction(
+"udf3", 
JavaUserDefinedScalarFunctions.AsyncJavaFunc2.class)
+.setupTemporarySystemFunction(
+"udf4", 
JavaUserDefinedScalarFunctions.AsyncUdfWithOpen.class)
+.setupCatalogFunction(
+"udf5", 
JavaUserDefinedScalarFunctions.AsyncJavaFunc5.class)
+.setupTableSource(
+SourceTestStep.newBuilder("source_t")
+.addSchema(
+"a BIGINT, b INT NOT NULL, c 
VARCHAR, d TIMESTAMP(3)")
+.producedBeforeRestore(
+Row.of(
+5L,
+11,
+"hello world",
+LocalDateTime.of(2023, 12, 
16, 1, 1, 1, 123)))
+.producedAfterRestore(
+Row.of(
+5L,
+11,
+"hello world",
+LocalDateTime.of(2023, 12, 
16, 1, 1, 1, 123)))
+.build())
+.setupTableSink(
+SinkTestStep.newBuilder("sink_t")
+.addSchema(
+"a BIGINT",
+"a1 VARCHAR",
+"b INT NOT NULL",
+

Re: [PR] [FLINK-34095] Adds restore tests for StreamExecAsyncCalc [flink]

2024-01-29 Thread via GitHub


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

   
   ## CI report:
   
   * e83e62b94aae829bb91f00bd5b82feb883d68338 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



[PR] [FLINK-34095] Adds restore tests for StreamExecAsyncCalc [flink]

2024-01-29 Thread via GitHub


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

   
   
   ## What is the purpose of the change
   Adds some restore tests for StreamExecAsyncCalc, which is utilized by using 
`AsyncScalarFunction`.
   
   
   ## Brief change log
   
   *(for example:)*
 - *The TaskInfo is stored in the blob store on job creation time as a 
persistent artifact*
 - *Deployments RPC transmits only the blob storage reference*
 - *TaskManagers retrieve the TaskInfo from the blob cache*
   
   
   ## Verifying this change
   
   Please make sure both new and modified tests in this PR follows the 
conventions defined in our code quality guide: 
https://flink.apache.org/contributing/code-style-and-quality-common.html#testing
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe 
tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
 - *Added integration tests for end-to-end deployment with large payloads 
(100MB)*
 - *Extended integration test for recovery after master (JobManager) 
failure*
 - *Added test that validates that TaskInfo is transferred only once across 
recoveries*
 - *Manually verified the change by running a 4 node cluster with 2 
JobManagers and 4 TaskManagers, a stateful streaming program, and killing one 
JobManager and two TaskManagers during the execution, verifying that recovery 
happens correctly.*
   
   ## Does this pull request potentially affect one of the following parts:
   
 - Dependencies (does it add or upgrade a dependency): (yes / no)
 - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / no)
 - The serializers: (yes / no / don't know)
 - The runtime per-record code paths (performance sensitive): (yes / no / 
don't know)
 - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
 - The S3 file system connector: (yes / no / don't know)
   
   ## Documentation
   
 - Does this pull request introduce a new feature? (yes / no)
 - If yes, how is the feature documented? (not applicable / docs / JavaDocs 
/ not documented)
   


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