From 8eea15573fe719f3c905be7a0bb8b9d9e2e0bb65 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 13 Mar 2023 14:50:25 +0800 Subject: [PATCH 1/2] Update src/frontend/src/optimizer/plan_visitor/temporal_join_validator.rs Co-authored-by: Bugen Zhao --- .../src/optimizer/plan_visitor/temporal_join_validator.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/optimizer/plan_visitor/temporal_join_validator.rs b/src/frontend/src/optimizer/plan_visitor/temporal_join_validator.rs index 1de8cfd332ea..93cfe5858420 100644 --- a/src/frontend/src/optimizer/plan_visitor/temporal_join_validator.rs +++ b/src/frontend/src/optimizer/plan_visitor/temporal_join_validator.rs @@ -37,8 +37,8 @@ impl PlanVisitor for TemporalJoinValidator { stream_table_scan.logical().for_system_time_as_of_now() } - fn visit_batch_seq_scan(&mut self, bathc_seq_scan: &BatchSeqScan) -> bool { - bathc_seq_scan.logical().for_system_time_as_of_now() + fn visit_batch_seq_scan(&mut self, batch_seq_scan: &BatchSeqScan) -> bool { + batch_seq_scan.logical().for_system_time_as_of_now() } fn visit_logical_scan(&mut self, logical_scan: &LogicalScan) -> bool { From aa53c53bbe823928cec536f4fbf16128cd462c71 Mon Sep 17 00:00:00 2001 From: Dylan Chen Date: Mon, 13 Mar 2023 14:57:14 +0800 Subject: [PATCH 2/2] testing the format of temporal join --- src/sqlparser/tests/testdata/select.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sqlparser/tests/testdata/select.yaml b/src/sqlparser/tests/testdata/select.yaml index 05dc060777ee..b891b97c6edf 100644 --- a/src/sqlparser/tests/testdata/select.yaml +++ b/src/sqlparser/tests/testdata/select.yaml @@ -76,3 +76,6 @@ error_msg: |- sql parser error: Expected end of statement, found: ( Near "SELECT 1::int" +- input: select id1, a1, id2, a2 from stream as S join version FOR SYSTEM_TIME AS OF NOW() AS V on id1= id2 + formatted_sql: SELECT id1, a1, id2, a2 FROM stream AS S JOIN version FOR SYSTEM_TIME AS OF NOW() AS V ON id1 = id2 + formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Identifier(Ident { value: "id1", quote_style: None })), UnnamedExpr(Identifier(Ident { value: "a1", quote_style: None })), UnnamedExpr(Identifier(Ident { value: "id2", quote_style: None })), UnnamedExpr(Identifier(Ident { value: "a2", quote_style: None }))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "stream", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "S", quote_style: None }, columns: [] }), for_system_time_as_of_now: false }, joins: [Join { relation: Table { name: ObjectName([Ident { value: "version", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "V", quote_style: None }, columns: [] }), for_system_time_as_of_now: true }, join_operator: Inner(On(BinaryOp { left: Identifier(Ident { value: "id1", quote_style: None }), op: Eq, right: Identifier(Ident { value: "id2", quote_style: None }) })) }] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })' \ No newline at end of file