milenkovicm commented on code in PR #2588:
URL: 
https://github.com/apache/datafusion-ballista/pull/2588#discussion_r4302551701


##########
python/src/config.rs:
##########
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use ballista_core::config::BallistaConfig;
+use datafusion::config::{ConfigExtension, ExtensionOptions};
+use datafusion_ffi::config::extension_options::FFI_ExtensionOptions;
+use pyo3::exceptions::PyValueError;
+use pyo3::prelude::*;
+use pyo3::types::PyCapsule;
+use std::collections::HashMap;
+
+/// Ballista configuration exposed as a DataFusion config extension, to be
+/// registered with `SessionConfig.with_extension(...)`.
+///
+/// Once registered, `ballista.*` keys are listed in
+/// `information_schema.df_settings` and can be changed with `SET`.
+#[pyclass(
+    name = "BallistaConfigExtension",
+    module = "ballista._internal_ballista",
+    skip_from_py_object
+)]
+pub(crate) struct PyBallistaConfigExtension {
+    config: BallistaConfig,
+}
+
+#[pymethods]
+impl PyBallistaConfigExtension {
+    #[new]
+    #[pyo3(signature = (settings=None))]
+    fn new(settings: Option<HashMap<String, String>>) -> PyResult<Self> {
+        let mut config = BallistaConfig::default();
+        for (key, value) in settings.unwrap_or_default() {
+            let Some(inner_key) = key
+                .strip_prefix(BallistaConfig::PREFIX)
+                .and_then(|k| k.strip_prefix('.'))
+            else {
+                return Err(PyValueError::new_err(format!(
+                    "unsupported Ballista configuration key: {key}"
+                )));
+            };
+            config
+                .set(inner_key, &value)
+                .map_err(|error| PyValueError::new_err(error.to_string()))?;
+        }
+        Ok(Self { config })
+    }
+
+    fn __datafusion_extension_options__<'py>(

Review Comment:
   i can't reproduce this issue 
   
   ```
   ctx.sql("SET ballista.job.name='super job'").show()
   ctx.sql("SET ballista.shuffle.force_remote_read=true").show()
   
   ctx.sql("select id, count(*) from t group by id").show()
   ```
   
   manually checking scheduler i see them set 
   
   same for 
   
   ```
   ctx = BallistaSessionContext(address=f"df://{host}:{port}", cluster_config={
       "ballista.job.name": "super job",
       "ballista.shuffle.force_remote_read": True
   })
   ```
   
   can you please re-check when u get chance 



-- 
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]

Reply via email to