Skip to content

Conversation

chenkovsky
Copy link
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

What changes are included in this PR?

implement shiftleft/shiftright/shiftrightunsighed.

Are these changes tested?

UT

Are there any user-facing changes?

No

@github-actions github-actions bot added the spark label Aug 20, 2025
Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

Thanks for the PR; it's quite chunky, so would appreciate some explanations on some of the decisions made in the code

Comment on lines +147 to +154
// Coerce smaller integer types to Int32
let coerced_first = match &arg_types[0] {
DataType::Int8 | DataType::Int16 | DataType::Null => DataType::Int32,
DataType::UInt8 | DataType::UInt16 => DataType::UInt32,
_ => arg_types[0].clone(),
};

Ok(vec![coerced_first, DataType::Int32])
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an explanation for why we coerce to these specific types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, so it's to align with Spark (well Java) only having access to Int/Long types; I do feel this coercion logic might already be expressible via the TypeSignature API, have you given that a shot?

Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

Some suggested simplifications, otherwise I'm fine with merging as is

Comment on lines +38 to +45
///
/// # Arguments
/// * `value` - The array of values to shift.
/// * `shift` - The array of shift amounts (must be Int32).
///
/// # Returns
/// A new array with the shifted values.
///
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
///
/// # Arguments
/// * `value` - The array of values to shift.
/// * `shift` - The array of shift amounts (must be Int32).
///
/// # Returns
/// A new array with the shifted values.
///

Would prefer to minimize verbosity of documentation where possible (applicable for the other similar instances below)

@Jefffrey Jefffrey merged commit cad78be into apache:main Sep 14, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants