martin-g commented on code in PR #25785:
URL: https://github.com/apache/datafusion/pull/25785#discussion_r4130084940


##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog
+    pub fn with_location(mut self, location: Option<String>) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_location(mut self, location: Option<String>) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(

Review Comment:
   ```suggestion
       #[must_use]
       pub fn builder(
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog
+    pub fn with_location(mut self, location: Option<String>) -> Self {
+        self.location = location;
+        self
+    }
+
+    /// Set the if_not_exists flag
+    pub fn with_if_not_exists(mut self, if_not_exists: bool) -> Self {
+        self.if_not_exists = if_not_exists;
+        self
+    }
+
+    /// Set the or_replace flag
+    pub fn with_or_replace(mut self, or_replace: bool) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_or_replace(mut self, or_replace: bool) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog
+    pub fn with_location(mut self, location: Option<String>) -> Self {
+        self.location = location;
+        self
+    }
+
+    /// Set the if_not_exists flag
+    pub fn with_if_not_exists(mut self, if_not_exists: bool) -> Self {
+        self.if_not_exists = if_not_exists;
+        self
+    }
+
+    /// Set the or_replace flag
+    pub fn with_or_replace(mut self, or_replace: bool) -> Self {
+        self.or_replace = or_replace;
+        self
+    }
+
+    /// Set the catalog options
+    pub fn with_options(mut self, options: HashMap<String, String>) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_options(mut self, options: HashMap<String, String>) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -737,6 +821,64 @@ impl PartialOrd for DropCatalog {
     }
 }
 
+impl DropCatalog {
+    /// Creates a builder for [`DropCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::DropCatalog;
+    /// let cmd = 
DropCatalog::builder("my_catalog").with_if_exists(true).build();
+    /// assert_eq!(cmd.name, "my_catalog");
+    /// ```
+    pub fn builder(name: impl Into<String>) -> DropCatalogBuilder {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn builder(name: impl Into<String>) -> DropCatalogBuilder {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog
+    pub fn with_location(mut self, location: Option<String>) -> Self {
+        self.location = location;
+        self
+    }
+
+    /// Set the if_not_exists flag
+    pub fn with_if_not_exists(mut self, if_not_exists: bool) -> Self {
+        self.if_not_exists = if_not_exists;
+        self
+    }
+
+    /// Set the or_replace flag
+    pub fn with_or_replace(mut self, or_replace: bool) -> Self {
+        self.or_replace = or_replace;
+        self
+    }
+
+    /// Set the catalog options
+    pub fn with_options(mut self, options: HashMap<String, String>) -> Self {
+        self.options = options;
+        self
+    }
+
+    /// Set the schema
+    pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog
+    pub fn with_location(mut self, location: Option<String>) -> Self {
+        self.location = location;
+        self
+    }
+
+    /// Set the if_not_exists flag
+    pub fn with_if_not_exists(mut self, if_not_exists: bool) -> Self {
+        self.if_not_exists = if_not_exists;
+        self
+    }
+
+    /// Set the or_replace flag
+    pub fn with_or_replace(mut self, or_replace: bool) -> Self {
+        self.or_replace = or_replace;
+        self
+    }
+
+    /// Set the catalog options
+    pub fn with_options(mut self, options: HashMap<String, String>) -> Self {
+        self.options = options;
+        self
+    }
+
+    /// Set the schema
+    pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {
+        self.schema = schema;
+        self
+    }
+
+    /// Build the [`CreateExternalCatalog`]
+    pub fn build(self) -> CreateExternalCatalog {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn build(self) -> CreateExternalCatalog {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -737,6 +821,64 @@ impl PartialOrd for DropCatalog {
     }
 }
 
+impl DropCatalog {
+    /// Creates a builder for [`DropCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::DropCatalog;
+    /// let cmd = 
DropCatalog::builder("my_catalog").with_if_exists(true).build();
+    /// assert_eq!(cmd.name, "my_catalog");
+    /// ```
+    pub fn builder(name: impl Into<String>) -> DropCatalogBuilder {
+        DropCatalogBuilder {
+            name: name.into(),
+            if_exists: false,
+            cascade: false,
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`DropCatalog`].
+#[derive(Debug, Clone)]
+pub struct DropCatalogBuilder {
+    name: String,
+    if_exists: bool,
+    cascade: bool,
+    schema: DFSchemaRef,
+}
+
+impl DropCatalogBuilder {
+    /// Set the if_exists flag
+    pub fn with_if_exists(mut self, if_exists: bool) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_if_exists(mut self, if_exists: bool) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -737,6 +821,64 @@ impl PartialOrd for DropCatalog {
     }
 }
 
+impl DropCatalog {
+    /// Creates a builder for [`DropCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::DropCatalog;
+    /// let cmd = 
DropCatalog::builder("my_catalog").with_if_exists(true).build();
+    /// assert_eq!(cmd.name, "my_catalog");
+    /// ```
+    pub fn builder(name: impl Into<String>) -> DropCatalogBuilder {
+        DropCatalogBuilder {
+            name: name.into(),
+            if_exists: false,
+            cascade: false,
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`DropCatalog`].
+#[derive(Debug, Clone)]
+pub struct DropCatalogBuilder {
+    name: String,
+    if_exists: bool,
+    cascade: bool,
+    schema: DFSchemaRef,
+}
+
+impl DropCatalogBuilder {
+    /// Set the if_exists flag
+    pub fn with_if_exists(mut self, if_exists: bool) -> Self {
+        self.if_exists = if_exists;
+        self
+    }
+
+    /// Set whether the drop should cascade
+    pub fn with_cascade(mut self, cascade: bool) -> Self {
+        self.cascade = cascade;
+        self
+    }
+
+    /// Set the schema
+    pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {
+        self.schema = schema;
+        self
+    }
+
+    /// Build the [`DropCatalog`]
+    pub fn build(self) -> DropCatalog {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn build(self) -> DropCatalog {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -737,6 +821,64 @@ impl PartialOrd for DropCatalog {
     }
 }
 
+impl DropCatalog {
+    /// Creates a builder for [`DropCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::DropCatalog;
+    /// let cmd = 
DropCatalog::builder("my_catalog").with_if_exists(true).build();
+    /// assert_eq!(cmd.name, "my_catalog");
+    /// ```
+    pub fn builder(name: impl Into<String>) -> DropCatalogBuilder {
+        DropCatalogBuilder {
+            name: name.into(),
+            if_exists: false,
+            cascade: false,
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`DropCatalog`].
+#[derive(Debug, Clone)]
+pub struct DropCatalogBuilder {
+    name: String,
+    if_exists: bool,
+    cascade: bool,
+    schema: DFSchemaRef,
+}
+
+impl DropCatalogBuilder {
+    /// Set the if_exists flag
+    pub fn with_if_exists(mut self, if_exists: bool) -> Self {
+        self.if_exists = if_exists;
+        self
+    }
+
+    /// Set whether the drop should cascade
+    pub fn with_cascade(mut self, cascade: bool) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_cascade(mut self, cascade: bool) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog
+    pub fn with_location(mut self, location: Option<String>) -> Self {
+        self.location = location;
+        self
+    }
+
+    /// Set the if_not_exists flag
+    pub fn with_if_not_exists(mut self, if_not_exists: bool) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_if_not_exists(mut self, if_not_exists: bool) -> Self {
   ```



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -615,6 +615,90 @@ impl PartialOrd for CreateExternalCatalog {
     }
 }
 
+impl CreateExternalCatalog {
+    /// Creates a builder for [`CreateExternalCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::CreateExternalCatalog;
+    /// let cmd = CreateExternalCatalog::builder("my_catalog", "memory")
+    ///     .with_if_not_exists(true)
+    ///     .build();
+    /// assert_eq!(cmd.catalog_name, "my_catalog");
+    /// ```
+    pub fn builder(
+        catalog_name: impl Into<String>,
+        catalog_type: impl Into<String>,
+    ) -> CreateExternalCatalogBuilder {
+        CreateExternalCatalogBuilder {
+            catalog_name: catalog_name.into(),
+            catalog_type: catalog_type.into(),
+            location: None,
+            if_not_exists: false,
+            or_replace: false,
+            options: HashMap::new(),
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`CreateExternalCatalog`].
+#[derive(Debug, Clone)]
+pub struct CreateExternalCatalogBuilder {
+    catalog_name: String,
+    catalog_type: String,
+    location: Option<String>,
+    if_not_exists: bool,
+    or_replace: bool,
+    options: HashMap<String, String>,
+    schema: DFSchemaRef,
+}
+
+impl CreateExternalCatalogBuilder {
+    /// Set the physical location of the catalog

Review Comment:
   Passing `None` will **un**set the location.



##########
datafusion/expr/src/logical_plan/ddl.rs:
##########
@@ -737,6 +821,64 @@ impl PartialOrd for DropCatalog {
     }
 }
 
+impl DropCatalog {
+    /// Creates a builder for [`DropCatalog`].
+    ///
+    /// # Example
+    /// ```
+    /// # use datafusion_expr::DropCatalog;
+    /// let cmd = 
DropCatalog::builder("my_catalog").with_if_exists(true).build();
+    /// assert_eq!(cmd.name, "my_catalog");
+    /// ```
+    pub fn builder(name: impl Into<String>) -> DropCatalogBuilder {
+        DropCatalogBuilder {
+            name: name.into(),
+            if_exists: false,
+            cascade: false,
+            schema: Arc::new(DFSchema::empty()),
+        }
+    }
+}
+
+/// Builder for [`DropCatalog`].
+#[derive(Debug, Clone)]
+pub struct DropCatalogBuilder {
+    name: String,
+    if_exists: bool,
+    cascade: bool,
+    schema: DFSchemaRef,
+}
+
+impl DropCatalogBuilder {
+    /// Set the if_exists flag
+    pub fn with_if_exists(mut self, if_exists: bool) -> Self {
+        self.if_exists = if_exists;
+        self
+    }
+
+    /// Set whether the drop should cascade
+    pub fn with_cascade(mut self, cascade: bool) -> Self {
+        self.cascade = cascade;
+        self
+    }
+
+    /// Set the schema
+    pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {

Review Comment:
   ```suggestion
       #[must_use]
       pub fn with_schema(mut self, schema: DFSchemaRef) -> Self {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to