Skip to content

Conversation

@fsk119
Copy link
Member

@fsk119 fsk119 commented Oct 20, 2025

What is the purpose of the change

Support to using runtime config in the VECTOR_SEARCH API. For example, you can use the following statements.

SELECT * FROM nullableSrc 
LEFT JOIN LATERAL TABLE(VECTOR_SEARCH(TABLE vector, DESCRIPTOR(`vector`), nullableSrc.vector, 2, MAP['timeout', '100ms'])) 
ON TRUE

Brief change log

  • Extend the SqlVectorSearchTableFunction to accept config parameter.
  • Modify the rule to convert config operands to MAP in VectorSearchSpec
  • Support to merge options between runtime config and flink conf

Verifying this change

This change added tests and can be verified as follows:

  • Added plan tests to check plan contains the correct operands
  • Added ITCase to verify planner uses the correct operator if aysnc is true
  • Added restore tests

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)

@flinkbot
Copy link
Collaborator

flinkbot commented Oct 20, 2025

CI report:

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

@fsk119 fsk119 changed the title Config [FLINK-38430][table] Support runtime config for VECTOR_SEARCH Oct 20, 2025
Copy link
Contributor

@lihaosky lihaosky left a comment

Choose a reason for hiding this comment

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

CI test failure ConfigOptionsDocsCompletenessITCase seems relevant

<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 search function provider does not support the suggested mode, it will throw exception to notify users.</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Mention the default value?

<td><h5>output-mode</h5></td>
<td style="word-wrap: break-word;">(none)</td>
<td><p>Enum</p></td>
<td>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.<br /><br />Possible values:<ul><li>"ORDERED"</li><li>"ALLOW_UNORDERED"</li></ul></td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Mention default?

public static final ConfigOption<Boolean> ASYNC =
key("async")
.booleanType()
.noDefaultValue()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why there's no default value?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's same as MLPredictRuntimeConfigOptions#ASYNC. I think we can align the behaviour.

public static final ConfigOption<ExecutionConfigOptions.AsyncOutputMode> ASYNC_OUTPUT_MODE =
key("output-mode")
.enumType(ExecutionConfigOptions.AsyncOutputMode.class)
.noDefaultValue()
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

public static final ConfigOption<Integer> ASYNC_MAX_CONCURRENT_OPERATIONS =
key("max-concurrent-operations")
.intType()
.noDefaultValue()
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto. Mention default it's in TABLE_EXEC_ASYNC_VECTOR_SEARCH_MAX_CONCURRENT_OPERATIONS?

public static final ConfigOption<Duration> ASYNC_TIMEOUT =
key("timeout")
.durationType()
.noDefaultValue()
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

return result;
}

public static Optional<RuntimeException> checkConfigValue(Map<String, String> runtimeConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

checkVectorSearchConfigValue? This looks to be mainly for vector search config check

Copy link
Member Author

Choose a reason for hiding this comment

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

I move it to SqlVectorSearchFunction file

@github-actions github-actions bot added the community-reviewed PR has been reviewed by the community. label Oct 24, 2025
@fsk119
Copy link
Member Author

fsk119 commented Oct 24, 2025

It's not easy to fix ConfigOptionsDocsCompletenessITCase. I think we can disable the check the option duplicate for ML_PREDICT and VECTOR_SEARCH. In the future, it's better we can reuse the same options for both ML_PREDICT and VECTOR_SEARCH.

Copy link
Contributor

@lihaosky lihaosky left a comment

Choose a reason for hiding this comment

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

ConfigOptionsDocsCompletenessITCase still failed with another reason. Otherwise, looks good

Copy link
Contributor

@lihaosky lihaosky 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 4f46693 into apache:master Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed PR has been reviewed by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants