File tree 4 files changed +7
-13
lines changed
core/src/execution/context
4 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -688,7 +688,7 @@ impl SessionContext {
688
688
column_defaults,
689
689
} = cmd;
690
690
691
- let input = Arc :: try_unwrap ( input) . unwrap_or_else ( |e| e . as_ref ( ) . clone ( ) ) ;
691
+ let input = Arc :: unwrap_or_clone ( input) ;
692
692
let input = self . state ( ) . optimize ( & input) ?;
693
693
let table = self . table ( name. clone ( ) ) . await ;
694
694
match ( if_not_exists, or_replace, table) {
Original file line number Diff line number Diff line change @@ -394,7 +394,7 @@ pub fn create_udf(
394
394
volatility : Volatility ,
395
395
fun : ScalarFunctionImplementation ,
396
396
) -> ScalarUDF {
397
- let return_type = Arc :: try_unwrap ( return_type) . unwrap_or_else ( |t| t . as_ref ( ) . clone ( ) ) ;
397
+ let return_type = Arc :: unwrap_or_clone ( return_type) ;
398
398
ScalarUDF :: from ( SimpleScalarUDF :: new (
399
399
name,
400
400
input_types,
@@ -476,8 +476,8 @@ pub fn create_udaf(
476
476
accumulator : AccumulatorFactoryFunction ,
477
477
state_type : Arc < Vec < DataType > > ,
478
478
) -> AggregateUDF {
479
- let return_type = Arc :: try_unwrap ( return_type) . unwrap_or_else ( |t| t . as_ref ( ) . clone ( ) ) ;
480
- let state_type = Arc :: try_unwrap ( state_type) . unwrap_or_else ( |t| t . as_ref ( ) . clone ( ) ) ;
479
+ let return_type = Arc :: unwrap_or_clone ( return_type) ;
480
+ let state_type = Arc :: unwrap_or_clone ( state_type) ;
481
481
let state_fields = state_type
482
482
. into_iter ( )
483
483
. enumerate ( )
@@ -594,7 +594,7 @@ pub fn create_udwf(
594
594
volatility : Volatility ,
595
595
partition_evaluator_factory : PartitionEvaluatorFactory ,
596
596
) -> WindowUDF {
597
- let return_type = Arc :: try_unwrap ( return_type) . unwrap_or_else ( |t| t . as_ref ( ) . clone ( ) ) ;
597
+ let return_type = Arc :: unwrap_or_clone ( return_type) ;
598
598
WindowUDF :: from ( SimpleWindowUDF :: new (
599
599
name,
600
600
input_type,
Original file line number Diff line number Diff line change @@ -1160,10 +1160,7 @@ impl LogicalPlan {
1160
1160
Ok ( if let LogicalPlan :: Prepare ( prepare_lp) = plan_with_values {
1161
1161
param_values. verify ( & prepare_lp. data_types ) ?;
1162
1162
// try and take ownership of the input if is not shared, clone otherwise
1163
- match Arc :: try_unwrap ( prepare_lp. input ) {
1164
- Ok ( input) => input,
1165
- Err ( arc_input) => arc_input. as_ref ( ) . clone ( ) ,
1166
- }
1163
+ Arc :: unwrap_or_clone ( prepare_lp. input )
1167
1164
} else {
1168
1165
plan_with_values
1169
1166
} )
Original file line number Diff line number Diff line change @@ -59,10 +59,7 @@ pub(super) fn normalize_union_schema(plan: &LogicalPlan) -> Result<LogicalPlan>
59
59
60
60
let transformed_plan = plan. transform_up ( |plan| match plan {
61
61
LogicalPlan :: Union ( mut union) => {
62
- let schema = match Arc :: try_unwrap ( union. schema ) {
63
- Ok ( inner) => inner,
64
- Err ( schema) => ( * schema) . clone ( ) ,
65
- } ;
62
+ let schema = Arc :: unwrap_or_clone ( union. schema ) ;
66
63
let schema = schema. strip_qualifiers ( ) ;
67
64
68
65
union. schema = Arc :: new ( schema) ;
You can’t perform that action at this time.
0 commit comments