How can I use substring to extract the four last characters of a column if I do not know the number of characters that are within a field

0 votes
I want to only get the last four digits of a column using substring unless there is another way to do so.

Here is what I have so far:

Column fieldColumn = dataset.apply(fieldName);

fieldColumn = fieldColumn.substr(functions.length(col(fieldName)),functions.length(col(fieldName)));
Jan 14, 2022 in Apache Spark by anonymous

edited Mar 4, 2025 697 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP