Skip to content

Commit

Permalink
Merge #49555 #49559
Browse files Browse the repository at this point in the history
49555: sql/catalog: rename ObjectDescriptor to Descriptor r=lucy-zhang,rohany a=ajwerner

We're trying to define Object as a member of a schema. Today that's not really
true because Objects are currently members of databases and not schemas but
we'll get there. Descriptor is the general term for all entities which are in
the catalog, resolvable by a name, and live in the descriptor table.

Release note: None

49559: workload: rename leftover vectorize option 'auto' to 'on' r=yuzefovich a=yuzefovich

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
3 people committed May 26, 2020
3 parents 33a86b2 + 873fe5e + dc2583e commit e3f2142
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/catalog/accessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ type Accessor interface {
// descriptor and that of its parent database. If the object is not
// found and flags.required is true, an error is returned, otherwise
// a nil reference is returned.
GetObjectDesc(ctx context.Context, txn *kv.Txn, settings *cluster.Settings, codec keys.SQLCodec, db, schema, object string, flags tree.ObjectLookupFlags) (ObjectDescriptor, error)
GetObjectDesc(ctx context.Context, txn *kv.Txn, settings *cluster.Settings, codec keys.SQLCodec, db, schema, object string, flags tree.ObjectLookupFlags) (Descriptor, error)
}
2 changes: 1 addition & 1 deletion pkg/sql/catalog/accessors/logical_schema_accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (l *LogicalSchemaAccessor) GetObjectDesc(
codec keys.SQLCodec,
db, schema, object string,
flags tree.ObjectLookupFlags,
) (catalog.ObjectDescriptor, error) {
) (catalog.Descriptor, error) {
switch flags.DesiredObjectKind {
case tree.TypeObject:
// TODO(ajwerner): Change this function if we ever expose non-table objects
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/catalog/accessors/physical_schema_accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (a *CachedPhysicalAccessor) GetObjectDesc(
codec keys.SQLCodec,
db, schema, object string,
flags tree.ObjectLookupFlags,
) (catalog.ObjectDescriptor, error) {
) (catalog.Descriptor, error) {
switch flags.DesiredObjectKind {
case tree.TypeObject:
// TypeObjects are not caches so fall through to the underlying physical
Expand Down
8 changes: 4 additions & 4 deletions pkg/sql/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sqlbase"
)

// ObjectDescriptor provides table information for results from a name lookup.
type ObjectDescriptor interface {
// Descriptor provides table information for results from a name lookup.
type Descriptor interface {
tree.NameResolutionResult

// DatabaseDesc returns the underlying database descriptor, or nil if the
Expand All @@ -43,15 +43,15 @@ type VirtualSchemas interface {

// VirtualSchema represents a collection of VirtualObjects.
type VirtualSchema interface {
Desc() ObjectDescriptor
Desc() Descriptor
NumTables() int
VisitTables(func(object VirtualObject))
GetObjectByName(name string) (VirtualObject, error)
}

// VirtualObject is a virtual schema object.
type VirtualObject interface {
Desc() ObjectDescriptor
Desc() Descriptor
}

// TableEntry is the value type of FkTableMetadata: An optional table
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/catalog/catalogkv/physical_accessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (a UncachedPhysicalAccessor) GetObjectDesc(
codec keys.SQLCodec,
db, schema, object string,
flags tree.ObjectLookupFlags,
) (catalog.ObjectDescriptor, error) {
) (catalog.Descriptor, error) {
// Look up the database ID.
dbID, err := GetDatabaseID(ctx, txn, codec, db, flags.Required)
if err != nil || dbID == sqlbase.InvalidID {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/catalog/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func ResolveExistingObject(
return nil, prefix, nil
}

obj := descI.(catalog.ObjectDescriptor)
obj := descI.(catalog.Descriptor)
switch lookupFlags.DesiredObjectKind {
case tree.TypeObject:
if obj.TypeDesc() == nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/virtual_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ type virtualSchemaEntry struct {
allTableNames map[string]struct{}
}

func (v virtualSchemaEntry) Desc() catalog.ObjectDescriptor {
func (v virtualSchemaEntry) Desc() catalog.Descriptor {
return v.desc
}

Expand Down Expand Up @@ -322,7 +322,7 @@ type virtualDefEntry struct {
validWithNoDatabaseContext bool
}

func (e virtualDefEntry) Desc() catalog.ObjectDescriptor {
func (e virtualDefEntry) Desc() catalog.Descriptor {
return sqlbase.NewImmutableTableDescriptor(*e.desc)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/workload/tpcds/tpcds.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var tpcdsMeta = workload.Meta{
`Note that --queries-to-omit flag has a higher precedence`)
g.flags.DurationVar(&g.queryTimeLimit, `query-time-limit`, 5*time.Minute,
`Time limit for a single run of a query`)
g.flags.StringVar(&g.vectorize, `vectorize`, `auto`,
g.flags.StringVar(&g.vectorize, `vectorize`, `on`,
`Set vectorize session variable`)
g.connFlags = workload.NewConnFlags(&g.flags)
return g
Expand Down
2 changes: 1 addition & 1 deletion pkg/workload/tpch/tpch.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var tpchMeta = workload.Meta{
g.flags.BoolVar(&g.disableChecks, `disable-checks`, false,
"Disable checking the output against the expected rows (default false). "+
"Note that the checks are only supported for scale factor 1")
g.flags.StringVar(&g.vectorize, `vectorize`, `auto`,
g.flags.StringVar(&g.vectorize, `vectorize`, `on`,
`Set vectorize session variable`)
g.flags.BoolVar(&g.verbose, `verbose`, false,
`Prints out the queries being run as well as histograms`)
Expand Down

0 comments on commit e3f2142

Please sign in to comment.