Skip to content

Conversation

shuiyisong
Copy link
Contributor

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

Introduce PipelineName to hold and reference the pipeline using name, schema, and version.
Now we can use schema.pipeline_name to refer to pipelines from other databases while ingesting logs.

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@shuiyisong shuiyisong requested review from sunng87 and paomian May 20, 2025 13:36
@shuiyisong shuiyisong requested a review from a team as a code owner May 20, 2025 13:36
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label May 20, 2025
@sunng87
Copy link
Member

sunng87 commented May 20, 2025

Do we really want to make pipeline isolated by schema? Do you think it's a good idea to make pipeline namespace agnostic? Any pipeline in the catalog can be accessed by any schema/namespace

@@ -54,12 +54,11 @@ impl PipelineHandler for Instance {

async fn get_pipeline(
&self,
name: &str,
version: PipelineVersion,
pipeline_name: &PipelineName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer separating the name and version in code. If a combined representation is necessary, consider using the format schema.pipeline:{version}.

/// The optional schema is for cross-schema reference.
/// Note the version can be None while query, which means the latest version of the pipeline.
#[derive(Debug, Clone)]
pub struct PipelineName {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PipelineIdentity is the more appropriate term.

}
);

let parts = name.split('.').collect::<Vec<&str>>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to consider quoted names such as "test.db"."test pipeline"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we need to process it like

pub fn table_idents_to_full_name(

Use sql parser to parse the name into ObjectName at first.

Ok(())
}

pub fn check_schema(&self, ctx_schema: &str) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a document for public functions.
Notice that it is only used when adding pipelines.

compiled_pipeline.clone(),
self.original_pipelines.insert(
generate_pipeline_cache_key(&pipeline_name),
(pipeline.to_owned(), version),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer clone over to_owned. Apply this suggestion throughout the file.

assert_eq!(res.status(), StatusCode::BAD_REQUEST);

// cross ref using public's pipeline
let res = client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should pipeline permissions for cross-database access be checked, or does the database access plugin already handle this? If not, should we intercept the request?

@shuiyisong
Copy link
Contributor Author

shuiyisong commented May 21, 2025

Adopt removing the schema in pipeline info instead of using the schema and allowing cross-schema reference.
see #6143

@shuiyisong shuiyisong closed this May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants