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

[backport] Tracking fix #4093

Merged
merged 3 commits into from
Oct 21, 2021
Merged

[backport] Tracking fix #4093

merged 3 commits into from
Oct 21, 2021

Conversation

nathaniel-may
Copy link
Contributor

@nathaniel-may nathaniel-may commented Oct 18, 2021

resolves #4038 for 0.21.latest, backport of #4048

Description

This is a manual backport since the commits on main rely on the static parser being on by default already, so an actual review of this is necessary. I'm trying to simply implement the same logic of fully populating a node for a more accurate comparison.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change

@cla-bot cla-bot bot added the cla:yes label Oct 18, 2021
@nathaniel-may nathaniel-may changed the base branch from main to 0.21.latest October 18, 2021 20:46
core/dbt/parser/models.py Outdated Show resolved Hide resolved
core/dbt/parser/models.py Outdated Show resolved Hide resolved
core/dbt/parser/models.py Show resolved Hide resolved
core/dbt/parser/models.py Outdated Show resolved Hide resolved
@nathaniel-may nathaniel-may force-pushed the tracking-fix-backport branch 3 times, most recently from eb99114 to 949f4b6 Compare October 20, 2021 15:31
@jtcohen6
Copy link
Contributor

jtcohen6 commented Oct 20, 2021

Looks like there are some unrelated tests failing. We might need some digging in to see if those are related to the substance of these changes, or incidental to the way this has been backported

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies—I was too quick to approve this last night. I decided to give this one more careful step-through with the reproduction case outlined in #4038.

I noticed two issues:

  • We don't correctly populate exp_sample_config._config_call_dict with _get_config_call_dict() in the sampling case. This ends up looking like a mismatched config, when it really isn't—the configs are present in experimentally_parsed, they're just never populated. I believe this issue is also present in the final code from Fix tracking bug for jinja sampling #4048, so we'll need to fix this in main, too.
  • I also think we're going to skip populating result (and therefore firing a tracking event) when the experimental parser fails, because of an extra conditional check. Thankfully, I don't believe this was an issue in Fix tracking bug for jinja sampling #4048

super().render_update(node, config)

if sample and isinstance(experimentally_parsed, dict):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to populate result any time we're sampling, regardless of whether experimentally_parsed is a dict (i.e. regardless of whether it succeeded)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For simplicity, I think it would be okay to consolidate this logic a bit more. We're only sampling in v0.21 in the specific case that if not flags.USE_EXPERIMENTAL_PARSER and sample. This is different from the logic going forward, where we have multiple conditional branches / types of sampling

model_parser_copy = self.partial_deepcopy()
exp_sample_node = deepcopy(node)
exp_sample_config = deepcopy(config)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're missing this line:

exp_sample_config._config_call_dict = _get_config_call_dict(experimentally_parsed)

Is there a reason that shouldn't just be part of populate?

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally as in #4109 (review). As soon as the tests are all passing, LGTM!

@nathaniel-may nathaniel-may merged commit 61caa79 into 0.21.latest Oct 21, 2021
@nathaniel-may nathaniel-may deleted the tracking-fix-backport branch October 21, 2021 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Static parser] hook ref missing from sample during comparison
2 participants