Skip to content

Conversation

@lihaosky
Copy link
Contributor

@lihaosky lihaosky commented Dec 3, 2025

What is the purpose of the change

Add batch support for ml_predict function

Brief change log

  • Create common exec node for stream and batch
  • Create common rule for stream and batch
  • Added batch unit/it/restore test

Verifying this change

unit/it/restore test for stream/batch

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? (yes)
  • If yes, how is the feature documented? (JavaDocs)

@flinkbot
Copy link
Collaborator

flinkbot commented Dec 3, 2025

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Member

@fsk119 fsk119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. I left some comments

FlinkLogicalTableFunctionScan.class,
FlinkConventions.LOGICAL(),
FlinkConventions.BATCH_PHYSICAL(),
"PhysicalMLPredictTableFunctionRule:Batch"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about using the same name as vector search? BatchPhysicalMLPredictTableFunctionRule.

* limitations under the License.
*/

package org.apache.flink.table.planner.runtime.batch.table;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better we move this class to org.apache.flink.table.planner.runtime.batch.sql. Here is used for table api tests.

* limitations under the License.
*/

package org.apache.flink.table.planner.runtime.batch.table;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


private void createScanTable(String tableName, List<Row> data) {
String dataId = TestValuesTableFactory.registerData(data);
String bounded = tEnv instanceof StreamExecutionEnvironment ? "false" : "true";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tEnv.getConfig().get(ExecutionOptions.RUNTIME_MODE) == RuntimeExecutionMode.BATCH

}

@Parameters(name = "backend = {0}, objectReuse = {1}, asyncOutputMode = {2}")
public static Collection<Object[]> parameters() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before change, we run tests with different statebackend. I prefer to keep the origin behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm following VectorSearchITCaseBase which doesn't have these. Probably because there's no BatchWithStateTestBase

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In batch mode, operator doesn't need state 0.0

@Override
public List<TableTestProgram> programs() {
return List.of(
SYNC_ML_PREDICT, ASYNC_UNORDERED_ML_PREDICT, SYNC_ML_PREDICT_WITH_RUNTIME_CONFIG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't add SYNC_ML_PREDICT_TABLE_API, SYNC_ML_PREDICT_TABLE_API...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are in semantic test. I'll add a batch semantic test

Copy link
Member

@fsk119 fsk119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fsk119 fsk119 merged commit 0ffc910 into apache:master Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants