-
-
Notifications
You must be signed in to change notification settings - Fork 231
dolthub/dolt#9641 - Fix BIT Overflow #3148
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
Open
elianddb
wants to merge
7
commits into
main
Choose a base branch
from
elianddb/9641-union-bit-field-overflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
93f1fde
to
3fe9336
Compare
This was referenced Aug 8, 2025
Merged
jycor
reviewed
Aug 12, 2025
sql/analyzer/costed_index_scan.go
Outdated
// to check for single scope. | ||
qFlags.Set(sql.QFlagMax1Row) | ||
} | ||
// Conservative: disable Max1Row optimization here due to lack of context for SetOp detection (dolt#9641) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An easier solution would be to unset the QFlagMax1Row in the resolve unions rule:
diff --git a/sql/analyzer/resolve_unions.go b/sql/analyzer/resolve_unions.go
index 213470932..ea4be8e4d 100644
--- a/sql/analyzer/resolve_unions.go
+++ b/sql/analyzer/resolve_unions.go
@@ -99,6 +99,10 @@ func finalizeUnions(ctx *sql.Context, a *Analyzer, n sql.Node, scope *plan.Scope
if err != nil {
return nil, transform.SameTree, err
}
+
+ // TODO: comment about why this is needed
+ qFlags.Unset(sql.QFlagMax1Row)
+
return newN, transform.NewTree, nil
})
}
jycor
reviewed
Aug 12, 2025
enginetest/queries/script_queries.go
Outdated
}, | ||
Assertions: []ScriptTestAssertion{ | ||
{ | ||
Query: "SELECT flag FROM bit_union_test_9641 WHERE id = 1 UNION SELECT NULL as flag", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test makes sense, but doesn't actually repro the original bug
b2556a7
to
db0f0db
Compare
92e8581
to
ba16e56
Compare
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.
Fixes dolthub/dolt#9641
Fixed Max1Row optimization being incorrectly applied to UNION subqueries. Also fixed UNION schema type reconciliation using GeneralizeTypes().