0
0
Apache Sparkdata~5 mins

String functions in Spark in Apache Spark - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the Spark function lower() do to a string column?
It converts all characters in the string column to lowercase letters.
Click to reveal answer
beginner
How does the concat() function work in Spark?
It joins two or more string columns or literals into one single string column.
Click to reveal answer
beginner
What is the purpose of the substring() function in Spark?
It extracts a part of a string from a specified start position for a given length.
Click to reveal answer
beginner
Explain what trim() does in Spark string functions.
It removes leading and trailing spaces from the string values in a column.
Click to reveal answer
intermediate
What does the regexp_replace() function do in Spark?
It replaces all substrings that match a regular expression pattern with a specified replacement string.
Click to reveal answer
Which Spark string function converts all letters in a column to uppercase?
Alower()
Bsubstring()
Ctrim()
Dupper()
What does the concat() function do in Spark?
AJoins multiple strings into one
BExtracts a substring
CRemoves spaces
DSplits a string into parts
Which function removes spaces at the start and end of a string in Spark?
Artrim()
Bltrim()
Ctrim()
Dsubstring()
How do you extract a part of a string starting at position 3 with length 4 in Spark?
Asubstr(column, 3, 4)
Bsubstr(column, 4, 3)
Csubstring(column, 4, 3)
Dsubstring(column, 3, 4)
What does regexp_replace() do in Spark?
AFinds a substring
BReplaces substrings matching a pattern
CSplits strings by pattern
DCounts pattern matches
Describe how you would clean a string column in Spark to remove extra spaces and convert all text to lowercase.
Think about removing spaces and changing case.
You got /4 concepts.
    Explain how to combine two string columns into one in Spark and then extract a part of the combined string.
    First join strings, then get a substring.
    You got /4 concepts.