Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrects mapping of parent join_keys columns when merging 2 data frames #503

Merged
merged 4 commits into from
Dec 22, 2023

Conversation

averissimo
Copy link
Contributor

@averissimo averissimo commented Dec 22, 2023

Pull Request

Fixes #502 (and CI in teal@main)

Context

A join_key("d1", "d2", c("d1_k" = "d2_k")) will create a symetrical relationship between "d1" and "d2", where "d1" is the parent of "d2".

The key mapping is inverted for (d2, d1), where key is stored asc("d2_k" = "d1_k").

So when the join_key is being extracted (jk[dataset_1, dataset_2]), the key columns for dataset_1 ("d2" in previous line) is obtained via names(), while the columns of dataset_2 are present in the values (unname())

Changes description

  • Corrects the retrieval of column specification to use in merge operation and filter overview
  • Add test in {teal.slice}
  • Removes teal.data::parents(..) <- ... in favor of new behavior that defines this parent-child relationship in join_key constructor

note: As far as I can see in the codebase, only ...DataFrames use parent-child relationship

@averissimo averissimo added bug Something isn't working core labels Dec 22, 2023
Copy link
Contributor

github-actions bot commented Dec 22, 2023

badge

Code Coverage Summary

Filename                        Stmts    Miss  Cover    Missing
----------------------------  -------  ------  -------  -------------------------------------------------------------------------------------------------------------------------------------------------
R/calls_combine_by.R                8       0  100.00%
R/choices_labeled.R                49      14  71.43%   22, 33, 38, 48-53, 65, 69-73
R/count_labels.R                   98       0  100.00%
R/filter_panel_api.R               35       1  97.14%   100
R/FilteredData-utils.R             98      29  70.41%   16-19, 22-25, 46-51, 144, 166-175, 235-238
R/FilteredData.R                  554     218  60.65%   146, 287, 359, 487-496, 518, 539-580, 598-601, 617, 658-691, 706-708, 712-718, 744-772, 794-796, 800-802, 805-816, 820-829, 831-869, 910, 933-955
R/FilteredDataset-utils.R          23       1  95.65%   113
R/FilteredDataset.R               176      67  61.93%   45, 144, 186-192, 220-277, 317-319
R/FilteredDatasetDataframe.R      121       8  93.39%   67, 129, 139, 226-230
R/FilteredDatasetDefault.R         18       4  77.78%   90-103
R/FilteredDatasetMAE.R            134      37  72.39%   23, 109-114, 153-158, 162-163, 183-205
R/FilterPanelAPI.R                 10       0  100.00%
R/FilterState-utils.R             101       2  98.02%   260, 290
R/FilterState.R                   361      61  83.10%   88, 212, 230-234, 241-242, 256-257, 263-264, 312, 314, 316, 368, 412, 644, 687-712, 723-742, 777-783, 792-798
R/FilterStateChoices.R            338     106  68.64%   302-305, 317, 360, 384-391, 395-412, 441, 456-467, 479-487, 491-520, 541-544, 547-550, 561-582, 595-596, 606
R/FilterStateDate.R               212     129  39.15%   219, 272-430
R/FilterStateDatettime.R          307     199  35.18%   256, 309-541
R/FilterStateEmpty.R               53      31  41.51%   82, 92-97, 111, 125-166
R/FilterStateExpr.R                75      62  17.33%   138-262
R/FilterStateLogical.R            196     144  26.53%   127, 150, 210, 213-399
R/FilterStateRange.R              410     105  74.39%   254, 378, 506-510, 513-523, 526, 538-544, 555-567, 571-581, 585-587, 601-628, 643, 646, 661-678, 713-718, 728-730
R/FilterStates-utils.R             70       9  87.14%   102, 121, 179-185, 207, 234
R/FilterStates.R                  364      30  91.76%   76-80, 189, 320-329, 417-420, 463, 548-552, 597, 718-721
R/FilterStatesDF.R                  5       0  100.00%
R/FilterStatesMAE.R                10       1  90.00%   39
R/FilterStatesMatrix.R              3       0  100.00%
R/FilterStatesSE.R                211     157  25.59%   34, 69-71, 81-83, 107-114, 122-129, 152-300
R/include_css_js.R                  5       5  0.00%    12-16
R/teal_slice.R                    107       4  96.26%   135, 189-190, 201
R/teal_slices.R                    83       5  93.98%   144-149
R/test_utils.R                     21       0  100.00%
R/utils.R                          49       2  95.92%   101-102
R/variable_types.R                 48      33  31.25%   41-46, 56, 69-104
R/zzz.R                            16      16  0.00%    3-47
TOTAL                            4369    1480  66.12%

Diff against main

Filename                        Stmts    Miss  Cover
----------------------------  -------  ------  -------
R/FilteredDatasetDataframe.R        0      -1  +0.83%
TOTAL                               0      -1  +0.02%

Results for commit: a89a530

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

github-actions bot commented Dec 22, 2023

Unit Tests Summary

    1 files    29 suites   23s ⏱️
366 tests 366 ✔️ 0 💤 0
842 runs  842 ✔️ 0 💤 0

Results for commit a89a530.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Dec 22, 2023

Unit Test Performance Difference

Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
FilteredData 👶 $+0.09$ get_data_of_the_child_is_dependent_on_the_ancestor_filter_mismatched_columns_

Results for commit 727edbc

♻️ This comment has been updated with latest results.

@vedhav
Copy link
Contributor

vedhav commented Dec 22, 2023

I didn't dive deep into the new changes so won't be of much help with the review. Although, I feel we might want to bump up the teal.data version here and teal.data + teal.slice version in the teal PR once this is merged. Is that so?

averissimo added a commit to insightsengineering/teal that referenced this pull request Dec 22, 2023
…efault (#1020)

# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

Fixes insightsengineering/teal.slice#502

Part of insightsengineering/teal.slice#503 and
insightsengineering/teal.data#215

### Changes 

- Corrects test to reflect behavior resulting from `teal.data` default
parent setting when creating new `join_key`
@averissimo averissimo enabled auto-merge (squash) December 22, 2023 15:05
@averissimo averissimo merged commit 9474272 into main Dec 22, 2023
24 checks passed
@averissimo averissimo deleted the 502_join_keys_mapping@main branch December 22, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: problem with datasets that have different merging keys with parent
3 participants