Using reduce to process attributes that span relations