milenkovicm commented on code in PR #1100: URL: https://github.com/apache/datafusion-ballista/pull/1100#discussion_r1835472608
########## python/src/lib.rs: ########## @@ -15,18 +15,66 @@ // specific language governing permissions and limitations // under the License. +use ballista::prelude::*; +use datafusion::prelude::*; +use datafusion_python::context::PySessionContext as DataFusionPythonSessionContext; +use datafusion_python::utils::wait_for_future; +use std::collections::HashMap; + use pyo3::prelude::*; -pub mod context; mod utils; -pub use crate::context::PySessionContext; - #[pymodule] -fn pyballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { +fn ballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { pyo3_log::init(); // Ballista structs - m.add_class::<PySessionContext>()?; + m.add_class::<PyBallista>()?; // DataFusion structs m.add_class::<datafusion_python::dataframe::PyDataFrame>()?; Ok(()) } + +#[pyclass(name = "Ballista", module = "ballista", subclass)] +pub struct PyBallista(pub Option<Vec<(String, String)>>); + +#[pymethods] +impl PyBallista { + #[new] + #[pyo3(signature = (config=None))] + pub fn new(config: Option<Vec<(String, String)>>) -> Self { + match config { + Some(config) => Self(Some(config)), + None => Self(Some(vec![(String::from(""), String::from(""))])) + } + } + + #[pyo3(signature = (config=None))] + pub fn config(&mut self, config: Option<Vec<(String, String)>>) -> Self { + match config { + Some(config) => Self(Some(config)), + None => Self(Some(vec![(String::from(""), String::from(""))])) Review Comment: why do we insert `("","")` tuple? not valid config value. ########## python/src/lib.rs: ########## @@ -15,18 +15,66 @@ // specific language governing permissions and limitations // under the License. +use ballista::prelude::*; +use datafusion::prelude::*; +use datafusion_python::context::PySessionContext as DataFusionPythonSessionContext; +use datafusion_python::utils::wait_for_future; +use std::collections::HashMap; + use pyo3::prelude::*; -pub mod context; mod utils; -pub use crate::context::PySessionContext; - #[pymodule] -fn pyballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { +fn ballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { pyo3_log::init(); // Ballista structs - m.add_class::<PySessionContext>()?; + m.add_class::<PyBallista>()?; // DataFusion structs m.add_class::<datafusion_python::dataframe::PyDataFrame>()?; Ok(()) } + +#[pyclass(name = "Ballista", module = "ballista", subclass)] +pub struct PyBallista(pub Option<Vec<(String, String)>>); + +#[pymethods] +impl PyBallista { + #[new] + #[pyo3(signature = (config=None))] + pub fn new(config: Option<Vec<(String, String)>>) -> Self { + match config { + Some(config) => Self(Some(config)), + None => Self(Some(vec![(String::from(""), String::from(""))])) Review Comment: why do we insert `("","")` tuple? not valid config value. ########## python/src/lib.rs: ########## @@ -15,18 +15,66 @@ // specific language governing permissions and limitations // under the License. +use ballista::prelude::*; +use datafusion::prelude::*; +use datafusion_python::context::PySessionContext as DataFusionPythonSessionContext; +use datafusion_python::utils::wait_for_future; +use std::collections::HashMap; + use pyo3::prelude::*; -pub mod context; mod utils; -pub use crate::context::PySessionContext; - #[pymodule] -fn pyballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { +fn ballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { pyo3_log::init(); // Ballista structs - m.add_class::<PySessionContext>()?; + m.add_class::<PyBallista>()?; // DataFusion structs m.add_class::<datafusion_python::dataframe::PyDataFrame>()?; Ok(()) } + +#[pyclass(name = "Ballista", module = "ballista", subclass)] +pub struct PyBallista(pub Option<Vec<(String, String)>>); + +#[pymethods] +impl PyBallista { + #[new] + #[pyo3(signature = (config=None))] + pub fn new(config: Option<Vec<(String, String)>>) -> Self { + match config { + Some(config) => Self(Some(config)), + None => Self(Some(vec![(String::from(""), String::from(""))])) + } + } + + #[pyo3(signature = (config=None))] Review Comment: config(None) makes no sense ########## python/src/lib.rs: ########## @@ -15,18 +15,66 @@ // specific language governing permissions and limitations // under the License. +use ballista::prelude::*; +use datafusion::prelude::*; +use datafusion_python::context::PySessionContext as DataFusionPythonSessionContext; +use datafusion_python::utils::wait_for_future; +use std::collections::HashMap; + use pyo3::prelude::*; -pub mod context; mod utils; -pub use crate::context::PySessionContext; - #[pymodule] -fn pyballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { +fn ballista_internal(_py: Python, m: Bound<'_, PyModule>) -> PyResult<()> { pyo3_log::init(); // Ballista structs - m.add_class::<PySessionContext>()?; + m.add_class::<PyBallista>()?; // DataFusion structs m.add_class::<datafusion_python::dataframe::PyDataFrame>()?; Ok(()) } + +#[pyclass(name = "Ballista", module = "ballista", subclass)] +pub struct PyBallista(pub Option<Vec<(String, String)>>); Review Comment: config values still not used to configure new context? -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org