9、Flink SQL 流式概念之Compiled Plan详解

生成 Compiled Plan

配置过程首先会使用 COMPILE PLAN 语句生成一个 JSON 文件,它表示了序列化后的执行计划。

COMPILE PLAN 不支持查询语句 SELECT... FROM...

执行 COMPILE PLAN 语句

TableEnvironment tableEnv = TableEnvironment.create(EnvironmentSettings.inStreamingMode());

tableEnv.executeSql(
    "CREATE TABLE orders (order_id BIGINT, order_line_id BIGINT, buyer_id BIGINT, ...)");
tableEnv.executeSql(
    "CREATE TABLE line_orders (order_line_id BIGINT, order_status TINYINT, ...)");
tableEnv.executeSql(
    "CREATE TABLE enriched_orders (order_id BIGINT, order_line_id BIGINT, order_status TINYINT, ...)");

// CompilePlan#writeToFile only supports a local file path, if you need to write to remote filesystem,
// please use tableEnv.executeSql("COMPILE PLAN 'hdfs://path/to/plan.json' FOR ...")
CompiledPlan compiledPlan = 
    tableEnv.compilePlanSql(
      

你可能感兴趣的:(Flink,SQL,flink,sql,数据库)