Skip to content

get rid of more error("missing") - #7290

Merged
mccanne merged 2 commits into
mainfrom
vector-missing
Sep 8, 2026
Merged

get rid of more error("missing")#7290
mccanne merged 2 commits into
mainfrom
vector-missing

Conversation

@mccanne

@mccanne mccanne commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

This commit deletes vector.NewMissing and replaces all the instances of its use with errors. The vcache projection logic produces a string error instead of a structured error because projection shouldn't involve reading this for the "on" field of such errors. I think this variation in no-such-field errors is ok to live with. Down the road when we have lazy vectors, we can load dynamically load the needed info to compute the complete structured errors.

There are still lots of references to error("missing") throughout the docs. These will be addressed in a future PR.

This commit deletes vector.NewMissing and replaces all the instances
of its use with errors.  The vcache projection logic produces a string
error instead of a structured error because projection shouldn't involve
reading this for the "on" field of such errors.  I think this variation
in no-such-field errors is ok to live with.  Down the road when we have
lazy vectors, we can load dynamically load the needed info to compute
the complete structured errors.

There are still lots of references to error("missing") throughout the
docs.  These will be addressed in a future PR.
Comment thread runtime/vam/expr/function/types.go Outdated
}
if len(errs) > 0 {
return vector.Combine(out, errs, vector.NewMissing(n.sctx, uint32(len(errs))))
return vector.NewCombinedError(n.sctx, "not a named type", out, vec, errs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return vector.NewCombinedError(n.sctx, "not a named type", out, vec, errs)
return vector.NewCombinedError(n.sctx, "nameof: not a named type", out, vec, errs)

Comment thread runtime/vam/expr/dot.go Outdated
if len(errs) > 0 {
//XXX need to build error vector above with each field-missing message
return vector.Combine(typvals, errs, vector.NewMissing(d.sctx, uint32(len(errs))))
return vector.NewCombinedError(d.sctx, fmt.Sprintf("no such field %s", d.field), typvals, val, errs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return vector.NewCombinedError(d.sctx, fmt.Sprintf("no such field %s", d.field), typvals, val, errs)
return vector.NewCombinedError(d.sctx, fmt.Sprintf("no such field %s", sup.QuotedName(d.field)), typvals, val, errs)

Comment thread runtime/vam/expr/index.go Outdated
return indexMap(i.sctx, container, index)
default:
return vector.NewMissing(i.sctx, container.Len())
return vector.NewWrappedError(i.sctx, "entity cannot be indexed", container)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think value reads better.

Suggested change
return vector.NewWrappedError(i.sctx, "entity cannot be indexed", container)
return vector.NewWrappedError(i.sctx, "value cannot be indexed", container)

Comment thread runtime/vcache/bool.go Outdated
vec := vector.NewBool(b.load(loader))
if len(projection) > 0 {
return vector.NewMissing(loader.sctx, b.length())
return vector.NewWrappedError(loader.sctx, "dot operator on non-record", vec)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We changed this error string in runtime/vam/expr/dot.go to be '.': applied to non-record, and being consistent with that everywhere would be good.

Comment thread runtime/vcache/record.go Outdated
val = r.fields[k].project(loader, node.Proj)
} else {
val = vector.NewMissing(loader.sctx, r.length())
val = vector.NewStringError(loader.sctx, fmt.Sprintf("no such field %s", node.Name), r.length())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val = vector.NewStringError(loader.sctx, fmt.Sprintf("no such field %s", node.Name), r.length())
val = vector.NewStringError(loader.sctx, fmt.Sprintf("no such field %s", sup.QuotedName(node.Name)), r.length())

@mccanne
mccanne merged commit 086170e into main Sep 8, 2026
4 checks passed
@mccanne
mccanne deleted the vector-missing branch September 8, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants