snuyanzin commented on code in PR #28664:
URL: https://github.com/apache/flink/pull/28664#discussion_r3549436461
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/stream/sql/SnapshotTableFunctionTest.java:
##########
@@ -65,60 +65,42 @@ void setup() {
+ " rate_time TIMESTAMP(3),"
+ " WATERMARK FOR rate_time AS rate_time"
+ ") WITH ('connector' = 'values')");
- // Sinks used by the execution tests below.
- util.tableEnv()
- .executeSql(
- "CREATE TABLE RatesSink ("
- + " currency STRING,"
- + " rate INT,"
- + " rate_time TIMESTAMP(3)"
- + ") WITH ('connector' = 'blackhole')");
- util.tableEnv()
- .executeSql(
- "CREATE TABLE JoinSink ("
- + " order_id INT,"
- + " amount INT,"
- + " rate INT"
- + ") WITH ('connector' = 'blackhole')");
- }
-
- @Test
- void testFromContext() {
- // SNAPSHOT used as a standalone table function with the full set of
named arguments
- util.verifyRelPlan(
- "SELECT * FROM SNAPSHOT("
- + "input => TABLE Rates, "
- + "load_completed_condition => 'user_time', "
- + "load_completed_time => CAST(TIMESTAMP '2026-07-01
00:00:00.001' AS TIMESTAMP_LTZ(3)), "
- + "load_completed_idle_timeout => INTERVAL '10'
SECOND, "
- + "state_ttl => INTERVAL '1' DAY)");
}
@Test
void testLateralContext() {
- // SNAPSHOT used in a LATERAL context
- util.verifyRelPlan(
- "SELECT o.order_id, o.amount, r.rate "
- + "FROM Orders AS o, LATERAL TABLE(SNAPSHOT(input =>
TABLE Rates)) AS r "
- + "WHERE o.currency = r.currency");
+ // SNAPSHOT used in a LATERAL context is rewritten into the dedicated
LATERAL SNAPSHOT join.
+ // An explicit load_completed_time keeps the rewrite deterministic; we
only assert that the
+ // dedicated join node appears rather than pinning the whole plan.
+ final String plan =
+ util.tableEnv()
+ .explainSql(
+ "SELECT o.order_id, o.amount, r.rate "
Review Comment:
i wonder if we need to have a couple of tests like: create a view with a
query with `LATERAL SNAPSHOT` and check that `SELECT` from this view continues
working?
Asking to be sure expanded version (which is used in views and materialized
tables) still a valid one
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]