Skip to content

Commit

Permalink
Merge #116106
Browse files Browse the repository at this point in the history
116106: reducesql: reduce index visibility r=mgartner a=mgartner

This commit updates `reducesql` so that it can attempt to reduce
visibility options of index definitions, like `INVISIBLE`,
`NOT VISIBLE`, and `VISIBILITY 0.5`.

Epic: None

Release note: None


Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
  • Loading branch information
craig[bot] and mgartner committed Dec 14, 2023
2 parents da553e3 + d4ead79 commit 830dad6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/cmd/reduce/reduce/reducesql/reducesql.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var SQLPasses = []reduce.Pass{
removeIndexCols,
removeIndexPredicate,
removeIndexStoringCols,
removeIndexInvisibility,
removeIndexPartitionBy,
removeIndexPartitions,
removeIndexPartitionListValues,
Expand Down Expand Up @@ -902,6 +903,19 @@ var (
}
return 0
})
removeIndexInvisibility = walkSQL("remove index Invisibility", func(xfi int, node interface{}) int {
xf := xfi == 0
switch node := node.(type) {
case *tree.IndexTableDef:
if node.Invisibility.Value != 0 {
if xf {
node.Invisibility = tree.IndexInvisibility{Value: 0.0}
}
return 1
}
}
return 0
})
removeIndexPartitionBy = walkSQL("remove INDEX PARTITION BY", func(xfi int, node interface{}) int {
xf := xfi == 0
removePartitionBy := func(idx *tree.IndexTableDef) int {
Expand Down

0 comments on commit 830dad6

Please sign in to comment.