Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-35229

join An error occurred when the table was empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.18.0, 1.17.2, 1.19.0
    • 1.18.1, 1.17.3, 1.19.2
    • Table SQL / API
    • None

    Description

      //代码占位符
      StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
      env.setRuntimeMode(RuntimeExecutionMode.BATCH).setParallelism(1);
      StreamTableEnvironment tableEnvironment = StreamTableEnvironment.create(env);
      
      Table ticker = tableEnvironment.fromValues(
              DataTypes.ROW(
                      DataTypes.FIELD("symbol", DataTypes.STRING()),
                      DataTypes.FIELD("price", DataTypes.BIGINT())
              ),
              row("A", 12L),
              row("B", 17L)
      );
      tableEnvironment.createTemporaryView("ticker_t", ticker);
      
      Table ticker1 = tableEnvironment.fromValues(
              DataTypes.ROW(
                      DataTypes.FIELD("symbol", DataTypes.STRING()),
                      DataTypes.FIELD("price", DataTypes.BIGINT())
              )
      );
      tableEnvironment.createTemporaryView("ticker_y", ticker1);
      
      Table ticker2 = tableEnvironment.fromValues(
              DataTypes.ROW(
                      DataTypes.FIELD("symbol", DataTypes.STRING()),
                      DataTypes.FIELD("price", DataTypes.BIGINT())
              ),
              row("A", 12L),
              row("B", 17L)
      );
      tableEnvironment.createTemporaryView("ticker_z", ticker2);
      
      tableEnvironment.sqlQuery("select coalesce(t.symbol, y.symbol, z.symbol) as symbol, " +
                      " t.price as price_t, y.price as price_y,  z.price as price_z " +
                      "from ticker_t t FULL OUTER JOIN ticker_y y ON t.symbol = y.symbol " +
                      "FULL OUTER JOIN ticker_z z ON y.symbol = z.symbol")
              .execute().print(); 

      ----------------------------------------------------------------------------------------------

      op                         symbol              price_t              price_y              price_z

      ----------------------------------------------------------------------------------------------

      +I                              A                   12               <NULL>               <NULL>
      +I                              B                   17               <NULL>               <NULL>
      +I                              A               <NULL>               <NULL>                   12
      +I                              B               <NULL>               <NULL>                   17

      ----------------------------------------------------------------------------------------------

      Attachments

        Activity

          People

            Unassigned Unassigned
            leexu lixu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: