Skip to content

Commit

Permalink
refactor: remove prefix "rw_" in session variables
Browse files Browse the repository at this point in the history
Signed-off-by: xxchan <[email protected]>
  • Loading branch information
xxchan committed Sep 30, 2024
1 parent f7e5068 commit b288278
Show file tree
Hide file tree
Showing 23 changed files with 113 additions and 86 deletions.
8 changes: 4 additions & 4 deletions e2e_test/batch/aggregate/two_phase_agg.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ statement ok
SET RW_IMPLICIT_FLUSH TO true;

statement ok
SET RW_ENABLE_TWO_PHASE_AGG=false;
SET ENABLE_TWO_PHASE_AGG=false;

# This should override `RW_ENABLE_TWO_PHASE_AGG`, enabling it.
# This should override `ENABLE_TWO_PHASE_AGG`, enabling it.
statement ok
SET RW_FORCE_TWO_PHASE_AGG=true;

query T
SHOW RW_ENABLE_TWO_PHASE_AGG;
SHOW ENABLE_TWO_PHASE_AGG;
----
true

Expand Down Expand Up @@ -41,4 +41,4 @@ aaaaaaaaaanz 0 0
abc 3 1

statement ok
drop table t;
drop table t;
26 changes: 13 additions & 13 deletions e2e_test/batch/catalog/pg_settings.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ user application_name
user backfill_rate_limit
user background_ddl
user batch_enable_distributed_dml
user batch_enable_lookup_join
user batch_enable_sort_agg
user batch_parallelism
user bypass_cluster_limits
user bytea_output
Expand All @@ -29,27 +31,21 @@ user client_encoding
user client_min_messages
user create_compaction_group_for_mv
user datestyle
user enable_join_ordering
user enable_share_plan
user enable_shared_source
user enable_two_phase_agg
user extra_float_digits
user force_split_distinct_agg
user force_two_phase_agg
user idle_in_transaction_session_timeout
user implicit_flush
user intervalstyle
user lock_timeout
user max_split_range_gap
user query_epoch
user query_mode
user row_security
user rw_batch_enable_lookup_join
user rw_batch_enable_sort_agg
user rw_enable_join_ordering
user rw_enable_share_plan
user rw_enable_shared_source
user rw_enable_two_phase_agg
user rw_force_split_distinct_agg
user rw_force_two_phase_agg
user rw_implicit_flush
user rw_streaming_allow_jsonb_in_stream_key
user rw_streaming_enable_bushy_join
user rw_streaming_enable_delta_join
user rw_streaming_over_window_cache_policy
user search_path
user server_encoding
user server_version
Expand All @@ -58,7 +54,11 @@ user sink_decouple
user source_rate_limit
user standard_conforming_strings
user statement_timeout
user streaming_allow_jsonb_in_stream_key
user streaming_enable_bushy_join
user streaming_enable_delta_join
user streaming_max_parallelism
user streaming_over_window_cache_policy
user streaming_parallelism
user streaming_use_arrangement_backfill
user streaming_use_snapshot_backfill
Expand Down
26 changes: 26 additions & 0 deletions e2e_test/ddl/alter_session_params.slt
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Test aliases
# RW_ prefix are aliases to the one without prefix. <https://github.com/risingwavelabs/risingwave/pull/18769>
query T
show STREAMING_ENABLE_DELTA_JOIN;
----
false

statement ok
set STREAMING_ENABLE_DELTA_JOIN to true;

query T
show STREAMING_ENABLE_DELTA_JOIN;
----
true

query T
show RW_STREAMING_ENABLE_DELTA_JOIN;
----
true

statement ok
set STREAMING_ENABLE_DELTA_JOIN to false;

# Test aliases done

statement ok
set RW_STREAMING_ENABLE_DELTA_JOIN to true;

Expand All @@ -16,6 +41,7 @@ set RW_STREAMING_ENABLE_DELTA_JOIN to false;
statement ok
alter system set rw_streaming_enable_delta_join to true;

# Alter system won't change the current session's params.
query T
show RW_STREAMING_ENABLE_DELTA_JOIN;
----
Expand Down
4 changes: 2 additions & 2 deletions e2e_test/source_inline/kafka/shared_source.slt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
control substitution on

statement ok
SET rw_enable_shared_source TO true;
SET enable_shared_source TO true;

system ok
rpk topic create shared_source -p 4
Expand Down Expand Up @@ -86,7 +86,7 @@ internal_table.mjs --name mv_1 --type sourcebackfill

# This does not affect the behavior for CREATE MATERIALIZED VIEW below. It also uses the shared source, and creates SourceBackfillExecutor.
statement ok
SET rw_enable_shared_source TO false;
SET enable_shared_source TO false;

statement ok
create materialized view mv_2 as select * from s0;
Expand Down
8 changes: 4 additions & 4 deletions e2e_test/streaming/aggregate/two_phase_agg.slt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ statement ok
SET RW_IMPLICIT_FLUSH TO true;

