Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing necessary fields instead of the entire QueryContext struct #5296

Open
WenyXu opened this issue Jan 6, 2025 · 2 comments
Open

Storing necessary fields instead of the entire QueryContext struct #5296

WenyXu opened this issue Jan 6, 2025 · 2 comments

Comments

@WenyXu
Copy link
Member

WenyXu commented Jan 6, 2025

          It's better to store only the necessary fields instead of the entire `QueryContext` struct. I'm going to convert this PR into an issue and plan to refactor it in the future.

Originally posted by @WenyXu in #5200 (comment)

@evenyag
Copy link
Contributor

evenyag commented Jan 6, 2025

@WenyXu Can we turn this into a good first issue if you provide more context for it?

@WenyXu WenyXu removed their assignment Jan 8, 2025
@WenyXu
Copy link
Member Author

WenyXu commented Jan 8, 2025

#[derive(Debug, Serialize, Deserialize)]
pub struct CreateFlowData {
pub(crate) cluster_id: ClusterId,
pub(crate) state: CreateFlowState,
pub(crate) task: CreateFlowTask,
pub(crate) flow_id: Option<FlowId>,
pub(crate) peers: Vec<Peer>,
pub(crate) source_table_ids: Vec<TableId>,
pub(crate) query_context: QueryContext,
/// For verify if prev value is consistent when need to update flow metadata.
/// only set when `or_replace` is true.
pub(crate) prev_flow_info_value: Option<DeserializedValueWithBytes<FlowInfoValue>>,
}

We don't need to store the entire QueryContext, only store the required fields of QueryContext in CreateFlowData. e.g., schema, catalog, timezone.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueryContext {
current_catalog: String,
current_schema: String,
timezone: String,
extensions: HashMap<String, String>,
channel: u8,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants