Problems / Split Tags to Rows / Editorial
string_split(tags, ',')
unnest(...)
F.explode(F.split('tags', ','))
' portable'
trim()
count(*)
product_count DESC, tag
A comma-separated column is a list masquerading as a string — un-nesting it back into rows (unnest/explode) is the wide-to-long reshape that makes counting trivial. The classic bug here is trim placement: trim must run on each fragment after the split, otherwise 'portable' and ' portable' are counted as two different tags.
unnest
explode
trim
'portable'
Solve Split Tags to Rows yourself →