kosiew commented on code in PR #1253:
URL: 
https://github.com/apache/datafusion-python/pull/1253#discussion_r2394645989


##########
src/expr/conditional_expr.rs:
##########
@@ -15,40 +15,101 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use crate::{errors::PyDataFusionResult, expr::PyExpr};
+use std::sync::Arc;
+
+use crate::{
+    errors::{PyDataFusionError, PyDataFusionResult},
+    expr::PyExpr,
+};
 use datafusion::logical_expr::conditional_expressions::CaseBuilder;
+use parking_lot::{Mutex, MutexGuard};
 use pyo3::prelude::*;
 
-#[pyclass(name = "CaseBuilder", module = "datafusion.expr", subclass)]
-pub struct PyCaseBuilder {
-    pub case_builder: CaseBuilder,
+struct CaseBuilderHandle<'a> {
+    guard: MutexGuard<'a, Option<CaseBuilder>>,
+    builder: Option<CaseBuilder>,

Review Comment:
   The Option wrapper is needed because into_inner takes ownership of the 
builder; clearing the field to None ensures the Drop implementation doesn’t try 
to reinsert or drop the same CaseBuilder a second time when the handle is 
consumed.
   



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