Package io.confluent.flink.plugin
Class ConfluentMLExpressions
java.lang.Object
io.confluent.flink.plugin.ConfluentMLExpressions
Entry point of the ML Function Expression DSL for Confluent Flink ML functions.
This class contains static methods for creating ML function expressions that can be used in
Table API operations. Similar to Flink's Expressions class, this provides a convenient
way to access ML functions in a type-safe manner.
import static io.confluent.flink.plugin.ConfluentMLExpressions.*;
Example usage:
table_env.select(mlOneHotEncoder($("category")).as("one_hot_encoded"));
-
Method Summary
Modifier and TypeMethodDescriptionstatic ApiExpressionaiComplete(String modelName, Object... arguments) Calls the AI_COMPLETE function to generate text completions using AI models.static ApiExpressionaiEmbedding(String modelName, Object... arguments) Calls the AI_EMBEDDING function to generate embeddings using AI models.static ApiExpressionaiRunAgent(String agentName, Object... arguments) Calls the AI_RUN_AGENT function to execute an AI agent workflow.static ApiExpressionaiToolInvoke(String modelName, Object... arguments) Calls the AI_TOOL_INVOKE function to invoke AI tools.static ApiExpressionmlBucketize(Object value, Object arraySplitPoints, Object... arguments) Calls the ML_BUCKETIZE function to bucketize continuous values into discrete buckets.static ApiExpressionmlCharacterTextSplitter(Object text, Object... arguments) Calls the ML_CHARACTER_TEXT_SPLITTER function to split text by character count.static ApiExpressionmlDetectAnomalies(Object value, Object timestamp, Object... arguments) Calls the ML_DETECT_ANOMALIES function to detect anomalies in time series data.static ApiExpressionmlEvaluate(String modelName, Object... arguments) Calls the ML_EVALUATE function to evaluate ML models.static ApiExpressionmlEvaluateAll(String modelName, Object... arguments) Calls the ML_EVALUATE_ALL function to evaluate all versions of ML models.static ApiExpressionmlFileFormatTextSplitter(Object text, Object... arguments) Calls the ML_FILE_FORMAT_TEXT_SPLITTER function to split text based on file format.static ApiExpressionmlForecast(Object value, Object timestamp, Object... arguments) Calls the ML_FORECAST function to forecast time series data.static ApiExpressionmlLabelEncoder(Object value, Object categories, Object... arguments) Calls the ML_LABEL_ENCODER function to encode categorical labels as integers.static ApiExpressionmlMaxAbsScaler(Object features, Object... arguments) Calls the ML_MAX_ABS_SCALER function to scale features by their maximum absolute value.static ApiExpressionmlMinMaxScaler(Object value, Object... arguments) Calls the ML_MIN_MAX_SCALER function to scale features to a fixed range (typically [0, 1]).static ApiExpressionCalls the ML_NGRAMS function to generate n-grams from text.static ApiExpressionmlNormalizer(Object value, Object... arguments) Calls the ML_NORMALIZER function to normalize vectors to have unit norm.static ApiExpressionmlOneHotEncoder(Object value, Object... arguments) Calls the ML_ONE_HOT_ENCODER function to perform one-hot encoding of categorical variables.static ApiExpressionmlRecursiveTextSplitter(Object text, Object... arguments) Calls the ML_RECURSIVE_TEXT_SPLITTER function to split text recursively with hierarchy.static ApiExpressionmlRobustScaler(Object value, Object... arguments) Calls the ML_ROBUST_SCALER function to scale features using robust statistics.static ApiExpressionmlStandardScaler(Object value, Object... arguments) Calls the ML_STANDARD_SCALER function to standardize features (zero mean, unit variance).
-
Method Details
-
aiComplete
Calls the AI_COMPLETE function to generate text completions using AI models.Example usage:
table_env.from("table-name").joinLateral(aiComplete("model-name",$("input"), lit(","))) .select("input", "completion");- Parameters:
modelName- the name of the AI model to usearguments- the input arguments for text completion- Returns:
- an expression that calls the AI_COMPLETE function
-
aiEmbedding
Calls the AI_EMBEDDING function to generate embeddings using AI models.Example usage:
table_env.from("table-name").joinLateral(aiEmbedding("model-name",$("input"), lit(","))) .select("input", "embedding");- Parameters:
modelName- the name of the embedding model to usearguments- the input arguments for embedding generation- Returns:
- an expression that calls the AI_EMBEDDING function
-
aiRunAgent
Calls the AI_RUN_AGENT function to execute an AI agent workflow.Example usage:
table_env.select(aiRunAgent("agent-name", $("input")).as("agent_response"));- Parameters:
agentName- the name of the agent to runarguments- the input arguments for the agent- Returns:
- an expression that calls the AI_RUN_AGENT function
-
aiToolInvoke
Calls the AI_TOOL_INVOKE function to invoke AI tools.Example usage:
table_env.select(aiToolInvoke("model-name", $("input")).as("result"))- Parameters:
modelName- the name of the text_generation model to usearguments- the input arguments for the tool- Returns:
- an expression that calls the AI_TOOL_INVOKE function
-
mlEvaluate
Calls the ML_EVALUATE function to evaluate ML models.Example usage:
table_env.groupBy($("group_key")) .aggregate(mlEvaluate("model-name", $("features"), $("labels")).as("metrics"))- Parameters:
modelName- the name of the ML model to evaluatearguments- the input arguments for model evaluation- Returns:
- an expression that calls the ML_EVALUATE function
-
mlEvaluateAll
Calls the ML_EVALUATE_ALL function to evaluate all versions of ML models.Example usage:
table_env.groupBy($("group_key")) .aggregate(mlEvaluateAll("model-name", $("features"), $("labels")).as("all_metrics"))- Parameters:
modelName- the name of the ML model to evaluate all versionsarguments- the input arguments for model evaluation- Returns:
- an expression that calls the ML_EVALUATE_ALL function
-
mlDetectAnomalies
Calls the ML_DETECT_ANOMALIES function to detect anomalies in time series data.- Parameters:
value- the numeric value columntimestamp- the timestamp columnarguments- additional optional arguments- Returns:
- an expression that calls the ML_DETECT_ANOMALIES function
-
mlForecast
Calls the ML_FORECAST function to forecast time series data.- Parameters:
value- the numeric value columntimestamp- the timestamp columnarguments- additional optional arguments- Returns:
- an expression that calls the ML_FORECAST function
-
mlBucketize
Calls the ML_BUCKETIZE function to bucketize continuous values into discrete buckets.Example usage:
table_env.select(mlBucketize($("age"), [5, 18, 65, 100]).as("age_bucket"))- Parameters:
value- the value to bucketizearguments- the bucket boundaries or configuration- Returns:
- an expression that calls the ML_BUCKETIZE function
-
mlLabelEncoder
Calls the ML_LABEL_ENCODER function to encode categorical labels as integers.Example usage:
table_env.select(mlLabelEncoder($("category")).as("encoded_category"))- Parameters:
value- the categorical value to encodearguments- additional encoding configuration- Returns:
- an expression that calls the ML_LABEL_ENCODER function
-
mlOneHotEncoder
Calls the ML_ONE_HOT_ENCODER function to perform one-hot encoding of categorical variables.Example usage:
table_env.select(mlOneHotEncoder($("category")).as("one_hot_encoded"))- Parameters:
value- the categorical value to one-hot encodearguments- additional encoding configuration- Returns:
- an expression that calls the ML_ONE_HOT_ENCODER function
-
mlMinMaxScaler
Calls the ML_MIN_MAX_SCALER function to scale features to a fixed range (typically [0, 1]).Example usage:
table_env.select(mlMinMaxScaler($("feature")).as("scaled_feature"))- Parameters:
value- the numeric value to scalearguments- additional scaling configuration (min, max values)- Returns:
- an expression that calls the ML_MIN_MAX_SCALER function
-
mlMaxAbsScaler
Calls the ML_MAX_ABS_SCALER function to scale features by their maximum absolute value.Example usage:
table_env.select(mlMaxAbsScaler(array($("feature1"), $("feature2"))).as("scaled_features"))- Parameters:
features- the features to scale (typically an array)arguments- additional scaling configuration- Returns:
- an expression that calls the ML_MAX_ABS_SCALER function
-
mlStandardScaler
Calls the ML_STANDARD_SCALER function to standardize features (zero mean, unit variance).Example usage:
table_env.select(mlStandardScaler($("feature")).as("standardized_feature"))- Parameters:
value- the numeric value to standardizearguments- additional scaling configuration- Returns:
- an expression that calls the ML_STANDARD_SCALER function
-
mlRobustScaler
Calls the ML_ROBUST_SCALER function to scale features using robust statistics.Example usage:
table_env.select(mlRobustScaler($("feature")).as("robust_scaled_feature"))- Parameters:
value- the numeric value to scalearguments- additional scaling configuration- Returns:
- an expression that calls the ML_ROBUST_SCALER function
-
mlNormalizer
Calls the ML_NORMALIZER function to normalize vectors to have unit norm.Example usage:
table_env.select(mlNormalizer($("vector_feature")).as("normalized_vector"))- Parameters:
value- the vector to normalizearguments- additional normalization configuration (e.g., norm type)- Returns:
- an expression that calls the ML_NORMALIZER function
-
mlCharacterTextSplitter
Calls the ML_CHARACTER_TEXT_SPLITTER function to split text by character count.Example usage:
table_env.select(mlCharacterTextSplitter($("text"), 100).as("text_chunks"))- Parameters:
text- the text to splitarguments- splitting configuration (chunk size, overlap, etc.)- Returns:
- an expression that calls the ML_CHARACTER_TEXT_SPLITTER function
-
mlRecursiveTextSplitter
Calls the ML_RECURSIVE_TEXT_SPLITTER function to split text recursively with hierarchy.Example usage:
table_env.select(mlRecursiveTextSplitter($("text"), 500, 50).as("text_chunks"))- Parameters:
text- the text to splitarguments- splitting configuration (chunk size, overlap, separators, etc.)- Returns:
- an expression that calls the ML_RECURSIVE_TEXT_SPLITTER function
-
mlFileFormatTextSplitter
Calls the ML_FILE_FORMAT_TEXT_SPLITTER function to split text based on file format.Example usage:
table_env.select(mlFileFormatTextSplitter($("document"), "markdown").as("text_chunks"))- Parameters:
text- the text/document to splitarguments- splitting configuration (format type, chunk size, etc.)- Returns:
- an expression that calls the ML_FILE_FORMAT_TEXT_SPLITTER function
-
mlNgrams
Calls the ML_NGRAMS function to generate n-grams from text.Example usage:
table_env.select(mlNgrams($("text"), 2).as("bigrams")) // Generate bigrams- Parameters:
input- the text to generate n-grams fromarguments- n-gram configuration (n value, tokenizer options, etc.)- Returns:
- an expression that calls the ML_NGRAMS function
-