Может, просто транспонировать подойдет вам?
val table = Array(
Array("Product A","Customer 1"),
Array("Product B","Customer 1"),
Array("Product C","Customer 2"),
Array("Product A","Customer 2")
)
val Array(productSet, customerSet) = table.transpose.map(_.toSet)
productSet //Set(Product A, Product B, Product C)
customerSet //Set(Customer 1, Customer 2)