File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1+ use datafusion:: common:: internal_datafusion_err;
12use datafusion:: error:: DataFusionError ;
23use datafusion:: error:: Result ;
34use datafusion:: execution:: FunctionRegistry ;
@@ -7,7 +8,6 @@ use datafusion_proto::physical_plan::PhysicalExtensionCodec;
78use prost:: Message ;
89use std:: fmt:: Debug ;
910use std:: sync:: Arc ;
10-
1111// Code taken from https://github.com/apache/datafusion/blob/10f41887fa40d7d425c19b07857f80115460a98e/datafusion/proto/src/physical_plan/mod.rs
1212// TODO: It's not yet on DF 49, once upgrading to DF 50 we can remove this
1313
@@ -46,12 +46,13 @@ impl ComposedPhysicalExtensionCodec {
4646 let proto =
4747 DataEncoderTuple :: decode ( buf) . map_err ( |e| DataFusionError :: Internal ( e. to_string ( ) ) ) ?;
4848
49- let codec =
50- self . codecs
51- . get ( proto. encoder_position as usize )
52- . ok_or ( DataFusionError :: Internal (
53- "Can't find required codec in codec list" . to_owned ( ) ,
54- ) ) ?;
49+ let pos = proto. encoder_position as usize ;
50+ let codec = self . codecs . get ( pos) . ok_or_else ( || {
51+ internal_datafusion_err ! (
52+ "Can't find required codec in position {pos} in codec list with {} elements" ,
53+ self . codecs. len( )
54+ )
55+ } ) ?;
5556
5657 decode ( codec. as_ref ( ) , & proto. blob )
5758 }
You can’t perform that action at this time.
0 commit comments