get rid of more error("missing") - #7290
Merged
Merged
Conversation
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.
nwt
reviewed
Sep 8, 2026
| } | ||
| 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) |
Member
There was a problem hiding this comment.
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) |
| 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) |
Member
There was a problem hiding this comment.
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) |
| return indexMap(i.sctx, container, index) | ||
| default: | ||
| return vector.NewMissing(i.sctx, container.Len()) | ||
| return vector.NewWrappedError(i.sctx, "entity cannot be indexed", container) |
Member
There was a problem hiding this comment.
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) |
| 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) |
Member
There was a problem hiding this comment.
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.
| 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()) |
Member
There was a problem hiding this comment.
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()) |
nwt
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.