All Products
Search
Document Center

Realtime Compute for Apache Flink:Text translation

Last Updated:Oct 20, 2026

Translates a text column in a Flink SQL job using a large language model (LLM).

Limitations

  • Requires Ververica Runtime (VVR) 11.4 or later.

  • To use the Flink AI service (built-in models), VVR 11.7 or later is required, and the Flink AI service must be activated. For details, see Flink AI service (built-in models).

  • Throughput is subject to rate limiting by the model platform. When the rate limit is exceeded, the Flink job experiences backpressure and this operator becomes a bottleneck. Severe rate limiting triggers timeout errors and causes the job to restart.

Syntax

AI_TRANSLATE(
  MODEL => MODEL <MODEL NAME>,
  INPUT => <INPUT COLUMN NAME>,
  SOURCE_LANG => <SOURCE LANGUAGE>,
  TARGET_LANG => <TARGET LANGUAGE>
)

Parameters

Parameter Data type Description
MODEL <MODEL NAME> MODEL The name of the registered model service. For more information, see Model settings. The output type of this model must be VARIANT.
<INPUT COLUMN NAME> STRING The source text to translate.
<SOURCE LANGUAGE> STRING The language code of the source text (for example, zh for Chinese). Pass auto to let the model detect the language automatically. The following source languages are supported: Chinese (zh), English (en), Japanese (ja), Korean (ko), French (fr), German (de), Spanish (es), Russian (ru), Arabic (ar), and Portuguese (pt). Note: The actually supported languages depend on the model you register. Note: This parameter must be a constant.
<TARGET LANGUAGE> STRING The language code of the target language (for example, zh for Chinese). The following target languages are supported: Chinese (zh), English (en), Japanese (ja), Korean (ko), French (fr), German (de), Spanish (es), Russian (ru), Arabic (ar), and Portuguese (pt). Note: The actually supported languages depend on the model you register. Note: This parameter must be a constant.

Return values

Field Data type Description
translated_text STRING The translated text.
detected_language STRING The detected source language.

Examples

Test data

id content
1 I like Flink very much. It's so fast!

SQL statements

The following example references a Flink built-in model and uses AI_TRANSLATE to translate the input text.

CREATE TEMPORARY MODEL general_model
INPUT (`input` STRING)
OUTPUT (`content` VARIANT)
WITH (
    'provider' = 'openai-compat',
    'task'      = 'chat/completions',
    'model'     = 'qwen3.6-flash'
);

CREATE TEMPORARY VIEW infos(id, content)
AS VALUES (1, 'I like Flink very much. It''s so fast!');

-- Positional argument syntax
SELECT id, translated_text, detected_language
FROM infos,
LATERAL TABLE(
  AI_TRANSLATE(
    MODEL general_model,
    content,
    'auto',
    'zh'
  ));

-- Named argument syntax
SELECT id, translated_text, detected_language
FROM infos,
LATERAL TABLE(
  AI_TRANSLATE(
    MODEL => MODEL general_model,
    INPUT => content,
    SOURCE_LANG => 'auto',
    TARGET_LANG => 'zh'
  ));

Output

id translated_text detected_language
1 我非常喜欢 Flink,它非常快! en