Skip to content
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

Document why nullable of list item does not map to schema of first argument #11625

Closed
jcsherin opened this issue Jul 23, 2024 · 0 comments · Fixed by #11626
Closed

Document why nullable of list item does not map to schema of first argument #11625

jcsherin opened this issue Jul 23, 2024 · 0 comments · Fixed by #11626
Labels
enhancement New feature or request

Comments

@jcsherin
Copy link
Contributor

Is your feature request related to a problem or challenge?

For a brief time we considered it necessary to extend StateFieldArgs to include the nullable derived from the schema of the first argument. So that we could define a list item for the accumulator state like this:

// The data type and the `nullable` is equivalent to schema of the first argument
Field::new("item", args.input_type.clone(), args.input_nullable)

Note: The field input_nullable in the above code does not exist in StateFieldArgs.

Instead we currently do this in code:

Field::new("item", args.input_type.clone(), true) // allows null values in aggregate computation

We take advantage of the fact that currently aggregates do no have any special treatment for null values present inside list of accumulator state. So we can avoid adding a new field like input_nullable to StateFieldArgs.

Describe the solution you'd like

Capture this decision explicitly as a doc comment to benefit future readers of code. Add the comment to the following aggregates:

  1. sum
  2. count
  3. array_agg
  4. nth_value
  5. bit_and_or_xor

There are no code changes required.

Describe alternatives you've considered

No response

Additional context

See #11433 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant