Skip to content

Conversation

@tlm365
Copy link
Contributor

@tlm365 tlm365 commented Nov 12, 2024

Which issue does this PR close?

Closes #6715.

Rationale for this change

What changes are included in this PR?

  • Add support cast string view (Utf8View) to numeric(Int/Float/Decimal).
  • Unit tests.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 12, 2024
Ok(Arc::new(byte_array_builder.finish()))
}

trait StringArrayType<'a>: ArrayAccessor<Item = &'a str> + Sized {
Copy link
Contributor

Choose a reason for hiding this comment

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

We would now have this in arrow-string and arrow-cast. Perhaps this would be best moved to arrow-array alongside ArrayAccessor ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Omega359 Thanks so much for reviewing.

We would now have this in arrow-string and arrow-cast. Perhaps this would be best moved to arrow-array alongside ArrayAccessor ?

Makes sense to me 👍

@tlm365 tlm365 marked this pull request as ready for review November 12, 2024 19:07
@alamb alamb changed the title [arrow-cast] Improve support for casting string view to numeric Support for casting StringViewArray to DecimalArray Nov 15, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @tlm365 - this looks good to me 👍

Thank you @Omega359 foe the revew

unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}

/// A trait for Arrow String Arrays, currently three types are supported:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is nice to start making public -- we use it in DataFusion a bit as well, so starting to consolidate on a single implementation will be good

@alamb alamb merged commit 8b33f96 into apache:master Nov 16, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Utf8View -> numeric in can_cast_types

3 participants