cj-zhukov commented on code in PR #18946:
URL: https://github.com/apache/datafusion/pull/18946#discussion_r2570997632
##########
datafusion-examples/examples/proto/main.rs:
##########
@@ -50,19 +53,35 @@ impl FromStr for ExampleKind {
fn from_str(s: &str) -> Result<Self> {
match s {
+ "all" => Ok(Self::All),
"composed_extension_codec" => Ok(Self::ComposedExtensionCodec),
_ => Err(DataFusionError::Execution(format!("Unknown example:
{s}"))),
}
}
}
impl ExampleKind {
- const ALL: [Self; 1] = [Self::ComposedExtensionCodec];
+ const ALL_VARIANTS: [Self; 2] = [Self::All, Self::ComposedExtensionCodec];
+
+ const RUNNABLE_VARIANTS: [Self; 1] = [Self::ComposedExtensionCodec];
const EXAMPLE_NAME: &str = "proto";
fn variants() -> Vec<&'static str> {
- Self::ALL.iter().map(|x| x.as_ref()).collect()
+ Self::ALL_VARIANTS
+ .iter()
+ .map(|example| example.as_ref())
+ .collect()
+ }
+
+ async fn run(&self) -> Result<()> {
+ match self {
+ ExampleKind::ComposedExtensionCodec => {
+ composed_extension_codec::composed_extension_codec().await?
+ }
+ ExampleKind::All => unreachable!("`All` should be handled in
main"),
Review Comment:
@martin-g Thank you for the suggestion, I really like this! I'm going to
work on it.
--
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]