alamb commented on code in PR #13575:
URL: https://github.com/apache/datafusion/pull/13575#discussion_r1861285393
##########
datafusion/doc/src/lib.rs:
##########
@@ -205,30 +210,14 @@ impl DocumentationBuilder {
related_udfs,
} = self;
- if doc_section.is_none() {
Review Comment:
🎉
##########
datafusion/functions/src/core/arrow_cast.rs:
##########
@@ -147,10 +147,10 @@ static DOCUMENTATION: OnceLock<Documentation> =
OnceLock::new();
fn get_arrow_cast_doc() -> &'static Documentation {
DOCUMENTATION.get_or_init(|| {
- Documentation::builder()
- .with_doc_section(DOC_SECTION_OTHER)
- .with_description("Casts a value to a specific Arrow data type.")
- .with_syntax_example("arrow_cast(expression, datatype)")
+ Documentation::builder(
+ DOC_SECTION_OTHER,
Review Comment:
it is somewhat unfortunate that we lose the builder syntax but I think it is
worth it
##########
datafusion/doc/src/lib.rs:
##########
@@ -86,29 +90,30 @@ pub struct DocSection {
/// description: None,
/// };
///
-/// let documentation = Documentation::builder()
-/// .with_doc_section(doc_section)
-/// .with_description("Add one to an int32")
-/// .with_syntax_example("add_one(2)")
+/// let documentation = Documentation::builder(doc_section, "Add one to an
int32".to_owned(), "add_one(2)".to_owned())
/// .with_argument("arg_1", "The int32 number to add one to")
/// .build();
/// # }
pub struct DocumentationBuilder {
- pub doc_section: Option<DocSection>,
- pub description: Option<String>,
- pub syntax_example: Option<String>,
+ pub doc_section: DocSection,
+ pub description: String,
+ pub syntax_example: String,
pub sql_example: Option<String>,
pub arguments: Option<Vec<(String, String)>>,
pub alternative_syntax: Option<Vec<String>>,
pub related_udfs: Option<Vec<String>>,
}
impl DocumentationBuilder {
- pub fn new() -> Self {
+ pub fn new(
Review Comment:
for anyone following along these settings are required, otherwise the
builder will error (or now panic)
So I think the idea here is that the compiler can now verify the required
fields which seems like an improvement to me, even though it is an API change
cc @Omega359
--
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]