zhangfengcdt commented on code in PR #44:
URL: https://github.com/apache/sedona-db/pull/44#discussion_r2335119730
##########
python/sedonadb/src/context.rs:
##########
@@ -74,11 +74,29 @@ impl InternalContext {
&self,
py: Python<'py>,
table_paths: Vec<String>,
+ options: HashMap<String, PyObject>,
) -> Result<InternalDataFrame, PySedonaError> {
+ // Convert Python options dict to Rust HashMap<String, String>
+ let rust_options: HashMap<String, String> = options
+ .into_iter()
+ .map(|(k, v)| {
+ let v_str = if v.is_none(py) {
+ String::new()
+ } else {
+ // Convert PyObject to string
+ match v.call_method0(py, "__str__") {
+ Ok(str_obj) => str_obj.extract::<String>(py)?,
+ Err(_) => v.extract::<String>(py)?,
+ }
Review Comment:
This should be much simplified using built-in .str() method.
--
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]