Fix incorrect loop variable handling in substring removal step#29
Open
gloria-trivitt wants to merge 1 commit into
Open
Fix incorrect loop variable handling in substring removal step#29gloria-trivitt wants to merge 1 commit into
gloria-trivitt wants to merge 1 commit into
Conversation
…to prevent them from being marked as processed before loop handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
In
module2_v2, during the column transformation step, loop variables were not processed correctly. As a result, the final table retained duplicated loop suffixes (_N_N) instead of being normalized to a single loop index.Example:
Expected:
Refer to
nih-nci-dceg-connect-stg-5519.ForTestingOnly.module2_v2_with_cleaned_columns.sqlinsql_stage_2026-04-16.zip. This file contains the SQL output before the fix.Root Cause
During the substring removal step (
_build_substring_removal_clauses):Resolution
Updated
_build_substring_removal_clausesto:subset_columns(columns that actually contain removable substrings)extract_loop_number(). This ensures loop variables are preserved for Step 4 and correctly normalized.Additional Behavior Corrected
This change also corrected unintended handling of non-loop columns during the substring removal step.
These examples are specific to the participants table and can be reviewed in:
nih-nci-dceg-connect-stg-5519.ForTestingOnly.participants_with_cleaned_columns.sqlBefore fix:
After fix:
subset_columns)_build_loop_variable_clauses) now correctly evaluates them:is_pure_variable()and excludedsql_stage_2026-04-16.zip: Contains SQL statements to create tables in CleanConnect for 4/16/2026. This is before the fix and has the issue present.
sql_stage_2026-04-16.zip
sql_stage_2026-04-17.zip: Contains SQL statements to create tables in CleanConnect for 4/17/2026. This is after the fix.
sql_stage_2026-04-17.zip