-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow overwrite stream_rate_control in with clause (#13009)
Signed-off-by: tabVersion <[email protected]>
- Loading branch information
1 parent
059a840
commit 942a526
Showing
13 changed files
with
147 additions
and
26 deletions.
There are no files selected for viewing
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,23 @@ | ||
# streaming_rate_limit also applies to create sink and create source, please refer to | ||
# e2e_test/source/basic/kafka.slt and e2e_test/sink/kafka/create_sink.slt for this part | ||
|
||
statement ok | ||
create table t1 (v1 int); | ||
|
||
# tracked in https://github.com/risingwavelabs/risingwave/issues/13474 | ||
# create with duplicate streaming_rate_limit | ||
# statement error | ||
# create materialized view mv1 with (streaming_rate_limit = 1000, streaming_rate_limit = 2000) as select * from t1; | ||
|
||
# create with unknown fields | ||
statement error unexpected options in WITH clause | ||
create materialized view mv1 with (streaming_rate_limit = 1000, unknown_field = 2000) as select * from t1; | ||
|
||
statement ok | ||
create materialized view mv1 with (streaming_rate_limit = 1000) as select * from t1; | ||
|
||
statement ok | ||
drop materialized view mv1; | ||
|
||
statement ok | ||
drop table t1; |
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
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
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,52 @@ | ||
// 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 crate::handler::HandlerArgs; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub struct OverwriteOptions { | ||
pub streaming_rate_limit: Option<u32>, | ||
// ttl has been deprecated | ||
pub ttl: Option<u32>, | ||
} | ||
|
||
impl OverwriteOptions { | ||
const STREAMING_RATE_LIMIT_KEY: &'static str = "streaming_rate_limit"; | ||
const TTL_KEY: &'static str = "ttl"; | ||
|
||
pub fn new(args: &mut HandlerArgs) -> Self { | ||
let streaming_rate_limit = { | ||
if let Some(x) = args | ||
.with_options | ||
.inner_mut() | ||
.remove(Self::STREAMING_RATE_LIMIT_KEY) | ||
{ | ||
// FIXME(tabVersion): validate the value | ||
Some(x.parse::<u32>().unwrap()) | ||
} else { | ||
args.session.config().get_streaming_rate_limit() | ||
} | ||
}; | ||
let ttl = args | ||
.with_options | ||
.inner_mut() | ||
.remove(Self::TTL_KEY) | ||
// FIXME(tabVersion): validate the value | ||
.map(|x| x.parse::<u32>().unwrap()); | ||
Self { | ||
streaming_rate_limit, | ||
ttl, | ||
} | ||
} | ||
} |
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