@@ -190,16 +190,9 @@ pub fn get_cached_compare(
190
190
path : compare_entry_2. path . to_str ( ) . map ( |s| s. to_owned ( ) ) . unwrap ( ) ,
191
191
} ;
192
192
193
- // let match_df = tabular::read_df(get_compare_match_path(repo, compare_id), DFOpts::empty())?;
194
193
let diff_df = tabular:: read_df ( get_compare_diff_path ( repo, compare_id) , DFOpts :: empty ( ) ) ?;
195
- // let left_only_df = tabular::read_df(get_compare_left_path(repo, compare_id), DFOpts::empty())?;
196
- // let right_only_df =
197
- // tabular::read_df(get_compare_right_path(repo, compare_id), DFOpts::empty())?;
198
194
199
- // let match_schema = Schema::from_polars(&match_df.schema());
200
195
let diff_schema = Schema :: from_polars ( & diff_df. schema ( ) ) ;
201
- // let left_only_schema = Schema::from_polars(&left_only_df.schema());
202
- // let right_only_schema = Schema::from_polars(&right_only_df.schema());
203
196
204
197
let source_df_left = CompareSourceDF :: from_name_df_entry_schema (
205
198
LEFT ,
@@ -214,14 +207,6 @@ pub fn get_cached_compare(
214
207
right_schema. schema . clone ( ) ,
215
208
) ;
216
209
217
- // let derived_df_match = CompareDerivedDF::from_compare_info(
218
- // MATCH,
219
- // Some(compare_id),
220
- // Some(&left_commit),
221
- // Some(&right_commit),
222
- // match_df,
223
- // match_schema,
224
- // );
225
210
let derived_df_diff = CompareDerivedDF :: from_compare_info (
226
211
DIFF ,
227
212
Some ( compare_id) ,
@@ -230,34 +215,14 @@ pub fn get_cached_compare(
230
215
diff_df,
231
216
diff_schema,
232
217
) ;
233
- // let derived_df_left_only = CompareDerivedDF::from_compare_info(
234
- // LEFT_ONLY,
235
- // Some(compare_id),
236
- // Some(&left_commit),
237
- // Some(&right_commit),
238
- // left_only_df,
239
- // left_only_schema,
240
- // );
241
- // let derived_df_right_only = CompareDerivedDF::from_compare_info(
242
- // RIGHT_ONLY,
243
- // Some(compare_id),
244
- // Some(&left_commit),
245
- // Some(&right_commit),
246
- // right_only_df,
247
- // right_only_schema,
248
- // );
249
218
250
219
let source_dfs: HashMap < String , CompareSourceDF > = HashMap :: from ( [
251
220
( LEFT . to_string ( ) , source_df_left) ,
252
221
( RIGHT . to_string ( ) , source_df_right) ,
253
222
] ) ;
254
223
255
- let derived_dfs: HashMap < String , CompareDerivedDF > = HashMap :: from ( [
256
- // (MATCH.to_string(), derived_df_match),
257
- ( DIFF . to_string ( ) , derived_df_diff) ,
258
- // (LEFT_ONLY.to_string(), derived_df_left_only),
259
- // (RIGHT_ONLY.to_string(), derived_df_right_only),
260
- ] ) ;
224
+ let derived_dfs: HashMap < String , CompareDerivedDF > =
225
+ HashMap :: from ( [ ( DIFF . to_string ( ) , derived_df_diff) ] ) ;
261
226
262
227
let compare_results = CompareTabular {
263
228
source : source_dfs,
@@ -561,29 +526,14 @@ fn build_compare_tabular(
561
526
compare_tabular_raw : & CompareTabularRaw ,
562
527
compare_id : Option < & str > ,
563
528
) -> CompareTabular {
564
- // let left_only_df = &compare_tabular_raw.left_only_df;
565
- // let right_only_df = &compare_tabular_raw.right_only_df;
566
529
let diff_df = & compare_tabular_raw. diff_df . clone ( ) ;
567
- // let match_df = &compare_tabular_raw.match_df.clone();
568
530
569
531
let diff_schema = Schema :: from_polars ( & diff_df. schema ( ) ) ;
570
- // let match_schema = Schema::from_polars(&match_df.schema());
571
- // let left_only_schema = Schema::from_polars(&left_only_df.schema());
572
- // let right_only_schema = Schema::from_polars(&right_only_df.schema());
573
532
574
533
let df_1_size = DataFrameSize :: from_df ( df_1) ;
575
534
let df_2_size = DataFrameSize :: from_df ( df_2) ;
576
535
let og_schema_1 = Schema :: from_polars ( & df_1. schema ( ) ) ;
577
536
let og_schema_2 = Schema :: from_polars ( & df_2. schema ( ) ) ;
578
-
579
- // let derived_df_match = CompareDerivedDF::from_compare_info(
580
- // MATCH,
581
- // compare_id,
582
- // compare_entry_1.commit_entry.as_ref(),
583
- // compare_entry_2.commit_entry.as_ref(),
584
- // match_df.clone(),
585
- // match_schema,
586
- // );
587
537
let derived_df_diff = CompareDerivedDF :: from_compare_info (
588
538
DIFF ,
589
539
compare_id,
@@ -592,22 +542,6 @@ fn build_compare_tabular(
592
542
diff_df. clone ( ) ,
593
543
diff_schema,
594
544
) ;
595
- // let derived_df_left_only = CompareDerivedDF::from_compare_info(
596
- // LEFT_ONLY,
597
- // compare_id,
598
- // compare_entry_1.commit_entry.as_ref(),
599
- // compare_entry_2.commit_entry.as_ref(),
600
- // left_only_df.clone(),
601
- // left_only_schema,
602
- // );
603
- // let derived_df_right_only = CompareDerivedDF::from_compare_info(
604
- // RIGHT_ONLY,
605
- // compare_id,
606
- // compare_entry_1.commit_entry.as_ref(),
607
- // compare_entry_2.commit_entry.as_ref(),
608
- // right_only_df.clone(),
609
- // right_only_schema,
610
- // );
611
545
612
546
let source_df_left = CompareSourceDF {
613
547
name : LEFT . to_string ( ) ,
@@ -638,12 +572,8 @@ fn build_compare_tabular(
638
572
( RIGHT . to_string ( ) , source_df_right) ,
639
573
] ) ;
640
574
641
- let derived_dfs: HashMap < String , CompareDerivedDF > = HashMap :: from ( [
642
- // (MATCH.to_string(), derived_df_match),
643
- ( DIFF . to_string ( ) , derived_df_diff) ,
644
- // (LEFT_ONLY.to_string(), derived_df_left_only),
645
- // (RIGHT_ONLY.to_string(), derived_df_right_only),
646
- ] ) ;
575
+ let derived_dfs: HashMap < String , CompareDerivedDF > =
576
+ HashMap :: from ( [ ( DIFF . to_string ( ) , derived_df_diff) ] ) ;
647
577
648
578
CompareTabular {
649
579
source : source_dfs,
@@ -818,6 +748,7 @@ mod tests {
818
748
compare_entry_2,
819
749
keys,
820
750
targets,
751
+ vec ! [ ] ,
821
752
None ,
822
753
) ;
823
754
@@ -940,6 +871,7 @@ mod tests {
940
871
String :: from( "gender" ) ,
941
872
] ,
942
873
vec ! [ String :: from( "target" ) , String :: from( "other_target" ) ] ,
874
+ vec ! [ ] ,
943
875
None ,
944
876
) ?;
945
877
@@ -973,15 +905,10 @@ mod tests {
973
905
. lazy ( )
974
906
. filter ( col ( diff_col) . eq ( lit ( "modified" ) ) )
975
907
. collect ( ) ?;
976
- let unchanged_df = df
977
- . lazy ( )
978
- . filter ( col ( diff_col) . eq ( lit ( "unchanged" ) ) )
979
- . collect ( ) ?;
980
908
981
909
assert_eq ! ( added_df. height( ) , 1 ) ;
982
910
assert_eq ! ( removed_df. height( ) , 2 ) ;
983
911
assert_eq ! ( modified_df. height( ) , 5 ) ;
984
- assert_eq ! ( unchanged_df. height( ) , 6 ) ;
985
912
986
913
// Update one of the files
987
914
let path = Path :: new ( "compare_left.csv" ) ;
@@ -1029,7 +956,7 @@ mod tests {
1029
956
assert ! ( maybe_compare. is_none( ) ) ;
1030
957
1031
958
// Create the compare and add to the cache to ensure proper update
1032
- let result = api:: local:: compare:: compare_files (
959
+ api:: local:: compare:: compare_files (
1033
960
& repo,
1034
961
Some ( "a_compare_id" ) ,
1035
962
new_compare_entry_1,
@@ -1040,6 +967,7 @@ mod tests {
1040
967
String :: from( "gender" ) ,
1041
968
] ,
1042
969
vec ! [ String :: from( "target" ) , String :: from( "other_target" ) ] ,
970
+ vec ! [ ] ,
1043
971
None ,
1044
972
) ?;
1045
973
@@ -1064,15 +992,10 @@ mod tests {
1064
992
. lazy ( )
1065
993
. filter ( col ( diff_col) . eq ( lit ( "modified" ) ) )
1066
994
. collect ( ) ?;
1067
- let unchanged_df = df
1068
- . lazy ( )
1069
- . filter ( col ( diff_col) . eq ( lit ( "unchanged" ) ) )
1070
- . collect ( ) ?;
1071
995
1072
996
assert_eq ! ( added_df. height( ) , 6 ) ;
1073
997
assert_eq ! ( removed_df. height( ) , 0 ) ;
1074
998
assert_eq ! ( modified_df. height( ) , 0 ) ;
1075
- assert_eq ! ( unchanged_df. height( ) , 6 ) ;
1076
999
Ok ( ( ) )
1077
1000
} )
1078
1001
}
0 commit comments