@@ -457,7 +457,7 @@ impl PySessionContext {
457
457
pub fn sql ( & mut self , query : & str , py : Python ) -> PyDataFusionResult < PyDataFrame > {
458
458
let result = self . ctx . sql ( query) ;
459
459
let df = wait_for_future ( py, result) ?;
460
- Ok ( PyDataFrame :: new ( df) )
460
+ Ok ( PyDataFrame :: new ( df, self . ctx . display_config . clone ( ) ) )
461
461
}
462
462
463
463
#[ pyo3( signature = ( query, options=None ) ) ]
@@ -474,7 +474,7 @@ impl PySessionContext {
474
474
} ;
475
475
let result = self . ctx . sql_with_options ( query, options) ;
476
476
let df = wait_for_future ( py, result) ?;
477
- Ok ( PyDataFrame :: new ( df) )
477
+ Ok ( PyDataFrame :: new ( df, self . ctx . display_config . clone ( ) ) )
478
478
}
479
479
480
480
#[ pyo3( signature = ( partitions, name=None , schema=None ) ) ]
@@ -509,13 +509,16 @@ impl PySessionContext {
509
509
510
510
let table = wait_for_future ( py, self . _table ( & table_name) ) ?;
511
511
512
- let df = PyDataFrame :: new ( table) ;
512
+ let df = PyDataFrame :: new ( table, self . ctx . display_config . clone ( ) ) ;
513
513
Ok ( df)
514
514
}
515
515
516
516
/// Create a DataFrame from an existing logical plan
517
517
pub fn create_dataframe_from_logical_plan ( & mut self , plan : PyLogicalPlan ) -> PyDataFrame {
518
- PyDataFrame :: new ( DataFrame :: new ( self . ctx . state ( ) , plan. plan . as_ref ( ) . clone ( ) ) )
518
+ PyDataFrame :: new (
519
+ DataFrame :: new ( self . ctx . state ( ) , plan. plan . as_ref ( ) . clone ( ) ) ,
520
+ self . ctx . display_config . clone ( ) ,
521
+ )
519
522
}
520
523
521
524
/// Construct datafusion dataframe from Python list
@@ -883,15 +886,18 @@ impl PySessionContext {
883
886
pub fn table ( & self , name : & str , py : Python ) -> PyResult < PyDataFrame > {
884
887
let x = wait_for_future ( py, self . ctx . table ( name) )
885
888
. map_err ( |e| PyKeyError :: new_err ( e. to_string ( ) ) ) ?;
886
- Ok ( PyDataFrame :: new ( x) )
889
+ Ok ( PyDataFrame :: new ( x, self . ctx . display_config . clone ( ) ) )
887
890
}
888
891
889
892
pub fn table_exist ( & self , name : & str ) -> PyDataFusionResult < bool > {
890
893
Ok ( self . ctx . table_exist ( name) ?)
891
894
}
892
895
893
896
pub fn empty_table ( & self ) -> PyDataFusionResult < PyDataFrame > {
894
- Ok ( PyDataFrame :: new ( self . ctx . read_empty ( ) ?) )
897
+ Ok (
898
+ PyDataFrame :: new ( self . ctx . read_empty ( ) ?) ,
899
+ self . ctx . display_config . clone ( ) ,
900
+ )
895
901
}
896
902
897
903
pub fn session_id ( & self ) -> String {
@@ -926,7 +932,7 @@ impl PySessionContext {
926
932
let result = self . ctx . read_json ( path, options) ;
927
933
wait_for_future ( py, result) ?
928
934
} ;
929
- Ok ( PyDataFrame :: new ( df) )
935
+ Ok ( PyDataFrame :: new ( df, self . ctx . display_config . clone ( ) ) )
930
936
}
931
937
932
938
#[ allow( clippy:: too_many_arguments) ]
@@ -971,12 +977,18 @@ impl PySessionContext {
971
977
let paths = path. extract :: < Vec < String > > ( ) ?;
972
978
let paths = paths. iter ( ) . map ( |p| p as & str ) . collect :: < Vec < & str > > ( ) ;
973
979
let result = self . ctx . read_csv ( paths, options) ;
974
- let df = PyDataFrame :: new ( wait_for_future ( py, result) ?) ;
980
+ let df = PyDataFrame :: new (
981
+ wait_for_future ( py, result) ?,
982
+ self . ctx . display_config . clone ( ) ,
983
+ ) ;
975
984
Ok ( df)
976
985
} else {
977
986
let path = path. extract :: < String > ( ) ?;
978
987
let result = self . ctx . read_csv ( path, options) ;
979
- let df = PyDataFrame :: new ( wait_for_future ( py, result) ?) ;
988
+ let df = PyDataFrame :: new (
989
+ wait_for_future ( py, result) ?,
990
+ self . ctx . display_config . clone ( ) ,
991
+ ) ;
980
992
Ok ( df)
981
993
}
982
994
}
@@ -1014,7 +1026,10 @@ impl PySessionContext {
1014
1026
. collect ( ) ;
1015
1027
1016
1028
let result = self . ctx . read_parquet ( path, options) ;
1017
- let df = PyDataFrame :: new ( wait_for_future ( py, result) ?) ;
1029
+ let df = PyDataFrame :: new (
1030
+ wait_for_future ( py, result) ?,
1031
+ self . ctx . display_config . clone ( ) ,
1032
+ ) ;
1018
1033
Ok ( df)
1019
1034
}
1020
1035
@@ -1039,12 +1054,12 @@ impl PySessionContext {
1039
1054
let read_future = self . ctx . read_avro ( path, options) ;
1040
1055
wait_for_future ( py, read_future) ?
1041
1056
} ;
1042
- Ok ( PyDataFrame :: new ( df) )
1057
+ Ok ( PyDataFrame :: new ( df, self . ctx . display_config . clone ( ) ) )
1043
1058
}
1044
1059
1045
1060
pub fn read_table ( & self , table : & PyTable ) -> PyDataFusionResult < PyDataFrame > {
1046
1061
let df = self . ctx . read_table ( table. table ( ) ) ?;
1047
- Ok ( PyDataFrame :: new ( df) )
1062
+ Ok ( PyDataFrame :: new ( df, self . ctx . display_config . clone ( ) ) )
1048
1063
}
1049
1064
1050
1065
fn __repr__ ( & self ) -> PyResult < String > {
0 commit comments