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

opt: revert data race fix #85352

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pkg/sql/opt/memo/logical_props_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,13 +1497,9 @@ func (b *logicalPropsBuilder) buildFiltersItemProps(item *FiltersItem, scalar *p
// Constraints
// -----------
cb := constraintsBuilder{md: b.mem.Metadata(), evalCtx: b.evalCtx}
// TODO(rytaft): Using local variables here to avoid a data race. It would be
// better to avoid lazy building of props altogether.
constraints, tightConstraints := cb.buildConstraints(item.Condition)
if constraints.IsUnconstrained() {
scalar.Constraints, scalar.TightConstraints = cb.buildConstraints(item.Condition)
if scalar.Constraints.IsUnconstrained() {
scalar.Constraints, scalar.TightConstraints = nil, false
} else {
scalar.Constraints, scalar.TightConstraints = constraints, tightConstraints
}

// Functional Dependencies
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/opt/ops/scalar.opt
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ define Filters {

# FiltersItem contains a filter condition that's evaluated to determine whether
# Select or Join rows should be filtered. In addition, the FiltersItem caches a
# set of scalar properties that are lazily calculated by traversing the
# Condition scalar expression. This allows the properties for the entire
# expression subtree to be calculated once and then repeatedly reused.
# set of scalar properties that are calculated by traversing the Condition
# scalar expression. This allows the properties for the entire expression
# subtree to be calculated once and then repeatedly reused.
[Scalar, Bool, ListItem, ScalarProps]
define FiltersItem {
Condition ScalarExpr
Expand Down