@@ -3,7 +3,7 @@ use crate::dataframe::JsDataFrame;
3
3
use crate :: prelude:: * ;
4
4
use polars:: prelude:: { col, lit, ClosedWindow , JoinType } ;
5
5
use polars_io:: cloud:: CloudOptions ;
6
- use polars_io:: RowIndex ;
6
+ use polars_io:: { HiveOptions , RowIndex } ;
7
7
use std:: collections:: HashMap ;
8
8
use std:: num:: NonZeroUsize ;
9
9
use std:: path:: PathBuf ;
@@ -134,34 +134,37 @@ impl JsLazyFrame {
134
134
pub fn sort (
135
135
& self ,
136
136
by_column : String ,
137
- reverse : bool ,
137
+ descending : bool ,
138
138
nulls_last : bool ,
139
- multithreaded : bool ,
140
139
maintain_order : bool ,
141
140
) -> JsLazyFrame {
142
141
let ldf = self . ldf . clone ( ) ;
143
142
ldf. sort (
144
- & by_column,
145
- SortOptions {
146
- descending : reverse,
147
- nulls_last,
148
- multithreaded,
149
- maintain_order,
150
- } ,
143
+ [ & by_column] ,
144
+ SortMultipleOptions :: default ( )
145
+ . with_order_descending ( descending)
146
+ . with_nulls_last ( nulls_last)
147
+ . with_maintain_order ( maintain_order) ,
151
148
)
152
149
. into ( )
153
150
}
154
151
#[ napi( catch_unwind) ]
155
152
pub fn sort_by_exprs (
156
153
& self ,
157
154
by_column : Vec < & JsExpr > ,
158
- reverse : Vec < bool > ,
155
+ descending : bool ,
159
156
nulls_last : bool ,
160
157
maintain_order : bool ,
161
158
) -> JsLazyFrame {
162
159
let ldf = self . ldf . clone ( ) ;
163
- ldf. sort_by_exprs ( by_column. to_exprs ( ) , reverse, nulls_last, maintain_order)
164
- . into ( )
160
+ ldf. sort_by_exprs (
161
+ by_column. to_exprs ( ) ,
162
+ SortMultipleOptions :: default ( )
163
+ . with_order_descending ( descending)
164
+ . with_nulls_last ( nulls_last)
165
+ . with_maintain_order ( maintain_order) ,
166
+ )
167
+ . into ( )
165
168
}
166
169
#[ napi( catch_unwind) ]
167
170
pub fn cache ( & self ) -> JsLazyFrame {
@@ -229,7 +232,7 @@ impl JsLazyFrame {
229
232
let closed_window = closed. 0 ;
230
233
let ldf = self . ldf . clone ( ) ;
231
234
let by = by. to_exprs ( ) ;
232
- let lazy_gb = ldf. group_by_rolling (
235
+ let lazy_gb = ldf. rolling (
233
236
index_column. inner . clone ( ) ,
234
237
by,
235
238
RollingGroupOptions {
@@ -711,8 +714,7 @@ pub struct ScanParquetOptions {
711
714
pub rechunk : Option < bool > ,
712
715
pub low_memory : Option < bool > ,
713
716
pub use_statistics : Option < bool > ,
714
- pub hive_partitioning : Option < bool > ,
715
- pub cloud_options : Option < HashMap :: < String , String > > ,
717
+ pub cloud_options : Option < HashMap < String , String > > ,
716
718
pub retries : Option < i64 > ,
717
719
}
718
720
@@ -725,14 +727,14 @@ pub fn scan_parquet(path: String, options: ScanParquetOptions) -> napi::Result<J
725
727
let rechunk = options. rechunk . unwrap_or ( false ) ;
726
728
let low_memory = options. low_memory . unwrap_or ( false ) ;
727
729
let use_statistics = options. use_statistics . unwrap_or ( false ) ;
728
-
730
+
729
731
let mut cloud_options: Option < CloudOptions > = if let Some ( o) = options. cloud_options {
730
732
let co: Vec < ( String , String ) > = o. into_iter ( ) . map ( |kv : ( String , String ) | kv) . collect ( ) ;
731
733
Some ( CloudOptions :: from_untyped_config ( & path, co) . map_err ( JsPolarsErr :: from) ?)
732
734
} else {
733
735
None
734
736
} ;
735
-
737
+
736
738
let retries = options. retries . unwrap_or_else ( || 2 ) as usize ;
737
739
if retries > 0 {
738
740
cloud_options =
@@ -744,7 +746,6 @@ pub fn scan_parquet(path: String, options: ScanParquetOptions) -> napi::Result<J
744
746
} ) ;
745
747
}
746
748
747
- let hive_partitioning: bool = options. hive_partitioning . unwrap_or ( false ) ;
748
749
let args = ScanArgsParquet {
749
750
n_rows,
750
751
cache,
@@ -754,7 +755,11 @@ pub fn scan_parquet(path: String, options: ScanParquetOptions) -> napi::Result<J
754
755
low_memory,
755
756
cloud_options,
756
757
use_statistics,
757
- hive_partitioning,
758
+ // TODO: Support Hive partitioning.
759
+ hive_options : HiveOptions {
760
+ enabled : false ,
761
+ ..Default :: default ( )
762
+ } ,
758
763
} ;
759
764
let lf = LazyFrame :: scan_parquet ( path, args) . map_err ( JsPolarsErr :: from) ?;
760
765
Ok ( lf. into ( ) )
@@ -774,14 +779,14 @@ pub fn scan_ipc(path: String, options: ScanIPCOptions) -> napi::Result<JsLazyFra
774
779
let n_rows = options. n_rows . map ( |i| i as usize ) ;
775
780
let cache = options. cache . unwrap_or ( true ) ;
776
781
let rechunk = options. rechunk . unwrap_or ( false ) ;
777
- let memmap = options. memmap . unwrap_or ( true ) ;
782
+ let memory_map = options. memmap . unwrap_or ( true ) ;
778
783
let row_index: Option < RowIndex > = options. row_count . map ( |rc| rc. into ( ) ) ;
779
784
let args = ScanArgsIpc {
780
785
n_rows,
781
786
cache,
782
787
rechunk,
783
788
row_index,
784
- memmap ,
789
+ memory_map ,
785
790
cloud_options : Default :: default ( ) ,
786
791
} ;
787
792
let lf = LazyFrame :: scan_ipc ( path, args) . map_err ( JsPolarsErr :: from) ?;
0 commit comments