lihaosky commented on code in PR #26654: URL: https://github.com/apache/flink/pull/26654#discussion_r2138377376
########## docs/layouts/shortcodes/generated/ml_predict_runtime_config_configuration.html: ########## @@ -0,0 +1,36 @@ +<table class="configuration table table-bordered"> + <thead> + <tr> + <th class="text-left" style="width: 20%">Key</th> + <th class="text-left" style="width: 15%">Default</th> + <th class="text-left" style="width: 10%">Type</th> + <th class="text-left" style="width: 55%">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td><h5>async</h5></td> + <td style="word-wrap: break-word;">(none)</td> + <td>Boolean</td> + <td>Value can be 'true' or 'false' to suggest the planner choose the corresponding predict function. If the backend predict function provider does not support the suggested mode, it will take no effect.</td> Review Comment: It should throw error instead of take no effect. I think we can enforce correct behavior instead of doing something silently which may not be what user expects. * If user explicitly specify the mode, their provider must support it * If they don't specify the mode, we choose what's available and prefer async ########## flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/MLPredictRuntimeConfigOptions.java: ########## @@ -0,0 +1,84 @@ +/* + * 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.api.config; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.configuration.ConfigOption; + +import org.apache.flink.shaded.guava33.com.google.common.collect.ImmutableSet; + +import java.time.Duration; +import java.util.HashSet; +import java.util.Set; + +import static org.apache.flink.configuration.ConfigOptions.key; + +/** + * This class holds option name definitions for ML_PREDICT runtime config based on {@link + * ConfigOption}. + */ +@PublicEvolving +public class MLPredictRuntimeConfigOptions { + + public static final ConfigOption<Boolean> ASYNC = + key("async") + .booleanType() + .noDefaultValue() + .withDescription( + "Value can be 'true' or 'false' to suggest the planner choose the corresponding" + + " predict function. If the backend predict function provider does not support the" + + " suggested mode, it will take no effect."); + + public static final ConfigOption<ExecutionConfigOptions.AsyncOutputMode> ASYNC_OUTPUT_MODE = + key("output-mode") + .enumType(ExecutionConfigOptions.AsyncOutputMode.class) + .noDefaultValue() + .withDescription( + "Output mode for asynchronous operations which will convert to {@see AsyncDataStream.OutputMode}, ORDERED by default. " + + "If set to ALLOW_UNORDERED, will attempt to use {@see AsyncDataStream.OutputMode.UNORDERED} when it does not " + + "affect the correctness of the result, otherwise ORDERED will be still used."); + + public static final ConfigOption<Integer> ASYNC_CAPACITY = + key("capacity") + .intType() + .noDefaultValue() + .withDescription( + "The max number of async i/o operation that the async ml predict can trigger."); + + public static final ConfigOption<Duration> ASYNC_TIMEOUT = + key("timeout") + .durationType() + .noDefaultValue() + .withDescription( + "Timeout from first invoke to final completion of asynchronous operation, may include multiple" + + " retries, and will be reset in case of failover."); + + private static final Set<ConfigOption<?>> supportedKeys = new HashSet<>(); + + static { + supportedKeys.add(ASYNC); + supportedKeys.add(ASYNC_OUTPUT_MODE); + supportedKeys.add(ASYNC_CAPACITY); + supportedKeys.add(ASYNC_TIMEOUT); Review Comment: Missing `retry-strategy`, `retry-delay` and `max-attempt`? Add those in following up PRs? -- 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