This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 21cb3573c7 Print undocumented functions to console while generating
docs (#12874)
21cb3573c7 is described below
commit 21cb3573c74166722d9c0b093328991545866b83
Author: Andrew Lamb <[email protected]>
AuthorDate: Mon Oct 14 07:41:34 2024 -0400
Print undocumented functions to console while generating docs (#12874)
---
datafusion/core/src/bin/print_functions_docs.rs | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/datafusion/core/src/bin/print_functions_docs.rs
b/datafusion/core/src/bin/print_functions_docs.rs
index d9415028c1..d87c3cefe6 100644
--- a/datafusion/core/src/bin/print_functions_docs.rs
+++ b/datafusion/core/src/bin/print_functions_docs.rs
@@ -20,10 +20,16 @@ use datafusion_expr::{
aggregate_doc_sections, scalar_doc_sections, window_doc_sections,
AggregateUDF,
DocSection, Documentation, ScalarUDF, WindowUDF,
};
+use hashbrown::HashSet;
use itertools::Itertools;
use std::env::args;
use std::fmt::Write as _;
+/// Print documentation for all functions of a given type to stdout
+///
+/// Usage: `cargo run --bin print_functions_docs -- <type>`
+///
+/// Called from `dev/update_function_docs.sh`
fn main() {
let args: Vec<String> = args().collect();
@@ -83,9 +89,12 @@ fn print_docs(
) -> String {
let mut docs = "".to_string();
+ // Ensure that all providers have documentation
+ let mut providers_with_no_docs = HashSet::new();
+
// doc sections only includes sections that have 'include' == true
for doc_section in doc_sections {
- // make sure there is a function that is in this doc section
+ // make sure there is at least one function that is in this doc section
if !&providers.iter().any(|f| {
if let Some(documentation) = f.get_documentation() {
documentation.doc_section == doc_section
@@ -96,12 +105,14 @@ fn print_docs(
continue;
}
+ // filter out functions that are not in this doc section
let providers: Vec<&Box<dyn DocProvider>> = providers
.iter()
.filter(|&f| {
if let Some(documentation) = f.get_documentation() {
documentation.doc_section == doc_section
} else {
+ providers_with_no_docs.insert(f.get_name());
false
}
})
@@ -202,9 +213,19 @@ fn print_docs(
}
}
+ // If there are any functions that do not have documentation, print them
out
+ // eventually make this an error:
https://github.com/apache/datafusion/issues/12872
+ if !providers_with_no_docs.is_empty() {
+ eprintln!("INFO: The following functions do not have documentation:");
+ for f in providers_with_no_docs {
+ eprintln!(" - {f}");
+ }
+ }
+
docs
}
+/// Trait for accessing name / aliases / documentation for differnet functions
trait DocProvider {
fn get_name(&self) -> String;
fn get_aliases(&self) -> Vec<String>;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]