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

Rename TypeSignature::NullAry --> TypeSignature::Nullary and improve comments #13817

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Dec 17, 2024

Which issue does this PR close?

Rationale for this change

Is the A here intended to be upper-case? I'd have expected Nullary

While I was making that change I noticed that the TypeSignature documentation could be improved as well so I did it at the same time

What changes are included in this PR?

  1. Rename TypeSignature::NullAry --> TypeSignature::Nullary
  2. improve comments

Are these changes tested?

By CI

Are there any user-facing changes?

The name of an enum has changed, but this has not yet been released, so it isn't a user visible change in my mind

@@ -74,6 +74,8 @@ pub enum Volatility {
/// adds a cast such as `cos(CAST int_column AS DOUBLE)` during planning.
///
/// # Data Types
///
/// ## Timestamps
Copy link
Member

Choose a reason for hiding this comment

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

should there be one empty line after a header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call -- fixed

datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
Coercible(Vec<TypeSignatureClass>),
/// The arguments will be coerced to a single type based on the comparison rules.
/// For example, i32 and i64 has coerced type Int64.
/// One or more arguments that can be "compared"
Copy link
Member

Choose a reason for hiding this comment

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

what does this mean ?

///
/// Note:
/// - If compares with numeric and string, numeric is preferred for numeric string cases. For example, nullif('2', 1) has coerced types Int64.
/// - If compares with numeric and string, numeric is preferred for numeric string cases. For example, `nullif('2', 1)` has coerced types `Int64`.
Copy link
Member

Choose a reason for hiding this comment

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

is the reader expected to know/assume that nullif uses signature "Comparable"?

Copy link
Contributor

Choose a reason for hiding this comment

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

actual example direct reader to understand this easily

datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
///
/// # Examples
/// Function `make_array` takes 0 or more arguments with arbitrary types, its `TypeSignature`
///
/// Since `make_array` takes 0 or more arguments with arbitrary types, its `TypeSignature`
/// is `OneOf(vec![Any(0), VariadicAny])`.
Copy link
Member

Choose a reason for hiding this comment

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

This IMO is wrong design of those signatures, but whatever (for now)

datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
/// For example, if a function is called with (utf8, large_utf8), all
/// arguments will be coerced to `LargeUtf8`
///
/// For functions that take no arguments (e.g. `random()` see [`TypeSignature::Nullary`]).
Copy link
Member

Choose a reason for hiding this comment

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

here too

@jayzhan211
Copy link
Contributor

Thanks @alamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions logical-expr Logical plan and expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants