-
Notifications
You must be signed in to change notification settings - Fork 189
docs: consistently mark 0 as valid anchor/reference #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c851ebc to
e95927f
Compare
proto/substrait/algebra.proto
Outdated
| // to a scalar function in the associated YAML file. Required; avoid | ||
| // using anchor/reference zero. | ||
| // to a scalar function in the associated YAML file. | ||
| // Required; 0 is a valid anchor/reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only one I am not sure about... I find the language here a bit confusing. Is it saying the two separate things:
- this field is required, and
- you must not use anchor/reference 0
?
Or is it saying "it is required not to use anchor/reference 0"?
I think it is the former. In which case there is nothing special about ScalarFunction.function_reference that prevents it from being 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that the intent of this is:
- It is required that this field be set.
- 0 is a valid anchor / reference
0c0da1c to
098e7f9
Compare
098e7f9 to
f32460f
Compare
|
|
||
| // Note: type_variation_reference fields within Type messages reference a | ||
| // type_variation_anchor defined in the plan's extension declarations. The value | ||
| // 0 represents the system-preferred variation and is a valid reference value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure where a good place to put this was considering type_variation_reference shows up a ton of times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For type variation anchor defined in the extension, it is better to not use 0 because it is reserved IMO. Perhaps, we can document this in the type extension proto message as well as type variation documentation?
|
Given that the proposed documentation changes say "non-negative" would it make sense to always say I do remember the substrait-validator having a check for the 0 anchors reporting a warning. Should probably be also updated at some point in time. |
|
I can provide some guidance on why the non-zero language exists for references. Effectively, if a The stance of the project has generally been What do you think about including the explicit guidance to avoid zero values? |
vbarua
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this. Left on minor comment, but otherwise looks good to me.
|
Should we also update tutorials for URN anchors to start from 0? Edit: I just reread this to understand:
I guess the idea is that anchors are unique, unordered values and they're all valid as long as they're unique (within a plan) at any given time? |
|
|
||
| // Note: type_variation_reference fields within Type messages reference a | ||
| // type_variation_anchor defined in the plan's extension declarations. The value | ||
| // 0 represents the system-preferred variation and is a valid reference value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For type variation anchor defined in the extension, it is better to not use 0 because it is reserved IMO. Perhaps, we can document this in the type extension proto message as well as type variation documentation?
| // A surrogate key used in the context of a single plan to reference a | ||
| // specific type variation | ||
| // specific type variation. | ||
| // 0 is a valid anchor/reference, but prefer non-zero values for ergonomics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we be explicit about using non-zero here?
There are lots of places where the validity of anchor/reference 0 is not explicitly mentioned. This PR adds explicitly clarification in the proto comments and the site docs to clarify that anchor/reference 0 is valid.
Closes #899