You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "lixu (Jira)" <ji...@apache.org> on 2024/04/24 10:13:00 UTC
[jira] [Created] (FLINK-35229) join An error occurred when the table was empty
lixu created FLINK-35229:
----------------------------
Summary: join An error occurred when the table was empty
Key: FLINK-35229
URL: https://issues.apache.org/jira/browse/FLINK-35229
Project: Flink
Issue Type: Bug
Components: Table SQL / API
Affects Versions: 1.19.0, 1.17.2, 1.18.0
Reporter: lixu
Fix For: 1.17.3, 1.19.1, 1.18.1
{code:java}
//代码占位符
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(); {code}
+----+--------------------------------+----------------------+----------------------+----------------------+
| 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 |
+----+--------------------------------+----------------------+----------------------+----------------------+
--
This message was sent by Atlassian Jira
(v8.20.10#820010)