Skip to content

Conversation

@benbellick
Copy link
Member

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

@benbellick benbellick force-pushed the benbellick/consistent-0-anchor branch from c851ebc to e95927f Compare November 24, 2025 19:49
// 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.
Copy link
Member Author

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:

  1. this field is required, and
  2. 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.

@benbellick benbellick force-pushed the benbellick/consistent-0-anchor branch 2 times, most recently from 0c0da1c to 098e7f9 Compare November 24, 2025 19:58
@benbellick benbellick force-pushed the benbellick/consistent-0-anchor branch from 098e7f9 to f32460f Compare November 24, 2025 20:11

// 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.
Copy link
Member Author

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.

@benbellick benbellick marked this pull request as ready for review November 24, 2025 20:13
@nielspardon
Copy link
Member

Given that the proposed documentation changes say "non-negative" would it make sense to always say >= 0 in the proto comments to be super specific?

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.

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.

consistently clarify that 0 is allowed value in anchors / references

3 participants