Flink sql 之sql执行计划

Flink sql 之sql执行计划,第1张

Flink sql 之sql执行计划 flink sql 的执行计划 查看方式3种

1.方式一

  // 计算iopv
        Table calculateTable = tableEnv.sqlQuery("select n" +
                "  fund_code,n" +
                "   (sum_cash+sum_creation_cash_substitute+estimate_cash_component)/creation_redemption_unit as real_time_iopv,n" +
                "  CURRENT_TIMESTAMP as computation_time n" +
                "   from " + checkTable);

        TableResult tableResult = tableEnv.executeSql(" explain select * from " + calculateTable);
        tableResult.print();


2.方式二

      // 维表 join
        Table dimJoin = tableEnv.sqlQuery(
                "select  " +
                        "proctime,update_time,last_price, pc.underlying_security_id,pc.fund_code,pc.trading_day," +
                        "pl.creation_redemption_unit,pc.creation_cash_substitute,pl.estimate_cash_component," +
                        " pc.substitute_flag,pc.substitute_flag,pc.component_share " +
                        " from " + sourceTable +
                        " as hsh left join " + pcfComponents +
                        " FOR SYSTEM_TIME AS OF hsh.proctime as pc on hsh.prod_code=pc.underlying_security_id" +
                        " left join " + pcfList +
                        " FOR SYSTEM_TIME AS OF hsh.proctime as pl on pl.fund_code=pc.fund_code" +
                        " where pl.trading_day in ('2021-12-31') " +
//                        " and pc.underlying_security_id <> '159900' and pc.creation_cash_substitute is not null "+
                        " and index <> 'true' "
        );

        String sql = tableEnv.explainSql("select * from " + dimJoin);
        System.out.println(sql);


3.方式三

// 老版本
tableEnv.explain(Table类型)
// 新版本 flink 1.13 
tableEnv.explainSql("select 字符串")

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5696064.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存