statement ok
SET RW_ENABLE_TWO_PHASE_AGG=false;
SET ENABLE_TWO_PHASE_AGG=false;

# This should override `RW_ENABLE_TWO_PHASE_AGG`, enabling it.
# This should override `ENABLE_TWO_PHASE_AGG`, enabling it.
statement ok
SET RW_FORCE_TWO_PHASE_AGG=true;

query T
SHOW RW_ENABLE_TWO_PHASE_AGG;
SHOW ENABLE_TWO_PHASE_AGG;
----
true

Expand Down Expand Up @@ -58,4 +58,4 @@ statement ok
drop materialized view m1;

statement ok
drop table t;
drop table t;
2 changes: 1 addition & 1 deletion risedev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ profile:
# # Specify custom environment variables
# env:
# RUST_LOG: "info,risingwave_storage::hummock=off"
# RW_ENABLE_PRETTY_LOG: "true"
# ENABLE_PRETTY_LOG: "true"
steps:
# If you want to use the local s3 storage, enable the following line
# - use: minio
Expand Down
7 changes: 4 additions & 3 deletions src/common/proc_macro/src/session_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub(crate) fn derive_config(input: DeriveInput) -> TokenStream {

if let Some(alias) = alias {
alias_to_entry_name_branches.push(quote! {
#alias => #entry_name,
#alias => #entry_name.to_string(),
})
}

Expand Down Expand Up @@ -277,10 +277,11 @@ pub(crate) fn derive_config(input: DeriveInput) -> TokenStream {
}

pub fn alias_to_entry_name(key_name: &str) -> String {
match key_name {
let key_name = key_name.to_ascii_lowercase();
match key_name.as_str() {
#(#alias_to_entry_name_branches)*
_ => key_name,
}.to_ascii_lowercase()
}
}

#(#struct_impl_get)*
Expand Down
28 changes: 14 additions & 14 deletions src/common/src/session_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct SessionConfig {
/// If `RW_IMPLICIT_FLUSH` is on, then every INSERT/UPDATE/DELETE statement will block
/// until the entire dataflow is refreshed. In other words, every related table & MV will
/// be able to see the write.
#[parameter(default = false, rename = "rw_implicit_flush")]
#[parameter(default = false, alias = "rw_implicit_flush")]
implicit_flush: bool,

/// If `CREATE_COMPACTION_GROUP_FOR_MV` is on, dedicated compaction groups will be created in
Expand Down Expand Up @@ -96,12 +96,12 @@ pub struct SessionConfig {
date_style: String,

/// Force the use of lookup join instead of hash join when possible for local batch execution.
#[parameter(default = true, rename = "rw_batch_enable_lookup_join")]
#[parameter(default = true, alias = "rw_batch_enable_lookup_join")]
batch_enable_lookup_join: bool,

/// Enable usage of sortAgg instead of hash agg when order property is satisfied in batch
/// execution
#[parameter(default = true, rename = "rw_batch_enable_sort_agg")]
#[parameter(default = true, alias = "rw_batch_enable_sort_agg")]
batch_enable_sort_agg: bool,

/// Enable distributed DML, so an insert, delete, and update statement can be executed in a distributed way (e.g. running in multiple compute nodes).
Expand Down Expand Up @@ -150,11 +150,11 @@ pub struct SessionConfig {
streaming_parallelism: ConfigNonZeroU64,

/// Enable delta join for streaming queries. Defaults to false.
#[parameter(default = false, rename = "rw_streaming_enable_delta_join")]
#[parameter(default = false, alias = "rw_streaming_enable_delta_join")]
streaming_enable_delta_join: bool,

/// Enable bushy join for streaming queries. Defaults to true.
#[parameter(default = true, rename = "rw_streaming_enable_bushy_join")]
#[parameter(default = true, alias = "rw_streaming_enable_bushy_join")]
streaming_enable_bushy_join: bool,

/// Enable arrangement backfill for streaming queries. Defaults to true.
Expand All @@ -169,32 +169,32 @@ pub struct SessionConfig {
streaming_use_snapshot_backfill: bool,

/// Allow `jsonb` in stream key
#[parameter(default = false, rename = "rw_streaming_allow_jsonb_in_stream_key")]
#[parameter(default = false, alias = "rw_streaming_allow_jsonb_in_stream_key")]
streaming_allow_jsonb_in_stream_key: bool,

/// Enable join ordering for streaming and batch queries. Defaults to true.
#[parameter(default = true, rename = "rw_enable_join_ordering")]
#[parameter(default = true, alias = "rw_enable_join_ordering")]
enable_join_ordering: bool,

/// Enable two phase agg optimization. Defaults to true.
/// Setting this to true will always set `FORCE_TWO_PHASE_AGG` to false.
#[parameter(default = true, flags = "SETTER", rename = "rw_enable_two_phase_agg")]
#[parameter(default = true, flags = "SETTER", alias = "rw_enable_two_phase_agg")]
enable_two_phase_agg: bool,

/// Force two phase agg optimization whenever there's a choice between
/// optimizations. Defaults to false.
/// Setting this to true will always set `ENABLE_TWO_PHASE_AGG` to false.
#[parameter(default = false, flags = "SETTER", rename = "rw_force_two_phase_agg")]
#[parameter(default = false, flags = "SETTER", alias = "rw_force_two_phase_agg")]
force_two_phase_agg: bool,

/// Enable sharing of common sub-plans.
/// This means that DAG structured query plans can be constructed,
#[parameter(default = true, rename = "rw_enable_share_plan")]
#[parameter(default = true, alias = "rw_enable_share_plan")]
/// rather than only tree structured query plans.
enable_share_plan: bool,

/// Enable split distinct agg
#[parameter(default = false, rename = "rw_force_split_distinct_agg")]
#[parameter(default = false, alias = "rw_force_split_distinct_agg")]
force_split_distinct_agg: bool,

/// See <https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-INTERVALSTYLE>
Expand Down Expand Up @@ -276,7 +276,7 @@ pub struct SessionConfig {
/// Cache policy for partition cache in streaming over window.
/// Can be "full", "recent", "`recent_first_n`" or "`recent_last_n`".
#[serde_as(as = "DisplayFromStr")]
#[parameter(default = OverWindowCachePolicy::default(), rename = "rw_streaming_over_window_cache_policy")]
#[parameter(default = OverWindowCachePolicy::default(), alias = "rw_streaming_over_window_cache_policy")]
streaming_over_window_cache_policy: OverWindowCachePolicy,

/// Run DDL statements in background
Expand All @@ -287,8 +287,8 @@ pub struct SessionConfig {
///
/// When enabled, `CREATE SOURCE` will create a source streaming job, and `CREATE MATERIALIZED VIEWS` from the source
/// will forward the data from the same source streaming job, and also backfill prior data from the external source.
#[parameter(default = false)]
rw_enable_shared_source: bool,
#[parameter(default = false, alias = "rw_enable_shared_source")]
enable_shared_source: bool,

/// Shows the server-side character set encoding. At present, this parameter can be shown but not set, because the encoding is determined at database creation time.
#[parameter(default = SERVER_ENCODING)]
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/planner_test/tests/testdata/input/agg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@
- name: enable two phase aggregation with simple agg should have two phase agg
sql: |
SET QUERY_MODE TO DISTRIBUTED;
SET RW_ENABLE_TWO_PHASE_AGG=true;
SET ENABLE_TWO_PHASE_AGG=true;
create table t(v1 int, v2 int);
select min(v1), sum(v2) from t;
expected_outputs:
Expand All @@ -767,7 +767,7 @@
- name: disable two phase aggregation with simple agg
sql: |
SET QUERY_MODE TO DISTRIBUTED;
SET RW_ENABLE_TWO_PHASE_AGG=false;
SET ENABLE_TWO_PHASE_AGG=false;
create table t(v1 int, v2 int);
select min(v1), sum(v2) from t;
expected_outputs:
Expand Down Expand Up @@ -1118,4 +1118,4 @@
CREATE TABLE t (v1 int, v2 int);
SELECT approx_percentile(0.0, 1.0) WITHIN GROUP (order by v1) from t group by v2;
expected_outputs:
- binder_error
- binder_error
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- batch_plan
- name: bushy tree join ordering manually
sql: |
set rw_enable_join_ordering = false;
set enable_join_ordering = false;
create table t1 (v1 int, v2 int);
create table t2 (v3 int, v4 int);
create table t3 (v5 int, v6 int);
Expand All @@ -35,7 +35,7 @@
- batch_plan
- name: right deep tree join ordering manually
sql: |
set rw_enable_join_ordering = false;
set enable_join_ordering = false;
create table t1 (v1 int, v2 int);
create table t2 (v3 int, v4 int);
create table t3 (v5 int, v6 int);
Expand All @@ -44,4 +44,4 @@
expected_outputs:
- logical_plan
- stream_plan
- batch_plan
- batch_plan
6 changes: 3 additions & 3 deletions src/frontend/planner_test/tests/testdata/input/share.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
- logical_plan
- batch_plan
- sql: |
set rw_enable_share_plan=true;
set enable_share_plan=true;
create table t(a int, b int);
with cte as (select count(*) from t) select * from cte union all select * from cte;
expected_outputs:
- stream_plan
- sql: |
set rw_enable_share_plan=false;
set enable_share_plan=false;
create table t(a int, b int);
with cte as (select count(*) from t) select * from cte union all select * from cte;
expected_outputs:
Expand All @@ -76,7 +76,7 @@
before:
- create_sources
sql: |
set rw_enable_share_plan=false;
set enable_share_plan=false;
select count(*) cnt from auction A join auction B on A.id = B.id;
expected_outputs:
- stream_plan
Expand Down
Loading

0 comments on commit b288278

Please sign in to comment.