Skip to content

Commit

Permalink
opt: fix inverted key column type in testcat
Browse files Browse the repository at this point in the history
Previously, inverted key columns in the test catalog were incorrectly
given the type of their source column. Now they have the correct type,
`types.EncodedKey`.

Release note: None
  • Loading branch information
mgartner committed Jun 7, 2022
1 parent ba4d29e commit 678e325
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 64 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/catalog/tabledesc/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (w index) InvertedColumnName() string {
}

// InvertedColumnKeyType returns the type of the data element that is encoded
// as the inverted index key. This is currently always Bytes.
// as the inverted index key. This is currently always EncodedKey.
//
// Panics if the index is not inverted.
func (w index) InvertedColumnKeyType() *types.T {
Expand Down
10 changes: 5 additions & 5 deletions pkg/sql/opt/memo/testdata/stats/inverted-array
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ index-join t
├── stats: [rows=1020]
├── key: (1)
└── scan t@a_idx
├── columns: k:1(int!null) a_inverted_key:5(int[]!null)
├── columns: k:1(int!null) a_inverted_key:5(encodedkey!null)
├── inverted constraint: /5/1
│ └── spans: ["", ""]
├── flags: force-index=a_idx
Expand Down Expand Up @@ -120,7 +120,7 @@ index-join t
├── stats: [rows=20]
├── key: (1)
└── scan t@a_idx
├── columns: k:1(int!null) a_inverted_key:5(int[]!null)
├── columns: k:1(int!null) a_inverted_key:5(encodedkey!null)
├── inverted constraint: /5/1
│ └── spans: ["\x8a", "\x8c")
├── stats: [rows=20, distinct(1)=19.6078, null(1)=0, avgsize(1)=4, distinct(5)=2, null(5)=0, avgsize(5)=4]
Expand Down Expand Up @@ -183,7 +183,7 @@ select
│ ├── stats: [rows=20]
│ ├── key: (1)
│ └── scan t@a_idx
│ ├── columns: k:1(int!null) a_inverted_key:5(int[]!null)
│ ├── columns: k:1(int!null) a_inverted_key:5(encodedkey!null)
│ ├── inverted constraint: /5/1
│ │ └── spans
│ │ ├── ["C", "C"]
Expand Down Expand Up @@ -222,7 +222,7 @@ select
│ ├── stats: [rows=30]
│ ├── key: (1)
│ └── scan t@a_idx
│ ├── columns: k:1(int!null) a_inverted_key:5(int[]!null)
│ ├── columns: k:1(int!null) a_inverted_key:5(encodedkey!null)
│ ├── inverted constraint: /5/1
│ │ └── spans
│ │ ├── ["C", "C"]
Expand Down Expand Up @@ -267,7 +267,7 @@ select
│ ├── stats: [rows=30]
│ ├── key: (1)
│ └── scan t@a_idx
│ ├── columns: k:1(int!null) a_inverted_key:5(int[]!null)
│ ├── columns: k:1(int!null) a_inverted_key:5(encodedkey!null)
│ ├── inverted constraint: /5/1
│ │ └── spans
│ │ ├── ["C", "C"]
Expand Down
8 changes: 4 additions & 4 deletions pkg/sql/opt/memo/testdata/stats/inverted-geo
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ project
│ │ ├── stats: [rows=1.4e-06]
│ │ ├── key: (3)
│ │ └── scan t@t_g_idx
│ │ ├── columns: rowid:3(int!null) g_inverted_key:6(geometry!null)
│ │ ├── columns: rowid:3(int!null) g_inverted_key:6(encodedkey!null)
│ │ ├── inverted constraint: /6/3
│ │ │ └── spans: ["B\xfd\xff\xff\xff\xff\xff\xff\xff\xff", "B\xfd\xff\xff\xff\xff\xff\xff\xff\xff"]
│ │ ├── stats: [rows=1.4e-06, distinct(3)=4e-07, null(3)=0, avgsize(3)=4, distinct(6)=1.4e-06, null(6)=0, avgsize(6)=4]
Expand Down Expand Up @@ -401,7 +401,7 @@ project
│ │ ├── stats: [rows=1.42e-06]
│ │ ├── key: (3)
│ │ └── scan t@t_g_idx
│ │ ├── columns: rowid:3(int!null) g_inverted_key:6(geometry!null)
│ │ ├── columns: rowid:3(int!null) g_inverted_key:6(encodedkey!null)
│ │ ├── inverted constraint: /6/3
│ │ │ └── spans: ["B\xfd\xff\xff\xff\xff\xff\xff\xff\xff", "B\xfd\xff\xff\xff\xff\xff\xff\xff\xff"]
│ │ ├── stats: [rows=1.42e-06, distinct(3)=4e-07, null(3)=0, avgsize(3)=4, distinct(6)=1.42e-06, null(6)=0, avgsize(6)=4]
Expand Down Expand Up @@ -480,7 +480,7 @@ select
│ ├── stats: [rows=100]
│ ├── key: (3)
│ └── scan t@t_g_idx
│ ├── columns: rowid:3(int!null) g_inverted_key:6(geometry!null)
│ ├── columns: rowid:3(int!null) g_inverted_key:6(encodedkey!null)
│ ├── inverted constraint: /6/3
│ │ └── spans
│ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"]
Expand Down Expand Up @@ -522,7 +522,7 @@ project
│ ├── stats: [rows=100]
│ ├── key: (3)
│ └── scan t@t_g_idx
│ ├── columns: rowid:3(int!null) g_inverted_key:6(geometry!null)
│ ├── columns: rowid:3(int!null) g_inverted_key:6(encodedkey!null)
│ ├── inverted constraint: /6/3
│ │ └── spans
│ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"]
Expand Down
12 changes: 6 additions & 6 deletions pkg/sql/opt/memo/testdata/stats/inverted-geo-multi-column
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ project
│ ├── stats: [rows=60.78475]
│ ├── key: (1)
│ └── scan t@m
│ ├── columns: k:1(int!null) g_inverted_key:7(geometry!null)
│ ├── columns: k:1(int!null) g_inverted_key:7(encodedkey!null)
│ ├── constraint: /3: [/'banana' - /'banana']
│ ├── inverted constraint: /7/1
│ │ └── spans
Expand Down Expand Up @@ -151,7 +151,7 @@ project
│ ├── stats: [rows=60.78475]
│ ├── key: (1)
│ └── scan t@p,partial
│ ├── columns: k:1(int!null) g_inverted_key:8(geometry!null)
│ ├── columns: k:1(int!null) g_inverted_key:8(encodedkey!null)
│ ├── inverted constraint: /8/1
│ │ └── spans
│ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"]
Expand Down Expand Up @@ -214,7 +214,7 @@ project
│ ├── stats: [rows=121.5695]
│ ├── key: (1)
│ └── scan t@m
│ ├── columns: k:1(int!null) g_inverted_key:7(geometry!null)
│ ├── columns: k:1(int!null) g_inverted_key:7(encodedkey!null)
│ ├── constraint: /3
│ │ ├── [/'apple' - /'apple']
│ │ ├── [/'banana' - /'banana']
Expand Down Expand Up @@ -269,7 +269,7 @@ project
│ ├── stats: [rows=121.5695]
│ ├── key: (1)
│ └── scan t@p,partial
│ ├── columns: k:1(int!null) g_inverted_key:9(geometry!null)
│ ├── columns: k:1(int!null) g_inverted_key:9(encodedkey!null)
│ ├── inverted constraint: /9/1
│ │ └── spans
│ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"]
Expand Down Expand Up @@ -332,7 +332,7 @@ project
│ ├── stats: [rows=5.512417]
│ ├── key: (1)
│ └── scan t@mp,partial
│ ├── columns: k:1(int!null) g_inverted_key:10(geometry!null)
│ ├── columns: k:1(int!null) g_inverted_key:10(encodedkey!null)
│ ├── constraint: /4: [/400 - /400]
│ ├── inverted constraint: /10/1
│ │ └── spans
Expand Down Expand Up @@ -388,7 +388,7 @@ project
│ ├── stats: [rows=14.82863]
│ ├── key: (1)
│ └── scan t@mp,partial
│ ├── columns: k:1(int!null) g_inverted_key:10(geometry!null)
│ ├── columns: k:1(int!null) g_inverted_key:10(encodedkey!null)
│ ├── constraint: /4
│ │ ├── [/200 - /200]
│ │ ├── [/300 - /300]
Expand Down
Loading

0 comments on commit 678e325

Please sign in to comment.