Skip to content

Commit 06e6905

Browse files
committed
update
1 parent 4eb4d53 commit 06e6905

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

src/sql/planning_runtime.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
13+
//! Runtime-installed SQL planning defaults (from `GlobalConfig` / `conf/config.yaml`).
14+
15+
use std::sync::OnceLock;
16+
17+
use crate::config::streaming_job::ResolvedStreamingJobConfig;
18+
use crate::sql::common::constants::sql_planning_default;
19+
use crate::sql::types::SqlConfig;
20+
21+
static SQL_PLANNING: OnceLock<SqlConfig> = OnceLock::new();
22+
23+
/// Installs [`SqlConfig`] derived from resolved streaming job YAML (KeyBy parallelism, etc.).
24+
/// Safe to call once at bootstrap; later calls are ignored if already set.
25+
pub fn install_sql_planning_from_streaming_job(job: &ResolvedStreamingJobConfig) {
26+
let cfg = SqlConfig {
27+
default_parallelism: sql_planning_default::DEFAULT_PARALLELISM,
28+
key_by_parallelism: job.key_by_parallelism as usize,
29+
};
30+
let _ = SQL_PLANNING.set(cfg).ok();
31+
}
32+
33+
pub(crate) fn sql_planning_snapshot() -> SqlConfig {
34+
SQL_PLANNING.get().cloned().unwrap_or_default()
35+
}

0 commit comments

Comments
 (0)