apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
6.27k stars 1.18k forks source link

Make it clearer that `RuntimeEnv::new()` is fallable #12554

Closed alamb closed 1 month ago

alamb commented 1 month ago

Is your feature request related to a problem or challenge?

While working on https://github.com/datafusion-contrib/datafusion-dft it was not clear that RuntimeEnv::new() actually returns a Result as the typical rust convention is a function new() is infallable and a function like try_new() is fallable. While this isn't a big deal it was a small usability papercut

Describe the solution you'd like

I would like RuntimeEnv to follow standard rust conventions to make it easier to use

Describe alternatives you've considered

I suggest:

  1. Deprecating RuntimeEnv::new()
  2. Add a new function RuntimeEnv::try_new() that does the same thing
  3. Update all the datafusion code to use try_new instead

Additional context

No response

alamb commented 1 month ago

I think this is a good first issue as it is clearly described and straightforward to implement. It would be a good introduction to DataFusion I think

OussamaSaoudi commented 1 month ago

take