-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce watermark on source (#7750)
Done: - introduce watermark on source. TODO: - watermark expr display in frontend - define multiple watermark on source - define watermark on table Approved-By: fuyufjh
- Loading branch information
Showing
24 changed files
with
464 additions
and
56 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is automatically generated. See `src/frontend/planner_test/README.md` for more information. | ||
- name: watermark on source | ||
sql: | | ||
create source t (v1 timestamp with time zone, watermark for v1 as v1 - INTERVAL '1' SECOND) ROW FORMAT JSON; | ||
select t.v1 - INTERVAL '2' SECOND as v1 from t; | ||
logical_plan: | | ||
LogicalProject { exprs: [(v1 - '00:00:02':Interval)] } | ||
└─LogicalSource { source: t, columns: [v1, _row_id], time_range: [(Unbounded, Unbounded)] } | ||
stream_plan: | | ||
StreamMaterialize { columns: [v1, _row_id(hidden)], pk_columns: [_row_id] } | ||
└─StreamExchange { dist: HashShard(_row_id) } | ||
└─StreamProject { exprs: [(v1 - '00:00:02':Interval), _row_id], watermark_columns: [(v1 - '00:00:02':Interval)] } | ||
└─StreamRowIdGen { row_id_index: 1 } | ||
└─StreamWatermarkFilter | ||
└─StreamSource { source: "t", columns: ["v1", "_row_id"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2023 RisingWave Labs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use itertools::Itertools; | ||
use risingwave_common::catalog::{ColumnCatalog, Field}; | ||
use risingwave_common::error::Result; | ||
|
||
use crate::Binder; | ||
|
||
impl Binder { | ||
pub fn bind_columns_to_context( | ||
&mut self, | ||
name: String, | ||
column_catalogs: Vec<ColumnCatalog>, | ||
) -> Result<()> { | ||
let columns = column_catalogs | ||
.iter() | ||
.map(|c| (c.is_hidden, Field::from(&c.column_desc))) | ||
.collect_vec(); | ||
self.bind_table_to_context(columns, name, None) | ||
} | ||
|
||
pub fn get_column_binding_index( | ||
&mut self, | ||
table_name: String, | ||
column_name: &String, | ||
) -> Result<usize> { | ||
Ok(self | ||
.context | ||
.get_column_binding_index(&Some(table_name), column_name)?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.