@@ -38,7 +38,7 @@ use datafusion::datasource::object_store::ObjectStoreUrl;
3838use datafusion:: datasource:: physical_plan:: {
3939 FileGroup , FileScanConfig , FileScanConfigBuilder , FileSinkConfig , FileSource ,
4040} ;
41- use datafusion:: execution:: FunctionRegistry ;
41+ use datafusion:: execution:: { FunctionRegistry , TaskContext } ;
4242use datafusion:: logical_expr:: WindowFunctionDefinition ;
4343use datafusion:: physical_expr:: { LexOrdering , PhysicalSortExpr , ScalarFunctionExpr } ;
4444use datafusion:: physical_plan:: expressions:: {
@@ -47,8 +47,6 @@ use datafusion::physical_plan::expressions::{
4747} ;
4848use datafusion:: physical_plan:: windows:: { create_window_expr, schema_add_window_field} ;
4949use datafusion:: physical_plan:: { Partitioning , PhysicalExpr , WindowExpr } ;
50- use datafusion:: prelude:: SessionContext ;
51- use datafusion_common:: config:: ConfigOptions ;
5250use datafusion_common:: { not_impl_err, DataFusionError , Result } ;
5351use datafusion_proto_common:: common:: proto_error;
5452
@@ -76,7 +74,7 @@ impl From<&protobuf::PhysicalColumn> for Column {
7674/// * `codec` - An extension codec used to decode custom UDFs.
7775pub fn parse_physical_sort_expr (
7876 proto : & protobuf:: PhysicalSortExprNode ,
79- ctx : & SessionContext ,
77+ ctx : & TaskContext ,
8078 input_schema : & Schema ,
8179 codec : & dyn PhysicalExtensionCodec ,
8280) -> Result < PhysicalSortExpr > {
@@ -103,7 +101,7 @@ pub fn parse_physical_sort_expr(
103101/// * `codec` - An extension codec used to decode custom UDFs.
104102pub fn parse_physical_sort_exprs (
105103 proto : & [ protobuf:: PhysicalSortExprNode ] ,
106- ctx : & SessionContext ,
104+ ctx : & TaskContext ,
107105 input_schema : & Schema ,
108106 codec : & dyn PhysicalExtensionCodec ,
109107) -> Result < Vec < PhysicalSortExpr > > {
@@ -125,7 +123,7 @@ pub fn parse_physical_sort_exprs(
125123/// * `codec` - An extension codec used to decode custom UDFs.
126124pub fn parse_physical_window_expr (
127125 proto : & protobuf:: PhysicalWindowExprNode ,
128- ctx : & SessionContext ,
126+ ctx : & TaskContext ,
129127 input_schema : & Schema ,
130128 codec : & dyn PhysicalExtensionCodec ,
131129) -> Result < Arc < dyn WindowExpr > > {
@@ -186,7 +184,7 @@ pub fn parse_physical_window_expr(
186184
187185pub fn parse_physical_exprs < ' a , I > (
188186 protos : I ,
189- ctx : & SessionContext ,
187+ ctx : & TaskContext ,
190188 input_schema : & Schema ,
191189 codec : & dyn PhysicalExtensionCodec ,
192190) -> Result < Vec < Arc < dyn PhysicalExpr > > >
@@ -210,7 +208,7 @@ where
210208/// * `codec` - An extension codec used to decode custom UDFs.
211209pub fn parse_physical_expr (
212210 proto : & protobuf:: PhysicalExprNode ,
213- ctx : & SessionContext ,
211+ ctx : & TaskContext ,
214212 input_schema : & Schema ,
215213 codec : & dyn PhysicalExtensionCodec ,
216214) -> Result < Arc < dyn PhysicalExpr > > {
@@ -364,11 +362,8 @@ pub fn parse_physical_expr(
364362 let scalar_fun_def = Arc :: clone ( & udf) ;
365363
366364 let args = parse_physical_exprs ( & e. args , ctx, input_schema, codec) ?;
367- let config_options =
368- match ctx. state ( ) . execution_props ( ) . config_options . as_ref ( ) {
369- Some ( config_options) => Arc :: clone ( config_options) ,
370- None => Arc :: new ( ConfigOptions :: default ( ) ) ,
371- } ;
365+
366+ let config_options = Arc :: clone ( ctx. session_config ( ) . options ( ) ) ;
372367
373368 Arc :: new (
374369 ScalarFunctionExpr :: new (
@@ -419,7 +414,7 @@ pub fn parse_physical_expr(
419414
420415fn parse_required_physical_expr (
421416 expr : Option < & protobuf:: PhysicalExprNode > ,
422- ctx : & SessionContext ,
417+ ctx : & TaskContext ,
423418 field : & str ,
424419 input_schema : & Schema ,
425420 codec : & dyn PhysicalExtensionCodec ,
@@ -433,7 +428,7 @@ fn parse_required_physical_expr(
433428
434429pub fn parse_protobuf_hash_partitioning (
435430 partitioning : Option < & protobuf:: PhysicalHashRepartition > ,
436- ctx : & SessionContext ,
431+ ctx : & TaskContext ,
437432 input_schema : & Schema ,
438433 codec : & dyn PhysicalExtensionCodec ,
439434) -> Result < Option < Partitioning > > {
@@ -453,7 +448,7 @@ pub fn parse_protobuf_hash_partitioning(
453448
454449pub fn parse_protobuf_partitioning (
455450 partitioning : Option < & protobuf:: Partitioning > ,
456- ctx : & SessionContext ,
451+ ctx : & TaskContext ,
457452 input_schema : & Schema ,
458453 codec : & dyn PhysicalExtensionCodec ,
459454) -> Result < Option < Partitioning > > {
@@ -491,7 +486,7 @@ pub fn parse_protobuf_file_scan_schema(
491486
492487pub fn parse_protobuf_file_scan_config (
493488 proto : & protobuf:: FileScanExecConf ,
494- ctx : & SessionContext ,
489+ ctx : & TaskContext ,
495490 codec : & dyn PhysicalExtensionCodec ,
496491 file_source : Arc < dyn FileSource > ,
497492) -> Result < FileScanConfig > {
0 commit comments