Fix!: exclude Semicolon expressions from model state #4257
Merged
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.
Fixes #4252
I reproduced the issue locally by following the steps outlined in the above issue:
I observed that we hit this line for the
Semicolon
expression and store the query's SQL in itsmeta
dict. This explains the duplication of the model's query in the above serializedpost_statements
key.My initial approach was to avoid setting
meta["sql"]
forSemicolon
expressions, but then it occurred to me that we shouldn't be storing anySemicolon
expressions in the model, because they can also affect the data/metadata hash.I verified for the issue's examples that if I ran plan, removed the semicolon+comment, and then ran plan again then a diff was shown. This is because
Semicolon
isgen
'd since it's in thepost_statements
list and we get back a"SEMICOLON"
string in the_data_hash_values
. I added a test for this.I think we need a migration for this change. I'll take it to the finish line
on Mondaysoon.